code-puppy-core-plugins 0.0.2__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_puppy_core_plugins/__init__.py +5 -0
- code_puppy_core_plugins/acp/README.md +266 -0
- code_puppy_core_plugins/acp/__init__.py +8 -0
- code_puppy_core_plugins/acp/agent.py +494 -0
- code_puppy_core_plugins/acp/bridge.py +309 -0
- code_puppy_core_plugins/acp/capabilities.py +73 -0
- code_puppy_core_plugins/acp/commands.py +116 -0
- code_puppy_core_plugins/acp/content.py +115 -0
- code_puppy_core_plugins/acp/io_delegation.py +231 -0
- code_puppy_core_plugins/acp/mcp_config.py +66 -0
- code_puppy_core_plugins/acp/permissions.py +159 -0
- code_puppy_core_plugins/acp/persistence.py +197 -0
- code_puppy_core_plugins/acp/register_callbacks.py +110 -0
- code_puppy_core_plugins/acp/replay.py +114 -0
- code_puppy_core_plugins/acp/session.py +329 -0
- code_puppy_core_plugins/acp/session_config.py +179 -0
- code_puppy_core_plugins/acp/state.py +135 -0
- code_puppy_core_plugins/agent_skills/__init__.py +22 -0
- code_puppy_core_plugins/agent_skills/config.py +208 -0
- code_puppy_core_plugins/agent_skills/discovery.py +337 -0
- code_puppy_core_plugins/agent_skills/downloader.py +392 -0
- code_puppy_core_plugins/agent_skills/enabled_skills.py +82 -0
- code_puppy_core_plugins/agent_skills/installer.py +22 -0
- code_puppy_core_plugins/agent_skills/metadata.py +219 -0
- code_puppy_core_plugins/agent_skills/prompt_builder.py +49 -0
- code_puppy_core_plugins/agent_skills/provider.py +52 -0
- code_puppy_core_plugins/agent_skills/register_callbacks.py +309 -0
- code_puppy_core_plugins/agent_skills/remote_catalog.py +322 -0
- code_puppy_core_plugins/agent_skills/skill_catalog.py +257 -0
- code_puppy_core_plugins/agent_skills/skill_commands.py +102 -0
- code_puppy_core_plugins/agent_skills/skills_install_menu.py +698 -0
- code_puppy_core_plugins/agent_skills/skills_menu.py +794 -0
- code_puppy_core_plugins/aws_bedrock/__init__.py +14 -0
- code_puppy_core_plugins/aws_bedrock/config.py +101 -0
- code_puppy_core_plugins/aws_bedrock/register_callbacks.py +243 -0
- code_puppy_core_plugins/aws_bedrock/utils.py +186 -0
- code_puppy_core_plugins/azure_foundry/README.md +238 -0
- code_puppy_core_plugins/azure_foundry/__init__.py +15 -0
- code_puppy_core_plugins/azure_foundry/config.py +126 -0
- code_puppy_core_plugins/azure_foundry/discovery.py +189 -0
- code_puppy_core_plugins/azure_foundry/register_callbacks.py +506 -0
- code_puppy_core_plugins/azure_foundry/token.py +182 -0
- code_puppy_core_plugins/azure_foundry/utils.py +375 -0
- code_puppy_core_plugins/btw/__init__.py +1 -0
- code_puppy_core_plugins/btw/inline_view.py +135 -0
- code_puppy_core_plugins/btw/register_callbacks.py +106 -0
- code_puppy_core_plugins/btw/side_query.py +91 -0
- code_puppy_core_plugins/chatgpt_oauth/IMAGEGEN_SKILL.md +83 -0
- code_puppy_core_plugins/chatgpt_oauth/__init__.py +8 -0
- code_puppy_core_plugins/chatgpt_oauth/config.py +52 -0
- code_puppy_core_plugins/chatgpt_oauth/image_generation.py +253 -0
- code_puppy_core_plugins/chatgpt_oauth/image_tool.py +70 -0
- code_puppy_core_plugins/chatgpt_oauth/oauth_flow.py +461 -0
- code_puppy_core_plugins/chatgpt_oauth/register_callbacks.py +288 -0
- code_puppy_core_plugins/chatgpt_oauth/test_plugin.py +663 -0
- code_puppy_core_plugins/chatgpt_oauth/usage.py +113 -0
- code_puppy_core_plugins/chatgpt_oauth/utils.py +534 -0
- code_puppy_core_plugins/claude_code_hooks/__init__.py +1 -0
- code_puppy_core_plugins/claude_code_hooks/config.py +137 -0
- code_puppy_core_plugins/claude_code_hooks/register_callbacks.py +383 -0
- code_puppy_core_plugins/claude_code_oauth/README.md +167 -0
- code_puppy_core_plugins/claude_code_oauth/SETUP.md +93 -0
- code_puppy_core_plugins/claude_code_oauth/__init__.py +25 -0
- code_puppy_core_plugins/claude_code_oauth/config.py +59 -0
- code_puppy_core_plugins/claude_code_oauth/fast_mode.py +122 -0
- code_puppy_core_plugins/claude_code_oauth/prompt_handler.py +64 -0
- code_puppy_core_plugins/claude_code_oauth/register_callbacks.py +719 -0
- code_puppy_core_plugins/claude_code_oauth/test_plugin.py +285 -0
- code_puppy_core_plugins/claude_code_oauth/token_refresh_heartbeat.py +240 -0
- code_puppy_core_plugins/claude_code_oauth/utils.py +663 -0
- code_puppy_core_plugins/code_puppy_agent/AGENTS_AND_TOOLS.md +155 -0
- code_puppy_core_plugins/code_puppy_agent/MODELS_AND_MCP.md +104 -0
- code_puppy_core_plugins/code_puppy_agent/PLUGINS_AND_CALLBACKS.md +147 -0
- code_puppy_core_plugins/code_puppy_agent/SESSIONS_AND_HISTORY.md +39 -0
- code_puppy_core_plugins/code_puppy_agent/SKILL.md +180 -0
- code_puppy_core_plugins/code_puppy_agent/SKILLS_SYSTEM.md +136 -0
- code_puppy_core_plugins/code_puppy_agent/SYSTEM_PROMPT_CONFIG_AND_I18N.md +160 -0
- code_puppy_core_plugins/code_puppy_agent/__init__.py +5 -0
- code_puppy_core_plugins/code_puppy_agent/register_callbacks.py +46 -0
- code_puppy_core_plugins/computer_use/NativeCapture.swift +123 -0
- code_puppy_core_plugins/computer_use/README.md +109 -0
- code_puppy_core_plugins/computer_use/__init__.py +1 -0
- code_puppy_core_plugins/computer_use/accessibility.py +163 -0
- code_puppy_core_plugins/computer_use/activation.py +75 -0
- code_puppy_core_plugins/computer_use/backend.py +584 -0
- code_puppy_core_plugins/computer_use/backend_types.py +5 -0
- code_puppy_core_plugins/computer_use/capture.py +110 -0
- code_puppy_core_plugins/computer_use/commands.py +62 -0
- code_puppy_core_plugins/computer_use/geometry.py +81 -0
- code_puppy_core_plugins/computer_use/inline_image.py +56 -0
- code_puppy_core_plugins/computer_use/keycodes.py +47 -0
- code_puppy_core_plugins/computer_use/policy.py +144 -0
- code_puppy_core_plugins/computer_use/register_callbacks.py +96 -0
- code_puppy_core_plugins/computer_use/safety.py +18 -0
- code_puppy_core_plugins/computer_use/settle.py +64 -0
- code_puppy_core_plugins/computer_use/state.py +86 -0
- code_puppy_core_plugins/computer_use/tools.py +469 -0
- code_puppy_core_plugins/context_indicator/__init__.py +14 -0
- code_puppy_core_plugins/context_indicator/register_callbacks.py +249 -0
- code_puppy_core_plugins/context_indicator/usage.py +40 -0
- code_puppy_core_plugins/copilot_auth/__init__.py +11 -0
- code_puppy_core_plugins/copilot_auth/config.py +93 -0
- code_puppy_core_plugins/copilot_auth/reasoning_client.py +409 -0
- code_puppy_core_plugins/copilot_auth/register_callbacks.py +460 -0
- code_puppy_core_plugins/copilot_auth/utils.py +587 -0
- code_puppy_core_plugins/customizable_commands/__init__.py +0 -0
- code_puppy_core_plugins/customizable_commands/register_callbacks.py +464 -0
- code_puppy_core_plugins/dbos_durable_exec/__init__.py +1 -0
- code_puppy_core_plugins/dbos_durable_exec/cancel.py +15 -0
- code_puppy_core_plugins/dbos_durable_exec/commands.py +31 -0
- code_puppy_core_plugins/dbos_durable_exec/config.py +31 -0
- code_puppy_core_plugins/dbos_durable_exec/lifecycle.py +83 -0
- code_puppy_core_plugins/dbos_durable_exec/register_callbacks.py +45 -0
- code_puppy_core_plugins/dbos_durable_exec/runtime.py +65 -0
- code_puppy_core_plugins/dbos_durable_exec/startup_lock.py +155 -0
- code_puppy_core_plugins/dbos_durable_exec/workflow_ids.py +16 -0
- code_puppy_core_plugins/dbos_durable_exec/wrapper.py +58 -0
- code_puppy_core_plugins/destructive_command_guard/AGENTS.md +79 -0
- code_puppy_core_plugins/destructive_command_guard/__init__.py +14 -0
- code_puppy_core_plugins/destructive_command_guard/detector.py +374 -0
- code_puppy_core_plugins/destructive_command_guard/register_callbacks.py +165 -0
- code_puppy_core_plugins/emoji_filter/__init__.py +12 -0
- code_puppy_core_plugins/emoji_filter/config.py +26 -0
- code_puppy_core_plugins/emoji_filter/register_callbacks.py +238 -0
- code_puppy_core_plugins/emoji_filter/stripper.py +45 -0
- code_puppy_core_plugins/empty_html_comment_filter/register_callbacks.py +116 -0
- code_puppy_core_plugins/example_custom_command/README.md +328 -0
- code_puppy_core_plugins/example_custom_command/register_callbacks.py +66 -0
- code_puppy_core_plugins/file_permission_handler/__init__.py +4 -0
- code_puppy_core_plugins/file_permission_handler/register_callbacks.py +575 -0
- code_puppy_core_plugins/flux_bootstrap/__init__.py +5 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/_docs/README.md +173 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/_docs/cheatsheet.md +86 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/_docs/pipeline.md +167 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/_docs/synopsis.md +392 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/about.md +51 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/address-feedback.md +129 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/ask.md +211 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/aug.md +181 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/auto-pilot.md +71 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/cheatsheet.md +16 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/commit.md +103 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/config.md +108 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/create-pr.md +195 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/exec.md +221 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/new.md +151 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/qa.md +208 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/rebase.md +180 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/review.md +304 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/split.md +120 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/squash-commits.md +179 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/status.md +46 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/tests.md +155 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/scripts/flux_about.py +154 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/scripts/flux_cheatsheet.py +248 -0
- code_puppy_core_plugins/flux_bootstrap/bundled/scripts/flux_status.py +345 -0
- code_puppy_core_plugins/flux_bootstrap/installer.py +256 -0
- code_puppy_core_plugins/flux_bootstrap/register_callbacks.py +71 -0
- code_puppy_core_plugins/force_push_guard/__init__.py +5 -0
- code_puppy_core_plugins/force_push_guard/detector.py +96 -0
- code_puppy_core_plugins/force_push_guard/register_callbacks.py +161 -0
- code_puppy_core_plugins/fork/__init__.py +7 -0
- code_puppy_core_plugins/fork/register_callbacks.py +445 -0
- code_puppy_core_plugins/frontend_emitter/__init__.py +25 -0
- code_puppy_core_plugins/frontend_emitter/emitter.py +249 -0
- code_puppy_core_plugins/frontend_emitter/register_callbacks.py +412 -0
- code_puppy_core_plugins/frontend_emitter/session_context.py +50 -0
- code_puppy_core_plugins/grok_oauth/__init__.py +6 -0
- code_puppy_core_plugins/grok_oauth/config.py +49 -0
- code_puppy_core_plugins/grok_oauth/oauth_flow.py +213 -0
- code_puppy_core_plugins/grok_oauth/register_callbacks.py +132 -0
- code_puppy_core_plugins/grok_oauth/utils.py +195 -0
- code_puppy_core_plugins/herdr/README.md +168 -0
- code_puppy_core_plugins/herdr/__init__.py +9 -0
- code_puppy_core_plugins/herdr/client.py +339 -0
- code_puppy_core_plugins/herdr/register_callbacks.py +140 -0
- code_puppy_core_plugins/herdr/reporter.py +212 -0
- code_puppy_core_plugins/herdr/smoke.py +143 -0
- code_puppy_core_plugins/herdr/sources.py +133 -0
- code_puppy_core_plugins/hook_creator/__init__.py +1 -0
- code_puppy_core_plugins/hook_creator/register_callbacks.py +33 -0
- code_puppy_core_plugins/hook_manager/__init__.py +1 -0
- code_puppy_core_plugins/hook_manager/config.py +290 -0
- code_puppy_core_plugins/hook_manager/hooks_menu.py +571 -0
- code_puppy_core_plugins/hook_manager/register_callbacks.py +227 -0
- code_puppy_core_plugins/meta_oauth/__init__.py +1 -0
- code_puppy_core_plugins/meta_oauth/config.py +55 -0
- code_puppy_core_plugins/meta_oauth/oauth_flow.py +109 -0
- code_puppy_core_plugins/meta_oauth/register_callbacks.py +154 -0
- code_puppy_core_plugins/meta_oauth/utils.py +252 -0
- code_puppy_core_plugins/namespace_skill_search/README.md +118 -0
- code_puppy_core_plugins/namespace_skill_search/__init__.py +15 -0
- code_puppy_core_plugins/namespace_skill_search/namespaces.py +125 -0
- code_puppy_core_plugins/namespace_skill_search/register_callbacks.py +99 -0
- code_puppy_core_plugins/namespace_skill_search/search_tool.py +158 -0
- code_puppy_core_plugins/no_tools/__init__.py +0 -0
- code_puppy_core_plugins/no_tools/register_callbacks.py +42 -0
- code_puppy_core_plugins/oauth_pasteback.py +110 -0
- code_puppy_core_plugins/oauth_puppy_html.py +194 -0
- code_puppy_core_plugins/obsidian_agent/README.md +52 -0
- code_puppy_core_plugins/obsidian_agent/__init__.py +8 -0
- code_puppy_core_plugins/obsidian_agent/agent_obsidian.py +147 -0
- code_puppy_core_plugins/obsidian_agent/register_callbacks.py +13 -0
- code_puppy_core_plugins/ollama/__init__.py +1 -0
- code_puppy_core_plugins/ollama/register_callbacks.py +127 -0
- code_puppy_core_plugins/ollama_setup/__init__.py +5 -0
- code_puppy_core_plugins/ollama_setup/completer.py +38 -0
- code_puppy_core_plugins/ollama_setup/register_callbacks.py +419 -0
- code_puppy_core_plugins/plugin_list/__init__.py +0 -0
- code_puppy_core_plugins/plugin_list/plugin_contributions.py +348 -0
- code_puppy_core_plugins/plugin_list/plugin_meta.py +67 -0
- code_puppy_core_plugins/plugin_list/plugin_text_utils.py +173 -0
- code_puppy_core_plugins/plugin_list/plugins_menu.py +455 -0
- code_puppy_core_plugins/plugin_list/plugins_menu_layout.py +194 -0
- code_puppy_core_plugins/plugin_list/plugins_menu_render.py +431 -0
- code_puppy_core_plugins/plugin_list/project_trust_flow.py +162 -0
- code_puppy_core_plugins/plugin_list/register_callbacks.py +281 -0
- code_puppy_core_plugins/pop_command/__init__.py +1 -0
- code_puppy_core_plugins/pop_command/register_callbacks.py +191 -0
- code_puppy_core_plugins/prompt_newline/__init__.py +13 -0
- code_puppy_core_plugins/prompt_newline/config.py +21 -0
- code_puppy_core_plugins/prompt_newline/register_callbacks.py +163 -0
- code_puppy_core_plugins/prune/__init__.py +1 -0
- code_puppy_core_plugins/prune/prune_menu.py +308 -0
- code_puppy_core_plugins/prune/prune_model.py +517 -0
- code_puppy_core_plugins/prune/prune_render.py +354 -0
- code_puppy_core_plugins/prune/register_callbacks.py +388 -0
- code_puppy_core_plugins/puppy_kennel/README.md +203 -0
- code_puppy_core_plugins/puppy_kennel/__init__.py +6 -0
- code_puppy_core_plugins/puppy_kennel/commands.py +206 -0
- code_puppy_core_plugins/puppy_kennel/config.py +36 -0
- code_puppy_core_plugins/puppy_kennel/kennel.py +368 -0
- code_puppy_core_plugins/puppy_kennel/packer.py +152 -0
- code_puppy_core_plugins/puppy_kennel/recorder.py +83 -0
- code_puppy_core_plugins/puppy_kennel/register_callbacks.py +109 -0
- code_puppy_core_plugins/puppy_kennel/retriever.py +28 -0
- code_puppy_core_plugins/puppy_kennel/schema.py +78 -0
- code_puppy_core_plugins/puppy_kennel/state.py +68 -0
- code_puppy_core_plugins/puppy_kennel/tools.py +449 -0
- code_puppy_core_plugins/puppy_kennel/wings.py +110 -0
- code_puppy_core_plugins/puppy_spinner/README.md +93 -0
- code_puppy_core_plugins/puppy_spinner/__init__.py +11 -0
- code_puppy_core_plugins/puppy_spinner/builtin_frames.py +172 -0
- code_puppy_core_plugins/puppy_spinner/commands.py +116 -0
- code_puppy_core_plugins/puppy_spinner/picker.py +379 -0
- code_puppy_core_plugins/puppy_spinner/register_callbacks.py +193 -0
- code_puppy_core_plugins/puppy_spinner/spinners.py +444 -0
- code_puppy_core_plugins/quick_resume/__init__.py +0 -0
- code_puppy_core_plugins/quick_resume/register_callbacks.py +77 -0
- code_puppy_core_plugins/review_pr/__init__.py +1 -0
- code_puppy_core_plugins/review_pr/register_callbacks.py +162 -0
- code_puppy_core_plugins/shell_safety/__init__.py +6 -0
- code_puppy_core_plugins/shell_safety/agent_shell_safety.py +69 -0
- code_puppy_core_plugins/shell_safety/command_cache.py +156 -0
- code_puppy_core_plugins/shell_safety/register_callbacks.py +203 -0
- code_puppy_core_plugins/stack_dump/__init__.py +1 -0
- code_puppy_core_plugins/stack_dump/register_callbacks.py +79 -0
- code_puppy_core_plugins/statusline/__init__.py +14 -0
- code_puppy_core_plugins/statusline/config.py +68 -0
- code_puppy_core_plugins/statusline/payload.py +138 -0
- code_puppy_core_plugins/statusline/prompt_patch.py +76 -0
- code_puppy_core_plugins/statusline/register_callbacks.py +45 -0
- code_puppy_core_plugins/statusline/runner.py +122 -0
- code_puppy_core_plugins/statusline/statusline_command.py +197 -0
- code_puppy_core_plugins/steer_queue/__init__.py +10 -0
- code_puppy_core_plugins/steer_queue/queue_menu.py +444 -0
- code_puppy_core_plugins/steer_queue/register_callbacks.py +138 -0
- code_puppy_core_plugins/subagent_panel/README.md +102 -0
- code_puppy_core_plugins/subagent_panel/__init__.py +24 -0
- code_puppy_core_plugins/subagent_panel/coalesce_patch.py +242 -0
- code_puppy_core_plugins/subagent_panel/panel_render.py +145 -0
- code_puppy_core_plugins/subagent_panel/register_callbacks.py +535 -0
- code_puppy_core_plugins/subagent_panel/resume_repaint.py +112 -0
- code_puppy_core_plugins/subagent_panel/state.py +231 -0
- code_puppy_core_plugins/switch_agent_resume/__init__.py +5 -0
- code_puppy_core_plugins/switch_agent_resume/register_callbacks.py +314 -0
- code_puppy_core_plugins/theme/README.md +86 -0
- code_puppy_core_plugins/theme/__init__.py +14 -0
- code_puppy_core_plugins/theme/bundled_palettes.py +346 -0
- code_puppy_core_plugins/theme/content_styles.py +146 -0
- code_puppy_core_plugins/theme/osc_palette.py +178 -0
- code_puppy_core_plugins/theme/picker.py +358 -0
- code_puppy_core_plugins/theme/prompt_toolkit_theme.py +113 -0
- code_puppy_core_plugins/theme/register_callbacks.py +348 -0
- code_puppy_core_plugins/theme/rich_themes.py +202 -0
- code_puppy_core_plugins/theme/themes.py +720 -0
- code_puppy_core_plugins/timestamp_heartbeat/__init__.py +1 -0
- code_puppy_core_plugins/timestamp_heartbeat/register_callbacks.py +114 -0
- code_puppy_core_plugins/token_ratio_learner/__init__.py +5 -0
- code_puppy_core_plugins/token_ratio_learner/ratios.py +208 -0
- code_puppy_core_plugins/token_ratio_learner/register_callbacks.py +213 -0
- code_puppy_core_plugins/universal_constructor/__init__.py +13 -0
- code_puppy_core_plugins/universal_constructor/models.py +138 -0
- code_puppy_core_plugins/universal_constructor/provider.py +62 -0
- code_puppy_core_plugins/universal_constructor/register_callbacks.py +75 -0
- code_puppy_core_plugins/universal_constructor/registry.py +302 -0
- code_puppy_core_plugins/universal_constructor/sandbox.py +584 -0
- code_puppy_core_plugins/wide_completion_menu/__init__.py +6 -0
- code_puppy_core_plugins/wide_completion_menu/register_callbacks.py +165 -0
- code_puppy_core_plugins/wiggum/__init__.py +1 -0
- code_puppy_core_plugins/wiggum/goal_runs.py +91 -0
- code_puppy_core_plugins/wiggum/judge.py +299 -0
- code_puppy_core_plugins/wiggum/judge_config.py +249 -0
- code_puppy_core_plugins/wiggum/judges_menu.py +814 -0
- code_puppy_core_plugins/wiggum/register_callbacks.py +569 -0
- code_puppy_core_plugins/wiggum/state.py +89 -0
- code_puppy_core_plugins/yolo_cli/__init__.py +1 -0
- code_puppy_core_plugins/yolo_cli/register_callbacks.py +41 -0
- code_puppy_core_plugins-0.0.2.dist-info/METADATA +64 -0
- code_puppy_core_plugins-0.0.2.dist-info/RECORD +313 -0
- code_puppy_core_plugins-0.0.2.dist-info/WHEEL +4 -0
- code_puppy_core_plugins-0.0.2.dist-info/entry_points.txt +55 -0
- code_puppy_core_plugins-0.0.2.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Hook Manager plugin – registers callbacks for interactive hook management.
|
|
3
|
+
|
|
4
|
+
Provides:
|
|
5
|
+
/hooks – Launch interactive TUI menu (shows global + project hooks)
|
|
6
|
+
/hooks list – Quick text listing of all configured hooks
|
|
7
|
+
/hooks enable – Enable all hooks (both global and project)
|
|
8
|
+
/hooks disable – Disable all hooks (both global and project)
|
|
9
|
+
/hooks status – Show summary counts per event type
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import logging
|
|
13
|
+
from typing import Any, List, Optional, Tuple
|
|
14
|
+
|
|
15
|
+
from code_puppy.callbacks import register_callback
|
|
16
|
+
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
_COMMAND_NAME = "hooks"
|
|
20
|
+
_ALIASES = ("hook",)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# ---------------------------------------------------------------------------
|
|
24
|
+
# /help entry
|
|
25
|
+
# ---------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _hooks_command_help() -> List[Tuple[str, str]]:
|
|
29
|
+
"""Advertise /hooks in the /help menu."""
|
|
30
|
+
return [
|
|
31
|
+
(
|
|
32
|
+
"hooks",
|
|
33
|
+
"Manage Claude Code hooks (global + project) – browse, enable/disable, inspect",
|
|
34
|
+
),
|
|
35
|
+
("hook", "Alias for /hooks"),
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# ---------------------------------------------------------------------------
|
|
40
|
+
# /hooks command handler
|
|
41
|
+
# ---------------------------------------------------------------------------
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _handle_hooks_command(command: str, name: str) -> Optional[Any]:
|
|
45
|
+
"""Handle /hooks (and /hook) slash commands.
|
|
46
|
+
|
|
47
|
+
Sub-commands
|
|
48
|
+
------------
|
|
49
|
+
/hooks Launch interactive TUI menu (shows both global and project hooks)
|
|
50
|
+
/hooks list Print all hooks as text
|
|
51
|
+
/hooks enable Enable every hook (both global and project)
|
|
52
|
+
/hooks disable Disable every hook (both global and project)
|
|
53
|
+
/hooks status Show counts per event type
|
|
54
|
+
"""
|
|
55
|
+
if name not in (_COMMAND_NAME, *_ALIASES):
|
|
56
|
+
return None # Not our command – pass through
|
|
57
|
+
import copy
|
|
58
|
+
|
|
59
|
+
from code_puppy.messaging import emit_error, emit_info, emit_success, emit_warning
|
|
60
|
+
|
|
61
|
+
from .config import (
|
|
62
|
+
_load_global_hooks_config,
|
|
63
|
+
_load_project_hooks_config,
|
|
64
|
+
flatten_all_hooks,
|
|
65
|
+
save_global_hooks_config,
|
|
66
|
+
save_hooks_config,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
tokens = command.split()
|
|
70
|
+
subcommand = tokens[1].lower() if len(tokens) > 1 else ""
|
|
71
|
+
|
|
72
|
+
# ------------------------------------------------------------------ list
|
|
73
|
+
if subcommand == "list":
|
|
74
|
+
entries = flatten_all_hooks()
|
|
75
|
+
if not entries:
|
|
76
|
+
emit_info("No hooks configured.")
|
|
77
|
+
emit_info("Add hooks to .claude/settings.json (project):")
|
|
78
|
+
emit_info(' { "hooks": { "PreToolUse": [ ... ] } }')
|
|
79
|
+
emit_info("Or to ~/.code_puppy/hooks.json (global)")
|
|
80
|
+
return True
|
|
81
|
+
emit_info(f"\U0001f3a3 Hooks ({len(entries)} total)\n")
|
|
82
|
+
|
|
83
|
+
# Group by source for clarity
|
|
84
|
+
project_hooks = [e for e in entries if e.source == "project"]
|
|
85
|
+
global_hooks = [e for e in entries if e.source == "global"]
|
|
86
|
+
|
|
87
|
+
if project_hooks:
|
|
88
|
+
emit_info("📁 PROJECT HOOKS (.claude/settings.json):")
|
|
89
|
+
for entry in project_hooks:
|
|
90
|
+
status = (
|
|
91
|
+
"\U0001f7e2 enabled " if entry.enabled else "\U0001f534 disabled"
|
|
92
|
+
)
|
|
93
|
+
emit_info(
|
|
94
|
+
f" {status} [{entry.event_type}] matcher={entry.display_matcher}"
|
|
95
|
+
)
|
|
96
|
+
emit_info(f" {entry.display_command}")
|
|
97
|
+
emit_info("")
|
|
98
|
+
|
|
99
|
+
if global_hooks:
|
|
100
|
+
emit_info("🌍 GLOBAL HOOKS (~/.code_puppy/hooks.json):")
|
|
101
|
+
for entry in global_hooks:
|
|
102
|
+
status = (
|
|
103
|
+
"\U0001f7e2 enabled " if entry.enabled else "\U0001f534 disabled"
|
|
104
|
+
)
|
|
105
|
+
emit_info(
|
|
106
|
+
f" {status} [{entry.event_type}] matcher={entry.display_matcher}"
|
|
107
|
+
)
|
|
108
|
+
emit_info(f" {entry.display_command}")
|
|
109
|
+
emit_info("")
|
|
110
|
+
|
|
111
|
+
return True
|
|
112
|
+
# --------------------------------------------------------------- enable
|
|
113
|
+
if subcommand == "enable":
|
|
114
|
+
count = 0
|
|
115
|
+
|
|
116
|
+
# Enable all project hooks
|
|
117
|
+
project_config = _load_project_hooks_config()
|
|
118
|
+
project_cfg = copy.deepcopy(project_config)
|
|
119
|
+
for groups in project_cfg.values():
|
|
120
|
+
if not isinstance(groups, list):
|
|
121
|
+
continue
|
|
122
|
+
for group in groups:
|
|
123
|
+
for hook in group.get("hooks", []):
|
|
124
|
+
hook["enabled"] = True
|
|
125
|
+
count += 1
|
|
126
|
+
if project_config:
|
|
127
|
+
save_hooks_config(project_cfg)
|
|
128
|
+
|
|
129
|
+
# Enable all global hooks
|
|
130
|
+
global_config = _load_global_hooks_config()
|
|
131
|
+
global_cfg = copy.deepcopy(global_config)
|
|
132
|
+
for groups in global_cfg.values():
|
|
133
|
+
if not isinstance(groups, list):
|
|
134
|
+
continue
|
|
135
|
+
for group in groups:
|
|
136
|
+
for hook in group.get("hooks", []):
|
|
137
|
+
hook["enabled"] = True
|
|
138
|
+
count += 1
|
|
139
|
+
if global_config:
|
|
140
|
+
save_global_hooks_config(global_cfg)
|
|
141
|
+
|
|
142
|
+
emit_success(f"\u2705 Enabled {count} hook(s).")
|
|
143
|
+
return True
|
|
144
|
+
# -------------------------------------------------------------- disable
|
|
145
|
+
if subcommand == "disable":
|
|
146
|
+
count = 0
|
|
147
|
+
|
|
148
|
+
# Disable all project hooks
|
|
149
|
+
project_config = _load_project_hooks_config()
|
|
150
|
+
project_cfg = copy.deepcopy(project_config)
|
|
151
|
+
for groups in project_cfg.values():
|
|
152
|
+
if not isinstance(groups, list):
|
|
153
|
+
continue
|
|
154
|
+
for group in groups:
|
|
155
|
+
for hook in group.get("hooks", []):
|
|
156
|
+
hook["enabled"] = False
|
|
157
|
+
count += 1
|
|
158
|
+
if project_config:
|
|
159
|
+
save_hooks_config(project_cfg)
|
|
160
|
+
|
|
161
|
+
# Disable all global hooks
|
|
162
|
+
global_config = _load_global_hooks_config()
|
|
163
|
+
global_cfg = copy.deepcopy(global_config)
|
|
164
|
+
for groups in global_cfg.values():
|
|
165
|
+
if not isinstance(groups, list):
|
|
166
|
+
continue
|
|
167
|
+
for group in groups:
|
|
168
|
+
for hook in group.get("hooks", []):
|
|
169
|
+
hook["enabled"] = False
|
|
170
|
+
count += 1
|
|
171
|
+
if global_config:
|
|
172
|
+
save_global_hooks_config(global_cfg)
|
|
173
|
+
|
|
174
|
+
emit_warning(f"\U0001f534 Disabled {count} hook(s).")
|
|
175
|
+
return True
|
|
176
|
+
# --------------------------------------------------------------- status
|
|
177
|
+
if subcommand == "status":
|
|
178
|
+
entries = flatten_all_hooks()
|
|
179
|
+
if not entries:
|
|
180
|
+
emit_info("No hooks configured.")
|
|
181
|
+
return True
|
|
182
|
+
from collections import Counter
|
|
183
|
+
|
|
184
|
+
by_event: Counter = Counter()
|
|
185
|
+
enabled_by_event: Counter = Counter()
|
|
186
|
+
by_source: Counter = Counter()
|
|
187
|
+
|
|
188
|
+
for entry in entries:
|
|
189
|
+
by_event[entry.event_type] += 1
|
|
190
|
+
by_source[entry.source] += 1
|
|
191
|
+
if entry.enabled:
|
|
192
|
+
enabled_by_event[entry.event_type] += 1
|
|
193
|
+
|
|
194
|
+
emit_info(
|
|
195
|
+
f"\U0001f4ca Hook status "
|
|
196
|
+
f"({sum(enabled_by_event.values())}/{len(entries)} enabled)\n"
|
|
197
|
+
)
|
|
198
|
+
for event_type, total in sorted(by_event.items()):
|
|
199
|
+
enabled = enabled_by_event[event_type]
|
|
200
|
+
bar = "\u2588" * enabled + "\u2591" * (total - enabled)
|
|
201
|
+
emit_info(f" {event_type:<20} {bar} {enabled}/{total}")
|
|
202
|
+
|
|
203
|
+
emit_info(
|
|
204
|
+
f"\nSources: {by_source['project']} project, {by_source['global']} global"
|
|
205
|
+
)
|
|
206
|
+
emit_info("")
|
|
207
|
+
return True
|
|
208
|
+
# ----------------------------------------------- unknown sub-command
|
|
209
|
+
if subcommand and subcommand not in ("", "tui"):
|
|
210
|
+
emit_error(f"Unknown sub-command: {subcommand}")
|
|
211
|
+
emit_info("Usage: /hooks [list|enable|disable|status]")
|
|
212
|
+
return True
|
|
213
|
+
# --------------------------------------------------- default: TUI menu
|
|
214
|
+
from .hooks_menu import show_hooks_menu
|
|
215
|
+
|
|
216
|
+
show_hooks_menu()
|
|
217
|
+
return True
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
# ---------------------------------------------------------------------------
|
|
221
|
+
# Register callbacks
|
|
222
|
+
# ---------------------------------------------------------------------------
|
|
223
|
+
|
|
224
|
+
register_callback("custom_command_help", _hooks_command_help)
|
|
225
|
+
register_callback("custom_command", _handle_hooks_command)
|
|
226
|
+
|
|
227
|
+
logger.info("Hook Manager plugin loaded")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Meta Muse OAuth integration for Code Puppy."""
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""Configuration for Meta Muse device-code OAuth."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from code_puppy import config
|
|
10
|
+
|
|
11
|
+
META_OAUTH_CONFIG: dict[str, Any] = {
|
|
12
|
+
"auth_base_url": "https://auth.meta.com",
|
|
13
|
+
"device_authorization_path": "/oidc/device/authorization/",
|
|
14
|
+
"device_token_path": "/oidc/device/token/",
|
|
15
|
+
"device_code_grant": "urn:ietf:params:oauth:grant-type:device_code",
|
|
16
|
+
# Public client used by the official Muse Code launcher.
|
|
17
|
+
"client_id": "1031625952748946",
|
|
18
|
+
"api_origin": "https://api.meta.ai",
|
|
19
|
+
"api_base_url": "https://api.meta.ai/v1",
|
|
20
|
+
"mint_url": "https://api.meta.ai/muse-code/key",
|
|
21
|
+
"catalog_url": "https://api.meta.ai/muse-code/models",
|
|
22
|
+
"api_version": "1.0.0",
|
|
23
|
+
"request_timeout": 30,
|
|
24
|
+
"poll_timeout": 1_800,
|
|
25
|
+
"prefix": "meta-",
|
|
26
|
+
"default_model": "muse-spark-1.2-contributor",
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# Used when Meta's richer model catalogue is temporarily unavailable.
|
|
30
|
+
FALLBACK_MODELS: dict[str, dict[str, Any]] = {
|
|
31
|
+
"muse-spark-1.2-contributor": {
|
|
32
|
+
"context_length": 1_007_997,
|
|
33
|
+
"supported_settings": ["reasoning_effort"],
|
|
34
|
+
},
|
|
35
|
+
"muse-spark-1.2": {
|
|
36
|
+
"context_length": 1_007_997,
|
|
37
|
+
"supported_settings": ["reasoning_effort"],
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def get_token_storage_path() -> Path:
|
|
43
|
+
"""Return Code Puppy's private Meta credential path."""
|
|
44
|
+
data_dir = Path(config.DATA_DIR)
|
|
45
|
+
data_dir.mkdir(parents=True, exist_ok=True, mode=0o700)
|
|
46
|
+
return data_dir / "meta_oauth.json"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def get_muse_auth_path() -> Path:
|
|
50
|
+
"""Return the official Muse CLI credential path."""
|
|
51
|
+
override = os.getenv("MUSE_AUTH_PATH")
|
|
52
|
+
if override:
|
|
53
|
+
return Path(override).expanduser()
|
|
54
|
+
config_home = Path(os.getenv("XDG_CONFIG_HOME", Path.home() / ".config"))
|
|
55
|
+
return config_home / "muse" / "auth.json"
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""Interactive Meta Muse device-code OAuth flow."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import time
|
|
6
|
+
import webbrowser
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from code_puppy.i18n import t
|
|
10
|
+
from code_puppy.messaging import emit_error, emit_info, emit_success, emit_warning
|
|
11
|
+
from code_puppy.tools.common import should_suppress_browser
|
|
12
|
+
|
|
13
|
+
from .config import META_OAUTH_CONFIG
|
|
14
|
+
from .utils import (
|
|
15
|
+
discover_models,
|
|
16
|
+
load_credentials,
|
|
17
|
+
mint_api_credentials,
|
|
18
|
+
poll_device_token,
|
|
19
|
+
request_device_authorization,
|
|
20
|
+
save_credentials,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _open_verification_page(url: str) -> None:
|
|
25
|
+
if should_suppress_browser():
|
|
26
|
+
emit_info(t("oauth.meta.browser.headless", url=url))
|
|
27
|
+
return
|
|
28
|
+
try:
|
|
29
|
+
if not webbrowser.open(url):
|
|
30
|
+
emit_warning(t("oauth.meta.browser.manual", url=url))
|
|
31
|
+
except Exception as exc: # noqa: BLE001
|
|
32
|
+
emit_warning(t("oauth.meta.browser.failed", error=str(exc), url=url))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _poll_for_access_token(device: dict[str, Any]) -> dict[str, Any] | None:
|
|
36
|
+
interval = max(int(device.get("interval") or 5), 1)
|
|
37
|
+
lifetime = min(
|
|
38
|
+
max(int(device.get("expires_in") or 900), 60),
|
|
39
|
+
int(META_OAUTH_CONFIG["poll_timeout"]),
|
|
40
|
+
)
|
|
41
|
+
deadline = time.monotonic() + lifetime
|
|
42
|
+
|
|
43
|
+
while time.monotonic() < deadline:
|
|
44
|
+
state, payload = poll_device_token(str(device["device_code"]))
|
|
45
|
+
if state == "authorized":
|
|
46
|
+
return payload
|
|
47
|
+
if state == "slow_down":
|
|
48
|
+
interval += 5
|
|
49
|
+
elif state == "access_denied":
|
|
50
|
+
emit_error(t("oauth.meta.auth.denied"))
|
|
51
|
+
return None
|
|
52
|
+
elif state == "expired_token":
|
|
53
|
+
break
|
|
54
|
+
elif state != "authorization_pending":
|
|
55
|
+
emit_error(t("oauth.meta.auth.failed", error=state))
|
|
56
|
+
return None
|
|
57
|
+
time.sleep(interval)
|
|
58
|
+
|
|
59
|
+
emit_error(t("oauth.meta.auth.expired"))
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def run_oauth_flow() -> bool:
|
|
64
|
+
"""Authenticate a Meta account, mint a Model API key, and save it."""
|
|
65
|
+
existing = load_credentials()
|
|
66
|
+
if existing and existing.get("api_key"):
|
|
67
|
+
emit_warning(t("oauth.meta.auth.overwrite"))
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
device = request_device_authorization()
|
|
71
|
+
except Exception as exc: # noqa: BLE001
|
|
72
|
+
emit_error(t("oauth.meta.auth.start_failed", error=str(exc)))
|
|
73
|
+
return False
|
|
74
|
+
|
|
75
|
+
url = str(
|
|
76
|
+
device.get("verification_uri_complete") or device.get("verification_uri") or ""
|
|
77
|
+
)
|
|
78
|
+
code = str(device.get("user_code") or "")
|
|
79
|
+
if not url or not code or not device.get("device_code"):
|
|
80
|
+
emit_error(t("oauth.meta.auth.invalid_response"))
|
|
81
|
+
return False
|
|
82
|
+
|
|
83
|
+
emit_info(t("oauth.meta.auth.open", url=url))
|
|
84
|
+
emit_info(t("oauth.meta.auth.code", code=code))
|
|
85
|
+
_open_verification_page(url)
|
|
86
|
+
emit_info(t("oauth.meta.auth.waiting"))
|
|
87
|
+
|
|
88
|
+
try:
|
|
89
|
+
token_payload = _poll_for_access_token(device)
|
|
90
|
+
if not token_payload:
|
|
91
|
+
return False
|
|
92
|
+
access_token = str(token_payload.get("access_token") or "")
|
|
93
|
+
if not access_token:
|
|
94
|
+
raise RuntimeError(t("oauth.meta.auth.no_access_token"))
|
|
95
|
+
|
|
96
|
+
credentials = mint_api_credentials(access_token)
|
|
97
|
+
credentials["access_token"] = access_token
|
|
98
|
+
credentials["refresh_token"] = token_payload.get("refresh_token", "")
|
|
99
|
+
credentials["obtained_via"] = "device_code"
|
|
100
|
+
credentials["models"] = discover_models(credentials)
|
|
101
|
+
if not save_credentials(credentials):
|
|
102
|
+
emit_error(t("oauth.meta.auth.save_failed"))
|
|
103
|
+
return False
|
|
104
|
+
except Exception as exc: # noqa: BLE001
|
|
105
|
+
emit_error(t("oauth.meta.auth.failed", error=str(exc)))
|
|
106
|
+
return False
|
|
107
|
+
|
|
108
|
+
emit_success(t("oauth.meta.auth.success"))
|
|
109
|
+
return True
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"""Callbacks for Meta Muse OAuth authentication and model registration."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from code_puppy.callbacks import register_callback
|
|
8
|
+
from code_puppy.i18n import t
|
|
9
|
+
from code_puppy.messaging import emit_info, emit_success, emit_warning
|
|
10
|
+
from code_puppy.model_switching import set_model_and_reload_agent
|
|
11
|
+
|
|
12
|
+
from .config import FALLBACK_MODELS, META_OAUTH_CONFIG, get_token_storage_path
|
|
13
|
+
from .oauth_flow import run_oauth_flow
|
|
14
|
+
from .utils import discover_models, load_credentials
|
|
15
|
+
|
|
16
|
+
_PREFIX = str(META_OAUTH_CONFIG["prefix"])
|
|
17
|
+
_DEFAULT_MODEL = f"{_PREFIX}{META_OAUTH_CONFIG['default_model']}"
|
|
18
|
+
_model_cache: dict[str, dict[str, Any]] | None = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _custom_help() -> list[tuple[str, str]]:
|
|
22
|
+
return [
|
|
23
|
+
("meta-auth", t("oauth.meta.help.auth")),
|
|
24
|
+
("meta-status", t("oauth.meta.help.status")),
|
|
25
|
+
("meta-logout", t("oauth.meta.help.logout")),
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _get_model_specs(credentials: dict[str, Any]) -> dict[str, dict[str, Any]]:
|
|
30
|
+
global _model_cache
|
|
31
|
+
stored = credentials.get("models")
|
|
32
|
+
if isinstance(stored, dict):
|
|
33
|
+
valid = {
|
|
34
|
+
model_id: spec
|
|
35
|
+
for model_id, spec in stored.items()
|
|
36
|
+
if isinstance(model_id, str) and isinstance(spec, dict)
|
|
37
|
+
}
|
|
38
|
+
if valid:
|
|
39
|
+
return valid
|
|
40
|
+
if _model_cache is None:
|
|
41
|
+
try:
|
|
42
|
+
_model_cache = discover_models(credentials)
|
|
43
|
+
except Exception: # noqa: BLE001 - catalogue outage must not break startup
|
|
44
|
+
_model_cache = dict(FALLBACK_MODELS)
|
|
45
|
+
return _model_cache
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _meta_model_names(credentials: dict[str, Any] | None = None) -> list[str]:
|
|
49
|
+
credentials = credentials or load_credentials()
|
|
50
|
+
if not credentials:
|
|
51
|
+
return []
|
|
52
|
+
return [f"{_PREFIX}{model_id}" for model_id in _get_model_specs(credentials)]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _load_meta_models() -> dict[str, Any]:
|
|
56
|
+
"""Inject Muse models when an API key is available."""
|
|
57
|
+
credentials = load_credentials()
|
|
58
|
+
if not credentials:
|
|
59
|
+
return {}
|
|
60
|
+
return {
|
|
61
|
+
f"{_PREFIX}{model_id}": {
|
|
62
|
+
"type": "meta_oauth",
|
|
63
|
+
"provider": "meta",
|
|
64
|
+
"name": model_id,
|
|
65
|
+
"context_length": int(spec.get("context_length") or 128_000),
|
|
66
|
+
"supported_settings": list(spec.get("supported_settings") or []),
|
|
67
|
+
"oauth_source": "meta-oauth-plugin",
|
|
68
|
+
}
|
|
69
|
+
for model_id, spec in _get_model_specs(credentials).items()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _handle_meta_status() -> None:
|
|
74
|
+
credentials = load_credentials()
|
|
75
|
+
if not credentials:
|
|
76
|
+
emit_warning(t("oauth.meta.status.none"))
|
|
77
|
+
emit_info(t("oauth.meta.status.hint"))
|
|
78
|
+
return
|
|
79
|
+
emit_success(t("oauth.meta.status.authenticated"))
|
|
80
|
+
emit_info(
|
|
81
|
+
t("oauth.meta.status.source", source=credentials.get("_source", "unknown"))
|
|
82
|
+
)
|
|
83
|
+
emit_info(
|
|
84
|
+
t("oauth.meta.status.models", models=", ".join(_meta_model_names(credentials)))
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def _handle_meta_logout() -> None:
|
|
89
|
+
path = get_token_storage_path()
|
|
90
|
+
if path.exists():
|
|
91
|
+
path.unlink()
|
|
92
|
+
emit_info(t("oauth.meta.logout.removed"))
|
|
93
|
+
remaining = load_credentials()
|
|
94
|
+
if remaining:
|
|
95
|
+
emit_warning(
|
|
96
|
+
t("oauth.meta.logout.external", source=remaining.get("_source", "external"))
|
|
97
|
+
)
|
|
98
|
+
else:
|
|
99
|
+
emit_success(t("oauth.meta.logout.success"))
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _handle_custom_command(command: str, name: str) -> bool | None:
|
|
103
|
+
del command
|
|
104
|
+
if name == "meta-auth":
|
|
105
|
+
if run_oauth_flow():
|
|
106
|
+
set_model_and_reload_agent(_DEFAULT_MODEL)
|
|
107
|
+
return True
|
|
108
|
+
if name == "meta-status":
|
|
109
|
+
_handle_meta_status()
|
|
110
|
+
return True
|
|
111
|
+
if name == "meta-logout":
|
|
112
|
+
_handle_meta_logout()
|
|
113
|
+
return True
|
|
114
|
+
return None
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def _create_meta_oauth_model(
|
|
118
|
+
model_name: str, model_config: dict[str, Any], config: dict[str, Any]
|
|
119
|
+
) -> Any:
|
|
120
|
+
"""Create a Muse model using Meta's OpenAI Responses-compatible API."""
|
|
121
|
+
del config
|
|
122
|
+
from pydantic_ai.models.openai import OpenAIResponsesModel
|
|
123
|
+
|
|
124
|
+
from code_puppy.http_utils import create_async_client
|
|
125
|
+
from code_puppy.provider_identity import make_openai_provider
|
|
126
|
+
|
|
127
|
+
credentials = load_credentials()
|
|
128
|
+
if not credentials:
|
|
129
|
+
emit_warning(
|
|
130
|
+
t("oauth.meta.model.no_credentials", model=model_config.get("name"))
|
|
131
|
+
)
|
|
132
|
+
return None
|
|
133
|
+
|
|
134
|
+
client = create_async_client(
|
|
135
|
+
headers={"x-api-version": str(META_OAUTH_CONFIG["api_version"])},
|
|
136
|
+
model_name=model_name,
|
|
137
|
+
)
|
|
138
|
+
provider = make_openai_provider(
|
|
139
|
+
"meta",
|
|
140
|
+
api_key=credentials["api_key"],
|
|
141
|
+
base_url=credentials["api_base_url"],
|
|
142
|
+
http_client=client,
|
|
143
|
+
)
|
|
144
|
+
return OpenAIResponsesModel(model_name=model_config["name"], provider=provider)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def _register_model_types() -> list[dict[str, Any]]:
|
|
148
|
+
return [{"type": "meta_oauth", "handler": _create_meta_oauth_model}]
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
register_callback("custom_command_help", _custom_help)
|
|
152
|
+
register_callback("custom_command", _handle_custom_command)
|
|
153
|
+
register_callback("register_model_type", _register_model_types)
|
|
154
|
+
register_callback("load_models_config", _load_meta_models)
|