code-muse 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- code_muse/__init__.py +26 -0
- code_muse/__main__.py +10 -0
- code_muse/agents/__init__.py +31 -0
- code_muse/agents/_builder.py +214 -0
- code_muse/agents/_compaction.py +506 -0
- code_muse/agents/_diagnostics.py +171 -0
- code_muse/agents/_history.py +382 -0
- code_muse/agents/_key_listeners.py +148 -0
- code_muse/agents/_non_streaming_render.py +148 -0
- code_muse/agents/_runtime.py +596 -0
- code_muse/agents/agent_creator_agent.py +603 -0
- code_muse/agents/agent_helios.py +47 -0
- code_muse/agents/agent_manager.py +740 -0
- code_muse/agents/agent_muse.py +78 -0
- code_muse/agents/agent_planning.py +44 -0
- code_muse/agents/agent_qa_melpomene.py +207 -0
- code_muse/agents/base_agent.py +194 -0
- code_muse/agents/event_stream_handler.py +361 -0
- code_muse/agents/json_agent.py +201 -0
- code_muse/agents/prompt_v3.py +521 -0
- code_muse/agents/subagent_stream_handler.py +273 -0
- code_muse/callbacks.py +941 -0
- code_muse/chatgpt_codex_client.py +333 -0
- code_muse/claude_cache_client.py +853 -0
- code_muse/cli_runner/__init__.py +319 -0
- code_muse/cli_runner/args.py +63 -0
- code_muse/cli_runner/loop.py +510 -0
- code_muse/cli_runner/resume.py +72 -0
- code_muse/cli_runner/runner.py +161 -0
- code_muse/command_line/__init__.py +1 -0
- code_muse/command_line/add_model_menu.py +1331 -0
- code_muse/command_line/agent_menu.py +674 -0
- code_muse/command_line/attachments.py +397 -0
- code_muse/command_line/autosave_menu.py +709 -0
- code_muse/command_line/clipboard.py +528 -0
- code_muse/command_line/colors_menu.py +530 -0
- code_muse/command_line/command_handler.py +262 -0
- code_muse/command_line/command_registry.py +150 -0
- code_muse/command_line/config_commands.py +711 -0
- code_muse/command_line/core_commands.py +740 -0
- code_muse/command_line/diff_menu.py +865 -0
- code_muse/command_line/file_path_completion.py +73 -0
- code_muse/command_line/load_context_completion.py +57 -0
- code_muse/command_line/model_picker_completion.py +512 -0
- code_muse/command_line/model_settings_menu.py +983 -0
- code_muse/command_line/onboarding_slides.py +162 -0
- code_muse/command_line/onboarding_wizard.py +337 -0
- code_muse/command_line/pagination.py +41 -0
- code_muse/command_line/pin_command_completion.py +329 -0
- code_muse/command_line/prompt_toolkit_completion.py +886 -0
- code_muse/command_line/session_commands.py +304 -0
- code_muse/command_line/shell_passthrough.py +145 -0
- code_muse/command_line/skills_completion.py +158 -0
- code_muse/command_line/types.py +18 -0
- code_muse/command_line/uc_menu.py +908 -0
- code_muse/command_line/utils.py +105 -0
- code_muse/command_line/wiggum_state.py +77 -0
- code_muse/config.py +1138 -0
- code_muse/config_agent.py +168 -0
- code_muse/config_appearance.py +241 -0
- code_muse/config_model.py +357 -0
- code_muse/config_security.py +73 -0
- code_muse/error_logging.py +132 -0
- code_muse/evals/__init__.py +35 -0
- code_muse/evals/eval_helpers.py +81 -0
- code_muse/evals/eval_runner.py +299 -0
- code_muse/evals/sample_evals/__init__.py +1 -0
- code_muse/evals/sample_evals/eval_frugal_reads.py +59 -0
- code_muse/evals/sample_evals/eval_memory_planning.py +31 -0
- code_muse/evals/sample_evals/eval_shell_efficiency.py +39 -0
- code_muse/evals/sample_evals/eval_tool_masking.py +33 -0
- code_muse/fs_scan_cache/__init__.py +31 -0
- code_muse/fs_scan_cache/invalidation_hooks.py +89 -0
- code_muse/fs_scan_cache/scan_cache_core.cpython-314-darwin.so +0 -0
- code_muse/fs_scan_cache/scan_cache_core.pyx +203 -0
- code_muse/fs_scan_cache/tool_integration.py +309 -0
- code_muse/fs_scan_cache/ttl_policy.py +44 -0
- code_muse/gemini_code_assist.py +383 -0
- code_muse/gemini_model.py +838 -0
- code_muse/hook_engine/README.md +105 -0
- code_muse/hook_engine/__init__.py +21 -0
- code_muse/hook_engine/aliases.py +153 -0
- code_muse/hook_engine/engine.py +221 -0
- code_muse/hook_engine/executor.py +347 -0
- code_muse/hook_engine/matcher.py +154 -0
- code_muse/hook_engine/models.py +245 -0
- code_muse/hook_engine/registry.py +114 -0
- code_muse/hook_engine/trust.py +268 -0
- code_muse/hook_engine/validator.py +144 -0
- code_muse/http_utils.py +360 -0
- code_muse/keymap.py +128 -0
- code_muse/list_filtering.py +26 -0
- code_muse/main.py +10 -0
- code_muse/messaging/__init__.py +259 -0
- code_muse/messaging/bus.py +621 -0
- code_muse/messaging/commands.py +166 -0
- code_muse/messaging/markdown_patches.py +57 -0
- code_muse/messaging/message_queue.py +397 -0
- code_muse/messaging/messages.py +591 -0
- code_muse/messaging/queue_console.py +269 -0
- code_muse/messaging/renderers.py +308 -0
- code_muse/messaging/rich_renderer.py +1158 -0
- code_muse/messaging/shimmer.py +154 -0
- code_muse/messaging/spinner/__init__.py +87 -0
- code_muse/messaging/spinner/console_spinner.py +250 -0
- code_muse/messaging/spinner/spinner_base.py +82 -0
- code_muse/messaging/subagent_console.py +458 -0
- code_muse/model_factory.py +1203 -0
- code_muse/model_switching.py +59 -0
- code_muse/model_utils.py +156 -0
- code_muse/models.json +66 -0
- code_muse/models_cache/__init__.py +26 -0
- code_muse/models_cache/blocking_lru_cache.py +98 -0
- code_muse/models_cache/cache_writer.py +86 -0
- code_muse/models_cache/sha256_hash.cpython-314-darwin.so +0 -0
- code_muse/models_cache/sha256_hash.pyx +34 -0
- code_muse/models_cache/startup_integration.py +75 -0
- code_muse/models_dev_api.json +1 -0
- code_muse/models_dev_parser.py +590 -0
- code_muse/motion.py +126 -0
- code_muse/plugins/__init__.py +471 -0
- code_muse/plugins/agent_skills/__init__.py +32 -0
- code_muse/plugins/agent_skills/config.py +176 -0
- code_muse/plugins/agent_skills/discovery.py +309 -0
- code_muse/plugins/agent_skills/downloader.py +389 -0
- code_muse/plugins/agent_skills/installer.py +19 -0
- code_muse/plugins/agent_skills/metadata.py +293 -0
- code_muse/plugins/agent_skills/prompt_builder.py +66 -0
- code_muse/plugins/agent_skills/register_callbacks.py +298 -0
- code_muse/plugins/agent_skills/remote_catalog.py +320 -0
- code_muse/plugins/agent_skills/skill_catalog.py +254 -0
- code_muse/plugins/agent_skills/skills_install_menu.py +690 -0
- code_muse/plugins/agent_skills/skills_menu.py +791 -0
- code_muse/plugins/autonomous_memory/__init__.py +39 -0
- code_muse/plugins/autonomous_memory/bm25_scorer.cpython-314-darwin.so +0 -0
- code_muse/plugins/autonomous_memory/bm25_scorer.cpython-314-x86_64-linux-gnu.so +0 -0
- code_muse/plugins/autonomous_memory/bm25_scorer.pyx +291 -0
- code_muse/plugins/autonomous_memory/consolidation.py +82 -0
- code_muse/plugins/autonomous_memory/extraction.py +382 -0
- code_muse/plugins/autonomous_memory/lease_lock.py +105 -0
- code_muse/plugins/autonomous_memory/memory_injection.py +59 -0
- code_muse/plugins/autonomous_memory/register_callbacks.py +268 -0
- code_muse/plugins/autonomous_memory/secret_scanner.py +62 -0
- code_muse/plugins/autonomous_memory/session_scanner.py +163 -0
- code_muse/plugins/aws_bedrock/__init__.py +14 -0
- code_muse/plugins/aws_bedrock/config.py +99 -0
- code_muse/plugins/aws_bedrock/register_callbacks.py +241 -0
- code_muse/plugins/aws_bedrock/utils.py +153 -0
- code_muse/plugins/azure_foundry/README.md +238 -0
- code_muse/plugins/azure_foundry/__init__.py +15 -0
- code_muse/plugins/azure_foundry/config.py +125 -0
- code_muse/plugins/azure_foundry/discovery.py +187 -0
- code_muse/plugins/azure_foundry/register_callbacks.py +495 -0
- code_muse/plugins/azure_foundry/token.py +180 -0
- code_muse/plugins/azure_foundry/utils.py +345 -0
- code_muse/plugins/build_filter/__init__.py +1 -0
- code_muse/plugins/build_filter/register_callbacks.py +201 -0
- code_muse/plugins/build_filter/strategies/__init__.py +1 -0
- code_muse/plugins/build_filter/strategies/build.py +397 -0
- code_muse/plugins/chatgpt_oauth/__init__.py +6 -0
- code_muse/plugins/chatgpt_oauth/config.py +52 -0
- code_muse/plugins/chatgpt_oauth/oauth_flow.py +338 -0
- code_muse/plugins/chatgpt_oauth/register_callbacks.py +172 -0
- code_muse/plugins/chatgpt_oauth/test_plugin.py +301 -0
- code_muse/plugins/chatgpt_oauth/utils.py +538 -0
- code_muse/plugins/checkpointing/__init__.py +29 -0
- code_muse/plugins/checkpointing/checkpoint_hook.py +51 -0
- code_muse/plugins/checkpointing/conversation_snapshots.py +117 -0
- code_muse/plugins/checkpointing/register_callbacks.py +51 -0
- code_muse/plugins/checkpointing/restore_command.py +263 -0
- code_muse/plugins/checkpointing/rewind_shortcut.py +88 -0
- code_muse/plugins/checkpointing/shadow_git.py +90 -0
- code_muse/plugins/claude_code_hooks/__init__.py +1 -0
- code_muse/plugins/claude_code_hooks/config.py +188 -0
- code_muse/plugins/claude_code_hooks/register_callbacks.py +208 -0
- code_muse/plugins/claude_code_oauth/README.md +167 -0
- code_muse/plugins/claude_code_oauth/SETUP.md +93 -0
- code_muse/plugins/claude_code_oauth/__init__.py +25 -0
- code_muse/plugins/claude_code_oauth/config.py +52 -0
- code_muse/plugins/claude_code_oauth/fast_mode.py +124 -0
- code_muse/plugins/claude_code_oauth/prompt_handler.py +63 -0
- code_muse/plugins/claude_code_oauth/register_callbacks.py +547 -0
- code_muse/plugins/claude_code_oauth/test_fast_mode.py +165 -0
- code_muse/plugins/claude_code_oauth/test_plugin.py +283 -0
- code_muse/plugins/claude_code_oauth/token_refresh_heartbeat.py +237 -0
- code_muse/plugins/claude_code_oauth/utils.py +664 -0
- code_muse/plugins/copilot_auth/__init__.py +11 -0
- code_muse/plugins/copilot_auth/config.py +91 -0
- code_muse/plugins/copilot_auth/reasoning_client.py +409 -0
- code_muse/plugins/copilot_auth/register_callbacks.py +461 -0
- code_muse/plugins/copilot_auth/utils.py +584 -0
- code_muse/plugins/custom_commands/__init__.py +14 -0
- code_muse/plugins/custom_commands/args_injection.py +82 -0
- code_muse/plugins/custom_commands/command_discovery.py +89 -0
- code_muse/plugins/custom_commands/command_toml_schema.py +71 -0
- code_muse/plugins/custom_commands/register_callbacks.py +176 -0
- code_muse/plugins/customizable_commands/__init__.py +0 -0
- code_muse/plugins/customizable_commands/register_callbacks.py +136 -0
- code_muse/plugins/destructive_command_guard/__init__.py +14 -0
- code_muse/plugins/destructive_command_guard/detector.py +375 -0
- code_muse/plugins/destructive_command_guard/register_callbacks.py +148 -0
- code_muse/plugins/example_custom_command/README.md +280 -0
- code_muse/plugins/example_custom_command/register_callbacks.py +51 -0
- code_muse/plugins/file_permission_handler/__init__.py +4 -0
- code_muse/plugins/file_permission_handler/register_callbacks.py +441 -0
- code_muse/plugins/filter_engine/__init__.py +30 -0
- code_muse/plugins/filter_engine/classifier.py +153 -0
- code_muse/plugins/filter_engine/content_detector.py +184 -0
- code_muse/plugins/filter_engine/dispatcher.py +244 -0
- code_muse/plugins/filter_engine/register_callbacks.py +188 -0
- code_muse/plugins/filter_engine/registry.py +279 -0
- code_muse/plugins/filter_engine/strategies/__init__.py +8 -0
- code_muse/plugins/filter_engine/strategies/ast_compressor.cpython-314-darwin.so +0 -0
- code_muse/plugins/filter_engine/strategies/ast_compressor.cpython-314-x86_64-linux-gnu.so +0 -0
- code_muse/plugins/filter_engine/strategies/ast_compressor.pyx +348 -0
- code_muse/plugins/filter_engine/strategies/ast_parser.py +167 -0
- code_muse/plugins/filter_engine/strategies/code.cpython-314-darwin.so +0 -0
- code_muse/plugins/filter_engine/strategies/code.cpython-314-x86_64-linux-gnu.so +0 -0
- code_muse/plugins/filter_engine/strategies/code.pyx +584 -0
- code_muse/plugins/filter_engine/strategies/git.cpython-314-darwin.so +0 -0
- code_muse/plugins/filter_engine/strategies/git.cpython-314-x86_64-linux-gnu.so +0 -0
- code_muse/plugins/filter_engine/strategies/git.pyx +438 -0
- code_muse/plugins/filter_engine/strategies/json_compressor.cpython-314-darwin.so +0 -0
- code_muse/plugins/filter_engine/strategies/json_compressor.pyx +253 -0
- code_muse/plugins/filter_engine/strategies/json_patterns.cpython-314-darwin.so +0 -0
- code_muse/plugins/filter_engine/strategies/json_patterns.pyx +178 -0
- code_muse/plugins/filter_engine/strategies/lint.cpython-314-darwin.so +0 -0
- code_muse/plugins/filter_engine/strategies/lint.cpython-314-x86_64-linux-gnu.so +0 -0
- code_muse/plugins/filter_engine/strategies/lint.pyx +626 -0
- code_muse/plugins/filter_engine/strategies/test.cpython-314-darwin.so +0 -0
- code_muse/plugins/filter_engine/strategies/test.cpython-314-x86_64-linux-gnu.so +0 -0
- code_muse/plugins/filter_engine/strategies/test.pyx +431 -0
- code_muse/plugins/filter_engine/verbosity.py +63 -0
- code_muse/plugins/force_push_guard/__init__.py +5 -0
- code_muse/plugins/force_push_guard/detector.py +96 -0
- code_muse/plugins/force_push_guard/register_callbacks.py +144 -0
- code_muse/plugins/force_push_guard/test_detector.py +143 -0
- code_muse/plugins/frontend_emitter/__init__.py +25 -0
- code_muse/plugins/frontend_emitter/emitter.py +121 -0
- code_muse/plugins/frontend_emitter/register_callbacks.py +259 -0
- code_muse/plugins/gac/__init__.py +4 -0
- code_muse/plugins/gac/git_ops.py +136 -0
- code_muse/plugins/gac/prompt.py +191 -0
- code_muse/plugins/gac/register_callbacks.py +82 -0
- code_muse/plugins/hook_creator/__init__.py +1 -0
- code_muse/plugins/hook_creator/register_callbacks.py +34 -0
- code_muse/plugins/hook_manager/__init__.py +1 -0
- code_muse/plugins/hook_manager/config.py +289 -0
- code_muse/plugins/hook_manager/hooks_menu.py +563 -0
- code_muse/plugins/hook_manager/register_callbacks.py +227 -0
- code_muse/plugins/hook_monitor/register_callbacks.py +36 -0
- code_muse/plugins/mindpack/__init__.py +0 -0
- code_muse/plugins/mindpack/factory.py +930 -0
- code_muse/plugins/mindpack/judge.py +573 -0
- code_muse/plugins/mindpack/memory.py +100 -0
- code_muse/plugins/mindpack/mindpack_menu.py +1552 -0
- code_muse/plugins/mindpack/orchestration.py +605 -0
- code_muse/plugins/mindpack/register_callbacks.py +175 -0
- code_muse/plugins/mindpack/schemas.py +358 -0
- code_muse/plugins/mindpack/tools.py +387 -0
- code_muse/plugins/oauth_muse_html.py +226 -0
- code_muse/plugins/ollama_setup/__init__.py +5 -0
- code_muse/plugins/ollama_setup/completer.py +36 -0
- code_muse/plugins/ollama_setup/register_callbacks.py +410 -0
- code_muse/plugins/plan_command/__init__.py +0 -0
- code_muse/plugins/plan_command/register_callbacks.py +206 -0
- code_muse/plugins/plan_mode/__init__.py +37 -0
- code_muse/plugins/plan_mode/mode_cycling.py +40 -0
- code_muse/plugins/plan_mode/plan_generation.py +68 -0
- code_muse/plugins/plan_mode/plan_hooks.py +74 -0
- code_muse/plugins/plan_mode/plan_mode_tools.py +138 -0
- code_muse/plugins/plan_mode/register_callbacks.py +121 -0
- code_muse/plugins/plugin_trust/register_callbacks.py +140 -0
- code_muse/plugins/policy_engine/__init__.py +46 -0
- code_muse/plugins/policy_engine/approval_flow_integration.py +59 -0
- code_muse/plugins/policy_engine/policy_evaluator.py +75 -0
- code_muse/plugins/policy_engine/policy_file_discovery.py +90 -0
- code_muse/plugins/policy_engine/policy_toml_schema.py +115 -0
- code_muse/plugins/policy_engine/register_callbacks.py +112 -0
- code_muse/plugins/pop_command/__init__.py +1 -0
- code_muse/plugins/pop_command/register_callbacks.py +189 -0
- code_muse/plugins/prompt_newline/__init__.py +13 -0
- code_muse/plugins/prompt_newline/config.py +19 -0
- code_muse/plugins/prompt_newline/register_callbacks.py +159 -0
- code_muse/plugins/safety_status/__init__.py +0 -0
- code_muse/plugins/safety_status/register_callbacks.py +113 -0
- code_muse/plugins/semantic_compression/__init__.py +6 -0
- code_muse/plugins/semantic_compression/compressor.py +295 -0
- code_muse/plugins/semantic_compression/config.py +123 -0
- code_muse/plugins/semantic_compression/register_callbacks.py +320 -0
- code_muse/plugins/shell_minimizer/__init__.py +50 -0
- code_muse/plugins/shell_minimizer/builtin_filters.toml +393 -0
- code_muse/plugins/shell_minimizer/pipeline.py +556 -0
- code_muse/plugins/shell_minimizer/primitives.py +482 -0
- code_muse/plugins/shell_minimizer/register_callbacks.py +276 -0
- code_muse/plugins/shell_safety/__init__.py +6 -0
- code_muse/plugins/shell_safety/agent_shell_safety.py +69 -0
- code_muse/plugins/shell_safety/command_cache.py +149 -0
- code_muse/plugins/shell_safety/register_callbacks.py +202 -0
- code_muse/plugins/synthetic_status/__init__.py +1 -0
- code_muse/plugins/synthetic_status/register_callbacks.py +128 -0
- code_muse/plugins/synthetic_status/status_api.py +145 -0
- code_muse/plugins/token_caching/__init__.py +21 -0
- code_muse/plugins/token_caching/cache_hit_tracking.py +128 -0
- code_muse/plugins/token_caching/cacheable_prefix_detection.py +28 -0
- code_muse/plugins/token_caching/register_callbacks.py +54 -0
- code_muse/plugins/token_caching/stats_display.py +35 -0
- code_muse/plugins/token_tracking/__init__.py +26 -0
- code_muse/plugins/token_tracking/database.py +381 -0
- code_muse/plugins/token_tracking/edit_analyzer.py +97 -0
- code_muse/plugins/token_tracking/record.py +55 -0
- code_muse/plugins/token_tracking/register_callbacks.py +277 -0
- code_muse/plugins/token_tracking/reports.py +329 -0
- code_muse/plugins/universal_constructor/__init__.py +13 -0
- code_muse/plugins/universal_constructor/models.py +136 -0
- code_muse/plugins/universal_constructor/register_callbacks.py +47 -0
- code_muse/plugins/universal_constructor/registry.py +390 -0
- code_muse/plugins/universal_constructor/runner.py +474 -0
- code_muse/plugins/universal_constructor/safety.py +440 -0
- code_muse/plugins/universal_constructor/sandbox.py +584 -0
- code_muse/provider_identity.py +105 -0
- code_muse/pydantic_patches.py +410 -0
- code_muse/reopenable_async_client.py +233 -0
- code_muse/round_robin_model.py +151 -0
- code_muse/secret_storage.py +74 -0
- code_muse/security/__init__.py +1 -0
- code_muse/security/redaction.cpython-314-darwin.so +0 -0
- code_muse/security/redaction.cpython-314-x86_64-linux-gnu.so +0 -0
- code_muse/security/redaction.pyx +135 -0
- code_muse/session_storage.py +565 -0
- code_muse/status_display.py +261 -0
- code_muse/stream_parser/__init__.py +76 -0
- code_muse/stream_parser/assistant_text_parser.py +90 -0
- code_muse/stream_parser/citation_parser.py +76 -0
- code_muse/stream_parser/inline_hidden_tag_parser.py +236 -0
- code_muse/stream_parser/proposed_plan_parser.py +158 -0
- code_muse/stream_parser/stream_text_chunk.py +23 -0
- code_muse/stream_parser/stream_text_parser.py +27 -0
- code_muse/stream_parser/tagged_line_parser.cpython-314-darwin.so +0 -0
- code_muse/stream_parser/tagged_line_parser.pyx +251 -0
- code_muse/stream_parser/utf8_stream_parser.cpython-314-darwin.so +0 -0
- code_muse/stream_parser/utf8_stream_parser.pyx +206 -0
- code_muse/summarization_agent.py +308 -0
- code_muse/terminal_utils.cpython-314-darwin.so +0 -0
- code_muse/terminal_utils.cpython-314-x86_64-linux-gnu.so +0 -0
- code_muse/terminal_utils.pyx +483 -0
- code_muse/tools/__init__.py +459 -0
- code_muse/tools/agent_tools.py +613 -0
- code_muse/tools/ask_user_question/__init__.py +26 -0
- code_muse/tools/ask_user_question/constants.py +73 -0
- code_muse/tools/ask_user_question/demo_tui.py +55 -0
- code_muse/tools/ask_user_question/handler.py +232 -0
- code_muse/tools/ask_user_question/models.py +302 -0
- code_muse/tools/ask_user_question/registration.py +37 -0
- code_muse/tools/ask_user_question/renderers.py +336 -0
- code_muse/tools/ask_user_question/terminal_ui.py +327 -0
- code_muse/tools/ask_user_question/theme.py +156 -0
- code_muse/tools/ask_user_question/tui_loop.py +422 -0
- code_muse/tools/background_jobs.py +99 -0
- code_muse/tools/browser/__init__.py +37 -0
- code_muse/tools/browser/browser_control.py +289 -0
- code_muse/tools/browser/browser_interactions.py +545 -0
- code_muse/tools/browser/browser_locators.py +640 -0
- code_muse/tools/browser/browser_manager.py +376 -0
- code_muse/tools/browser/browser_navigation.py +251 -0
- code_muse/tools/browser/browser_screenshot.py +180 -0
- code_muse/tools/browser/browser_scripts.py +462 -0
- code_muse/tools/browser/browser_workflows.py +222 -0
- code_muse/tools/chrome_cdp/__init__.py +1070 -0
- code_muse/tools/chrome_cdp/register_callbacks.py +61 -0
- code_muse/tools/command_runner.py +1401 -0
- code_muse/tools/common.py +1407 -0
- code_muse/tools/display.py +87 -0
- code_muse/tools/file_modifications.py +1099 -0
- code_muse/tools/file_operations.py +860 -0
- code_muse/tools/image_tools.py +185 -0
- code_muse/tools/meetin_proxy/__init__.py +243 -0
- code_muse/tools/meetin_proxy/capture_addon.py +82 -0
- code_muse/tools/meetin_proxy/proxy_manager.py +326 -0
- code_muse/tools/meetin_proxy/register_callbacks.py +45 -0
- code_muse/tools/path_policy.py +219 -0
- code_muse/tools/skills_tools.py +586 -0
- code_muse/tools/subagent_context.py +158 -0
- code_muse/tools/tools_content.py +50 -0
- code_muse/tools/universal_constructor.py +965 -0
- code_muse/uvx_detection.py +241 -0
- code_muse/version_checker.py +86 -0
- code_muse-0.0.1.data/data/code_muse/models.json +66 -0
- code_muse-0.0.1.data/data/code_muse/models_dev_api.json +1 -0
- code_muse-0.0.1.dist-info/METADATA +845 -0
- code_muse-0.0.1.dist-info/RECORD +394 -0
- code_muse-0.0.1.dist-info/WHEEL +4 -0
- code_muse-0.0.1.dist-info/entry_points.txt +2 -0
- code_muse-0.0.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"""AWS Bedrock Plugin callbacks for Muse CLI.
|
|
2
|
+
|
|
3
|
+
This plugin enables Muse to use Anthropic Claude models hosted on
|
|
4
|
+
AWS Bedrock with standard AWS credential chain authentication.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from code_muse.callbacks import register_callback
|
|
11
|
+
from code_muse.messaging import emit_error, emit_info, emit_success, emit_warning
|
|
12
|
+
|
|
13
|
+
from .config import (
|
|
14
|
+
get_aws_profile,
|
|
15
|
+
get_bedrock_region,
|
|
16
|
+
)
|
|
17
|
+
from .utils import (
|
|
18
|
+
add_bedrock_models_to_config,
|
|
19
|
+
get_bedrock_models_from_config,
|
|
20
|
+
remove_bedrock_models_from_config,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
logger = logging.getLogger(__name__)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# ============================================================================
|
|
27
|
+
# Slash Command Handlers
|
|
28
|
+
# ============================================================================
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _handle_bedrock_status() -> None:
|
|
32
|
+
"""Handle the /bedrock-status command."""
|
|
33
|
+
emit_info("")
|
|
34
|
+
emit_info("AWS Bedrock Status")
|
|
35
|
+
emit_info("=" * 40)
|
|
36
|
+
|
|
37
|
+
region = get_bedrock_region()
|
|
38
|
+
profile = get_aws_profile()
|
|
39
|
+
|
|
40
|
+
emit_info(f"Region: {region}")
|
|
41
|
+
if profile:
|
|
42
|
+
emit_info(f"Profile: {profile}")
|
|
43
|
+
else:
|
|
44
|
+
emit_info("Profile: (default credential chain)")
|
|
45
|
+
|
|
46
|
+
# Check AWS credentials
|
|
47
|
+
try:
|
|
48
|
+
import boto3
|
|
49
|
+
|
|
50
|
+
session = boto3.Session(profile_name=profile, region_name=region)
|
|
51
|
+
sts = session.client("sts")
|
|
52
|
+
identity = sts.get_caller_identity()
|
|
53
|
+
arn = identity.get("Arn", "unknown")
|
|
54
|
+
emit_success(f"Authenticated: {arn}")
|
|
55
|
+
except ImportError:
|
|
56
|
+
emit_warning("boto3 not installed - cannot verify credentials")
|
|
57
|
+
except Exception as e:
|
|
58
|
+
emit_warning(f"Authentication: {e}")
|
|
59
|
+
|
|
60
|
+
emit_info("")
|
|
61
|
+
bedrock_models = get_bedrock_models_from_config()
|
|
62
|
+
if bedrock_models:
|
|
63
|
+
emit_info(f"Configured Models ({len(bedrock_models)}):")
|
|
64
|
+
for model_key, config in bedrock_models.items():
|
|
65
|
+
model_id = config.get("name", "unknown")
|
|
66
|
+
emit_info(f" - {model_key}: {model_id}")
|
|
67
|
+
else:
|
|
68
|
+
emit_info("Configured Models: None")
|
|
69
|
+
emit_info(" Run /bedrock-setup to configure models")
|
|
70
|
+
|
|
71
|
+
emit_info("")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _handle_bedrock_setup() -> None:
|
|
75
|
+
"""Handle the /bedrock-setup command.
|
|
76
|
+
|
|
77
|
+
Region and credentials auto-resolve from the AWS environment
|
|
78
|
+
(IAM role, env vars, ~/.aws/config). No prompts needed.
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
added_models = add_bedrock_models_to_config(
|
|
82
|
+
aws_region=get_bedrock_region(),
|
|
83
|
+
aws_profile=get_aws_profile(),
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
if added_models:
|
|
87
|
+
emit_success(f"Bedrock: added {len(added_models)} model(s):")
|
|
88
|
+
for model_key in added_models:
|
|
89
|
+
emit_info(f" - {model_key}")
|
|
90
|
+
|
|
91
|
+
from code_muse.model_switching import set_model_and_reload_agent
|
|
92
|
+
|
|
93
|
+
set_model_and_reload_agent("bedrock-opus-4-7")
|
|
94
|
+
emit_info("Switched to bedrock-opus-4-7.")
|
|
95
|
+
else:
|
|
96
|
+
emit_warning("Bedrock: no models added — check configuration.")
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def _handle_bedrock_remove() -> None:
|
|
100
|
+
"""Handle the /bedrock-remove command."""
|
|
101
|
+
removed = remove_bedrock_models_from_config()
|
|
102
|
+
if removed:
|
|
103
|
+
emit_success(f"Removed {len(removed)} Bedrock model(s):")
|
|
104
|
+
for model_key in removed:
|
|
105
|
+
emit_info(f" - {model_key}")
|
|
106
|
+
else:
|
|
107
|
+
emit_info("No Bedrock models found in configuration.")
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# ============================================================================
|
|
111
|
+
# Custom Command Registration
|
|
112
|
+
# ============================================================================
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _custom_help() -> list[tuple[str, str]]:
|
|
116
|
+
"""Return help entries for custom commands."""
|
|
117
|
+
return [
|
|
118
|
+
("bedrock-status", "Check AWS Bedrock authentication and configuration"),
|
|
119
|
+
("bedrock-setup", "Auto-configure Bedrock Claude models"),
|
|
120
|
+
("bedrock-remove", "Remove all Bedrock model configurations"),
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def _handle_custom_command(command: str, name: str) -> bool | None:
|
|
125
|
+
"""Handle custom slash commands for the AWS Bedrock plugin."""
|
|
126
|
+
handlers = {
|
|
127
|
+
"bedrock-status": _handle_bedrock_status,
|
|
128
|
+
"bedrock-setup": _handle_bedrock_setup,
|
|
129
|
+
"bedrock-remove": _handle_bedrock_remove,
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
handler = handlers.get(name)
|
|
133
|
+
if handler is None:
|
|
134
|
+
return None
|
|
135
|
+
|
|
136
|
+
try:
|
|
137
|
+
handler()
|
|
138
|
+
return True
|
|
139
|
+
except Exception as e:
|
|
140
|
+
logger.exception("Error handling /%s command: %s", name, e)
|
|
141
|
+
emit_error(f"Command /{name} failed: {e}")
|
|
142
|
+
return True
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# ============================================================================
|
|
146
|
+
# Model Type Handler
|
|
147
|
+
# ============================================================================
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def _create_aws_bedrock_model(model_name: str, model_config: dict, config: dict) -> Any:
|
|
151
|
+
"""Create an AWS Bedrock model instance.
|
|
152
|
+
|
|
153
|
+
Uses AsyncAnthropicBedrock from the anthropic SDK with standard
|
|
154
|
+
AWS credential chain (env vars, profiles, IAM roles, SSO).
|
|
155
|
+
"""
|
|
156
|
+
try:
|
|
157
|
+
from anthropic import AsyncAnthropicBedrock
|
|
158
|
+
from pydantic_ai.models.anthropic import AnthropicModel
|
|
159
|
+
except ImportError as e:
|
|
160
|
+
emit_error(
|
|
161
|
+
f"Failed to create Bedrock model '{model_name}': Missing dependency - {e}"
|
|
162
|
+
)
|
|
163
|
+
return None
|
|
164
|
+
|
|
165
|
+
from code_muse.claude_cache_client import patch_anthropic_client_messages
|
|
166
|
+
from code_muse.config import get_effective_model_settings
|
|
167
|
+
from code_muse.model_factory import CONTEXT_1M_BETA
|
|
168
|
+
from code_muse.provider_identity import (
|
|
169
|
+
make_anthropic_provider,
|
|
170
|
+
resolve_provider_identity,
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
model_id = model_config.get("name")
|
|
174
|
+
if not model_id:
|
|
175
|
+
emit_warning(f"Model ID not specified for '{model_name}'.")
|
|
176
|
+
return None
|
|
177
|
+
|
|
178
|
+
try:
|
|
179
|
+
effective_settings = get_effective_model_settings(model_name)
|
|
180
|
+
interleaved_thinking = effective_settings.get("interleaved_thinking", True)
|
|
181
|
+
|
|
182
|
+
beta_parts: list[str] = []
|
|
183
|
+
if interleaved_thinking:
|
|
184
|
+
beta_parts.append("interleaved-thinking-2025-05-14")
|
|
185
|
+
|
|
186
|
+
context_length = model_config.get("context_length", 200000)
|
|
187
|
+
if context_length >= 1_000_000:
|
|
188
|
+
beta_parts.append(CONTEXT_1M_BETA)
|
|
189
|
+
|
|
190
|
+
default_headers: dict[str, str] | None = None
|
|
191
|
+
if beta_parts:
|
|
192
|
+
default_headers = {"anthropic-beta": ",".join(beta_parts)}
|
|
193
|
+
|
|
194
|
+
client_kwargs: dict[str, Any] = {
|
|
195
|
+
"aws_region": model_config.get("aws_region") or get_bedrock_region(),
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
aws_profile = model_config.get("aws_profile") or get_aws_profile()
|
|
199
|
+
if aws_profile:
|
|
200
|
+
client_kwargs["aws_profile"] = aws_profile
|
|
201
|
+
|
|
202
|
+
if default_headers:
|
|
203
|
+
client_kwargs["default_headers"] = default_headers
|
|
204
|
+
|
|
205
|
+
anthropic_client = AsyncAnthropicBedrock(**client_kwargs)
|
|
206
|
+
|
|
207
|
+
patch_anthropic_client_messages(anthropic_client)
|
|
208
|
+
|
|
209
|
+
provider_identity = resolve_provider_identity(model_name, model_config)
|
|
210
|
+
provider = make_anthropic_provider(
|
|
211
|
+
provider_identity,
|
|
212
|
+
anthropic_client=anthropic_client,
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
model = AnthropicModel(model_name=model_id, provider=provider)
|
|
216
|
+
logger.info(
|
|
217
|
+
"Created Bedrock model: %s -> %s @ %s",
|
|
218
|
+
model_name,
|
|
219
|
+
model_id,
|
|
220
|
+
client_kwargs.get("aws_region", "auto"),
|
|
221
|
+
)
|
|
222
|
+
return model
|
|
223
|
+
|
|
224
|
+
except Exception as e:
|
|
225
|
+
emit_error(f"Failed to create Bedrock model '{model_name}': {e}")
|
|
226
|
+
logger.exception("Error creating Bedrock model: %s", e)
|
|
227
|
+
return None
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def _register_model_types() -> list[dict[str, Any]]:
|
|
231
|
+
"""Register the aws_bedrock model type handler."""
|
|
232
|
+
return [{"type": "aws_bedrock", "handler": _create_aws_bedrock_model}]
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
# ============================================================================
|
|
236
|
+
# Callback Registration
|
|
237
|
+
# ============================================================================
|
|
238
|
+
|
|
239
|
+
register_callback("custom_command_help", _custom_help)
|
|
240
|
+
register_callback("custom_command", _handle_custom_command)
|
|
241
|
+
register_callback("register_model_type", _register_model_types)
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"""Utility functions for the AWS Bedrock plugin."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import logging
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from .config import (
|
|
8
|
+
MODELS,
|
|
9
|
+
get_extra_models_path,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
logger = logging.getLogger(__name__)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def load_extra_models() -> dict[str, Any]:
|
|
16
|
+
"""Load the extra_models.json configuration file."""
|
|
17
|
+
extra_models_path = get_extra_models_path()
|
|
18
|
+
if not extra_models_path.exists():
|
|
19
|
+
return {}
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
with open(extra_models_path, encoding="utf-8") as f:
|
|
23
|
+
return json.load(f)
|
|
24
|
+
except (json.JSONDecodeError, OSError) as e:
|
|
25
|
+
logger.error("Error loading extra_models.json: %s", e)
|
|
26
|
+
return {}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def save_extra_models(models: dict[str, Any]) -> bool:
|
|
30
|
+
"""Save model configurations to extra_models.json (atomic write)."""
|
|
31
|
+
extra_models_path = get_extra_models_path()
|
|
32
|
+
|
|
33
|
+
try:
|
|
34
|
+
extra_models_path.parent.mkdir(parents=True, exist_ok=True)
|
|
35
|
+
temp_path = extra_models_path.with_suffix(".tmp")
|
|
36
|
+
with open(temp_path, "w", encoding="utf-8") as f:
|
|
37
|
+
json.dump(models, f, indent=2, ensure_ascii=False)
|
|
38
|
+
temp_path.replace(extra_models_path)
|
|
39
|
+
return True
|
|
40
|
+
except Exception as e:
|
|
41
|
+
logger.error("Error saving extra_models.json: %s", e)
|
|
42
|
+
return False
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _build_model_entry(
|
|
46
|
+
model_id: str,
|
|
47
|
+
context_length: int,
|
|
48
|
+
has_effort: bool,
|
|
49
|
+
effort: str | None = None,
|
|
50
|
+
aws_region: str | None = None,
|
|
51
|
+
aws_profile: str | None = None,
|
|
52
|
+
) -> dict[str, Any]:
|
|
53
|
+
"""Build a single model config entry for extra_models.json."""
|
|
54
|
+
supported_settings = [
|
|
55
|
+
"temperature",
|
|
56
|
+
"extended_thinking",
|
|
57
|
+
"budget_tokens",
|
|
58
|
+
"interleaved_thinking",
|
|
59
|
+
]
|
|
60
|
+
if has_effort:
|
|
61
|
+
supported_settings.append("effort")
|
|
62
|
+
|
|
63
|
+
config: dict[str, Any] = {
|
|
64
|
+
"type": "aws_bedrock",
|
|
65
|
+
"provider": "aws_bedrock",
|
|
66
|
+
"name": model_id,
|
|
67
|
+
"context_length": context_length,
|
|
68
|
+
"supported_settings": supported_settings,
|
|
69
|
+
}
|
|
70
|
+
if effort:
|
|
71
|
+
config["default_effort"] = effort
|
|
72
|
+
if aws_region:
|
|
73
|
+
config["aws_region"] = aws_region
|
|
74
|
+
if aws_profile:
|
|
75
|
+
config["aws_profile"] = aws_profile
|
|
76
|
+
|
|
77
|
+
return config
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def add_bedrock_models_to_config(
|
|
81
|
+
aws_region: str | None = None,
|
|
82
|
+
aws_profile: str | None = None,
|
|
83
|
+
) -> list[str]:
|
|
84
|
+
"""Add Bedrock model configurations (with effort variants) to extra_models.json."""
|
|
85
|
+
models = load_extra_models()
|
|
86
|
+
added: list[str] = []
|
|
87
|
+
|
|
88
|
+
for spec in MODELS:
|
|
89
|
+
base_key = spec["base_key"]
|
|
90
|
+
model_id = spec["model_id"]
|
|
91
|
+
context_length = spec["context_length"]
|
|
92
|
+
variants = spec.get("variants")
|
|
93
|
+
|
|
94
|
+
if variants:
|
|
95
|
+
for variant in variants:
|
|
96
|
+
if variant == "default":
|
|
97
|
+
key = base_key
|
|
98
|
+
effort = None
|
|
99
|
+
else:
|
|
100
|
+
key = f"{base_key}-{variant}"
|
|
101
|
+
effort = variant
|
|
102
|
+
|
|
103
|
+
models[key] = _build_model_entry(
|
|
104
|
+
model_id=model_id,
|
|
105
|
+
context_length=context_length,
|
|
106
|
+
has_effort=True,
|
|
107
|
+
effort=effort,
|
|
108
|
+
aws_region=aws_region,
|
|
109
|
+
aws_profile=aws_profile,
|
|
110
|
+
)
|
|
111
|
+
added.append(key)
|
|
112
|
+
else:
|
|
113
|
+
models[base_key] = _build_model_entry(
|
|
114
|
+
model_id=model_id,
|
|
115
|
+
context_length=context_length,
|
|
116
|
+
has_effort=False,
|
|
117
|
+
aws_region=aws_region,
|
|
118
|
+
aws_profile=aws_profile,
|
|
119
|
+
)
|
|
120
|
+
added.append(base_key)
|
|
121
|
+
|
|
122
|
+
if added and save_extra_models(models):
|
|
123
|
+
return added
|
|
124
|
+
return []
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def remove_bedrock_models_from_config() -> list[str]:
|
|
128
|
+
"""Remove all Bedrock model configurations from extra_models.json."""
|
|
129
|
+
models = load_extra_models()
|
|
130
|
+
removed = [
|
|
131
|
+
key
|
|
132
|
+
for key, cfg in models.items()
|
|
133
|
+
if isinstance(cfg, dict) and cfg.get("type") == "aws_bedrock"
|
|
134
|
+
]
|
|
135
|
+
|
|
136
|
+
for key in removed:
|
|
137
|
+
del models[key]
|
|
138
|
+
|
|
139
|
+
if removed and not save_extra_models(models):
|
|
140
|
+
logger.error("Failed to save extra_models.json after removing Bedrock models")
|
|
141
|
+
return []
|
|
142
|
+
|
|
143
|
+
return removed
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def get_bedrock_models_from_config() -> dict[str, Any]:
|
|
147
|
+
"""Get all Bedrock model configurations from extra_models.json."""
|
|
148
|
+
models = load_extra_models()
|
|
149
|
+
return {
|
|
150
|
+
key: cfg
|
|
151
|
+
for key, cfg in models.items()
|
|
152
|
+
if isinstance(cfg, dict) and cfg.get("type") == "aws_bedrock"
|
|
153
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# Azure AI Foundry Plugin for Muse
|
|
2
|
+
|
|
3
|
+
This plugin enables Muse to use Anthropic Claude models hosted on
|
|
4
|
+
Microsoft Azure AI Foundry with Azure AD (Entra ID) authentication.
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
Azure AI Foundry provides enterprise-grade hosting of Anthropic Claude models
|
|
9
|
+
within the Microsoft Azure cloud. This plugin uses your existing Azure CLI
|
|
10
|
+
credentials (`az login`) to authenticate, eliminating the need for API keys.
|
|
11
|
+
|
|
12
|
+
## Supported Models
|
|
13
|
+
|
|
14
|
+
| Model | Context Length | Deployment Name (Default) |
|
|
15
|
+
|-------|----------------|---------------------------|
|
|
16
|
+
| Claude Opus 4.6 | 1M tokens | `claude-opus-4-6` |
|
|
17
|
+
| Claude Sonnet 4.6 | 1M tokens | `claude-sonnet-4-6` |
|
|
18
|
+
| Claude Haiku 4.5 | 200K tokens | `claude-haiku-4-5` |
|
|
19
|
+
|
|
20
|
+
Deployment names are user-configurable during setup.
|
|
21
|
+
|
|
22
|
+
## Prerequisites
|
|
23
|
+
|
|
24
|
+
1. **Azure subscription** with access to Azure AI Foundry
|
|
25
|
+
2. **Azure CLI** installed and authenticated (`az login`)
|
|
26
|
+
3. **Claude model deployments** provisioned in your Azure AI Foundry resource
|
|
27
|
+
4. **Python packages**: `azure-identity>=1.15.0` (installed with Muse)
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
### 1. Authenticate with Azure
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
az login
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 2. Set Your Resource Name
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
export ANTHROPIC_FOUNDRY_RESOURCE=your-resource-name
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 3. Run Interactive Setup
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pup
|
|
47
|
+
/foundry-setup
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The wizard will guide you through configuring your model deployments.
|
|
51
|
+
|
|
52
|
+
### 4. Start Using Foundry Models
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
/model foundry-claude-opus
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Configuration
|
|
59
|
+
|
|
60
|
+
### Environment Variables
|
|
61
|
+
|
|
62
|
+
| Variable | Description | Required |
|
|
63
|
+
|----------|-------------|----------|
|
|
64
|
+
| `ANTHROPIC_FOUNDRY_RESOURCE` | Your Azure AI Foundry resource name | Yes |
|
|
65
|
+
| `ANTHROPIC_FOUNDRY_BASE_URL` | Override the base URL (optional) | No |
|
|
66
|
+
|
|
67
|
+
### Model Configuration
|
|
68
|
+
|
|
69
|
+
Models are stored in `~/.muse/extra_models.json`:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"foundry-claude-opus": {
|
|
74
|
+
"type": "azure_foundry",
|
|
75
|
+
"name": "it-entra-claude-opus-4-6[1m]",
|
|
76
|
+
"foundry_resource": "$ANTHROPIC_FOUNDRY_RESOURCE",
|
|
77
|
+
"context_length": 1000000,
|
|
78
|
+
"supported_settings": ["temperature", "extended_thinking", "effort"]
|
|
79
|
+
},
|
|
80
|
+
"foundry-claude-sonnet": {
|
|
81
|
+
"type": "azure_foundry",
|
|
82
|
+
"name": "it-entra-claude-sonnet-4-6[1m]",
|
|
83
|
+
"foundry_resource": "$ANTHROPIC_FOUNDRY_RESOURCE",
|
|
84
|
+
"context_length": 1000000,
|
|
85
|
+
"supported_settings": ["temperature", "interleaved_thinking", "thinking_budget"]
|
|
86
|
+
},
|
|
87
|
+
"foundry-claude-haiku": {
|
|
88
|
+
"type": "azure_foundry",
|
|
89
|
+
"name": "it-entra-claude-haiku-4-5",
|
|
90
|
+
"foundry_resource": "$ANTHROPIC_FOUNDRY_RESOURCE",
|
|
91
|
+
"context_length": 200000,
|
|
92
|
+
"supported_settings": ["temperature", "interleaved_thinking", "thinking_budget"]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Configuration Fields:**
|
|
98
|
+
|
|
99
|
+
- `type`: Must be `"azure_foundry"` to route to this plugin
|
|
100
|
+
- `name`: Your Azure deployment name (e.g., `it-entra-claude-opus-4-6`)
|
|
101
|
+
- `foundry_resource`: Resource name (supports `$ENV_VAR` syntax)
|
|
102
|
+
- `context_length`: Model context window in tokens
|
|
103
|
+
- `supported_settings`: List of supported model settings
|
|
104
|
+
|
|
105
|
+
## Model Settings by Tier
|
|
106
|
+
|
|
107
|
+
### Opus 4.6 Models
|
|
108
|
+
- `temperature`: Temperature for sampling (0-1)
|
|
109
|
+
- `extended_thinking`: Enable thinking (defaults to "adaptive")
|
|
110
|
+
- `effort`: Thinking effort level ("low", "medium", "high")
|
|
111
|
+
|
|
112
|
+
### Sonnet & Haiku Models
|
|
113
|
+
- `temperature`: Temperature for sampling (0-1)
|
|
114
|
+
- `interleaved_thinking`: Enable interleaved thinking (boolean)
|
|
115
|
+
- `thinking_budget`: Maximum tokens for internal reasoning
|
|
116
|
+
|
|
117
|
+
## Context Window Configuration
|
|
118
|
+
|
|
119
|
+
Deployment names can include a context window suffix following the Claude Code format:
|
|
120
|
+
- `[1m]` - 1 million tokens
|
|
121
|
+
- `[2m]` - 2 million tokens
|
|
122
|
+
- `[200k]` - 200 thousand tokens
|
|
123
|
+
- `[500k]` - 500 thousand tokens
|
|
124
|
+
|
|
125
|
+
When you specify a deployment name with a context suffix (e.g., `it-entra-claude-opus-4-6[1m]`):
|
|
126
|
+
1. The suffix is **automatically stripped** before sending to Azure
|
|
127
|
+
2. The `context_length` is set based on the parsed suffix
|
|
128
|
+
|
|
129
|
+
**Example:**
|
|
130
|
+
|
|
131
|
+
During `/foundry-setup`, if you enter:
|
|
132
|
+
```
|
|
133
|
+
Opus deployment name: it-entra-claude-opus-4-6[1m]
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The saved configuration will have:
|
|
137
|
+
- `name`: `it-entra-claude-opus-4-6` (suffix stripped)
|
|
138
|
+
- `context_length`: `1000000` (parsed from `[1m]`)
|
|
139
|
+
|
|
140
|
+
This is useful when your Azure deployment names don't include the context indicator,
|
|
141
|
+
but you want to configure the context length.
|
|
142
|
+
|
|
143
|
+
## Slash Commands
|
|
144
|
+
|
|
145
|
+
| Command | Description |
|
|
146
|
+
|---------|-------------|
|
|
147
|
+
| `/foundry-status` | Check Azure AD authentication status and configured models |
|
|
148
|
+
| `/foundry-setup` | Interactive wizard to configure Foundry models |
|
|
149
|
+
| `/foundry-remove` | Remove all Foundry model configurations |
|
|
150
|
+
|
|
151
|
+
### Example: /foundry-status
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
Azure AI Foundry Status
|
|
155
|
+
========================================
|
|
156
|
+
Authentication: Valid (expires in 45 minutes)
|
|
157
|
+
Logged in as: user@company.com
|
|
158
|
+
|
|
159
|
+
Foundry Resource: my-foundry-resource
|
|
160
|
+
|
|
161
|
+
Configured Models (3):
|
|
162
|
+
- foundry-claude-opus: it-entra-claude-opus-4-6[1m]
|
|
163
|
+
- foundry-claude-sonnet: it-entra-claude-sonnet-4-6[1m]
|
|
164
|
+
- foundry-claude-haiku: it-entra-claude-haiku-4-5
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## How It Works
|
|
168
|
+
|
|
169
|
+
1. **Token Acquisition**: Uses `AzureCliCredential` from `azure-identity` to
|
|
170
|
+
obtain tokens from your `az login` session
|
|
171
|
+
|
|
172
|
+
2. **Token Refresh**: The `get_bearer_token_provider` function handles automatic
|
|
173
|
+
token refresh before expiry
|
|
174
|
+
|
|
175
|
+
3. **API Calls**: Creates an `AsyncAnthropicFoundry` client that uses the native
|
|
176
|
+
Anthropic Messages API (not OpenAI format)
|
|
177
|
+
|
|
178
|
+
4. **Integration**: Wraps the client in pydantic-ai's `AnthropicModel` for
|
|
179
|
+
seamless integration with Muse's agent system
|
|
180
|
+
|
|
181
|
+
## Troubleshooting
|
|
182
|
+
|
|
183
|
+
### "CredentialUnavailableError" or "Not authenticated"
|
|
184
|
+
|
|
185
|
+
Run `az login` to authenticate with Azure:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
az login
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### "Resource not found" or "404 errors"
|
|
192
|
+
|
|
193
|
+
1. Verify `ANTHROPIC_FOUNDRY_RESOURCE` is set correctly
|
|
194
|
+
2. Check that your model deployments exist in Azure AI Foundry
|
|
195
|
+
3. Ensure the deployment names match your configuration
|
|
196
|
+
|
|
197
|
+
### Token Expiry
|
|
198
|
+
|
|
199
|
+
Tokens are automatically refreshed by the Azure Identity library. If you
|
|
200
|
+
encounter issues, try:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
az account get-access-token --resource https://cognitiveservices.azure.com
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Model Not Found
|
|
207
|
+
|
|
208
|
+
After running `/foundry-setup`, verify configuration with `/foundry-status`.
|
|
209
|
+
Check that deployment names match exactly (case-sensitive).
|
|
210
|
+
|
|
211
|
+
## Architecture
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
code_muse/plugins/azure_foundry/
|
|
215
|
+
├── __init__.py # Package marker and version
|
|
216
|
+
├── config.py # Constants and configuration helpers
|
|
217
|
+
├── token.py # Azure AD token provider
|
|
218
|
+
├── utils.py # Configuration file utilities
|
|
219
|
+
└── register_callbacks.py # Plugin callbacks and model handler
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Security Notes
|
|
223
|
+
|
|
224
|
+
- **No API keys stored**: Authentication uses Azure AD tokens only
|
|
225
|
+
- **Token caching**: Managed by Azure CLI, not stored by this plugin
|
|
226
|
+
- **Credential scope**: Limited to `https://cognitiveservices.azure.com/.default`
|
|
227
|
+
|
|
228
|
+
## Contributing
|
|
229
|
+
|
|
230
|
+
This plugin follows Muse's plugin architecture. Key callbacks:
|
|
231
|
+
|
|
232
|
+
- `register_model_type`: Registers `azure_foundry` type handler
|
|
233
|
+
- `custom_command`: Handles `/foundry-*` slash commands
|
|
234
|
+
- `custom_command_help`: Provides help text for commands
|
|
235
|
+
|
|
236
|
+
## License
|
|
237
|
+
|
|
238
|
+
Same as Muse (see repository LICENSE file).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Azure AI Foundry Plugin for Muse.
|
|
2
|
+
|
|
3
|
+
This plugin enables Muse to use Anthropic Claude models hosted on
|
|
4
|
+
Microsoft Azure AI Foundry with Azure AD (Entra ID) authentication.
|
|
5
|
+
|
|
6
|
+
The plugin uses the `az login` credentials from the Azure CLI to authenticate,
|
|
7
|
+
eliminating the need for API keys.
|
|
8
|
+
|
|
9
|
+
Supported models:
|
|
10
|
+
- Claude Opus 4.6 (1M context)
|
|
11
|
+
- Claude Sonnet 4.6 (1M context)
|
|
12
|
+
- Claude Haiku 4.5 (200K context)
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
__version__ = "0.1.0"
|