novacode-cli 1.2.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.
- novacode_cli/__init__.py +29 -0
- novacode_cli/__main__.py +6 -0
- novacode_cli/_lazy_heavy.py +99 -0
- novacode_cli/_version.py +3 -0
- novacode_cli/agent_stream.py +178 -0
- novacode_cli/agents/agent_file.py +250 -0
- novacode_cli/agents/agent_mailbox.py +120 -0
- novacode_cli/agents/approval_decisions.py +146 -0
- novacode_cli/agents/arg_repair.py +196 -0
- novacode_cli/agents/async_agents/__init__.py +6 -0
- novacode_cli/agents/async_agents/_config.py +213 -0
- novacode_cli/agents/async_agents/_mcp_tools.py +192 -0
- novacode_cli/agents/async_agents/_specialist.py +84 -0
- novacode_cli/agents/async_agents/_test_commands.py +89 -0
- novacode_cli/agents/async_agents/_tools.py +432 -0
- novacode_cli/agents/async_agents/general_purpose.py +42 -0
- novacode_cli/agents/async_agents/langgraph.json +9 -0
- novacode_cli/agents/async_agents/research.py +22 -0
- novacode_cli/agents/async_context.py +303 -0
- novacode_cli/agents/async_on_demand.py +52 -0
- novacode_cli/agents/async_task_errors.py +75 -0
- novacode_cli/agents/async_workspace.py +27 -0
- novacode_cli/agents/attribution.py +165 -0
- novacode_cli/agents/browser_mode.py +119 -0
- novacode_cli/agents/btw_agent.py +71 -0
- novacode_cli/agents/caveman.py +352 -0
- novacode_cli/agents/caveman_support.py +370 -0
- novacode_cli/agents/code_mode.py +774 -0
- novacode_cli/agents/code_runtime.py +160 -0
- novacode_cli/agents/context_compaction.py +1339 -0
- novacode_cli/agents/core_agent.py +2710 -0
- novacode_cli/agents/default_subagents/__init__.py +24 -0
- novacode_cli/agents/default_subagents/async_subagents.py +296 -0
- novacode_cli/agents/default_subagents/builtin/browser-automation-agent.md +110 -0
- novacode_cli/agents/default_subagents/builtin/bug-fix-agent.md +22 -0
- novacode_cli/agents/default_subagents/builtin/bug-investigation-agent.md +42 -0
- novacode_cli/agents/default_subagents/builtin/code-explorer.md +37 -0
- novacode_cli/agents/default_subagents/builtin/code-review-agent.md +33 -0
- novacode_cli/agents/default_subagents/builtin/dependency-audit-agent.md +34 -0
- novacode_cli/agents/default_subagents/builtin/documentation-update-agent.md +46 -0
- novacode_cli/agents/default_subagents/builtin/performance-audit-agent.md +41 -0
- novacode_cli/agents/default_subagents/builtin/plan-scout-agent.md +64 -0
- novacode_cli/agents/default_subagents/builtin/refactoring-agent.md +35 -0
- novacode_cli/agents/default_subagents/builtin/refactoring-specialist-agent.md +175 -0
- novacode_cli/agents/default_subagents/builtin/security-audit-agent.md +96 -0
- novacode_cli/agents/default_subagents/builtin/test-generation-agent.md +33 -0
- novacode_cli/agents/default_subagents/builtin/test-runner-agent.md +55 -0
- novacode_cli/agents/default_subagents/prompt.py +88 -0
- novacode_cli/agents/default_subagents/subagents.py +138 -0
- novacode_cli/agents/dream_agent.py +93 -0
- novacode_cli/agents/edit_diagnostics.py +362 -0
- novacode_cli/agents/edit_fallback.py +62 -0
- novacode_cli/agents/handoff.py +166 -0
- novacode_cli/agents/invocation.py +152 -0
- novacode_cli/agents/model_budget.py +42 -0
- novacode_cli/agents/model_retry.py +113 -0
- novacode_cli/agents/model_router.py +420 -0
- novacode_cli/agents/openai_decisions.py +186 -0
- novacode_cli/agents/plan_agent/__init__.py +12 -0
- novacode_cli/agents/plan_agent/plan_agent.py +357 -0
- novacode_cli/agents/plan_agent/plan_mode_middleware.py +64 -0
- novacode_cli/agents/plan_execution.py +237 -0
- novacode_cli/agents/ponytail.py +66 -0
- novacode_cli/agents/prime.py +274 -0
- novacode_cli/agents/provider_caching.py +99 -0
- novacode_cli/agents/server_launcher.py +904 -0
- novacode_cli/agents/strict_tools.py +384 -0
- novacode_cli/agents/task_discipline.py +294 -0
- novacode_cli/agents/tool_call_repair.py +290 -0
- novacode_cli/agents/tool_offload.py +291 -0
- novacode_cli/agents/tool_search.py +806 -0
- novacode_cli/agents/tool_search_variants.py +106 -0
- novacode_cli/agents/tool_verdicts.py +1194 -0
- novacode_cli/agents/user_async_agents.py +312 -0
- novacode_cli/artifacts/__init__.py +10 -0
- novacode_cli/artifacts/registry.py +278 -0
- novacode_cli/artifacts/server.py +426 -0
- novacode_cli/assets/Nova.png +0 -0
- novacode_cli/assets/nova-avatar.png +0 -0
- novacode_cli/audio/__init__.py +301 -0
- novacode_cli/audio/capture.py +137 -0
- novacode_cli/audio/downloads.py +273 -0
- novacode_cli/audio/pipeline.py +391 -0
- novacode_cli/audio/playback.py +87 -0
- novacode_cli/audio/providers.py +208 -0
- novacode_cli/audio/speakable.py +78 -0
- novacode_cli/audio/stt.py +132 -0
- novacode_cli/audio/stt_deepgram.py +69 -0
- novacode_cli/audio/stt_elevenlabs.py +89 -0
- novacode_cli/audio/stt_parakeet.py +94 -0
- novacode_cli/audio/stt_whistle.py +61 -0
- novacode_cli/audio/summarize.py +92 -0
- novacode_cli/audio/tts.py +85 -0
- novacode_cli/audio/tts_kokoro.py +73 -0
- novacode_cli/audio/tts_orpheus.py +180 -0
- novacode_cli/audio/tts_pocket.py +131 -0
- novacode_cli/audio/tts_sano.py +69 -0
- novacode_cli/audio/vad.py +145 -0
- novacode_cli/backends/__init__.py +17 -0
- novacode_cli/backends/filesystem.py +894 -0
- novacode_cli/backends/native_search.py +92 -0
- novacode_cli/bootstrap/__init__.py +9 -0
- novacode_cli/bootstrap/env_snapshot.py +240 -0
- novacode_cli/bootstrap/steering.py +464 -0
- novacode_cli/bootstrap/vision_router.py +604 -0
- novacode_cli/brand.py +362 -0
- novacode_cli/cli_args.py +718 -0
- novacode_cli/commands/__init__.py +237 -0
- novacode_cli/commands/agents_commands.py +231 -0
- novacode_cli/commands/auth_handler.py +40 -0
- novacode_cli/commands/browser_use_handler.py +75 -0
- novacode_cli/commands/cache_handler.py +32 -0
- novacode_cli/commands/chat_handler.py +1357 -0
- novacode_cli/commands/ci_fix.py +171 -0
- novacode_cli/commands/claude_plan.py +331 -0
- novacode_cli/commands/codex_plan.py +195 -0
- novacode_cli/commands/commands.py +1113 -0
- novacode_cli/commands/create_handler.py +124 -0
- novacode_cli/commands/create_server.py +1887 -0
- novacode_cli/commands/cron_handler.py +119 -0
- novacode_cli/commands/dream_handler.py +203 -0
- novacode_cli/commands/effort_handler.py +65 -0
- novacode_cli/commands/evolution_handler.py +214 -0
- novacode_cli/commands/file_commands.py +381 -0
- novacode_cli/commands/handoff_handler.py +68 -0
- novacode_cli/commands/hooks_handler.py +269 -0
- novacode_cli/commands/init_handler.py +146 -0
- novacode_cli/commands/learning_handler.py +160 -0
- novacode_cli/commands/lite_mode_handler.py +76 -0
- novacode_cli/commands/log_commands.py +363 -0
- novacode_cli/commands/mcp_handler.py +29 -0
- novacode_cli/commands/model_handler.py +29 -0
- novacode_cli/commands/notifications_handler.py +158 -0
- novacode_cli/commands/onboard_handler.py +121 -0
- novacode_cli/commands/plan_handler.py +440 -0
- novacode_cli/commands/planner_usage.py +250 -0
- novacode_cli/commands/plugin_install_handler.py +38 -0
- novacode_cli/commands/plugins_handler.py +35 -0
- novacode_cli/commands/prime_handler.py +455 -0
- novacode_cli/commands/prompt_handler.py +149 -0
- novacode_cli/commands/provider_usage.py +160 -0
- novacode_cli/commands/ralph_events.py +106 -0
- novacode_cli/commands/ralph_handler.py +1293 -0
- novacode_cli/commands/refine_handler.py +213 -0
- novacode_cli/commands/research_handler.py +202 -0
- novacode_cli/commands/rootapp_remote.py +83 -0
- novacode_cli/commands/router_handler.py +36 -0
- novacode_cli/commands/server_commands.py +249 -0
- novacode_cli/commands/session_commands.py +203 -0
- novacode_cli/commands/share_handler.py +450 -0
- novacode_cli/commands/side_commands.py +366 -0
- novacode_cli/commands/skill_invoke.py +420 -0
- novacode_cli/commands/skills_commands.py +48 -0
- novacode_cli/commands/trace_handler.py +322 -0
- novacode_cli/commands/trello_handler.py +226 -0
- novacode_cli/commands/trello_remote.py +177 -0
- novacode_cli/commands/trello_server.py +1214 -0
- novacode_cli/commands/vision_handler.py +127 -0
- novacode_cli/commands/voice_handler.py +447 -0
- novacode_cli/commands/webhook_handler.py +134 -0
- novacode_cli/commands/wiki_commands.py +227 -0
- novacode_cli/compaction.py +753 -0
- novacode_cli/computation_cache.py +159 -0
- novacode_cli/computer/__init__.py +1 -0
- novacode_cli/computer/persistent.py +234 -0
- novacode_cli/computer/preview.py +253 -0
- novacode_cli/computer/runtime.py +474 -0
- novacode_cli/computer/windows_console.py +152 -0
- novacode_cli/computer/windows_qemu.py +211 -0
- novacode_cli/config/browser_mode.py +159 -0
- novacode_cli/config/catalog_models.py +95 -0
- novacode_cli/config/config.py +1388 -0
- novacode_cli/config/credentials.py +540 -0
- novacode_cli/config/google_oauth_auth.py +281 -0
- novacode_cli/config/model_capabilities.py +343 -0
- novacode_cli/config/model_catalog.py +275 -0
- novacode_cli/config/model_create.py +1325 -0
- novacode_cli/config/model_manager.py +695 -0
- novacode_cli/config/nova_config.py +1283 -0
- novacode_cli/config/openai_chatgpt_auth.py +384 -0
- novacode_cli/config/opencode_gateway.py +25 -0
- novacode_cli/config/plan_mode.py +188 -0
- novacode_cli/config/provider_auth.py +438 -0
- novacode_cli/config/provider_catalog.json +5127 -0
- novacode_cli/config/provider_registry.py +38 -0
- novacode_cli/config/provider_transports.py +258 -0
- novacode_cli/config/role_models.py +175 -0
- novacode_cli/context/__init__.py +50 -0
- novacode_cli/context/_analysis.py +799 -0
- novacode_cli/context/_budget.py +116 -0
- novacode_cli/context/_conversation.py +73 -0
- novacode_cli/context/_dynamic.py +264 -0
- novacode_cli/context/_model_config.py +380 -0
- novacode_cli/context/_models_dev.py +99 -0
- novacode_cli/context/archives.py +248 -0
- novacode_cli/context/estimates.py +65 -0
- novacode_cli/context/history.py +17 -0
- novacode_cli/context/knowledge_cache.py +292 -0
- novacode_cli/context/manager.py +101 -0
- novacode_cli/context/observations.py +65 -0
- novacode_cli/context/pressure.py +168 -0
- novacode_cli/context/provider_accounting.py +109 -0
- novacode_cli/context/snapshot.py +493 -0
- novacode_cli/context/strategies.py +279 -0
- novacode_cli/context/task_progress.py +122 -0
- novacode_cli/core/__init__.py +0 -0
- novacode_cli/core/agent_loop.py +1821 -0
- novacode_cli/core/autonomous_loop.py +277 -0
- novacode_cli/core/code_approvals.py +57 -0
- novacode_cli/core/input_preparation.py +276 -0
- novacode_cli/core/reasoning.py +67 -0
- novacode_cli/core/streaming.py +326 -0
- novacode_cli/core/subagent_tasks.py +696 -0
- novacode_cli/core/subagent_tracking.py +235 -0
- novacode_cli/core/tool_results.py +116 -0
- novacode_cli/core/verification_loop.py +272 -0
- novacode_cli/council.py +595 -0
- novacode_cli/council_consensus.py +115 -0
- novacode_cli/council_decision.py +157 -0
- novacode_cli/council_planner.py +1421 -0
- novacode_cli/council_settings.py +208 -0
- novacode_cli/council_web_settings.py +41 -0
- novacode_cli/council_workspace.py +56 -0
- novacode_cli/cowork/__init__.py +10 -0
- novacode_cli/cowork/broker_middleware.py +162 -0
- novacode_cli/cowork/launcher.py +102 -0
- novacode_cli/cowork/policy.py +284 -0
- novacode_cli/cowork/ui.py +826 -0
- novacode_cli/daemons/__init__.py +1 -0
- novacode_cli/daemons/registry.py +342 -0
- novacode_cli/desktop_notifications.py +302 -0
- novacode_cli/doctor.py +251 -0
- novacode_cli/embeddings.py +109 -0
- novacode_cli/entrypoint.py +56 -0
- novacode_cli/errors/__init__.py +19 -0
- novacode_cli/errors/handlers.py +648 -0
- novacode_cli/errors/provider_errors.py +249 -0
- novacode_cli/errors/taxonomy.py +80 -0
- novacode_cli/events.py +179 -0
- novacode_cli/file_ops.py +714 -0
- novacode_cli/git_safety.py +281 -0
- novacode_cli/handoff.py +383 -0
- novacode_cli/headless/__init__.py +18 -0
- novacode_cli/headless/input.py +58 -0
- novacode_cli/headless/output.py +224 -0
- novacode_cli/headless/pipe.py +532 -0
- novacode_cli/headless/runner.py +461 -0
- novacode_cli/hermes/__init__.py +39 -0
- novacode_cli/hermes/activation.py +297 -0
- novacode_cli/hermes/config.py +129 -0
- novacode_cli/hermes/curator.py +199 -0
- novacode_cli/hermes/evolution.py +374 -0
- novacode_cli/hermes/ledger.py +364 -0
- novacode_cli/hermes/memory_tiers.py +969 -0
- novacode_cli/hermes/middleware.py +678 -0
- novacode_cli/hermes/overview.py +174 -0
- novacode_cli/hermes/prompt_evolution.py +503 -0
- novacode_cli/hermes/refine_loop.py +643 -0
- novacode_cli/hermes/refinement_log.py +190 -0
- novacode_cli/hermes/review.py +674 -0
- novacode_cli/hermes/skill_debate.py +135 -0
- novacode_cli/hermes/skill_discovery.py +450 -0
- novacode_cli/hermes/skill_manager.py +335 -0
- novacode_cli/hermes/skill_proposals.py +43 -0
- novacode_cli/hermes/test_gaming.py +119 -0
- novacode_cli/hermes/tracker.py +435 -0
- novacode_cli/hermes/tuner.py +206 -0
- novacode_cli/hermes/verification_memory.py +134 -0
- novacode_cli/hermes/verifier.py +277 -0
- novacode_cli/hitl/__init__.py +22 -0
- novacode_cli/hitl/interrupts.py +493 -0
- novacode_cli/hooks.py +359 -0
- novacode_cli/image_utils.py +517 -0
- novacode_cli/init/__init__.py +7 -0
- novacode_cli/init/events.py +43 -0
- novacode_cli/input_utils.py +526 -0
- novacode_cli/install_commands.py +87 -0
- novacode_cli/integrations/__init__.py +82 -0
- novacode_cli/integrations/daytona.py +122 -0
- novacode_cli/integrations/docker.py +309 -0
- novacode_cli/integrations/host_path.py +111 -0
- novacode_cli/integrations/langsmith.py +151 -0
- novacode_cli/integrations/modal.py +134 -0
- novacode_cli/integrations/runloop.py +130 -0
- novacode_cli/integrations/sandbox_factory.py +1388 -0
- novacode_cli/integrations/sandbox_registry.py +312 -0
- novacode_cli/integrations/workdir_backend.py +589 -0
- novacode_cli/main.py +2078 -0
- novacode_cli/mcp/__init__.py +73 -0
- novacode_cli/mcp/auth.py +189 -0
- novacode_cli/mcp/client.py +571 -0
- novacode_cli/mcp/code_mode.py +5 -0
- novacode_cli/mcp/code_runtime.py +5 -0
- novacode_cli/mcp/commands.py +902 -0
- novacode_cli/mcp/config.py +406 -0
- novacode_cli/mcp/generic.py +128 -0
- novacode_cli/mcp/middleware.py +993 -0
- novacode_cli/mcp/presets.py +367 -0
- novacode_cli/memory/__init__.py +1 -0
- novacode_cli/memory/agent_memory.py +1312 -0
- novacode_cli/memory/builtin_lessons.py +60 -0
- novacode_cli/memory/dream_gates.py +192 -0
- novacode_cli/memory/limits.py +59 -0
- novacode_cli/memory/parsed_cache.py +106 -0
- novacode_cli/memory/recall_stats.py +97 -0
- novacode_cli/memory/semantic.py +116 -0
- novacode_cli/memory/store.py +335 -0
- novacode_cli/memory/wiki.py +274 -0
- novacode_cli/migrate.py +185 -0
- novacode_cli/onboarding.py +649 -0
- novacode_cli/onboarding_check.py +119 -0
- novacode_cli/path_approval.py +297 -0
- novacode_cli/plan_archive.py +148 -0
- novacode_cli/plugins/__init__.py +121 -0
- novacode_cli/plugins/claude_plugins.py +538 -0
- novacode_cli/plugins/cli.py +168 -0
- novacode_cli/plugins/components.py +413 -0
- novacode_cli/plugins/hooks.py +356 -0
- novacode_cli/plugins/loader.py +317 -0
- novacode_cli/plugins/marketplaces.py +199 -0
- novacode_cli/plugins/storage.py +70 -0
- novacode_cli/prime.py +759 -0
- novacode_cli/prime_factory/__init__.py +15 -0
- novacode_cli/prime_factory/container.py +198 -0
- novacode_cli/prime_factory/controller.py +565 -0
- novacode_cli/prime_factory/knowledge.py +261 -0
- novacode_cli/prime_factory/publication.py +218 -0
- novacode_cli/prime_factory/recovery.py +50 -0
- novacode_cli/prime_factory/research.py +370 -0
- novacode_cli/prime_factory/runner.py +608 -0
- novacode_cli/prime_factory/runtime.py +261 -0
- novacode_cli/prime_factory/state.py +201 -0
- novacode_cli/prime_factory/store.py +128 -0
- novacode_cli/prime_factory/worker.py +129 -0
- novacode_cli/prime_factory/workflow.py +899 -0
- novacode_cli/prime_factory/workspace.py +317 -0
- novacode_cli/prime_memory.py +290 -0
- novacode_cli/process_manager.py +585 -0
- novacode_cli/project_onboard.py +537 -0
- novacode_cli/prompts/System_Prompt_Nova.jinja +23 -0
- novacode_cli/prompts/__init__.py +168 -0
- novacode_cli/prompts/agent_definitions.jinja +11 -0
- novacode_cli/prompts/agent_generation.jinja +125 -0
- novacode_cli/prompts/async_agents/general_purpose.jinja +22 -0
- novacode_cli/prompts/claude_plan_mode.jinja +12 -0
- novacode_cli/prompts/coding_workflow.jinja +18 -0
- novacode_cli/prompts/computer_use.jinja +17 -0
- novacode_cli/prompts/core_agent_system.jinja +81 -0
- novacode_cli/prompts/delegation.jinja +15 -0
- novacode_cli/prompts/desktop_power.jinja +4 -0
- novacode_cli/prompts/file_paths.jinja +15 -0
- novacode_cli/prompts/file_tracker.jinja +23 -0
- novacode_cli/prompts/init_agents_md.jinja +56 -0
- novacode_cli/prompts/init_exploration.jinja +174 -0
- novacode_cli/prompts/init_semantic_orchestrate.jinja +37 -0
- novacode_cli/prompts/instruction_scope.jinja +5 -0
- novacode_cli/prompts/learnings_extraction.jinja +45 -0
- novacode_cli/prompts/longterm_memory.jinja +54 -0
- novacode_cli/prompts/mcp.jinja +84 -0
- novacode_cli/prompts/memory_consolidation.jinja +40 -0
- novacode_cli/prompts/nova_evolution.jinja +73 -0
- novacode_cli/prompts/nova_review.jinja +158 -0
- novacode_cli/prompts/nova_skill_debate.jinja +36 -0
- novacode_cli/prompts/nova_standing_instructions.jinja +26 -0
- novacode_cli/prompts/nova_verify.jinja +100 -0
- novacode_cli/prompts/onboard_dashboard.jinja +378 -0
- novacode_cli/prompts/plan_agent.jinja +87 -0
- novacode_cli/prompts/plan_scouts.jinja +5 -0
- novacode_cli/prompts/plan_storage.jinja +8 -0
- novacode_cli/prompts/planning.jinja +82 -0
- novacode_cli/prompts/ponytail/LICENSE +21 -0
- novacode_cli/prompts/ponytail/UPSTREAM.json +15 -0
- novacode_cli/prompts/ponytail/hooks/ponytail-config.js +175 -0
- novacode_cli/prompts/ponytail/hooks/ponytail-instructions.js +98 -0
- novacode_cli/prompts/ponytail/skills/ponytail/SKILL.md +52 -0
- novacode_cli/prompts/ponytail/skills/ponytail-audit/SKILL.md +103 -0
- novacode_cli/prompts/ponytail/skills/ponytail-debt/SKILL.md +44 -0
- novacode_cli/prompts/ponytail/skills/ponytail-gain/SKILL.md +52 -0
- novacode_cli/prompts/ponytail/skills/ponytail-help/SKILL.md +76 -0
- novacode_cli/prompts/ponytail/skills/ponytail-review/SKILL.md +101 -0
- novacode_cli/prompts/prompt_evolution.jinja +27 -0
- novacode_cli/prompts/ralph_iteration.jinja +75 -0
- novacode_cli/prompts/refine_gate.jinja +31 -0
- novacode_cli/prompts/refine_plan.jinja +64 -0
- novacode_cli/prompts/refine_review.jinja +34 -0
- novacode_cli/prompts/research_delivery.jinja +9 -0
- novacode_cli/prompts/research_swarm.jinja +130 -0
- novacode_cli/prompts/response_style.jinja +5 -0
- novacode_cli/prompts/session_summarization.jinja +86 -0
- novacode_cli/prompts/skill_creation.jinja +85 -0
- novacode_cli/prompts/subagents/fact_checker.jinja +48 -0
- novacode_cli/prompts/subagents/financial_analyst.jinja +50 -0
- novacode_cli/prompts/subagents/literature_reviewer.jinja +52 -0
- novacode_cli/prompts/subagents/market_analyst.jinja +48 -0
- novacode_cli/prompts/subagents/research_synthesizer.jinja +57 -0
- novacode_cli/prompts/subagents/technical_researcher.jinja +56 -0
- novacode_cli/prompts/subagents/web_researcher.jinja +46 -0
- novacode_cli/prompts/summarization.jinja +107 -0
- novacode_cli/prompts/summarization_answers.jinja +23 -0
- novacode_cli/prompts/summarization_questions.jinja +32 -0
- novacode_cli/prompts/vision_caption.jinja +21 -0
- novacode_cli/prompts/voice_summary.jinja +65 -0
- novacode_cli/prompts/wiki_file.jinja +57 -0
- novacode_cli/prompts/wiki_ingest.jinja +87 -0
- novacode_cli/recovery.py +383 -0
- novacode_cli/remote/__init__.py +45 -0
- novacode_cli/remote/approvals.py +282 -0
- novacode_cli/remote/async_task_clients.py +97 -0
- novacode_cli/remote/async_task_watcher.py +240 -0
- novacode_cli/remote/bridge.py +905 -0
- novacode_cli/remote/command_menu.py +26 -0
- novacode_cli/remote/command_ui.py +243 -0
- novacode_cli/remote/config.py +199 -0
- novacode_cli/remote/discord_bridge.py +530 -0
- novacode_cli/remote/discord_format.py +31 -0
- novacode_cli/remote/discord_threads.py +225 -0
- novacode_cli/remote/images.py +97 -0
- novacode_cli/remote/processor.py +601 -0
- novacode_cli/remote/rootapp_bot/bot.cjs +16 -0
- novacode_cli/remote/rootapp_bot/package-lock.json +2683 -0
- novacode_cli/remote/rootapp_bot/package.json +18 -0
- novacode_cli/remote/rootapp_bot/transport.cjs +80 -0
- novacode_cli/remote/rootapp_bridge.py +370 -0
- novacode_cli/remote/rootapp_setup.py +89 -0
- novacode_cli/remote/routing.py +103 -0
- novacode_cli/remote/scheduler.py +302 -0
- novacode_cli/remote/session.py +164 -0
- novacode_cli/remote/status.py +411 -0
- novacode_cli/remote/streaming.py +188 -0
- novacode_cli/remote/telegram_bridge.py +1118 -0
- novacode_cli/remote/telegram_format.py +215 -0
- novacode_cli/remote/telegram_hub.py +256 -0
- novacode_cli/remote/voice_notes.py +120 -0
- novacode_cli/remote/webhook_adapters.py +167 -0
- novacode_cli/remote/webhook_server.py +154 -0
- novacode_cli/rewind.py +150 -0
- novacode_cli/rooms/__init__.py +1 -0
- novacode_cli/rooms/bridge.py +86 -0
- novacode_cli/rooms/cli.py +231 -0
- novacode_cli/rooms/nova.py +227 -0
- novacode_cli/rooms/runtime.py +299 -0
- novacode_cli/rooms/store.py +538 -0
- novacode_cli/rooms/workspace.py +94 -0
- novacode_cli/security/__init__.py +29 -0
- novacode_cli/security/approval_context.py +45 -0
- novacode_cli/security/delegated_approval.py +68 -0
- novacode_cli/security/local_http.py +85 -0
- novacode_cli/security/middleware.py +87 -0
- novacode_cli/security/paths.py +35 -0
- novacode_cli/security/policy.py +535 -0
- novacode_cli/security/policy_writer.py +90 -0
- novacode_cli/security/prompt_injection.py +203 -0
- novacode_cli/security/remember.py +81 -0
- novacode_cli/security/rule_synthesis.py +116 -0
- novacode_cli/security/secret_files.py +61 -0
- novacode_cli/security/session_allow.py +114 -0
- novacode_cli/security/unicode_security.py +516 -0
- novacode_cli/security/validator.py +173 -0
- novacode_cli/server/__init__.py +9 -0
- novacode_cli/server/app.py +632 -0
- novacode_cli/server/event_adapter.py +189 -0
- novacode_cli/server/session_manager.py +90 -0
- novacode_cli/server_main.py +64 -0
- novacode_cli/server_runner/dev_server.py +530 -0
- novacode_cli/server_runner/test_runner.py +470 -0
- novacode_cli/session/__init__.py +1 -0
- novacode_cli/session/adapters/__init__.py +240 -0
- novacode_cli/session/adapters/claude_code.py +102 -0
- novacode_cli/session/adapters/codex.py +77 -0
- novacode_cli/session/adapters/harness_native.py +75 -0
- novacode_cli/session/checkpoint_coordinator.py +448 -0
- novacode_cli/session/context_restore.py +25 -0
- novacode_cli/session/history_export.py +228 -0
- novacode_cli/session/history_tree.py +174 -0
- novacode_cli/session/imported_context.py +267 -0
- novacode_cli/session/runtime_identity.py +32 -0
- novacode_cli/session/session_persistence.py +1168 -0
- novacode_cli/session/session_prompt_builder.py +279 -0
- novacode_cli/session/session_restore.py +351 -0
- novacode_cli/session/session_summarization.py +20 -0
- novacode_cli/session/transcript_journal.py +153 -0
- novacode_cli/sessions/__init__.py +11 -0
- novacode_cli/sessions/gateway.py +84 -0
- novacode_cli/sessions/launch.py +51 -0
- novacode_cli/sessions/lease.py +213 -0
- novacode_cli/sessions/messaging.py +255 -0
- novacode_cli/sessions/protocol.py +216 -0
- novacode_cli/sessions/resume.py +31 -0
- novacode_cli/sessions/supervisor.py +498 -0
- novacode_cli/sessions/tasks.py +73 -0
- novacode_cli/sessions/tui_messaging.py +413 -0
- novacode_cli/sessions/worker.py +652 -0
- novacode_cli/sessions/worktree.py +262 -0
- novacode_cli/shell/__init__.py +27 -0
- novacode_cli/shell/jobs.py +475 -0
- novacode_cli/shell/middleware.py +1568 -0
- novacode_cli/shell/os_sandbox.py +205 -0
- novacode_cli/shell/output.py +181 -0
- novacode_cli/shell/patterns.py +275 -0
- novacode_cli/shell/processes.py +87 -0
- novacode_cli/shell/utils.py +236 -0
- novacode_cli/skills/__init__.py +26 -0
- novacode_cli/skills/builtin/handoff/SKILL.md +15 -0
- novacode_cli/skills/curation_middleware.py +69 -0
- novacode_cli/skills/executable.py +161 -0
- novacode_cli/skills/libraries.py +102 -0
- novacode_cli/skills/load.py +248 -0
- novacode_cli/skills/prune.py +215 -0
- novacode_cli/skills/refreshing_middleware.py +896 -0
- novacode_cli/skills/retrieval.py +248 -0
- novacode_cli/skills/runtime.py +118 -0
- novacode_cli/skills/schema.py +254 -0
- novacode_cli/skills/skill_creation.py +1549 -0
- novacode_cli/skills/skill_lock.py +75 -0
- novacode_cli/skills/skill_system_prompt.py +16 -0
- novacode_cli/skills/skills_prefs.py +126 -0
- novacode_cli/skills/tool_resolver.py +31 -0
- novacode_cli/skills/upstream.py +50 -0
- novacode_cli/skills/versioning.py +291 -0
- novacode_cli/states/Session.py +847 -0
- novacode_cli/states/__init__.py +31 -0
- novacode_cli/states/slices/__init__.py +17 -0
- novacode_cli/states/slices/agent_runtime.py +249 -0
- novacode_cli/states/slices/background_tasks.py +21 -0
- novacode_cli/states/slices/notifications.py +74 -0
- novacode_cli/states/slices/remote_bridge.py +56 -0
- novacode_cli/states/slices/ui_settings.py +49 -0
- novacode_cli/states/slices/wiki.py +25 -0
- novacode_cli/teammates/__init__.py +1 -0
- novacode_cli/teammates/controller.py +557 -0
- novacode_cli/teammates/graph.py +104 -0
- novacode_cli/teammates/registry.py +175 -0
- novacode_cli/teammates/service.py +254 -0
- novacode_cli/teammates/worker.py +19 -0
- novacode_cli/teams/__init__.py +1 -0
- novacode_cli/teams/adapters/__init__.py +1 -0
- novacode_cli/teams/adapters/container.py +316 -0
- novacode_cli/teams/adapters/inprocess.py +206 -0
- novacode_cli/teams/adapters/process.py +364 -0
- novacode_cli/teams/bootstrap.py +246 -0
- novacode_cli/teams/container_git.py +67 -0
- novacode_cli/teams/context.py +34 -0
- novacode_cli/teams/coordinator.py +815 -0
- novacode_cli/teams/gateway.py +200 -0
- novacode_cli/teams/host.py +64 -0
- novacode_cli/teams/legacy.py +52 -0
- novacode_cli/teams/middleware.py +176 -0
- novacode_cli/teams/models.py +104 -0
- novacode_cli/teams/output.py +47 -0
- novacode_cli/teams/protocol.py +50 -0
- novacode_cli/teams/recovery.py +80 -0
- novacode_cli/teams/scheduler.py +44 -0
- novacode_cli/teams/store.py +631 -0
- novacode_cli/teams/worker.py +251 -0
- novacode_cli/teams/workspace.py +100 -0
- novacode_cli/token_utils.py +256 -0
- novacode_cli/tools/__init__.py +104 -0
- novacode_cli/tools/_shared.py +97 -0
- novacode_cli/tools/_types.py +24 -0
- novacode_cli/tools/artifact_tools.py +137 -0
- novacode_cli/tools/code_search_tools.py +330 -0
- novacode_cli/tools/computer_tools.py +77 -0
- novacode_cli/tools/cron_tools.py +65 -0
- novacode_cli/tools/daemon_tool.py +290 -0
- novacode_cli/tools/desktop_tools.py +161 -0
- novacode_cli/tools/fetch_tools.py +530 -0
- novacode_cli/tools/http_tools.py +279 -0
- novacode_cli/tools/inspection_tools.py +107 -0
- novacode_cli/tools/job_tools.py +143 -0
- novacode_cli/tools/knowledge_tools.py +427 -0
- novacode_cli/tools/memory_tools.py +461 -0
- novacode_cli/tools/memory_wiki_tools.py +40 -0
- novacode_cli/tools/notebook_tools.py +238 -0
- novacode_cli/tools/oracle_tool.py +83 -0
- novacode_cli/tools/plan_archive_tools.py +80 -0
- novacode_cli/tools/plan_mode_tools.py +315 -0
- novacode_cli/tools/python_kernel_loop.py +165 -0
- novacode_cli/tools/python_kernel_tool.py +222 -0
- novacode_cli/tools/reflection_tools.py +34 -0
- novacode_cli/tools/scraper_tools.py +377 -0
- novacode_cli/tools/skill_tools.py +275 -0
- novacode_cli/tools/speak_tool.py +51 -0
- novacode_cli/tools/store_memory_tools.py +227 -0
- novacode_cli/tools/ui_tools.py +62 -0
- novacode_cli/tools/waiter_tools.py +408 -0
- novacode_cli/tools/web_tools.py +349 -0
- novacode_cli/tools/wiki_tools.py +152 -0
- novacode_cli/tools/worktree_tools.py +219 -0
- novacode_cli/tracking/__init__.py +10 -0
- novacode_cli/tracking/file_tracker.py +826 -0
- novacode_cli/tracking/local_metrics.py +170 -0
- novacode_cli/tracking/loop_guard.py +507 -0
- novacode_cli/tracking/request_metrics.py +60 -0
- novacode_cli/tracking/tracing.py +692 -0
- novacode_cli/tracking/usage_tree.py +677 -0
- novacode_cli/tracking/workspace_anchoring.py +231 -0
- novacode_cli/tui/__init__.py +11 -0
- novacode_cli/tui/animation_rate.py +9 -0
- novacode_cli/tui/animations.py +332 -0
- novacode_cli/tui/app.py +19315 -0
- novacode_cli/tui/auth_display.py +87 -0
- novacode_cli/tui/auth_screens.py +826 -0
- novacode_cli/tui/avatar.py +294 -0
- novacode_cli/tui/avatar_frames.py +21 -0
- novacode_cli/tui/background_tasks.py +35 -0
- novacode_cli/tui/browser_settings_screen.py +70 -0
- novacode_cli/tui/caveman_screen.py +185 -0
- novacode_cli/tui/council_settings_screen.py +182 -0
- novacode_cli/tui/council_view.py +535 -0
- novacode_cli/tui/decision_settings.py +268 -0
- novacode_cli/tui/diff_preview.py +199 -0
- novacode_cli/tui/gc_tuning.py +63 -0
- novacode_cli/tui/handoff_screen.py +206 -0
- novacode_cli/tui/harness.py +244 -0
- novacode_cli/tui/history_tree_screen.py +179 -0
- novacode_cli/tui/home.py +328 -0
- novacode_cli/tui/home_scene.py +94 -0
- novacode_cli/tui/icons.py +81 -0
- novacode_cli/tui/interface_styles.tcss +327 -0
- novacode_cli/tui/matrix3.py +108 -0
- novacode_cli/tui/mcp_tools_screen.py +131 -0
- novacode_cli/tui/motion.py +178 -0
- novacode_cli/tui/output_body.py +136 -0
- novacode_cli/tui/output_buffer.py +59 -0
- novacode_cli/tui/palette.py +334 -0
- novacode_cli/tui/pickers.py +237 -0
- novacode_cli/tui/prime_panel.py +506 -0
- novacode_cli/tui/provider_signin.py +213 -0
- novacode_cli/tui/pty_shell.py +159 -0
- novacode_cli/tui/reference_screens.py +444 -0
- novacode_cli/tui/resume_picker.py +346 -0
- novacode_cli/tui/rooms.py +597 -0
- novacode_cli/tui/screens.py +7088 -0
- novacode_cli/tui/session_import.py +333 -0
- novacode_cli/tui/session_pane.py +242 -0
- novacode_cli/tui/session_tab.py +42 -0
- novacode_cli/tui/session_transcript.py +118 -0
- novacode_cli/tui/shell_output.py +7 -0
- novacode_cli/tui/stall_watch.py +174 -0
- novacode_cli/tui/statusline.py +40 -0
- novacode_cli/tui/statusline_screen.py +91 -0
- novacode_cli/tui/teammate_updates.py +162 -0
- novacode_cli/tui/teammates.py +548 -0
- novacode_cli/tui/terminal.py +289 -0
- novacode_cli/tui/terminal_view.py +235 -0
- novacode_cli/tui/themes.py +118 -0
- novacode_cli/tui/update_notice.py +84 -0
- novacode_cli/tui/voice_downloads.py +113 -0
- novacode_cli/tui/widgets.py +2038 -0
- novacode_cli/tui/windows_input.py +38 -0
- novacode_cli/tui/workspace_approval.py +165 -0
- novacode_cli/ui/council_web.py +113 -0
- novacode_cli/ui/council_workspace.py +72 -0
- novacode_cli/ui/cowork_web.py +41 -0
- novacode_cli/ui/diff_highlight.py +160 -0
- novacode_cli/ui/execution.py +1396 -0
- novacode_cli/ui/exit_summary.py +65 -0
- novacode_cli/ui/hitl_approval.py +196 -0
- novacode_cli/ui/input_preparation.py +2 -0
- novacode_cli/ui/interrupt_handlers.py +215 -0
- novacode_cli/ui/question_prompt.py +151 -0
- novacode_cli/ui/status_phrases.py +157 -0
- novacode_cli/ui/stream_preview.py +66 -0
- novacode_cli/ui/streaming.py +2 -0
- novacode_cli/ui/subagent_tracking.py +2 -0
- novacode_cli/ui/ui_elements.py +1585 -0
- novacode_cli/ui/web_workspace.py +244 -0
- novacode_cli/ui_events.py +299 -0
- novacode_cli/update_ui.py +243 -0
- novacode_cli/updates.py +489 -0
- novacode_cli/utils/backend_patches.py +399 -0
- novacode_cli/utils/backend_paths.py +467 -0
- novacode_cli/utils/lazy_providers.py +51 -0
- novacode_cli/utils/model_info.py +223 -0
- novacode_cli/utils/pdf_extraction.py +183 -0
- novacode_cli/utils/startup.py +29 -0
- novacode_cli/utils/tasks.py +42 -0
- novacode_cli/utils/windows.py +9 -0
- novacode_cli/vixie/hook_adapter.py +127 -0
- novacode_cli/vixie/server.py +375 -0
- novacode_cli/wiki/__init__.py +15 -0
- novacode_cli/wiki/ask.py +56 -0
- novacode_cli/wiki/file.py +71 -0
- novacode_cli/wiki/ingest.py +184 -0
- novacode_cli/wiki/manager.py +261 -0
- novacode_cli-1.2.0.dist-info/METADATA +271 -0
- novacode_cli-1.2.0.dist-info/RECORD +691 -0
- novacode_cli-1.2.0.dist-info/WHEEL +5 -0
- novacode_cli-1.2.0.dist-info/entry_points.txt +2 -0
- novacode_cli-1.2.0.dist-info/licenses/LICENSE +21 -0
- novacode_cli-1.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1388 @@
|
|
|
1
|
+
"""Configuration, constants, and model creation for the CLI.
|
|
2
|
+
|
|
3
|
+
This module provides centralized configuration management for the CLI, including:
|
|
4
|
+
- Color scheme and UI styling constants
|
|
5
|
+
- Environment variable parsing and settings management
|
|
6
|
+
- Project root detection and working directory management
|
|
7
|
+
- Rich console initialization with proper encoding
|
|
8
|
+
|
|
9
|
+
Key Components:
|
|
10
|
+
- create_model(): Factory function for creating chat models from configuration
|
|
11
|
+
- settings(): Global settings object with environment variable access
|
|
12
|
+
- COLORS: Color scheme constants for UI styling
|
|
13
|
+
- ASCII art banner for CLI startup
|
|
14
|
+
|
|
15
|
+
Supported Model Providers:
|
|
16
|
+
- OpenAI (default): Requires OPENAI_API_KEY
|
|
17
|
+
- Anthropic: Requires ANTHROPIC_API_KEY
|
|
18
|
+
- Ollama: Local models, requires OLLAMA_BASE_URL
|
|
19
|
+
- Google: Requires GOOGLE_API_KEY
|
|
20
|
+
|
|
21
|
+
Environment Configuration:
|
|
22
|
+
- API keys loaded from environment variables or .env files
|
|
23
|
+
- Configuration files in ~/.nova/ and .nova/
|
|
24
|
+
- Project-specific settings override global settings
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
import os
|
|
28
|
+
import random
|
|
29
|
+
import re
|
|
30
|
+
import sys
|
|
31
|
+
import time
|
|
32
|
+
from contextlib import asynccontextmanager, contextmanager
|
|
33
|
+
from dataclasses import dataclass
|
|
34
|
+
from pathlib import Path
|
|
35
|
+
|
|
36
|
+
import dotenv
|
|
37
|
+
from rich.console import Console, ConsoleOptions, RenderResult
|
|
38
|
+
from rich.live import Live
|
|
39
|
+
from rich.spinner import Spinner
|
|
40
|
+
from rich.table import Table
|
|
41
|
+
from rich.text import Text
|
|
42
|
+
|
|
43
|
+
from novacode_cli._version import __version__
|
|
44
|
+
from novacode_cli.brand import (
|
|
45
|
+
format_version_banner as format_version_banner,
|
|
46
|
+
TAGLINE,
|
|
47
|
+
art_for,
|
|
48
|
+
compact_mark,
|
|
49
|
+
get_accent_hex,
|
|
50
|
+
wordmark,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
dotenv.load_dotenv()
|
|
54
|
+
|
|
55
|
+
# Home directory for NOVA configuration
|
|
56
|
+
HOME_DIR = Path.home() / ".nova"
|
|
57
|
+
|
|
58
|
+
# Color scheme - Red & White Theme
|
|
59
|
+
COLORS = {
|
|
60
|
+
"primary": "#ef4444", # Bright red (primary actions, headings)
|
|
61
|
+
"secondary": "#dc2626", # Deep red (highlights, important text)
|
|
62
|
+
"accent": "#fca5a5", # Light red (accents, borders)
|
|
63
|
+
"dim": "#9ca3af", # Gray (secondary text)
|
|
64
|
+
"user": "#ffffff", # White (user messages)
|
|
65
|
+
"agent": "#ef4444", # Bright red (agent messages)
|
|
66
|
+
"thinking": "#f87171", # Medium red (thinking/processing)
|
|
67
|
+
"tool": "#dc2626", # Deep red (tool calls)
|
|
68
|
+
"success": "#10b981", # Green (success states)
|
|
69
|
+
"warning": "#f59e0b", # Orange (warnings)
|
|
70
|
+
"error": "#dc2626", # Deep red (errors)
|
|
71
|
+
"subagent": "#30c3f0", # Medium red (sub-agent messages)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
# Reserved agent ID for the main agent — not a user-created named subagent.
|
|
75
|
+
MAIN_AGENT_ID = "nova-agent"
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def agent_md(path: Path) -> Path:
|
|
79
|
+
"""The definition file of an agent: ``<name>/agent.md`` or a flat ``<name>.md``."""
|
|
80
|
+
return path if path.suffix == ".md" else path / "agent.md"
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
#: Nova's own specialists, shipped as agent files and copied to ~/.nova/agents/.
|
|
84
|
+
BUILTIN_AGENTS_DIR = (
|
|
85
|
+
Path(__file__).resolve().parents[1] / "agents" / "default_subagents" / "builtin"
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def seed_builtin_agents(agents_dir: Path) -> list[str]:
|
|
90
|
+
"""Copy each shipped agent file into *agents_dir* once; return the names written.
|
|
91
|
+
|
|
92
|
+
Every name is recorded in ``.builtin-seeded`` the first time it is seen, so a
|
|
93
|
+
file the user deletes stays deleted and one they edit is never overwritten.
|
|
94
|
+
An agent the user already has under that name (a ``<name>/`` folder or a
|
|
95
|
+
``<name>.md``) is kept, and the shipped one is not written.
|
|
96
|
+
"""
|
|
97
|
+
marker = agents_dir / ".builtin-seeded"
|
|
98
|
+
try:
|
|
99
|
+
done = set(marker.read_text(encoding="utf-8").split()) if marker.exists() else set()
|
|
100
|
+
shipped = sorted(BUILTIN_AGENTS_DIR.glob("*.md"))
|
|
101
|
+
new = [f for f in shipped if f.stem not in done]
|
|
102
|
+
if not new:
|
|
103
|
+
return []
|
|
104
|
+
agents_dir.mkdir(parents=True, exist_ok=True)
|
|
105
|
+
written = []
|
|
106
|
+
for source in new:
|
|
107
|
+
if not (agents_dir / source.stem).exists() and not (agents_dir / source.name).exists():
|
|
108
|
+
(agents_dir / source.name).write_bytes(source.read_bytes())
|
|
109
|
+
written.append(source.stem)
|
|
110
|
+
marker.write_text("\n".join(sorted(done | {f.stem for f in new})) + "\n", encoding="utf-8")
|
|
111
|
+
except OSError:
|
|
112
|
+
import logging
|
|
113
|
+
|
|
114
|
+
logging.getLogger(__name__).warning("could not seed the built-in agents", exc_info=True)
|
|
115
|
+
return []
|
|
116
|
+
return written
|
|
117
|
+
|
|
118
|
+
# Agent color registry - stores colors for custom agents
|
|
119
|
+
_agent_colors: dict[str, str] = {}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def extract_agent_description(agent_md: Path) -> str:
|
|
123
|
+
"""Extract description from agent.md YAML frontmatter or first content line.
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
agent_md: Path to the agent.md file.
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
Extracted description string.
|
|
130
|
+
"""
|
|
131
|
+
try:
|
|
132
|
+
content = agent_md.read_text(encoding="utf-8")
|
|
133
|
+
|
|
134
|
+
# YAML front-matter
|
|
135
|
+
if content.startswith("---"):
|
|
136
|
+
parts = content.split("---", 2)
|
|
137
|
+
if len(parts) >= 3:
|
|
138
|
+
front_matter = parts[1]
|
|
139
|
+
for line in front_matter.splitlines():
|
|
140
|
+
line = line.strip()
|
|
141
|
+
if line.startswith("description:"):
|
|
142
|
+
return line.split(":", 1)[1].strip()[:80]
|
|
143
|
+
|
|
144
|
+
# Fallback: first non-empty, non-heading line
|
|
145
|
+
for line in content.splitlines():
|
|
146
|
+
line = line.strip()
|
|
147
|
+
if line and not line.startswith("#"):
|
|
148
|
+
return (line[:80] + "...") if len(line) > 80 else line
|
|
149
|
+
|
|
150
|
+
except Exception:
|
|
151
|
+
pass
|
|
152
|
+
|
|
153
|
+
return "[unable to read]"
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def get_agent_color(agent_name: str) -> str:
|
|
157
|
+
"""Get the color for an agent by name.
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
agent_name: The name of the agent.
|
|
161
|
+
|
|
162
|
+
Returns:
|
|
163
|
+
The color string (hex or name), or default subagent color if not set.
|
|
164
|
+
"""
|
|
165
|
+
return _agent_colors.get(agent_name, COLORS["subagent"])
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def set_agent_color(agent_name: str, color: str) -> None:
|
|
169
|
+
"""Set the color for an agent.
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
agent_name: The name of the agent.
|
|
173
|
+
color: The color string (hex code like '#ef4444' or color name).
|
|
174
|
+
"""
|
|
175
|
+
_agent_colors[agent_name] = color
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def clear_agent_colors() -> None:
|
|
179
|
+
"""Clear all registered agent colors."""
|
|
180
|
+
_agent_colors.clear()
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def parse_agent_color(agent_md_path: Path) -> str | None:
|
|
184
|
+
"""Parse color from agent.md YAML frontmatter.
|
|
185
|
+
|
|
186
|
+
Looks for a color field in YAML frontmatter at the start of the file:
|
|
187
|
+
```
|
|
188
|
+
---
|
|
189
|
+
color: #ef4444
|
|
190
|
+
---
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Args:
|
|
194
|
+
agent_md_path: Path to the agent.md file.
|
|
195
|
+
|
|
196
|
+
Returns:
|
|
197
|
+
Color string if found, None otherwise.
|
|
198
|
+
"""
|
|
199
|
+
try:
|
|
200
|
+
content = agent_md_path.read_text(encoding="utf-8")
|
|
201
|
+
|
|
202
|
+
# Match YAML frontmatter between --- delimiters
|
|
203
|
+
frontmatter_pattern = r"^---\s*\n(.*?)\n---\s*\n"
|
|
204
|
+
match = re.match(frontmatter_pattern, content, re.DOTALL)
|
|
205
|
+
|
|
206
|
+
if not match:
|
|
207
|
+
return None
|
|
208
|
+
|
|
209
|
+
frontmatter = match.group(1)
|
|
210
|
+
|
|
211
|
+
# Parse color from frontmatter
|
|
212
|
+
for line in frontmatter.split("\n"):
|
|
213
|
+
kv_match = re.match(r"^color:\s*(.+)$", line.strip())
|
|
214
|
+
if kv_match:
|
|
215
|
+
return kv_match.group(1).strip().strip('"').strip("'")
|
|
216
|
+
|
|
217
|
+
return None
|
|
218
|
+
except Exception:
|
|
219
|
+
return None
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def get_responsive_ascii(
|
|
223
|
+
console: Console | None = None, width: int | None = None, height: int | None = None
|
|
224
|
+
) -> str:
|
|
225
|
+
"""Responsive startup ASCII art, sized to the terminal width.
|
|
226
|
+
|
|
227
|
+
Thin adapter over :func:`novacode_cli.brand.art_for`, which owns the art.
|
|
228
|
+
This used to inline three near-identical copies plus a fourth legacy
|
|
229
|
+
constant, whose rows ranged from 29 to 77 columns wide.
|
|
230
|
+
|
|
231
|
+
Args:
|
|
232
|
+
console: Rich console to read the terminal width from, used only when
|
|
233
|
+
``width`` is not given.
|
|
234
|
+
width: Explicit terminal width in columns. Prefer this from a Textual
|
|
235
|
+
app (``self.size.width``), since the global Rich console width does
|
|
236
|
+
not track the live TUI size on resize.
|
|
237
|
+
|
|
238
|
+
Returns:
|
|
239
|
+
ASCII art sized for the terminal.
|
|
240
|
+
"""
|
|
241
|
+
terminal_width = width
|
|
242
|
+
if terminal_width is None:
|
|
243
|
+
try:
|
|
244
|
+
terminal_width = console.width if console is not None else 80
|
|
245
|
+
except Exception:
|
|
246
|
+
terminal_width = 80
|
|
247
|
+
return art_for(terminal_width, settings.version, height)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
# Legacy static ASCII art. Kept as the name earlier code imported; the art
|
|
251
|
+
# itself now comes from brand.py so there is one wordmark, not five.
|
|
252
|
+
NOVA_CODE_ASCII = wordmark()
|
|
253
|
+
|
|
254
|
+
# Interactive commands
|
|
255
|
+
COMMANDS = {
|
|
256
|
+
"clear": "Clear screen and reset conversation",
|
|
257
|
+
"help": "Show help information",
|
|
258
|
+
"tokens": "Show token usage for current session",
|
|
259
|
+
"context": "Show detailed context window usage with visual breakdown",
|
|
260
|
+
"compact": "Summarize conversation to free up context (e.g., /compact Focus on X)",
|
|
261
|
+
"init": "Explore codebase and create NOVA.MD file",
|
|
262
|
+
"mcp": "Manage MCP servers (install presets, add custom, list, remove)",
|
|
263
|
+
"model": "Manage LLM providers (view, switch between OpenAI, Anthropic, Ollama, Google)",
|
|
264
|
+
"router": "Route each turn to a model chosen by a decision model (Jev or local)",
|
|
265
|
+
"hooks": "Manage hooks - list, add, remove, test, view logs (e.g., /hooks list)",
|
|
266
|
+
"skills": "Manage skills - create or list (e.g., /skills, /skills create, /skills list)",
|
|
267
|
+
"agents": "Manage custom agents - view, create, or delete (e.g., /agents)",
|
|
268
|
+
"sessions": "List and manage saved sessions",
|
|
269
|
+
"save": "Manually save current session (auto-saved on exit)",
|
|
270
|
+
"servers": "List and manage running dev servers",
|
|
271
|
+
"tests": "Run project tests (e.g., /tests or /tests pytest -v)",
|
|
272
|
+
"trace": "Manage LangSmith tracing (status, enable, disable, projects)",
|
|
273
|
+
"kill": "Kill a running process by PID or name (e.g., /kill 1234)",
|
|
274
|
+
"images": "Manage images in conversation (list, remove <id>, clear)",
|
|
275
|
+
"plan": "Toggle plan mode (e.g., /plan, /plan on, /plan off)",
|
|
276
|
+
"verbose": "Toggle verbose mode - show/hide internal agent context",
|
|
277
|
+
"steer": "Add persistent steering instructions (e.g., /steer focus on database layer)",
|
|
278
|
+
"remote": "Manage Discord, Telegram or Rootapp bridges (setup/start/stop/status/test)",
|
|
279
|
+
"cron": 'Schedule recurring agent tasks (e.g., /cron add "0 9 * * *" "review project")',
|
|
280
|
+
"webhook": "Manage the webhook ingress server (start/stop/register/status)",
|
|
281
|
+
"prompt": "Manage evolving system-prompt templates (status/rollback/accept/reject)",
|
|
282
|
+
"voice": "Local voice I/O — status, on/off, mode ptt|listen, test (ctrl+g talk, ctrl+l listen)",
|
|
283
|
+
"vision": "Analyze images with vision model (e.g., /vision @image.png, /vision @img1.png @img2.png)",
|
|
284
|
+
"files": "Show file operation summary for the session",
|
|
285
|
+
"critique": "Run critique agent on recent changes (e.g., /critique or /critique src/)",
|
|
286
|
+
"ralph": "Run autonomous looping mode (e.g., /ralph <task>, /ralph <task> --iterations 5)",
|
|
287
|
+
"browser-use": "Browser research mode (/browser-use on|off|status|settings or <task>)",
|
|
288
|
+
"council": "Open the Council web UI (5 agents answer independently, then vote — majority wins)",
|
|
289
|
+
"create": "Open the Skills & Agents web UI (browse, preview, edit, create skills and agents)",
|
|
290
|
+
"dream": "Run memory consolidation to organize and clean up memory files",
|
|
291
|
+
"research": "Run agent swarm research (e.g., /research <query>, /research academic <query>, /research market <query>)",
|
|
292
|
+
"reindex": "Rebuild the semantic code search index (after significant code changes)",
|
|
293
|
+
"trello": "Start a task board in the browser (add tasks, agent processes them one at a time)",
|
|
294
|
+
"exit": "Exit the CLI",
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
# Maximum argument length for display
|
|
299
|
+
MAX_ARG_LENGTH = 150
|
|
300
|
+
|
|
301
|
+
# Tool icons for display in tool calls
|
|
302
|
+
TOOL_ICONS = {
|
|
303
|
+
"read_file": "📄",
|
|
304
|
+
"write_file": "✍️",
|
|
305
|
+
"edit_file": "📝",
|
|
306
|
+
"shell": "💻",
|
|
307
|
+
"ls": "📁",
|
|
308
|
+
"glob": "🔍",
|
|
309
|
+
"grep": "🔎",
|
|
310
|
+
"web_search": "🌐",
|
|
311
|
+
"fetch_url": "📡",
|
|
312
|
+
"fetch_url": "🌍",
|
|
313
|
+
"task": "🤖",
|
|
314
|
+
"write_todos": "📋",
|
|
315
|
+
"mcp": "🔌",
|
|
316
|
+
"run_tests": "🧪",
|
|
317
|
+
"start_dev_server": "🚀",
|
|
318
|
+
"stop_dev_server": "🛑",
|
|
319
|
+
"list_servers": "📋",
|
|
320
|
+
"code_search": "🔍",
|
|
321
|
+
"find_related_code": "🔄",
|
|
322
|
+
"default": "🔧",
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
# Agent configuration
|
|
326
|
+
config = {"recursion_limit": 1000}
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
# Rich console instance
|
|
332
|
+
# Force UTF-8 encoding on Windows to support Unicode characters in ASCII art
|
|
333
|
+
if sys.platform == "win32":
|
|
334
|
+
import io
|
|
335
|
+
|
|
336
|
+
console = Console(
|
|
337
|
+
highlight=False, file=io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
|
|
338
|
+
)
|
|
339
|
+
else:
|
|
340
|
+
console = Console(highlight=False)
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
# Fun rotating boot messages for animated startup
|
|
344
|
+
_BOOT_MESSAGES = [
|
|
345
|
+
"Nova is launching…",
|
|
346
|
+
"mcp: routing through the stars…",
|
|
347
|
+
"mcp: establishing tool links…",
|
|
348
|
+
"memory: warming the neural core…",
|
|
349
|
+
"sandbox: spinning up isolation chamber…",
|
|
350
|
+
"session: weaving context threads…",
|
|
351
|
+
"skills: loading combat protocols…",
|
|
352
|
+
"system: calibrating LLM interface…",
|
|
353
|
+
"model: initializing cognition engine…",
|
|
354
|
+
"tools: loading the arsenal…",
|
|
355
|
+
"workspace: scanning the terrain…",
|
|
356
|
+
"plugins: discovering extensions…",
|
|
357
|
+
"engine: starting up the stacks…",
|
|
358
|
+
"firewall: raising digital shields…",
|
|
359
|
+
"backbone: synchronizing data buses…",
|
|
360
|
+
]
|
|
361
|
+
|
|
362
|
+
_BOOT_MESSAGE_INDEX: dict[str, list[str]] = {}
|
|
363
|
+
"""Tracks which messages have been used per subsystem for rotation."""
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
def _pick_boot_message(subsystem: str) -> str:
|
|
367
|
+
"""Pick a fun rotating message for a given subsystem.
|
|
368
|
+
|
|
369
|
+
Cycles through available messages for that subsystem (matched by prefix),
|
|
370
|
+
preferring unused ones first to keep startup varied.
|
|
371
|
+
|
|
372
|
+
Args:
|
|
373
|
+
subsystem: The message prefix/subsystem name (e.g. ``"mcp"``, ``"memory"``).
|
|
374
|
+
|
|
375
|
+
Returns:
|
|
376
|
+
A message string that hasn't been used this session (or a random one).
|
|
377
|
+
"""
|
|
378
|
+
candidates = [m for m in _BOOT_MESSAGES if m.startswith(subsystem)]
|
|
379
|
+
if not candidates:
|
|
380
|
+
return f"{subsystem}: initializing…"
|
|
381
|
+
|
|
382
|
+
if subsystem not in _BOOT_MESSAGE_INDEX:
|
|
383
|
+
_BOOT_MESSAGE_INDEX[subsystem] = []
|
|
384
|
+
|
|
385
|
+
used = _BOOT_MESSAGE_INDEX[subsystem]
|
|
386
|
+
available = [c for c in candidates if c not in used]
|
|
387
|
+
|
|
388
|
+
if available:
|
|
389
|
+
choice = random.choice(available)
|
|
390
|
+
else:
|
|
391
|
+
# All used — pick a random one and wrap around
|
|
392
|
+
choice = random.choice(candidates)
|
|
393
|
+
|
|
394
|
+
used.append(choice)
|
|
395
|
+
return choice
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
class BootRail:
|
|
399
|
+
"""An indeterminate progress rail that animates on elapsed time alone.
|
|
400
|
+
|
|
401
|
+
A boot genuinely cannot report a fraction: only ``core_agent`` emits an
|
|
402
|
+
unconditional ``boot_status`` (at the *start* of MCP discovery, which then
|
|
403
|
+
blocks for seconds emitting nothing), while voice, session, sandbox, memory
|
|
404
|
+
and shell are all conditional. So a ``done/total`` ratio has no honest
|
|
405
|
+
inputs — the denominator is usually 1, which pinned the previous rail at a
|
|
406
|
+
constant 0% for the entire boot.
|
|
407
|
+
|
|
408
|
+
This renderable therefore reports *activity*, not *completion*: a span
|
|
409
|
+
sweeps the track, position derived purely from wall-clock elapsed time. It
|
|
410
|
+
animates during any silent phase (e.g. MCP discovery) without a single
|
|
411
|
+
``boot_status`` call, and it never claims a percentage it cannot know.
|
|
412
|
+
|
|
413
|
+
Colour is applied by the caller via style strings, not here, so the bar
|
|
414
|
+
still reads correctly on consoles without truecolor.
|
|
415
|
+
"""
|
|
416
|
+
|
|
417
|
+
#: Number of character cells in the sweeping highlight.
|
|
418
|
+
COMET = 6
|
|
419
|
+
#: Cells of travel per second — fast enough to read as "working".
|
|
420
|
+
SPEED = 14.0
|
|
421
|
+
#: Track length in cells.
|
|
422
|
+
WIDTH = 28
|
|
423
|
+
|
|
424
|
+
def __init__(
|
|
425
|
+
self,
|
|
426
|
+
width: int = WIDTH,
|
|
427
|
+
accent: str = "cyan",
|
|
428
|
+
start: float | None = None,
|
|
429
|
+
) -> None:
|
|
430
|
+
"""Store the track width, highlight colour and the animation epoch."""
|
|
431
|
+
self.width = width
|
|
432
|
+
self.accent = accent
|
|
433
|
+
self._start = time.monotonic() if start is None else start
|
|
434
|
+
|
|
435
|
+
def frame(self, elapsed: float) -> Text:
|
|
436
|
+
"""The rail at *elapsed* seconds, as styled text.
|
|
437
|
+
|
|
438
|
+
Pure in ``elapsed``, so the geometry is testable without a display and
|
|
439
|
+
``__rich_console__`` just feeds it the wall clock.
|
|
440
|
+
"""
|
|
441
|
+
span = self.width + self.COMET
|
|
442
|
+
head = int(max(elapsed, 0.0) * self.SPEED) % span
|
|
443
|
+
track = Text()
|
|
444
|
+
for i in range(self.width):
|
|
445
|
+
if head - self.COMET < i <= head:
|
|
446
|
+
track.append("━", style=self.accent)
|
|
447
|
+
else:
|
|
448
|
+
track.append("─", style="grey30")
|
|
449
|
+
return track
|
|
450
|
+
|
|
451
|
+
def __rich_console__(self, console: Console, options: ConsoleOptions) -> RenderResult:
|
|
452
|
+
"""Yield the current frame.
|
|
453
|
+
|
|
454
|
+
Re-rendered on every ``Live`` refresh tick (~12/s), which is what makes
|
|
455
|
+
the rail keep moving while the boot is silent.
|
|
456
|
+
"""
|
|
457
|
+
yield from console.render(self.frame(time.monotonic() - self._start), options)
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
class BootAnimation:
|
|
461
|
+
"""Animated startup sequence with live spinner and accumulating status lines.
|
|
462
|
+
|
|
463
|
+
Use as a context manager around startup code. Any call to ``boot_status()``
|
|
464
|
+
inside the context is automatically rendered as an animated line with a
|
|
465
|
+
Rich spinner on the current message and checkmarks on completed ones.
|
|
466
|
+
|
|
467
|
+
Usage::
|
|
468
|
+
|
|
469
|
+
with BootAnimation.start():
|
|
470
|
+
boot_status("Nova is launching…")
|
|
471
|
+
time.sleep(2)
|
|
472
|
+
boot_status("mcp: all servers online", "ok")
|
|
473
|
+
boot_status("memory: initializing…")
|
|
474
|
+
time.sleep(1)
|
|
475
|
+
boot_status("memory: store ready", "ok")
|
|
476
|
+
# animation exits — clean transition to splash screen
|
|
477
|
+
"""
|
|
478
|
+
|
|
479
|
+
_instance: "BootAnimation | None" = None
|
|
480
|
+
_live: Live | None = None
|
|
481
|
+
_messages: list[tuple[str, str]] = []
|
|
482
|
+
_start_time: float = 0.0
|
|
483
|
+
|
|
484
|
+
@classmethod
|
|
485
|
+
@contextmanager
|
|
486
|
+
def start(cls) -> None:
|
|
487
|
+
"""Open the live display (sync version). Yields once, then tears down.
|
|
488
|
+
|
|
489
|
+
There is no ``total_steps`` argument: the progress rail derives its
|
|
490
|
+
denominator from the phases actually reported, so it cannot be told a
|
|
491
|
+
number the boot will never reach.
|
|
492
|
+
"""
|
|
493
|
+
cls._messages = []
|
|
494
|
+
cls._start_time = time.monotonic()
|
|
495
|
+
|
|
496
|
+
layout = Table.grid(padding=(0, 1))
|
|
497
|
+
layout.add_column(no_wrap=True)
|
|
498
|
+
|
|
499
|
+
with Live(
|
|
500
|
+
layout,
|
|
501
|
+
console=console,
|
|
502
|
+
refresh_per_second=12,
|
|
503
|
+
transient=True,
|
|
504
|
+
) as live:
|
|
505
|
+
cls._live = live
|
|
506
|
+
cls._instance = cls()
|
|
507
|
+
try:
|
|
508
|
+
yield
|
|
509
|
+
finally:
|
|
510
|
+
cls._instance = None
|
|
511
|
+
cls._live = None
|
|
512
|
+
|
|
513
|
+
@classmethod
|
|
514
|
+
@asynccontextmanager
|
|
515
|
+
async def async_start(cls) -> None:
|
|
516
|
+
"""Open the live display (async version). Yields once, then tears down.
|
|
517
|
+
|
|
518
|
+
Safe to use with ``async with`` in async functions (e.g. ``main()``).
|
|
519
|
+
Rich's ``Live.__enter__`` starts a background rendering thread which
|
|
520
|
+
is compatible with async event loops.
|
|
521
|
+
|
|
522
|
+
Like :meth:`start`, no ``total_steps``: the rail is derived from the
|
|
523
|
+
phases actually reported.
|
|
524
|
+
"""
|
|
525
|
+
cls._messages = []
|
|
526
|
+
cls._start_time = time.monotonic()
|
|
527
|
+
|
|
528
|
+
layout = Table.grid(padding=(0, 1))
|
|
529
|
+
layout.add_column(no_wrap=True)
|
|
530
|
+
|
|
531
|
+
live = Live(layout, console=console, refresh_per_second=12, transient=True)
|
|
532
|
+
live.__enter__()
|
|
533
|
+
cls._live = live
|
|
534
|
+
cls._instance = cls()
|
|
535
|
+
try:
|
|
536
|
+
yield
|
|
537
|
+
finally:
|
|
538
|
+
cls._instance = None
|
|
539
|
+
cls._live = None
|
|
540
|
+
live.__exit__(None, None, None)
|
|
541
|
+
|
|
542
|
+
@classmethod
|
|
543
|
+
def status(cls, message: str, level: str = "info") -> None:
|
|
544
|
+
"""Add or update a status line.
|
|
545
|
+
|
|
546
|
+
``"info"`` level messages are considered "in progress" — the most recent
|
|
547
|
+
one gets a spinner. ``"ok"`` and ``"warn"`` are "completed" and rendered
|
|
548
|
+
with checkmark or warning glyph.
|
|
549
|
+
|
|
550
|
+
Args:
|
|
551
|
+
message: Short ``"subsystem: detail"`` message.
|
|
552
|
+
level: ``"info"`` (in-progress with spinner), ``"ok"`` (green ✓),
|
|
553
|
+
or ``"warn"`` (yellow ⚠).
|
|
554
|
+
"""
|
|
555
|
+
# Replace last pending "info" with the new one (live-update the spinner
|
|
556
|
+
# text), otherwise append as a new line.
|
|
557
|
+
if level == "info":
|
|
558
|
+
if cls._messages and cls._messages[-1][1] == "info":
|
|
559
|
+
cls._messages[-1] = (message, level)
|
|
560
|
+
else:
|
|
561
|
+
cls._messages.append((message, level))
|
|
562
|
+
else:
|
|
563
|
+
cls._messages.append((message, level))
|
|
564
|
+
cls._refresh()
|
|
565
|
+
|
|
566
|
+
@staticmethod
|
|
567
|
+
def _phase(message: str) -> tuple[str, str]:
|
|
568
|
+
"""Split a ``"subsystem: detail"`` status into ``(label, detail)``.
|
|
569
|
+
|
|
570
|
+
The staged boot list reads as two aligned columns, so the label and the
|
|
571
|
+
detail are rendered separately. A message with no colon is all label.
|
|
572
|
+
"""
|
|
573
|
+
label, sep, detail = message.partition(":")
|
|
574
|
+
if not sep:
|
|
575
|
+
return message.strip(), ""
|
|
576
|
+
return label.strip(), detail.strip()
|
|
577
|
+
|
|
578
|
+
@classmethod
|
|
579
|
+
def _refresh(cls) -> None:
|
|
580
|
+
"""Rebuild and update the live staged boot display.
|
|
581
|
+
|
|
582
|
+
Three changes from the old splash, each fixing something real:
|
|
583
|
+
|
|
584
|
+
* **The rail no longer lies.** It is indeterminate: a span sweeps a
|
|
585
|
+
track on elapsed time, because the boot reports no usable fraction
|
|
586
|
+
(see :class:`BootRail`). An earlier attempt derived ``done/total``
|
|
587
|
+
from the phases observed, which pinned the bar at 0% for an entire
|
|
588
|
+
real boot — the denominator is 1 whenever nothing has completed yet.
|
|
589
|
+
* **One art source.** The header is ``brand.compact_mark()``; the old
|
|
590
|
+
splash inlined a 12-line braille blob spliced to a second ANSI
|
|
591
|
+
wordmark, with rows ranging from 29 to 77 columns wide.
|
|
592
|
+
* **Theme accent.** Colours come from ``brand.get_accent_hex()``, so the
|
|
593
|
+
boot screen is tinted for the theme the TUI is about to open with --
|
|
594
|
+
previously it was hardcoded red and the app opened blue.
|
|
595
|
+
"""
|
|
596
|
+
if not cls._live:
|
|
597
|
+
return
|
|
598
|
+
|
|
599
|
+
elapsed = time.monotonic() - cls._start_time
|
|
600
|
+
accent = get_accent_hex()
|
|
601
|
+
layout = Table.grid(padding=(0, 1))
|
|
602
|
+
layout.add_column(no_wrap=True)
|
|
603
|
+
|
|
604
|
+
# ── Header: the compact mark (see brand.py) ──
|
|
605
|
+
header = Text()
|
|
606
|
+
header.append(" ")
|
|
607
|
+
header.append(compact_mark(), style=f"bold {accent}")
|
|
608
|
+
layout.add_row(header)
|
|
609
|
+
|
|
610
|
+
caption = Text(" ", style="grey30")
|
|
611
|
+
caption.append(f"{TAGLINE} · v{settings.version}", style="grey30")
|
|
612
|
+
layout.add_row(caption)
|
|
613
|
+
layout.add_row(Text(""))
|
|
614
|
+
|
|
615
|
+
# ── Staged checklist: one aligned row per phase ──
|
|
616
|
+
# The last entry is split off only when it is still in progress; a
|
|
617
|
+
# finished boot therefore shows every phase with its checkmark and no
|
|
618
|
+
# lingering spinner (a spinner on a completed phase reads as "still
|
|
619
|
+
# working" right up until the screen vanishes).
|
|
620
|
+
label_w = max((len(cls._phase(m)[0]) for m, _ in cls._messages), default=0)
|
|
621
|
+
glyphs = {"ok": ("✓", "green"), "warn": ("⚠", "yellow")}
|
|
622
|
+
active = cls._messages[-1] if cls._messages and cls._messages[-1][1] == "info" else None
|
|
623
|
+
done_msgs = cls._messages[:-1] if active else cls._messages
|
|
624
|
+
for msg, lvl in done_msgs:
|
|
625
|
+
label, detail = cls._phase(msg)
|
|
626
|
+
glyph, style = glyphs.get(lvl, ("·", "grey42"))
|
|
627
|
+
row = Text()
|
|
628
|
+
row.append(f" {glyph} ", style=style)
|
|
629
|
+
row.append(label.ljust(label_w), style=f"bold {accent}")
|
|
630
|
+
if detail:
|
|
631
|
+
row.append(f" {detail}", style="default")
|
|
632
|
+
layout.add_row(row)
|
|
633
|
+
|
|
634
|
+
# ── Active phase, with a live spinner ──
|
|
635
|
+
if active:
|
|
636
|
+
label, detail = cls._phase(active[0])
|
|
637
|
+
text = f"{label.ljust(label_w)} {detail}".rstrip()
|
|
638
|
+
layout.add_row(Spinner("dots2", text=f" {text}", style=f"bold {accent}"))
|
|
639
|
+
|
|
640
|
+
# ── Honest progress rail ──
|
|
641
|
+
# Deliberately NOT a percentage. Only ``core_agent`` emits an
|
|
642
|
+
# unconditional status (at the start of MCP discovery); every other
|
|
643
|
+
# subsystem is conditional, so ``done/total`` was nearly always 0/1 and
|
|
644
|
+
# the old rail sat pinned at 0% for the whole boot. A sweeping rail
|
|
645
|
+
# reports activity, which is the one thing that is always true.
|
|
646
|
+
rail_row = Text(" ")
|
|
647
|
+
rail_row.append_text(cls._rail(accent))
|
|
648
|
+
rail_row.append(f" {elapsed:.1f}s", style="grey30")
|
|
649
|
+
layout.add_row(rail_row)
|
|
650
|
+
cls._live.update(layout)
|
|
651
|
+
|
|
652
|
+
@classmethod
|
|
653
|
+
def _rail(cls, accent: str) -> Text:
|
|
654
|
+
"""The rail for the current instant; shared by ``_refresh`` and tests."""
|
|
655
|
+
return BootRail(accent=accent, start=cls._start_time).frame(
|
|
656
|
+
time.monotonic() - cls._start_time
|
|
657
|
+
)
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
def boot_status(message: str, level: str = "info") -> None:
|
|
661
|
+
"""Print a uniform, minimal startup status line.
|
|
662
|
+
|
|
663
|
+
When inside a ``BootAnimation`` context, the message is rendered with a
|
|
664
|
+
live spinner animation instead of a static line. Outside the context,
|
|
665
|
+
falls back to a simple dimmed status line.
|
|
666
|
+
|
|
667
|
+
Keeps Nova's launch output tidy: one muted glyph per line, a consistent
|
|
668
|
+
palette, and short ``subsystem: detail`` messages instead of a mix of
|
|
669
|
+
colors and emoji.
|
|
670
|
+
|
|
671
|
+
Args:
|
|
672
|
+
message: Short status, ideally ``"subsystem: detail"`` (e.g.
|
|
673
|
+
``"sandbox: docker 3b7334a ready"``).
|
|
674
|
+
level: ``"info"`` (dim), ``"ok"`` (green), or ``"warn"`` (yellow).
|
|
675
|
+
"""
|
|
676
|
+
# Delegate to BootAnimation when active — renders with live spinner
|
|
677
|
+
if BootAnimation._instance is not None:
|
|
678
|
+
BootAnimation.status(message, level)
|
|
679
|
+
return
|
|
680
|
+
|
|
681
|
+
# Outside animation context: static line
|
|
682
|
+
from rich.text import Text
|
|
683
|
+
|
|
684
|
+
glyph, style = {
|
|
685
|
+
"info": ("·", "grey50"),
|
|
686
|
+
"ok": ("✓", "green"),
|
|
687
|
+
"warn": ("⚠", "yellow"),
|
|
688
|
+
}.get(level, ("·", "grey50"))
|
|
689
|
+
console.print(Text(f" {glyph} {message}", style=style))
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
def find_project_skills(project_root: Path) -> list[Path]:
|
|
693
|
+
"""Find project-specific skills directories.
|
|
694
|
+
|
|
695
|
+
Checks .agents/, .claude/, and .nova/ skills directories.
|
|
696
|
+
Checks current directories so additions and removals take effect immediately.
|
|
697
|
+
|
|
698
|
+
Args:
|
|
699
|
+
project_root: Path to the project root directory.
|
|
700
|
+
|
|
701
|
+
Returns:
|
|
702
|
+
List of skills directory paths that exist.
|
|
703
|
+
"""
|
|
704
|
+
skills_dirs = []
|
|
705
|
+
|
|
706
|
+
# The official Skills CLI stores shared project skills here.
|
|
707
|
+
shared_skills = project_root / ".agents" / "skills"
|
|
708
|
+
if shared_skills.is_dir():
|
|
709
|
+
skills_dirs.append(shared_skills)
|
|
710
|
+
|
|
711
|
+
# Check .claude/skills/
|
|
712
|
+
claude_skills = project_root / ".claude" / "skills"
|
|
713
|
+
if claude_skills.exists() and claude_skills.is_dir():
|
|
714
|
+
skills_dirs.append(claude_skills)
|
|
715
|
+
|
|
716
|
+
# Check .nova/skills/
|
|
717
|
+
deepagents_skills = project_root / ".nova" / "skills"
|
|
718
|
+
if deepagents_skills.exists() and deepagents_skills.is_dir():
|
|
719
|
+
skills_dirs.append(deepagents_skills)
|
|
720
|
+
|
|
721
|
+
return skills_dirs
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
def _find_project_root(start_path: Path | None = None) -> Path | None:
|
|
725
|
+
"""Find the project root by looking for .git directory.
|
|
726
|
+
|
|
727
|
+
Walks up the directory tree from start_path (or cwd) looking for a .git
|
|
728
|
+
directory, which indicates the project root.
|
|
729
|
+
|
|
730
|
+
Args:
|
|
731
|
+
start_path: Directory to start searching from. Defaults to current working directory.
|
|
732
|
+
|
|
733
|
+
Returns:
|
|
734
|
+
Path to the project root if found, None otherwise.
|
|
735
|
+
"""
|
|
736
|
+
current = Path(start_path or Path.cwd()).resolve()
|
|
737
|
+
|
|
738
|
+
# Walk up the directory tree
|
|
739
|
+
for parent in [current, *list(current.parents)]:
|
|
740
|
+
git_dir = parent / ".git"
|
|
741
|
+
if git_dir.exists():
|
|
742
|
+
return parent
|
|
743
|
+
|
|
744
|
+
return None
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
def _find_project_agent_md(project_root: Path) -> list[Path]:
|
|
748
|
+
"""Find all project instruction files, including Codex's AGENTS.md.
|
|
749
|
+
|
|
750
|
+
Returns every memory file that exists, ordered from most general to most
|
|
751
|
+
specific. All found files are combined so later entries take higher
|
|
752
|
+
precedence.
|
|
753
|
+
|
|
754
|
+
Load order (general → specific):
|
|
755
|
+
1. project_root/NOVA.md (NOVA root — created by /init)
|
|
756
|
+
2. project_root/.nova/NOVA.md (NOVA directory)
|
|
757
|
+
3. project_root/CLAUDE.md (Claude Code root)
|
|
758
|
+
4. project_root/.claude/CLAUDE.md (Claude Code directory)
|
|
759
|
+
5. project_root/AGENTS.md (Codex-compatible project instructions)
|
|
760
|
+
|
|
761
|
+
Args:
|
|
762
|
+
project_root: Path to the project root directory.
|
|
763
|
+
|
|
764
|
+
Returns:
|
|
765
|
+
List of existing paths (may be empty if no memory files found).
|
|
766
|
+
"""
|
|
767
|
+
candidates = [
|
|
768
|
+
project_root / "NOVA.md",
|
|
769
|
+
project_root / ".nova" / "NOVA.md",
|
|
770
|
+
project_root / "CLAUDE.md",
|
|
771
|
+
project_root / ".claude" / "CLAUDE.md",
|
|
772
|
+
project_root / "AGENTS.md",
|
|
773
|
+
]
|
|
774
|
+
return [p for p in candidates if p.exists()]
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
def get_default_coding_instructions() -> str:
|
|
778
|
+
"""Get the default coding agent instructions.
|
|
779
|
+
|
|
780
|
+
These are the immutable base instructions that cannot be modified by the agent.
|
|
781
|
+
Long-term memory (agent.md) is handled separately by the middleware.
|
|
782
|
+
"""
|
|
783
|
+
from novacode_cli.prompts import render_template
|
|
784
|
+
|
|
785
|
+
from novacode_cli.agents.default_subagents.async_subagents import (
|
|
786
|
+
async_agents_usable,
|
|
787
|
+
)
|
|
788
|
+
|
|
789
|
+
return render_template(
|
|
790
|
+
"System_Prompt_Nova.jinja",
|
|
791
|
+
has_tavily=settings.has_tavily,
|
|
792
|
+
# The async subagents exist only while their LangGraph container runs.
|
|
793
|
+
# Describing tools that are not bound wastes context and invites the
|
|
794
|
+
# model to call something that isn't there.
|
|
795
|
+
has_async_agents=async_agents_usable(),
|
|
796
|
+
)
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
@dataclass(repr=False)
|
|
800
|
+
class Settings:
|
|
801
|
+
"""Global settings and environment detection for deepagents-cli.
|
|
802
|
+
|
|
803
|
+
This class is initialized once at startup and provides access to:
|
|
804
|
+
- Available models and API keys
|
|
805
|
+
- Current project information
|
|
806
|
+
- Tool availability (e.g., Tavily)
|
|
807
|
+
- File system paths
|
|
808
|
+
|
|
809
|
+
Attributes:
|
|
810
|
+
project_root: Current project root directory (if in a git project)
|
|
811
|
+
|
|
812
|
+
openai_api_key: OpenAI API key if available
|
|
813
|
+
anthropic_api_key: Anthropic API key if available
|
|
814
|
+
tavily_api_key: Tavily API key if available
|
|
815
|
+
"""
|
|
816
|
+
|
|
817
|
+
# API keys
|
|
818
|
+
openai_api_key: str | None
|
|
819
|
+
anthropic_api_key: str | None
|
|
820
|
+
google_api_key: str | None
|
|
821
|
+
openrouter_api_key: str | None
|
|
822
|
+
opencode_api_key: str | None
|
|
823
|
+
nvidia_api_key: str | None
|
|
824
|
+
tavily_api_key: str | None
|
|
825
|
+
langsmith_api_key: str | None
|
|
826
|
+
|
|
827
|
+
# Ollama configuration
|
|
828
|
+
ollama_host: str | None
|
|
829
|
+
|
|
830
|
+
# Project information
|
|
831
|
+
project_root: Path | None
|
|
832
|
+
|
|
833
|
+
# LangSmith configuration
|
|
834
|
+
langsmith_project: str = "Nova-Code"
|
|
835
|
+
langsmith_workspace_id: str | None = None
|
|
836
|
+
langsmith_tracing_enabled: bool = False
|
|
837
|
+
|
|
838
|
+
version: str = __version__
|
|
839
|
+
opencode_zen_api_key: str | None = None
|
|
840
|
+
commandcode_api_key: str | None = None
|
|
841
|
+
|
|
842
|
+
def __repr__(self) -> str:
|
|
843
|
+
"""The settings, with every credential masked.
|
|
844
|
+
|
|
845
|
+
The dataclass default printed each key in full, and a Textual crash
|
|
846
|
+
screen prints local variables: any traceback that had ``settings`` in
|
|
847
|
+
scope put the user's API keys on screen, ready to be pasted into a bug
|
|
848
|
+
report. A key now shows only whether it is set.
|
|
849
|
+
"""
|
|
850
|
+
from dataclasses import fields
|
|
851
|
+
|
|
852
|
+
parts = []
|
|
853
|
+
for f in fields(self):
|
|
854
|
+
value = getattr(self, f.name)
|
|
855
|
+
if f.name.endswith(("_api_key", "_token", "_secret")):
|
|
856
|
+
value = "<set>" if value else None
|
|
857
|
+
parts.append(f"{f.name}={value!r}")
|
|
858
|
+
return f"Settings({', '.join(parts)})"
|
|
859
|
+
|
|
860
|
+
@classmethod
|
|
861
|
+
def from_environment(cls, *, start_path: Path | None = None) -> "Settings":
|
|
862
|
+
"""Create settings by detecting the current environment.
|
|
863
|
+
|
|
864
|
+
Priority order for API keys:
|
|
865
|
+
1. OS keychain (via SecretManager)
|
|
866
|
+
2. Environment variables
|
|
867
|
+
3. None (not configured)
|
|
868
|
+
|
|
869
|
+
Args:
|
|
870
|
+
start_path: Directory to start project detection from (defaults to cwd)
|
|
871
|
+
|
|
872
|
+
Returns:
|
|
873
|
+
Settings instance with detected configuration
|
|
874
|
+
"""
|
|
875
|
+
# Import SecretManager here to avoid circular imports
|
|
876
|
+
# (SecretManager imports from config, config imports SecretManager)
|
|
877
|
+
try:
|
|
878
|
+
from novacode_cli.onboarding import SecretManager
|
|
879
|
+
|
|
880
|
+
secret_manager = SecretManager()
|
|
881
|
+
except ImportError:
|
|
882
|
+
# If onboarding module not available yet, skip keyring
|
|
883
|
+
secret_manager = None
|
|
884
|
+
|
|
885
|
+
# Detect API keys - check keyring first, then environment variables
|
|
886
|
+
if secret_manager:
|
|
887
|
+
openai_key = secret_manager.get_secret("openai_api_key") or os.environ.get(
|
|
888
|
+
"OPENAI_API_KEY"
|
|
889
|
+
)
|
|
890
|
+
anthropic_key = secret_manager.get_secret(
|
|
891
|
+
"anthropic_api_key"
|
|
892
|
+
) or os.environ.get("ANTHROPIC_API_KEY")
|
|
893
|
+
google_key = secret_manager.get_secret("google_api_key") or os.environ.get(
|
|
894
|
+
"GOOGLE_API_KEY"
|
|
895
|
+
)
|
|
896
|
+
openrouter_key = secret_manager.get_secret(
|
|
897
|
+
"openrouter_api_key"
|
|
898
|
+
) or os.environ.get("OPENROUTER_API_KEY")
|
|
899
|
+
opencode_key = secret_manager.get_secret(
|
|
900
|
+
"opencode_api_key"
|
|
901
|
+
) or os.environ.get("OPENCODE_API_KEY")
|
|
902
|
+
nvidia_key = secret_manager.get_secret(
|
|
903
|
+
"nvidia_api_key"
|
|
904
|
+
) or os.environ.get("NVIDIA_API_KEY")
|
|
905
|
+
tavily_key = secret_manager.get_secret("tavily_api_key") or os.environ.get(
|
|
906
|
+
"TAVILY_API_KEY"
|
|
907
|
+
)
|
|
908
|
+
else:
|
|
909
|
+
openai_key = os.environ.get("OPENAI_API_KEY")
|
|
910
|
+
anthropic_key = os.environ.get("ANTHROPIC_API_KEY")
|
|
911
|
+
google_key = os.environ.get("GOOGLE_API_KEY")
|
|
912
|
+
openrouter_key = os.environ.get("OPENROUTER_API_KEY")
|
|
913
|
+
opencode_key = os.environ.get("OPENCODE_API_KEY")
|
|
914
|
+
nvidia_key = os.environ.get("NVIDIA_API_KEY")
|
|
915
|
+
tavily_key = os.environ.get("TAVILY_API_KEY")
|
|
916
|
+
|
|
917
|
+
langsmith_key = os.environ.get("LANGSMITH_API_KEY")
|
|
918
|
+
opencode_zen_key = (
|
|
919
|
+
secret_manager.get_secret("opencode_zen_api_key") if secret_manager else None
|
|
920
|
+
) or os.environ.get("OPENCODE_ZEN_API_KEY")
|
|
921
|
+
# CMD_API_KEY is the name Command Code's own docs use.
|
|
922
|
+
commandcode_key = (
|
|
923
|
+
secret_manager.get_secret("commandcode_api_key") if secret_manager else None
|
|
924
|
+
) or os.environ.get("COMMANDCODE_API_KEY") or os.environ.get("CMD_API_KEY")
|
|
925
|
+
|
|
926
|
+
# Detect Ollama host configuration
|
|
927
|
+
ollama_host = os.environ.get("OLLAMA_HOST")
|
|
928
|
+
|
|
929
|
+
# Detect project
|
|
930
|
+
project_root = _find_project_root(start_path)
|
|
931
|
+
|
|
932
|
+
# LangSmith configuration
|
|
933
|
+
langsmith_enabled = os.environ.get("LANGSMITH_TRACING", "").lower() == "true"
|
|
934
|
+
langsmith_project = os.environ.get("LANGSMITH_PROJECT", "Nova-Code")
|
|
935
|
+
langsmith_workspace = os.environ.get("LANGSMITH_WORKSPACE_ID")
|
|
936
|
+
|
|
937
|
+
return cls(
|
|
938
|
+
openai_api_key=openai_key,
|
|
939
|
+
anthropic_api_key=anthropic_key,
|
|
940
|
+
google_api_key=google_key,
|
|
941
|
+
openrouter_api_key=openrouter_key,
|
|
942
|
+
opencode_api_key=opencode_key,
|
|
943
|
+
opencode_zen_api_key=opencode_zen_key,
|
|
944
|
+
commandcode_api_key=commandcode_key,
|
|
945
|
+
nvidia_api_key=nvidia_key,
|
|
946
|
+
tavily_api_key=tavily_key,
|
|
947
|
+
langsmith_api_key=langsmith_key,
|
|
948
|
+
ollama_host=ollama_host,
|
|
949
|
+
project_root=project_root,
|
|
950
|
+
langsmith_project=langsmith_project,
|
|
951
|
+
langsmith_workspace_id=langsmith_workspace,
|
|
952
|
+
langsmith_tracing_enabled=langsmith_enabled,
|
|
953
|
+
)
|
|
954
|
+
|
|
955
|
+
@property
|
|
956
|
+
def has_openai(self) -> bool:
|
|
957
|
+
"""Check if OpenAI API key is configured."""
|
|
958
|
+
return self.openai_api_key is not None
|
|
959
|
+
|
|
960
|
+
@property
|
|
961
|
+
def has_anthropic(self) -> bool:
|
|
962
|
+
"""Check if Anthropic API key is configured."""
|
|
963
|
+
return self.anthropic_api_key is not None
|
|
964
|
+
|
|
965
|
+
@property
|
|
966
|
+
def has_google(self) -> bool:
|
|
967
|
+
"""Check if Google API key is configured."""
|
|
968
|
+
return self.google_api_key is not None
|
|
969
|
+
|
|
970
|
+
@property
|
|
971
|
+
def has_openrouter(self) -> bool:
|
|
972
|
+
"""Check if OpenRouter API key is configured."""
|
|
973
|
+
return self.openrouter_api_key is not None
|
|
974
|
+
|
|
975
|
+
@property
|
|
976
|
+
def has_opencode(self) -> bool:
|
|
977
|
+
"""Check if OpenCode Go API key is configured."""
|
|
978
|
+
return self.opencode_api_key is not None
|
|
979
|
+
|
|
980
|
+
@property
|
|
981
|
+
def has_nvidia(self) -> bool:
|
|
982
|
+
"""Check if an NVIDIA NIM API key is configured."""
|
|
983
|
+
return self.nvidia_api_key is not None
|
|
984
|
+
|
|
985
|
+
@property
|
|
986
|
+
def has_opencode_zen(self) -> bool:
|
|
987
|
+
return bool(self.opencode_zen_api_key)
|
|
988
|
+
|
|
989
|
+
@property
|
|
990
|
+
def has_commandcode(self) -> bool:
|
|
991
|
+
"""Check if a Command Code API key is configured."""
|
|
992
|
+
return bool(self.commandcode_api_key)
|
|
993
|
+
|
|
994
|
+
@property
|
|
995
|
+
def has_tavily(self) -> bool:
|
|
996
|
+
"""Check if Tavily API key is configured."""
|
|
997
|
+
return self.tavily_api_key is not None
|
|
998
|
+
|
|
999
|
+
@property
|
|
1000
|
+
def has_langsmith(self) -> bool:
|
|
1001
|
+
"""Check if LangSmith is configured and enabled."""
|
|
1002
|
+
return self.langsmith_api_key is not None and self.langsmith_tracing_enabled
|
|
1003
|
+
|
|
1004
|
+
@property
|
|
1005
|
+
def has_project(self) -> bool:
|
|
1006
|
+
"""Check if currently in a git project."""
|
|
1007
|
+
return self.project_root is not None
|
|
1008
|
+
|
|
1009
|
+
def get_workspace_root(self) -> Path:
|
|
1010
|
+
"""The project directory — THE root every part of Nova works in.
|
|
1011
|
+
|
|
1012
|
+
The git repository root whenever Nova is launched anywhere inside one,
|
|
1013
|
+
otherwise the (resolved) launch directory.
|
|
1014
|
+
|
|
1015
|
+
This used to return the launch directory when it was a subfolder of the
|
|
1016
|
+
repo, which split Nova in two: NOVA.md and the system prompt described
|
|
1017
|
+
the whole repository while the file tools could only reach the
|
|
1018
|
+
subfolder, so ``write_file("/tests/test_x.py")`` landed in
|
|
1019
|
+
``<subfolder>/tests/``. Launching from the repo root and from a
|
|
1020
|
+
subfolder now mean the same project, as they do in Claude Code.
|
|
1021
|
+
|
|
1022
|
+
Always returns a resolved path, so callers can compare roots directly;
|
|
1023
|
+
comparing an unresolved cwd to a resolved root broke on ``subst``
|
|
1024
|
+
drives and junctions.
|
|
1025
|
+
"""
|
|
1026
|
+
if self.project_root:
|
|
1027
|
+
return Path(self.project_root)
|
|
1028
|
+
return Path.cwd().resolve()
|
|
1029
|
+
|
|
1030
|
+
@property
|
|
1031
|
+
def has_graph(self) -> bool:
|
|
1032
|
+
"""Check if a project graph is available (built by /init).
|
|
1033
|
+
|
|
1034
|
+
Returns:
|
|
1035
|
+
True if `.nova/project-graph.json` exists under the project root.
|
|
1036
|
+
"""
|
|
1037
|
+
if not self.project_root:
|
|
1038
|
+
return False
|
|
1039
|
+
return (self.project_root / ".nova" / "project-graph.json").exists()
|
|
1040
|
+
|
|
1041
|
+
def get_onboarding_status(self) -> bool:
|
|
1042
|
+
"""Check if onboarding has been completed.
|
|
1043
|
+
|
|
1044
|
+
Returns:
|
|
1045
|
+
True if onboarding completed, False otherwise
|
|
1046
|
+
"""
|
|
1047
|
+
config_file = HOME_DIR / "config.json"
|
|
1048
|
+
onboarded_marker = HOME_DIR / ".onboarded"
|
|
1049
|
+
|
|
1050
|
+
# Check if either marker exists
|
|
1051
|
+
if onboarded_marker.exists():
|
|
1052
|
+
return True
|
|
1053
|
+
|
|
1054
|
+
# Check config.json for onboarding_completed flag
|
|
1055
|
+
if config_file.exists():
|
|
1056
|
+
try:
|
|
1057
|
+
import json
|
|
1058
|
+
|
|
1059
|
+
config = json.loads(config_file.read_text(encoding="utf-8"))
|
|
1060
|
+
return config.get("onboarding_completed", False)
|
|
1061
|
+
except Exception: # noqa: BLE001
|
|
1062
|
+
return False
|
|
1063
|
+
|
|
1064
|
+
return False
|
|
1065
|
+
|
|
1066
|
+
def mark_onboarding_complete(self) -> None:
|
|
1067
|
+
"""Mark onboarding as completed.
|
|
1068
|
+
|
|
1069
|
+
Creates completion markers in config.json and .onboarded file.
|
|
1070
|
+
"""
|
|
1071
|
+
import json
|
|
1072
|
+
|
|
1073
|
+
config_file = HOME_DIR / "config.json"
|
|
1074
|
+
onboarded_marker = HOME_DIR / ".onboarded"
|
|
1075
|
+
|
|
1076
|
+
# Update config.json
|
|
1077
|
+
config = {}
|
|
1078
|
+
if config_file.exists():
|
|
1079
|
+
try:
|
|
1080
|
+
config = json.loads(config_file.read_text(encoding="utf-8"))
|
|
1081
|
+
except Exception: # noqa: BLE001, S110
|
|
1082
|
+
pass
|
|
1083
|
+
|
|
1084
|
+
config["onboarding_completed"] = True
|
|
1085
|
+
config_file.parent.mkdir(parents=True, exist_ok=True)
|
|
1086
|
+
config_file.write_text(json.dumps(config, indent=2), encoding="utf-8")
|
|
1087
|
+
|
|
1088
|
+
# Create marker file
|
|
1089
|
+
onboarded_marker.touch()
|
|
1090
|
+
|
|
1091
|
+
@property
|
|
1092
|
+
def user_deepagents_dir(self) -> Path:
|
|
1093
|
+
"""Get the base user-level .nova directory.
|
|
1094
|
+
|
|
1095
|
+
Returns:
|
|
1096
|
+
Path to ~/.nova
|
|
1097
|
+
"""
|
|
1098
|
+
return HOME_DIR
|
|
1099
|
+
|
|
1100
|
+
@property
|
|
1101
|
+
def nova_dir(self) -> Path:
|
|
1102
|
+
"""Base user-level .nova directory (~/.nova).
|
|
1103
|
+
|
|
1104
|
+
Alias of :attr:`user_deepagents_dir`; used for paths like checkpoints
|
|
1105
|
+
and other per-user state under ~/.nova.
|
|
1106
|
+
"""
|
|
1107
|
+
return HOME_DIR
|
|
1108
|
+
|
|
1109
|
+
def get_agents_root_dir(self) -> Path:
|
|
1110
|
+
"""Get the global agents root directory.
|
|
1111
|
+
|
|
1112
|
+
Returns:
|
|
1113
|
+
Path to ~/.nova/agents/
|
|
1114
|
+
"""
|
|
1115
|
+
return self.user_deepagents_dir / "agents"
|
|
1116
|
+
|
|
1117
|
+
def get_project_agents_dir(self) -> Path | None:
|
|
1118
|
+
"""Get project-level agents directory path.
|
|
1119
|
+
|
|
1120
|
+
Returns:
|
|
1121
|
+
Path to {project_root}/.nova/agents/, or None if not in a project
|
|
1122
|
+
"""
|
|
1123
|
+
if not self.project_root:
|
|
1124
|
+
return None
|
|
1125
|
+
return self.project_root / ".nova" / "agents"
|
|
1126
|
+
|
|
1127
|
+
def ensure_project_agents_dir(self) -> Path | None:
|
|
1128
|
+
"""Ensure project-level agents directory exists and return its path.
|
|
1129
|
+
|
|
1130
|
+
Returns:
|
|
1131
|
+
Path to {project_root}/.nova/agents/, or None if not in a project
|
|
1132
|
+
"""
|
|
1133
|
+
if not self.project_root:
|
|
1134
|
+
return None
|
|
1135
|
+
agents_dir = self.get_project_agents_dir()
|
|
1136
|
+
if agents_dir:
|
|
1137
|
+
agents_dir.mkdir(parents=True, exist_ok=True)
|
|
1138
|
+
return agents_dir
|
|
1139
|
+
|
|
1140
|
+
def get_all_agents(self) -> list[tuple[str, Path, str]]:
|
|
1141
|
+
"""Get all available agents from both project and global scopes.
|
|
1142
|
+
|
|
1143
|
+
Returns:
|
|
1144
|
+
List of (agent_name, agent_path, scope) tuples, project agents first.
|
|
1145
|
+
agent_path is a ``<name>/`` folder or a flat ``<name>.md``; scope is
|
|
1146
|
+
either "global" or "project".
|
|
1147
|
+
"""
|
|
1148
|
+
agents: list[tuple[str, Path, str]] = []
|
|
1149
|
+
# Project ({project_root}/.nova/agents/) before global (~/.nova/agents/):
|
|
1150
|
+
# consumers keep the first of a name, so a project agent overrides its
|
|
1151
|
+
# global namesake, as find_agent already resolves it.
|
|
1152
|
+
for root, scope in (
|
|
1153
|
+
(self.get_project_agents_dir(), "project"),
|
|
1154
|
+
(self.get_agents_root_dir(), "global"),
|
|
1155
|
+
):
|
|
1156
|
+
if not root or not root.exists():
|
|
1157
|
+
continue
|
|
1158
|
+
found: dict[str, Path] = {}
|
|
1159
|
+
for entry in sorted(root.iterdir()):
|
|
1160
|
+
if entry.is_dir() and (entry / "agent.md").exists():
|
|
1161
|
+
found[entry.name] = entry
|
|
1162
|
+
# Claude Code's flat form, <name>.md; a <name>/ directory wins.
|
|
1163
|
+
for entry in sorted(root.glob("*.md")):
|
|
1164
|
+
found.setdefault(entry.stem, entry)
|
|
1165
|
+
# MAIN_AGENT_ID is reserved — not a user-created named agent.
|
|
1166
|
+
agents += [(n, p, scope) for n, p in found.items() if n != MAIN_AGENT_ID]
|
|
1167
|
+
|
|
1168
|
+
return agents
|
|
1169
|
+
|
|
1170
|
+
def find_agent(self, agent_name: str) -> tuple[Path, str] | None:
|
|
1171
|
+
"""Find an agent by name, checking project scope first then global.
|
|
1172
|
+
|
|
1173
|
+
Project-specific agents take precedence over global agents with the same name.
|
|
1174
|
+
|
|
1175
|
+
Args:
|
|
1176
|
+
agent_name: Name of the agent to find
|
|
1177
|
+
|
|
1178
|
+
Returns:
|
|
1179
|
+
Tuple of (agent_dir_path, scope) if found, None otherwise
|
|
1180
|
+
"""
|
|
1181
|
+
# Project agents first (higher priority); <name>/agent.md before <name>.md.
|
|
1182
|
+
for root, scope in ((self.get_project_agents_dir(), "project"),
|
|
1183
|
+
(self.get_agents_root_dir(), "global")):
|
|
1184
|
+
if not root:
|
|
1185
|
+
continue
|
|
1186
|
+
for path in (root / agent_name, root / f"{agent_name}.md"):
|
|
1187
|
+
if agent_md(path).is_file():
|
|
1188
|
+
return (path, scope)
|
|
1189
|
+
|
|
1190
|
+
return None
|
|
1191
|
+
|
|
1192
|
+
def get_global_skills_dir(self) -> Path:
|
|
1193
|
+
"""Get the global skills directory (shared across all agents).
|
|
1194
|
+
|
|
1195
|
+
Returns:
|
|
1196
|
+
Path to ~/.nova/skills/
|
|
1197
|
+
"""
|
|
1198
|
+
return self.user_deepagents_dir / "skills"
|
|
1199
|
+
|
|
1200
|
+
def get_user_agent_md_path(self, agent_name: str) -> Path:
|
|
1201
|
+
"""Get user-level agent.md path for a specific agent.
|
|
1202
|
+
|
|
1203
|
+
Returns path regardless of whether the file exists.
|
|
1204
|
+
|
|
1205
|
+
Args:
|
|
1206
|
+
agent_name: Name of the agent
|
|
1207
|
+
|
|
1208
|
+
Returns:
|
|
1209
|
+
Path to ~/.nova/agents/{agent_name}/agent.md
|
|
1210
|
+
"""
|
|
1211
|
+
return self.get_agents_root_dir() / agent_name / "agent.md"
|
|
1212
|
+
|
|
1213
|
+
def get_project_agent_md_path(self) -> Path | None:
|
|
1214
|
+
"""Get project-level agent.md path (legacy single-file method).
|
|
1215
|
+
|
|
1216
|
+
DEPRECATED: Use get_project_agent_md_paths() for full multi-file support.
|
|
1217
|
+
|
|
1218
|
+
Returns path regardless of whether the file exists.
|
|
1219
|
+
|
|
1220
|
+
Returns:
|
|
1221
|
+
Path to {project_root}/.nova/NOVA.md, or None if not in a project
|
|
1222
|
+
"""
|
|
1223
|
+
if not self.project_root:
|
|
1224
|
+
return None
|
|
1225
|
+
return self.project_root / ".nova" / "NOVA.md"
|
|
1226
|
+
|
|
1227
|
+
def get_project_agent_md_paths(self) -> list[Path]:
|
|
1228
|
+
"""Get all project-level instruction file paths (AGENTS/CLAUDE/NOVA.md).
|
|
1229
|
+
|
|
1230
|
+
Returns every memory file that exists at the project root, ordered from
|
|
1231
|
+
most general to most specific — matching Claude Code's hierarchical
|
|
1232
|
+
loading behavior where all found files are combined.
|
|
1233
|
+
|
|
1234
|
+
Returns:
|
|
1235
|
+
List of existing paths (empty if not in a project or no files found).
|
|
1236
|
+
"""
|
|
1237
|
+
if not self.project_root:
|
|
1238
|
+
return []
|
|
1239
|
+
return _find_project_agent_md(self.project_root)
|
|
1240
|
+
|
|
1241
|
+
@staticmethod
|
|
1242
|
+
def _is_valid_agent_name(agent_name: str) -> bool:
|
|
1243
|
+
"""Validate prevent invalid filesystem paths and security issues."""
|
|
1244
|
+
if not agent_name or not agent_name.strip():
|
|
1245
|
+
return False
|
|
1246
|
+
# Allow only alphanumeric, hyphens, underscores, and whitespace
|
|
1247
|
+
return bool(re.match(r"^[a-zA-Z0-9_\-\s]+$", agent_name))
|
|
1248
|
+
|
|
1249
|
+
def get_agent_dir(self, agent_name: str) -> Path:
|
|
1250
|
+
"""Get the global agent directory path.
|
|
1251
|
+
|
|
1252
|
+
Args:
|
|
1253
|
+
agent_name: Name of the agent
|
|
1254
|
+
|
|
1255
|
+
Returns:
|
|
1256
|
+
Path to ~/.nova/agents/{agent_name}
|
|
1257
|
+
"""
|
|
1258
|
+
if not self._is_valid_agent_name(agent_name):
|
|
1259
|
+
msg = (
|
|
1260
|
+
f"Invalid agent name: {agent_name!r}. "
|
|
1261
|
+
"Agent names can only contain letters, numbers, hyphens, underscores, and spaces."
|
|
1262
|
+
)
|
|
1263
|
+
raise ValueError(msg)
|
|
1264
|
+
return self.get_agents_root_dir() / agent_name
|
|
1265
|
+
|
|
1266
|
+
def ensure_agent_dir(self, agent_name: str) -> Path:
|
|
1267
|
+
"""Ensure the global agent directory exists and return its path.
|
|
1268
|
+
|
|
1269
|
+
Args:
|
|
1270
|
+
agent_name: Name of the agent
|
|
1271
|
+
|
|
1272
|
+
Returns:
|
|
1273
|
+
Path to ~/.nova/agents/{agent_name}
|
|
1274
|
+
"""
|
|
1275
|
+
if not self._is_valid_agent_name(agent_name):
|
|
1276
|
+
msg = (
|
|
1277
|
+
f"Invalid agent name: {agent_name!r}. "
|
|
1278
|
+
"Agent names can only contain letters, numbers, hyphens, underscores, and spaces."
|
|
1279
|
+
)
|
|
1280
|
+
raise ValueError(msg)
|
|
1281
|
+
agent_dir = self.get_agent_dir(agent_name)
|
|
1282
|
+
agent_dir.mkdir(parents=True, exist_ok=True)
|
|
1283
|
+
return agent_dir
|
|
1284
|
+
|
|
1285
|
+
def ensure_project_deepagents_dir(self) -> Path | None:
|
|
1286
|
+
"""Ensure the project .nova directory exists and return its path.
|
|
1287
|
+
|
|
1288
|
+
Returns:
|
|
1289
|
+
Path to project .nova directory, or None if not in a project
|
|
1290
|
+
"""
|
|
1291
|
+
if not self.project_root:
|
|
1292
|
+
return None
|
|
1293
|
+
|
|
1294
|
+
project_deepagents_dir = self.project_root / ".nova"
|
|
1295
|
+
project_deepagents_dir.mkdir(parents=True, exist_ok=True)
|
|
1296
|
+
return project_deepagents_dir
|
|
1297
|
+
|
|
1298
|
+
def get_user_skills_dir(self, agent_name: str | None = None) -> Path:
|
|
1299
|
+
"""Get user-level skills directory path (global, shared across agents).
|
|
1300
|
+
|
|
1301
|
+
Args:
|
|
1302
|
+
agent_name: DEPRECATED - kept for backward compatibility, ignored.
|
|
1303
|
+
Skills are now global at ~/.nova/skills/
|
|
1304
|
+
|
|
1305
|
+
Returns:
|
|
1306
|
+
Path to ~/.nova/skills/ (global skills directory)
|
|
1307
|
+
"""
|
|
1308
|
+
# Skills are now global, not per-agent
|
|
1309
|
+
return self.get_global_skills_dir()
|
|
1310
|
+
|
|
1311
|
+
def ensure_user_skills_dir(self, agent_name: str | None = None) -> Path:
|
|
1312
|
+
"""Ensure user-level skills directory exists and return its path.
|
|
1313
|
+
|
|
1314
|
+
Args:
|
|
1315
|
+
agent_name: DEPRECATED - kept for backward compatibility, ignored.
|
|
1316
|
+
Skills are now global at ~/.nova/skills/
|
|
1317
|
+
|
|
1318
|
+
Returns:
|
|
1319
|
+
Path to ~/.nova/skills/ (global skills directory)
|
|
1320
|
+
"""
|
|
1321
|
+
# Skills are now global, not per-agent
|
|
1322
|
+
skills_dir = self.get_global_skills_dir()
|
|
1323
|
+
skills_dir.mkdir(parents=True, exist_ok=True)
|
|
1324
|
+
return skills_dir
|
|
1325
|
+
|
|
1326
|
+
@staticmethod
|
|
1327
|
+
def get_shared_skills_dir() -> Path:
|
|
1328
|
+
"""Return the official Skills CLI's global canonical directory."""
|
|
1329
|
+
return Path.home() / ".agents" / "skills"
|
|
1330
|
+
|
|
1331
|
+
@staticmethod
|
|
1332
|
+
def get_global_claude_skills_dir() -> Path:
|
|
1333
|
+
"""Get the global Claude Code skills directory path.
|
|
1334
|
+
|
|
1335
|
+
Returns:
|
|
1336
|
+
Path to ~/.claude/skills/ (global Claude Code skills directory)
|
|
1337
|
+
"""
|
|
1338
|
+
return Path.home() / ".claude" / "skills"
|
|
1339
|
+
|
|
1340
|
+
def get_project_skills_dir(self) -> Path | None:
|
|
1341
|
+
"""Get project-level skills directory path (legacy .nova/skills/).
|
|
1342
|
+
|
|
1343
|
+
Returns:
|
|
1344
|
+
Path to {project_root}/.nova/skills/, or None if not in a project
|
|
1345
|
+
"""
|
|
1346
|
+
if not self.project_root:
|
|
1347
|
+
return None
|
|
1348
|
+
return self.project_root / ".nova" / "skills"
|
|
1349
|
+
|
|
1350
|
+
def get_project_skills_dirs(self) -> list[Path]:
|
|
1351
|
+
"""Get project skills, including Skills CLI installs in the launch directory.
|
|
1352
|
+
|
|
1353
|
+
Checks .agents/, .claude/, and .nova/ under the project root and
|
|
1354
|
+
nested .agents/skills directories between that root and cwd.
|
|
1355
|
+
|
|
1356
|
+
Returns:
|
|
1357
|
+
List of existing skills directory paths (may be empty if not in a project)
|
|
1358
|
+
"""
|
|
1359
|
+
# Upstream installs relative to cwd, including outside a Git project.
|
|
1360
|
+
root = self.project_root or Path.cwd()
|
|
1361
|
+
directories = list(find_project_skills(root))
|
|
1362
|
+
current = Path.cwd().resolve()
|
|
1363
|
+
if current.is_relative_to(root.resolve()):
|
|
1364
|
+
nested = []
|
|
1365
|
+
while current != root.resolve():
|
|
1366
|
+
shared = current / ".agents" / "skills"
|
|
1367
|
+
if shared.is_dir():
|
|
1368
|
+
nested.append(shared)
|
|
1369
|
+
current = current.parent
|
|
1370
|
+
directories.extend(reversed(nested))
|
|
1371
|
+
return directories
|
|
1372
|
+
|
|
1373
|
+
def ensure_project_skills_dir(self) -> Path | None:
|
|
1374
|
+
"""Ensure project-level skills directory exists and return its path.
|
|
1375
|
+
|
|
1376
|
+
Returns:
|
|
1377
|
+
Path to {project_root}/.nova/skills/, or None if not in a project
|
|
1378
|
+
"""
|
|
1379
|
+
if not self.project_root:
|
|
1380
|
+
return None
|
|
1381
|
+
skills_dir = self.get_project_skills_dir()
|
|
1382
|
+
if skills_dir:
|
|
1383
|
+
skills_dir.mkdir(parents=True, exist_ok=True)
|
|
1384
|
+
return skills_dir
|
|
1385
|
+
|
|
1386
|
+
|
|
1387
|
+
# Global settings instance (initialized once)
|
|
1388
|
+
settings = Settings.from_environment()
|