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,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codex-imagegen
|
|
3
|
+
description: Generate raster images with gpt-image-2 through Codex OAuth. Activate when the user asks to create a photo, illustration, icon, sprite, texture, product image, banner, or other raster artwork.
|
|
4
|
+
version: "1.0"
|
|
5
|
+
author: code-puppy
|
|
6
|
+
tags:
|
|
7
|
+
- image-generation
|
|
8
|
+
- codex
|
|
9
|
+
- gpt-image
|
|
10
|
+
- artwork
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Codex Image Generation
|
|
14
|
+
|
|
15
|
+
Use the `codex_imagegen` tool when the user asks you to create raster artwork.
|
|
16
|
+
The tool uses `gpt-image-2` through the user's existing Codex OAuth session,
|
|
17
|
+
saves the resulting PNG, and displays it inline when iTerm2 supports doing so.
|
|
18
|
+
|
|
19
|
+
## Decision rules
|
|
20
|
+
|
|
21
|
+
1. Generate an image when creation of a photo, illustration, icon, sprite,
|
|
22
|
+
texture, product image, banner, concept art, or similar raster asset is an
|
|
23
|
+
explicit part of the user's request.
|
|
24
|
+
2. Do not generate an image merely because one might decorate an otherwise
|
|
25
|
+
unrelated answer.
|
|
26
|
+
3. Prefer ordinary code tools for diagrams that should remain editable as
|
|
27
|
+
source, such as Mermaid, SVG, charts, or HTML/CSS layouts.
|
|
28
|
+
4. Before calling the tool, turn the user's request into a complete standalone
|
|
29
|
+
visual prompt. Include subject, composition, style, lighting, colors,
|
|
30
|
+
perspective, mood, and important exclusions when those details are known.
|
|
31
|
+
5. Do not claim that generation succeeded until the tool returns `success: true`.
|
|
32
|
+
6. Report the saved path after success. The image may already be visible inline,
|
|
33
|
+
so do not redundantly embed it unless the user asks.
|
|
34
|
+
7. If authentication is missing, tell the user to run `/codex-auth`.
|
|
35
|
+
|
|
36
|
+
## Reference images (visual consistency)
|
|
37
|
+
|
|
38
|
+
Pass `reference_images` to condition the result on images that already exist,
|
|
39
|
+
instead of generating from text alone. Use it whenever the output has to stay
|
|
40
|
+
visually consistent with something:
|
|
41
|
+
|
|
42
|
+
- **Same character across many images.** Conditioning on one canonical
|
|
43
|
+
reference holds a face/outfit together far better than re-describing it in
|
|
44
|
+
words. This is the reliable way to produce a set of portraits, expressions,
|
|
45
|
+
or poses that are recognizably the same person.
|
|
46
|
+
- **Matching an established style,** palette, or lighting across a set of
|
|
47
|
+
assets.
|
|
48
|
+
- **Iterating on an existing asset** — "same logo, dark background".
|
|
49
|
+
|
|
50
|
+
When references are supplied, write the `prompt` as the CHANGE you want; the
|
|
51
|
+
references supply the subject and style to preserve.
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
codex_imagegen(
|
|
55
|
+
prompt="Same man, same clothing and lighting, now glancing over his shoulder, anxious",
|
|
56
|
+
reference_images=["portraits/sandoval/_ref.png"],
|
|
57
|
+
)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Guidance:
|
|
61
|
+
|
|
62
|
+
1. Prefer one strong reference over several weak ones; extra references dilute
|
|
63
|
+
the conditioning.
|
|
64
|
+
2. Do not re-describe what the reference already shows unless you want it
|
|
65
|
+
changed — describing the face again can fight the reference.
|
|
66
|
+
3. Paths must exist and be readable image files, else the call fails with a
|
|
67
|
+
clear error.
|
|
68
|
+
|
|
69
|
+
## Tool
|
|
70
|
+
|
|
71
|
+
Call:
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
codex_imagegen(prompt="A complete standalone image prompt")
|
|
75
|
+
codex_imagegen(prompt="The change you want", reference_images=["path/to/ref.png"])
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The result contains:
|
|
79
|
+
|
|
80
|
+
- `success`: whether generation completed
|
|
81
|
+
- `path`: saved PNG path on success
|
|
82
|
+
- `displayed_inline`: whether iTerm2 inline display was attempted successfully
|
|
83
|
+
- `error`: safe failure text when generation fails
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import Any, Dict
|
|
3
|
+
|
|
4
|
+
from code_puppy import config
|
|
5
|
+
|
|
6
|
+
# ChatGPT OAuth configuration based on OpenAI's Codex CLI flow
|
|
7
|
+
CHATGPT_OAUTH_CONFIG: Dict[str, Any] = {
|
|
8
|
+
# OAuth endpoints from OpenAI auth service
|
|
9
|
+
"issuer": "https://auth.openai.com",
|
|
10
|
+
"auth_url": "https://auth.openai.com/oauth/authorize",
|
|
11
|
+
"token_url": "https://auth.openai.com/oauth/token",
|
|
12
|
+
# API endpoints - Codex uses chatgpt.com backend, not api.openai.com
|
|
13
|
+
"api_base_url": "https://chatgpt.com/backend-api/codex",
|
|
14
|
+
# OAuth client configuration for Code Puppy
|
|
15
|
+
"client_id": "app_EMoamEEZ73f0CkXaXp7hrann",
|
|
16
|
+
"scope": "openid profile email offline_access",
|
|
17
|
+
# Callback handling (we host a localhost callback to capture the redirect)
|
|
18
|
+
"redirect_host": "http://localhost",
|
|
19
|
+
"redirect_path": "auth/callback",
|
|
20
|
+
"required_port": 1455,
|
|
21
|
+
"callback_timeout": 120,
|
|
22
|
+
# Local configuration (uses XDG_DATA_HOME)
|
|
23
|
+
"token_storage": None, # Set dynamically in get_token_storage_path()
|
|
24
|
+
# Model configuration
|
|
25
|
+
"prefix": "codex-",
|
|
26
|
+
"default_context_length": 272000,
|
|
27
|
+
"api_key_env_var": "CHATGPT_OAUTH_API_KEY",
|
|
28
|
+
# Codex CLI version info (for User-Agent header)
|
|
29
|
+
"client_version": "0.144.1",
|
|
30
|
+
"originator": "codex_cli_rs",
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def get_token_storage_path() -> Path:
|
|
35
|
+
"""Get the path for storing OAuth tokens (uses XDG_DATA_HOME)."""
|
|
36
|
+
data_dir = Path(config.DATA_DIR)
|
|
37
|
+
data_dir.mkdir(parents=True, exist_ok=True, mode=0o700)
|
|
38
|
+
return data_dir / "chatgpt_oauth.json"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def get_config_dir() -> Path:
|
|
42
|
+
"""Get the Code Puppy configuration directory (uses XDG_CONFIG_HOME)."""
|
|
43
|
+
config_dir = Path(config.CONFIG_DIR)
|
|
44
|
+
config_dir.mkdir(parents=True, exist_ok=True, mode=0o700)
|
|
45
|
+
return config_dir
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def get_chatgpt_models_path() -> Path:
|
|
49
|
+
"""Get the path to the dedicated chatgpt_models.json file (uses XDG_DATA_HOME)."""
|
|
50
|
+
data_dir = Path(config.DATA_DIR)
|
|
51
|
+
data_dir.mkdir(parents=True, exist_ok=True, mode=0o700)
|
|
52
|
+
return data_dir / "chatgpt_models.json"
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"""Image generation through the ChatGPT Codex OAuth backend.
|
|
2
|
+
|
|
3
|
+
Two endpoints are used, both on the Codex backend rather than api.openai.com:
|
|
4
|
+
|
|
5
|
+
``POST /images/generations``
|
|
6
|
+
Plain text-to-image. JSON body ``{model, prompt, size, quality,
|
|
7
|
+
background}``.
|
|
8
|
+
|
|
9
|
+
``POST /images/edits``
|
|
10
|
+
Reference-conditioned generation — the model sees one or more input images
|
|
11
|
+
and preserves their subject/style. JSON body ``{model, prompt, images,
|
|
12
|
+
size, quality}`` where ``images`` is a list of OBJECTS, each with exactly
|
|
13
|
+
one accepted key, ``image_url``, holding a base64 data-URL string::
|
|
14
|
+
|
|
15
|
+
{"images": [{"image_url": "data:image/png;base64,iVBORw0..."}]}
|
|
16
|
+
|
|
17
|
+
.. note::
|
|
18
|
+
This endpoint is undocumented and its request shape was derived empirically
|
|
19
|
+
against the live service (2026-07). Deviations are rejected with HTTP 400:
|
|
20
|
+
a singular ``image`` key reports "Missing required parameter: 'images'";
|
|
21
|
+
bare base64 strings report "expected an object, but got a string";
|
|
22
|
+
``url`` / ``b64_json`` / ``data`` / ``type`` object keys report "Unknown
|
|
23
|
+
parameter"; and multipart/form-data uploads (the shape the public OpenAI
|
|
24
|
+
images API uses) are rejected outright. If reference conditioning starts
|
|
25
|
+
failing, re-probe those variants first — and note that unknown keys on
|
|
26
|
+
``/images/generations`` are silently IGNORED rather than rejected, so a
|
|
27
|
+
wrong shape there fails open as an unconditioned image.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
from __future__ import annotations
|
|
31
|
+
|
|
32
|
+
import base64
|
|
33
|
+
import binascii
|
|
34
|
+
import mimetypes
|
|
35
|
+
import os
|
|
36
|
+
import sys
|
|
37
|
+
import uuid
|
|
38
|
+
from pathlib import Path
|
|
39
|
+
from typing import Any, Iterable, Sequence
|
|
40
|
+
|
|
41
|
+
import requests
|
|
42
|
+
|
|
43
|
+
from code_puppy import config
|
|
44
|
+
from code_puppy.i18n import t
|
|
45
|
+
|
|
46
|
+
from .config import CHATGPT_OAUTH_CONFIG
|
|
47
|
+
from .utils import get_valid_access_token, load_stored_tokens
|
|
48
|
+
|
|
49
|
+
_IMAGE_MODEL = "gpt-image-2"
|
|
50
|
+
_REQUEST_TIMEOUT_SECONDS = 180
|
|
51
|
+
|
|
52
|
+
# Guard against pathologically large payloads: references are inlined as base64
|
|
53
|
+
# data URLs, so a huge file becomes a huge request body.
|
|
54
|
+
_MAX_REFERENCE_BYTES = 20 * 1024 * 1024
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class CodexImageGenerationError(RuntimeError):
|
|
58
|
+
"""A safe, user-displayable image generation failure."""
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def generate_image(
|
|
62
|
+
prompt: str, reference_images: Sequence[str | Path] | None = None
|
|
63
|
+
) -> Path:
|
|
64
|
+
"""Generate one image with Codex OAuth and save it under Code Puppy data.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
prompt: The image description.
|
|
68
|
+
reference_images: Optional paths to existing images. When provided, the
|
|
69
|
+
request goes to ``/images/edits`` and the model conditions on them,
|
|
70
|
+
preserving subject identity and style far better than describing the
|
|
71
|
+
subject in words. When omitted, behavior is unchanged: a plain
|
|
72
|
+
text-to-image call to ``/images/generations``.
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
Path to the saved PNG.
|
|
76
|
+
"""
|
|
77
|
+
normalized_prompt = prompt.strip()
|
|
78
|
+
if not normalized_prompt:
|
|
79
|
+
raise CodexImageGenerationError(t("codex.imagegen.prompt_required"))
|
|
80
|
+
|
|
81
|
+
access_token = get_valid_access_token()
|
|
82
|
+
tokens = load_stored_tokens() or {}
|
|
83
|
+
account_id = str(tokens.get("account_id", "")).strip()
|
|
84
|
+
if not access_token or not account_id:
|
|
85
|
+
raise CodexImageGenerationError(t("codex.imagegen.auth_required"))
|
|
86
|
+
|
|
87
|
+
encoded_references = _encode_references(reference_images or ())
|
|
88
|
+
response = _post_generation_request(
|
|
89
|
+
access_token, account_id, normalized_prompt, encoded_references
|
|
90
|
+
)
|
|
91
|
+
image_bytes = _decode_first_image(response)
|
|
92
|
+
return _save_image(image_bytes)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _encode_references(paths: Iterable[str | Path]) -> list[str]:
|
|
96
|
+
"""Read reference images and return them as base64 data-URL strings."""
|
|
97
|
+
encoded: list[str] = []
|
|
98
|
+
for raw in paths:
|
|
99
|
+
path = Path(raw).expanduser()
|
|
100
|
+
if not path.is_file():
|
|
101
|
+
raise CodexImageGenerationError(
|
|
102
|
+
t("codex.imagegen.reference_missing", path=str(path))
|
|
103
|
+
)
|
|
104
|
+
try:
|
|
105
|
+
data = path.read_bytes()
|
|
106
|
+
except OSError as exc:
|
|
107
|
+
raise CodexImageGenerationError(
|
|
108
|
+
t("codex.imagegen.reference_unreadable", path=str(path))
|
|
109
|
+
) from exc
|
|
110
|
+
if len(data) > _MAX_REFERENCE_BYTES:
|
|
111
|
+
raise CodexImageGenerationError(
|
|
112
|
+
t("codex.imagegen.reference_too_large", path=str(path))
|
|
113
|
+
)
|
|
114
|
+
mime, _ = mimetypes.guess_type(str(path))
|
|
115
|
+
if not (mime or "").startswith("image/"):
|
|
116
|
+
mime = "image/png"
|
|
117
|
+
b64 = base64.b64encode(data).decode("ascii")
|
|
118
|
+
encoded.append(f"data:{mime};base64,{b64}")
|
|
119
|
+
return encoded
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def _post_generation_request(
|
|
123
|
+
access_token: str,
|
|
124
|
+
account_id: str,
|
|
125
|
+
prompt: str,
|
|
126
|
+
reference_data_urls: Sequence[str] | None = None,
|
|
127
|
+
) -> dict[str, Any]:
|
|
128
|
+
base_url = str(CHATGPT_OAUTH_CONFIG["api_base_url"]).rstrip("/")
|
|
129
|
+
headers = {
|
|
130
|
+
"Authorization": f"Bearer {access_token}",
|
|
131
|
+
"ChatGPT-Account-Id": account_id,
|
|
132
|
+
"Accept": "application/json",
|
|
133
|
+
"Content-Type": "application/json",
|
|
134
|
+
"originator": CHATGPT_OAUTH_CONFIG.get("originator", "codex_cli_rs"),
|
|
135
|
+
"User-Agent": (
|
|
136
|
+
f"{CHATGPT_OAUTH_CONFIG.get('originator', 'codex_cli_rs')}/"
|
|
137
|
+
f"{CHATGPT_OAUTH_CONFIG.get('client_version', 'unknown')}"
|
|
138
|
+
),
|
|
139
|
+
}
|
|
140
|
+
if reference_data_urls:
|
|
141
|
+
# Reference-conditioned edit: `images` entries must be `{"image_url": ...}`
|
|
142
|
+
# objects only; `background` isn't accepted on this endpoint.
|
|
143
|
+
endpoint = "/images/edits"
|
|
144
|
+
payload = {
|
|
145
|
+
"prompt": prompt,
|
|
146
|
+
"model": _IMAGE_MODEL,
|
|
147
|
+
"images": [{"image_url": url} for url in reference_data_urls],
|
|
148
|
+
"quality": "auto",
|
|
149
|
+
"size": "auto",
|
|
150
|
+
}
|
|
151
|
+
else:
|
|
152
|
+
endpoint = "/images/generations"
|
|
153
|
+
payload = {
|
|
154
|
+
"prompt": prompt,
|
|
155
|
+
"background": "auto",
|
|
156
|
+
"model": _IMAGE_MODEL,
|
|
157
|
+
"quality": "auto",
|
|
158
|
+
"size": "auto",
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
try:
|
|
162
|
+
response = requests.post(
|
|
163
|
+
f"{base_url}{endpoint}",
|
|
164
|
+
headers=headers,
|
|
165
|
+
json=payload,
|
|
166
|
+
timeout=_REQUEST_TIMEOUT_SECONDS,
|
|
167
|
+
)
|
|
168
|
+
response.raise_for_status()
|
|
169
|
+
body = response.json()
|
|
170
|
+
except requests.RequestException as exc:
|
|
171
|
+
detail = _response_error_detail(getattr(exc, "response", None))
|
|
172
|
+
suffix = f": {detail}" if detail else ""
|
|
173
|
+
raise CodexImageGenerationError(
|
|
174
|
+
t("codex.imagegen.request_failed", detail=suffix)
|
|
175
|
+
) from exc
|
|
176
|
+
except ValueError as exc:
|
|
177
|
+
raise CodexImageGenerationError(t("codex.imagegen.invalid_json")) from exc
|
|
178
|
+
|
|
179
|
+
if not isinstance(body, dict):
|
|
180
|
+
raise CodexImageGenerationError(t("codex.imagegen.invalid_response"))
|
|
181
|
+
return body
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def _response_error_detail(response: requests.Response | None) -> str:
|
|
185
|
+
if response is None:
|
|
186
|
+
return ""
|
|
187
|
+
try:
|
|
188
|
+
body = response.json()
|
|
189
|
+
except ValueError:
|
|
190
|
+
return response.text.strip()[:300]
|
|
191
|
+
if not isinstance(body, dict):
|
|
192
|
+
return ""
|
|
193
|
+
error = body.get("error")
|
|
194
|
+
if isinstance(error, dict):
|
|
195
|
+
return str(error.get("message", ""))[:300]
|
|
196
|
+
return str(error or body.get("detail", ""))[:300]
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def _decode_first_image(body: dict[str, Any]) -> bytes:
|
|
200
|
+
data = body.get("data")
|
|
201
|
+
encoded = data[0].get("b64_json") if isinstance(data, list) and data else None
|
|
202
|
+
if not isinstance(encoded, str) or not encoded:
|
|
203
|
+
raise CodexImageGenerationError(t("codex.imagegen.no_data"))
|
|
204
|
+
try:
|
|
205
|
+
return base64.b64decode(encoded, validate=True)
|
|
206
|
+
except (binascii.Error, ValueError) as exc:
|
|
207
|
+
raise CodexImageGenerationError(t("codex.imagegen.malformed_data")) from exc
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def emit_iterm_image(output_path: Path) -> bool:
|
|
211
|
+
"""Display a saved image with iTerm2's OSC 1337 inline-image protocol."""
|
|
212
|
+
if not _is_iterm2() or not sys.stdout.isatty():
|
|
213
|
+
return False
|
|
214
|
+
|
|
215
|
+
try:
|
|
216
|
+
image_data = base64.b64encode(output_path.read_bytes()).decode("ascii")
|
|
217
|
+
encoded_name = base64.b64encode(output_path.name.encode()).decode("ascii")
|
|
218
|
+
sequence = (
|
|
219
|
+
f"\033]1337;File=name={encoded_name};inline=1;"
|
|
220
|
+
f"preserveAspectRatio=1:{image_data}\a\n"
|
|
221
|
+
)
|
|
222
|
+
from code_puppy.messaging.run_ui import suspended_run_ui
|
|
223
|
+
|
|
224
|
+
with suspended_run_ui():
|
|
225
|
+
sys.stdout.write(sequence)
|
|
226
|
+
sys.stdout.flush()
|
|
227
|
+
except Exception:
|
|
228
|
+
# Inline display is best-effort; the image remains safely saved even if
|
|
229
|
+
# terminal detection lied or the active UI cannot be suspended.
|
|
230
|
+
return False
|
|
231
|
+
return True
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def _is_iterm2() -> bool:
|
|
235
|
+
return bool(
|
|
236
|
+
os.environ.get("ITERM_SESSION_ID")
|
|
237
|
+
or os.environ.get("TERM_PROGRAM", "").lower() == "iterm.app"
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
def _save_image(image_bytes: bytes) -> Path:
|
|
242
|
+
output_dir = Path(config.DATA_DIR) / "generated_images"
|
|
243
|
+
output_dir.mkdir(parents=True, exist_ok=True, mode=0o700)
|
|
244
|
+
output_path = output_dir / f"codex-{uuid.uuid4().hex}.png"
|
|
245
|
+
temporary_path = output_path.with_suffix(".tmp")
|
|
246
|
+
try:
|
|
247
|
+
temporary_path.write_bytes(image_bytes)
|
|
248
|
+
os.chmod(temporary_path, 0o600)
|
|
249
|
+
temporary_path.replace(output_path)
|
|
250
|
+
except OSError as exc:
|
|
251
|
+
temporary_path.unlink(missing_ok=True)
|
|
252
|
+
raise CodexImageGenerationError(t("codex.imagegen.save_failed")) from exc
|
|
253
|
+
return output_path
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Agent-facing Codex OAuth image-generation tool."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from pydantic_ai import RunContext
|
|
9
|
+
|
|
10
|
+
from .image_generation import (
|
|
11
|
+
CodexImageGenerationError,
|
|
12
|
+
emit_iterm_image,
|
|
13
|
+
generate_image,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
TOOL_NAME = "codex_imagegen"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def register_codex_imagegen(agent: Any) -> None:
|
|
20
|
+
"""Register image generation on a pydantic-ai agent."""
|
|
21
|
+
|
|
22
|
+
@agent.tool
|
|
23
|
+
async def codex_imagegen(
|
|
24
|
+
context: RunContext,
|
|
25
|
+
prompt: str,
|
|
26
|
+
reference_images: list[str] | None = None,
|
|
27
|
+
) -> dict[str, Any]:
|
|
28
|
+
"""Generate a raster image using gpt-image-2 and Codex OAuth.
|
|
29
|
+
|
|
30
|
+
Use this when the user asks you to create a photo, illustration, icon,
|
|
31
|
+
sprite, texture, product image, banner, or other raster artwork. Write a
|
|
32
|
+
complete standalone visual prompt because the image model does not see
|
|
33
|
+
the conversation. The PNG is saved automatically and displayed inline
|
|
34
|
+
in iTerm2 when supported.
|
|
35
|
+
|
|
36
|
+
Pass ``reference_images`` to condition the result on existing images
|
|
37
|
+
instead of generating from text alone. Reach for it whenever the output
|
|
38
|
+
must stay visually consistent with something that already exists:
|
|
39
|
+
|
|
40
|
+
* the SAME character across multiple images (portraits, expressions,
|
|
41
|
+
poses) — conditioning on a canonical reference holds identity far
|
|
42
|
+
better than re-describing the face in words;
|
|
43
|
+
* matching an established art style, palette, or lighting;
|
|
44
|
+
* iterating on an existing asset ("same logo, but on a dark
|
|
45
|
+
background").
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
prompt: Detailed standalone description of the image to generate.
|
|
49
|
+
reference_images: Optional paths to existing image files to
|
|
50
|
+
condition on. Describe the CHANGE you want in ``prompt``; the
|
|
51
|
+
references supply the subject and style to preserve.
|
|
52
|
+
"""
|
|
53
|
+
del context
|
|
54
|
+
try:
|
|
55
|
+
output_path = await asyncio.to_thread(
|
|
56
|
+
generate_image, prompt, reference_images
|
|
57
|
+
)
|
|
58
|
+
except CodexImageGenerationError as exc:
|
|
59
|
+
return {"success": False, "error": str(exc)}
|
|
60
|
+
|
|
61
|
+
displayed_inline = emit_iterm_image(output_path)
|
|
62
|
+
return {
|
|
63
|
+
"success": True,
|
|
64
|
+
"path": str(output_path),
|
|
65
|
+
"displayed_inline": displayed_inline,
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def register_tools_callback() -> list[dict[str, Any]]:
|
|
70
|
+
return [{"name": TOOL_NAME, "register_func": register_codex_imagegen}]
|