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.
Files changed (313) hide show
  1. code_puppy_core_plugins/__init__.py +5 -0
  2. code_puppy_core_plugins/acp/README.md +266 -0
  3. code_puppy_core_plugins/acp/__init__.py +8 -0
  4. code_puppy_core_plugins/acp/agent.py +494 -0
  5. code_puppy_core_plugins/acp/bridge.py +309 -0
  6. code_puppy_core_plugins/acp/capabilities.py +73 -0
  7. code_puppy_core_plugins/acp/commands.py +116 -0
  8. code_puppy_core_plugins/acp/content.py +115 -0
  9. code_puppy_core_plugins/acp/io_delegation.py +231 -0
  10. code_puppy_core_plugins/acp/mcp_config.py +66 -0
  11. code_puppy_core_plugins/acp/permissions.py +159 -0
  12. code_puppy_core_plugins/acp/persistence.py +197 -0
  13. code_puppy_core_plugins/acp/register_callbacks.py +110 -0
  14. code_puppy_core_plugins/acp/replay.py +114 -0
  15. code_puppy_core_plugins/acp/session.py +329 -0
  16. code_puppy_core_plugins/acp/session_config.py +179 -0
  17. code_puppy_core_plugins/acp/state.py +135 -0
  18. code_puppy_core_plugins/agent_skills/__init__.py +22 -0
  19. code_puppy_core_plugins/agent_skills/config.py +208 -0
  20. code_puppy_core_plugins/agent_skills/discovery.py +337 -0
  21. code_puppy_core_plugins/agent_skills/downloader.py +392 -0
  22. code_puppy_core_plugins/agent_skills/enabled_skills.py +82 -0
  23. code_puppy_core_plugins/agent_skills/installer.py +22 -0
  24. code_puppy_core_plugins/agent_skills/metadata.py +219 -0
  25. code_puppy_core_plugins/agent_skills/prompt_builder.py +49 -0
  26. code_puppy_core_plugins/agent_skills/provider.py +52 -0
  27. code_puppy_core_plugins/agent_skills/register_callbacks.py +309 -0
  28. code_puppy_core_plugins/agent_skills/remote_catalog.py +322 -0
  29. code_puppy_core_plugins/agent_skills/skill_catalog.py +257 -0
  30. code_puppy_core_plugins/agent_skills/skill_commands.py +102 -0
  31. code_puppy_core_plugins/agent_skills/skills_install_menu.py +698 -0
  32. code_puppy_core_plugins/agent_skills/skills_menu.py +794 -0
  33. code_puppy_core_plugins/aws_bedrock/__init__.py +14 -0
  34. code_puppy_core_plugins/aws_bedrock/config.py +101 -0
  35. code_puppy_core_plugins/aws_bedrock/register_callbacks.py +243 -0
  36. code_puppy_core_plugins/aws_bedrock/utils.py +186 -0
  37. code_puppy_core_plugins/azure_foundry/README.md +238 -0
  38. code_puppy_core_plugins/azure_foundry/__init__.py +15 -0
  39. code_puppy_core_plugins/azure_foundry/config.py +126 -0
  40. code_puppy_core_plugins/azure_foundry/discovery.py +189 -0
  41. code_puppy_core_plugins/azure_foundry/register_callbacks.py +506 -0
  42. code_puppy_core_plugins/azure_foundry/token.py +182 -0
  43. code_puppy_core_plugins/azure_foundry/utils.py +375 -0
  44. code_puppy_core_plugins/btw/__init__.py +1 -0
  45. code_puppy_core_plugins/btw/inline_view.py +135 -0
  46. code_puppy_core_plugins/btw/register_callbacks.py +106 -0
  47. code_puppy_core_plugins/btw/side_query.py +91 -0
  48. code_puppy_core_plugins/chatgpt_oauth/IMAGEGEN_SKILL.md +83 -0
  49. code_puppy_core_plugins/chatgpt_oauth/__init__.py +8 -0
  50. code_puppy_core_plugins/chatgpt_oauth/config.py +52 -0
  51. code_puppy_core_plugins/chatgpt_oauth/image_generation.py +253 -0
  52. code_puppy_core_plugins/chatgpt_oauth/image_tool.py +70 -0
  53. code_puppy_core_plugins/chatgpt_oauth/oauth_flow.py +461 -0
  54. code_puppy_core_plugins/chatgpt_oauth/register_callbacks.py +288 -0
  55. code_puppy_core_plugins/chatgpt_oauth/test_plugin.py +663 -0
  56. code_puppy_core_plugins/chatgpt_oauth/usage.py +113 -0
  57. code_puppy_core_plugins/chatgpt_oauth/utils.py +534 -0
  58. code_puppy_core_plugins/claude_code_hooks/__init__.py +1 -0
  59. code_puppy_core_plugins/claude_code_hooks/config.py +137 -0
  60. code_puppy_core_plugins/claude_code_hooks/register_callbacks.py +383 -0
  61. code_puppy_core_plugins/claude_code_oauth/README.md +167 -0
  62. code_puppy_core_plugins/claude_code_oauth/SETUP.md +93 -0
  63. code_puppy_core_plugins/claude_code_oauth/__init__.py +25 -0
  64. code_puppy_core_plugins/claude_code_oauth/config.py +59 -0
  65. code_puppy_core_plugins/claude_code_oauth/fast_mode.py +122 -0
  66. code_puppy_core_plugins/claude_code_oauth/prompt_handler.py +64 -0
  67. code_puppy_core_plugins/claude_code_oauth/register_callbacks.py +719 -0
  68. code_puppy_core_plugins/claude_code_oauth/test_plugin.py +285 -0
  69. code_puppy_core_plugins/claude_code_oauth/token_refresh_heartbeat.py +240 -0
  70. code_puppy_core_plugins/claude_code_oauth/utils.py +663 -0
  71. code_puppy_core_plugins/code_puppy_agent/AGENTS_AND_TOOLS.md +155 -0
  72. code_puppy_core_plugins/code_puppy_agent/MODELS_AND_MCP.md +104 -0
  73. code_puppy_core_plugins/code_puppy_agent/PLUGINS_AND_CALLBACKS.md +147 -0
  74. code_puppy_core_plugins/code_puppy_agent/SESSIONS_AND_HISTORY.md +39 -0
  75. code_puppy_core_plugins/code_puppy_agent/SKILL.md +180 -0
  76. code_puppy_core_plugins/code_puppy_agent/SKILLS_SYSTEM.md +136 -0
  77. code_puppy_core_plugins/code_puppy_agent/SYSTEM_PROMPT_CONFIG_AND_I18N.md +160 -0
  78. code_puppy_core_plugins/code_puppy_agent/__init__.py +5 -0
  79. code_puppy_core_plugins/code_puppy_agent/register_callbacks.py +46 -0
  80. code_puppy_core_plugins/computer_use/NativeCapture.swift +123 -0
  81. code_puppy_core_plugins/computer_use/README.md +109 -0
  82. code_puppy_core_plugins/computer_use/__init__.py +1 -0
  83. code_puppy_core_plugins/computer_use/accessibility.py +163 -0
  84. code_puppy_core_plugins/computer_use/activation.py +75 -0
  85. code_puppy_core_plugins/computer_use/backend.py +584 -0
  86. code_puppy_core_plugins/computer_use/backend_types.py +5 -0
  87. code_puppy_core_plugins/computer_use/capture.py +110 -0
  88. code_puppy_core_plugins/computer_use/commands.py +62 -0
  89. code_puppy_core_plugins/computer_use/geometry.py +81 -0
  90. code_puppy_core_plugins/computer_use/inline_image.py +56 -0
  91. code_puppy_core_plugins/computer_use/keycodes.py +47 -0
  92. code_puppy_core_plugins/computer_use/policy.py +144 -0
  93. code_puppy_core_plugins/computer_use/register_callbacks.py +96 -0
  94. code_puppy_core_plugins/computer_use/safety.py +18 -0
  95. code_puppy_core_plugins/computer_use/settle.py +64 -0
  96. code_puppy_core_plugins/computer_use/state.py +86 -0
  97. code_puppy_core_plugins/computer_use/tools.py +469 -0
  98. code_puppy_core_plugins/context_indicator/__init__.py +14 -0
  99. code_puppy_core_plugins/context_indicator/register_callbacks.py +249 -0
  100. code_puppy_core_plugins/context_indicator/usage.py +40 -0
  101. code_puppy_core_plugins/copilot_auth/__init__.py +11 -0
  102. code_puppy_core_plugins/copilot_auth/config.py +93 -0
  103. code_puppy_core_plugins/copilot_auth/reasoning_client.py +409 -0
  104. code_puppy_core_plugins/copilot_auth/register_callbacks.py +460 -0
  105. code_puppy_core_plugins/copilot_auth/utils.py +587 -0
  106. code_puppy_core_plugins/customizable_commands/__init__.py +0 -0
  107. code_puppy_core_plugins/customizable_commands/register_callbacks.py +464 -0
  108. code_puppy_core_plugins/dbos_durable_exec/__init__.py +1 -0
  109. code_puppy_core_plugins/dbos_durable_exec/cancel.py +15 -0
  110. code_puppy_core_plugins/dbos_durable_exec/commands.py +31 -0
  111. code_puppy_core_plugins/dbos_durable_exec/config.py +31 -0
  112. code_puppy_core_plugins/dbos_durable_exec/lifecycle.py +83 -0
  113. code_puppy_core_plugins/dbos_durable_exec/register_callbacks.py +45 -0
  114. code_puppy_core_plugins/dbos_durable_exec/runtime.py +65 -0
  115. code_puppy_core_plugins/dbos_durable_exec/startup_lock.py +155 -0
  116. code_puppy_core_plugins/dbos_durable_exec/workflow_ids.py +16 -0
  117. code_puppy_core_plugins/dbos_durable_exec/wrapper.py +58 -0
  118. code_puppy_core_plugins/destructive_command_guard/AGENTS.md +79 -0
  119. code_puppy_core_plugins/destructive_command_guard/__init__.py +14 -0
  120. code_puppy_core_plugins/destructive_command_guard/detector.py +374 -0
  121. code_puppy_core_plugins/destructive_command_guard/register_callbacks.py +165 -0
  122. code_puppy_core_plugins/emoji_filter/__init__.py +12 -0
  123. code_puppy_core_plugins/emoji_filter/config.py +26 -0
  124. code_puppy_core_plugins/emoji_filter/register_callbacks.py +238 -0
  125. code_puppy_core_plugins/emoji_filter/stripper.py +45 -0
  126. code_puppy_core_plugins/empty_html_comment_filter/register_callbacks.py +116 -0
  127. code_puppy_core_plugins/example_custom_command/README.md +328 -0
  128. code_puppy_core_plugins/example_custom_command/register_callbacks.py +66 -0
  129. code_puppy_core_plugins/file_permission_handler/__init__.py +4 -0
  130. code_puppy_core_plugins/file_permission_handler/register_callbacks.py +575 -0
  131. code_puppy_core_plugins/flux_bootstrap/__init__.py +5 -0
  132. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/_docs/README.md +173 -0
  133. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/_docs/cheatsheet.md +86 -0
  134. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/_docs/pipeline.md +167 -0
  135. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/_docs/synopsis.md +392 -0
  136. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/about.md +51 -0
  137. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/address-feedback.md +129 -0
  138. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/ask.md +211 -0
  139. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/aug.md +181 -0
  140. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/auto-pilot.md +71 -0
  141. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/cheatsheet.md +16 -0
  142. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/commit.md +103 -0
  143. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/config.md +108 -0
  144. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/create-pr.md +195 -0
  145. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/exec.md +221 -0
  146. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/new.md +151 -0
  147. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/qa.md +208 -0
  148. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/rebase.md +180 -0
  149. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/review.md +304 -0
  150. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/split.md +120 -0
  151. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/squash-commits.md +179 -0
  152. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/status.md +46 -0
  153. code_puppy_core_plugins/flux_bootstrap/bundled/commands/flux/tests.md +155 -0
  154. code_puppy_core_plugins/flux_bootstrap/bundled/scripts/flux_about.py +154 -0
  155. code_puppy_core_plugins/flux_bootstrap/bundled/scripts/flux_cheatsheet.py +248 -0
  156. code_puppy_core_plugins/flux_bootstrap/bundled/scripts/flux_status.py +345 -0
  157. code_puppy_core_plugins/flux_bootstrap/installer.py +256 -0
  158. code_puppy_core_plugins/flux_bootstrap/register_callbacks.py +71 -0
  159. code_puppy_core_plugins/force_push_guard/__init__.py +5 -0
  160. code_puppy_core_plugins/force_push_guard/detector.py +96 -0
  161. code_puppy_core_plugins/force_push_guard/register_callbacks.py +161 -0
  162. code_puppy_core_plugins/fork/__init__.py +7 -0
  163. code_puppy_core_plugins/fork/register_callbacks.py +445 -0
  164. code_puppy_core_plugins/frontend_emitter/__init__.py +25 -0
  165. code_puppy_core_plugins/frontend_emitter/emitter.py +249 -0
  166. code_puppy_core_plugins/frontend_emitter/register_callbacks.py +412 -0
  167. code_puppy_core_plugins/frontend_emitter/session_context.py +50 -0
  168. code_puppy_core_plugins/grok_oauth/__init__.py +6 -0
  169. code_puppy_core_plugins/grok_oauth/config.py +49 -0
  170. code_puppy_core_plugins/grok_oauth/oauth_flow.py +213 -0
  171. code_puppy_core_plugins/grok_oauth/register_callbacks.py +132 -0
  172. code_puppy_core_plugins/grok_oauth/utils.py +195 -0
  173. code_puppy_core_plugins/herdr/README.md +168 -0
  174. code_puppy_core_plugins/herdr/__init__.py +9 -0
  175. code_puppy_core_plugins/herdr/client.py +339 -0
  176. code_puppy_core_plugins/herdr/register_callbacks.py +140 -0
  177. code_puppy_core_plugins/herdr/reporter.py +212 -0
  178. code_puppy_core_plugins/herdr/smoke.py +143 -0
  179. code_puppy_core_plugins/herdr/sources.py +133 -0
  180. code_puppy_core_plugins/hook_creator/__init__.py +1 -0
  181. code_puppy_core_plugins/hook_creator/register_callbacks.py +33 -0
  182. code_puppy_core_plugins/hook_manager/__init__.py +1 -0
  183. code_puppy_core_plugins/hook_manager/config.py +290 -0
  184. code_puppy_core_plugins/hook_manager/hooks_menu.py +571 -0
  185. code_puppy_core_plugins/hook_manager/register_callbacks.py +227 -0
  186. code_puppy_core_plugins/meta_oauth/__init__.py +1 -0
  187. code_puppy_core_plugins/meta_oauth/config.py +55 -0
  188. code_puppy_core_plugins/meta_oauth/oauth_flow.py +109 -0
  189. code_puppy_core_plugins/meta_oauth/register_callbacks.py +154 -0
  190. code_puppy_core_plugins/meta_oauth/utils.py +252 -0
  191. code_puppy_core_plugins/namespace_skill_search/README.md +118 -0
  192. code_puppy_core_plugins/namespace_skill_search/__init__.py +15 -0
  193. code_puppy_core_plugins/namespace_skill_search/namespaces.py +125 -0
  194. code_puppy_core_plugins/namespace_skill_search/register_callbacks.py +99 -0
  195. code_puppy_core_plugins/namespace_skill_search/search_tool.py +158 -0
  196. code_puppy_core_plugins/no_tools/__init__.py +0 -0
  197. code_puppy_core_plugins/no_tools/register_callbacks.py +42 -0
  198. code_puppy_core_plugins/oauth_pasteback.py +110 -0
  199. code_puppy_core_plugins/oauth_puppy_html.py +194 -0
  200. code_puppy_core_plugins/obsidian_agent/README.md +52 -0
  201. code_puppy_core_plugins/obsidian_agent/__init__.py +8 -0
  202. code_puppy_core_plugins/obsidian_agent/agent_obsidian.py +147 -0
  203. code_puppy_core_plugins/obsidian_agent/register_callbacks.py +13 -0
  204. code_puppy_core_plugins/ollama/__init__.py +1 -0
  205. code_puppy_core_plugins/ollama/register_callbacks.py +127 -0
  206. code_puppy_core_plugins/ollama_setup/__init__.py +5 -0
  207. code_puppy_core_plugins/ollama_setup/completer.py +38 -0
  208. code_puppy_core_plugins/ollama_setup/register_callbacks.py +419 -0
  209. code_puppy_core_plugins/plugin_list/__init__.py +0 -0
  210. code_puppy_core_plugins/plugin_list/plugin_contributions.py +348 -0
  211. code_puppy_core_plugins/plugin_list/plugin_meta.py +67 -0
  212. code_puppy_core_plugins/plugin_list/plugin_text_utils.py +173 -0
  213. code_puppy_core_plugins/plugin_list/plugins_menu.py +455 -0
  214. code_puppy_core_plugins/plugin_list/plugins_menu_layout.py +194 -0
  215. code_puppy_core_plugins/plugin_list/plugins_menu_render.py +431 -0
  216. code_puppy_core_plugins/plugin_list/project_trust_flow.py +162 -0
  217. code_puppy_core_plugins/plugin_list/register_callbacks.py +281 -0
  218. code_puppy_core_plugins/pop_command/__init__.py +1 -0
  219. code_puppy_core_plugins/pop_command/register_callbacks.py +191 -0
  220. code_puppy_core_plugins/prompt_newline/__init__.py +13 -0
  221. code_puppy_core_plugins/prompt_newline/config.py +21 -0
  222. code_puppy_core_plugins/prompt_newline/register_callbacks.py +163 -0
  223. code_puppy_core_plugins/prune/__init__.py +1 -0
  224. code_puppy_core_plugins/prune/prune_menu.py +308 -0
  225. code_puppy_core_plugins/prune/prune_model.py +517 -0
  226. code_puppy_core_plugins/prune/prune_render.py +354 -0
  227. code_puppy_core_plugins/prune/register_callbacks.py +388 -0
  228. code_puppy_core_plugins/puppy_kennel/README.md +203 -0
  229. code_puppy_core_plugins/puppy_kennel/__init__.py +6 -0
  230. code_puppy_core_plugins/puppy_kennel/commands.py +206 -0
  231. code_puppy_core_plugins/puppy_kennel/config.py +36 -0
  232. code_puppy_core_plugins/puppy_kennel/kennel.py +368 -0
  233. code_puppy_core_plugins/puppy_kennel/packer.py +152 -0
  234. code_puppy_core_plugins/puppy_kennel/recorder.py +83 -0
  235. code_puppy_core_plugins/puppy_kennel/register_callbacks.py +109 -0
  236. code_puppy_core_plugins/puppy_kennel/retriever.py +28 -0
  237. code_puppy_core_plugins/puppy_kennel/schema.py +78 -0
  238. code_puppy_core_plugins/puppy_kennel/state.py +68 -0
  239. code_puppy_core_plugins/puppy_kennel/tools.py +449 -0
  240. code_puppy_core_plugins/puppy_kennel/wings.py +110 -0
  241. code_puppy_core_plugins/puppy_spinner/README.md +93 -0
  242. code_puppy_core_plugins/puppy_spinner/__init__.py +11 -0
  243. code_puppy_core_plugins/puppy_spinner/builtin_frames.py +172 -0
  244. code_puppy_core_plugins/puppy_spinner/commands.py +116 -0
  245. code_puppy_core_plugins/puppy_spinner/picker.py +379 -0
  246. code_puppy_core_plugins/puppy_spinner/register_callbacks.py +193 -0
  247. code_puppy_core_plugins/puppy_spinner/spinners.py +444 -0
  248. code_puppy_core_plugins/quick_resume/__init__.py +0 -0
  249. code_puppy_core_plugins/quick_resume/register_callbacks.py +77 -0
  250. code_puppy_core_plugins/review_pr/__init__.py +1 -0
  251. code_puppy_core_plugins/review_pr/register_callbacks.py +162 -0
  252. code_puppy_core_plugins/shell_safety/__init__.py +6 -0
  253. code_puppy_core_plugins/shell_safety/agent_shell_safety.py +69 -0
  254. code_puppy_core_plugins/shell_safety/command_cache.py +156 -0
  255. code_puppy_core_plugins/shell_safety/register_callbacks.py +203 -0
  256. code_puppy_core_plugins/stack_dump/__init__.py +1 -0
  257. code_puppy_core_plugins/stack_dump/register_callbacks.py +79 -0
  258. code_puppy_core_plugins/statusline/__init__.py +14 -0
  259. code_puppy_core_plugins/statusline/config.py +68 -0
  260. code_puppy_core_plugins/statusline/payload.py +138 -0
  261. code_puppy_core_plugins/statusline/prompt_patch.py +76 -0
  262. code_puppy_core_plugins/statusline/register_callbacks.py +45 -0
  263. code_puppy_core_plugins/statusline/runner.py +122 -0
  264. code_puppy_core_plugins/statusline/statusline_command.py +197 -0
  265. code_puppy_core_plugins/steer_queue/__init__.py +10 -0
  266. code_puppy_core_plugins/steer_queue/queue_menu.py +444 -0
  267. code_puppy_core_plugins/steer_queue/register_callbacks.py +138 -0
  268. code_puppy_core_plugins/subagent_panel/README.md +102 -0
  269. code_puppy_core_plugins/subagent_panel/__init__.py +24 -0
  270. code_puppy_core_plugins/subagent_panel/coalesce_patch.py +242 -0
  271. code_puppy_core_plugins/subagent_panel/panel_render.py +145 -0
  272. code_puppy_core_plugins/subagent_panel/register_callbacks.py +535 -0
  273. code_puppy_core_plugins/subagent_panel/resume_repaint.py +112 -0
  274. code_puppy_core_plugins/subagent_panel/state.py +231 -0
  275. code_puppy_core_plugins/switch_agent_resume/__init__.py +5 -0
  276. code_puppy_core_plugins/switch_agent_resume/register_callbacks.py +314 -0
  277. code_puppy_core_plugins/theme/README.md +86 -0
  278. code_puppy_core_plugins/theme/__init__.py +14 -0
  279. code_puppy_core_plugins/theme/bundled_palettes.py +346 -0
  280. code_puppy_core_plugins/theme/content_styles.py +146 -0
  281. code_puppy_core_plugins/theme/osc_palette.py +178 -0
  282. code_puppy_core_plugins/theme/picker.py +358 -0
  283. code_puppy_core_plugins/theme/prompt_toolkit_theme.py +113 -0
  284. code_puppy_core_plugins/theme/register_callbacks.py +348 -0
  285. code_puppy_core_plugins/theme/rich_themes.py +202 -0
  286. code_puppy_core_plugins/theme/themes.py +720 -0
  287. code_puppy_core_plugins/timestamp_heartbeat/__init__.py +1 -0
  288. code_puppy_core_plugins/timestamp_heartbeat/register_callbacks.py +114 -0
  289. code_puppy_core_plugins/token_ratio_learner/__init__.py +5 -0
  290. code_puppy_core_plugins/token_ratio_learner/ratios.py +208 -0
  291. code_puppy_core_plugins/token_ratio_learner/register_callbacks.py +213 -0
  292. code_puppy_core_plugins/universal_constructor/__init__.py +13 -0
  293. code_puppy_core_plugins/universal_constructor/models.py +138 -0
  294. code_puppy_core_plugins/universal_constructor/provider.py +62 -0
  295. code_puppy_core_plugins/universal_constructor/register_callbacks.py +75 -0
  296. code_puppy_core_plugins/universal_constructor/registry.py +302 -0
  297. code_puppy_core_plugins/universal_constructor/sandbox.py +584 -0
  298. code_puppy_core_plugins/wide_completion_menu/__init__.py +6 -0
  299. code_puppy_core_plugins/wide_completion_menu/register_callbacks.py +165 -0
  300. code_puppy_core_plugins/wiggum/__init__.py +1 -0
  301. code_puppy_core_plugins/wiggum/goal_runs.py +91 -0
  302. code_puppy_core_plugins/wiggum/judge.py +299 -0
  303. code_puppy_core_plugins/wiggum/judge_config.py +249 -0
  304. code_puppy_core_plugins/wiggum/judges_menu.py +814 -0
  305. code_puppy_core_plugins/wiggum/register_callbacks.py +569 -0
  306. code_puppy_core_plugins/wiggum/state.py +89 -0
  307. code_puppy_core_plugins/yolo_cli/__init__.py +1 -0
  308. code_puppy_core_plugins/yolo_cli/register_callbacks.py +41 -0
  309. code_puppy_core_plugins-0.0.2.dist-info/METADATA +64 -0
  310. code_puppy_core_plugins-0.0.2.dist-info/RECORD +313 -0
  311. code_puppy_core_plugins-0.0.2.dist-info/WHEEL +4 -0
  312. code_puppy_core_plugins-0.0.2.dist-info/entry_points.txt +55 -0
  313. code_puppy_core_plugins-0.0.2.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,419 @@
1
+ """Ollama cloud model setup — /ollama-setup command.
2
+
3
+ Pulls an Ollama `:cloud` model and registers it in extra_models.json so the
4
+ model is immediately available for use in Code Puppy.
5
+
6
+ Cloud models supported (the Ollama "Recommended Models" cloud tier):
7
+ kimi-k2.6:cloud, kimi-k2.5:cloud, glm-5:cloud, glm-5.1:cloud, minimax-m2.7:cloud, qwen3.5:cloud
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import logging
13
+ import shutil
14
+ import subprocess
15
+ from typing import Any, Optional
16
+
17
+ from code_puppy import atomic_json
18
+ from code_puppy.callbacks import register_callback
19
+ from code_puppy.config import EXTRA_MODELS_FILE
20
+ from code_puppy.messaging import emit_error, emit_info, emit_success, emit_warning
21
+
22
+ logger = logging.getLogger(__name__)
23
+
24
+ # Cloud model catalogue: Ollama recommended ``:cloud`` tags mapped to
25
+ # ``extra_models.json`` metadata.
26
+
27
+ CLOUD_MODELS: dict[str, dict[str, Any]] = {
28
+ "kimi-k2.6:cloud": {
29
+ "context_length": 262144, # 256k
30
+ "description": "Moonshot Kimi K2.6 (cloud)",
31
+ },
32
+ "kimi-k2.5:cloud": {
33
+ "context_length": 262144, # 256k
34
+ "description": "Moonshot Kimi K2.5 (cloud)",
35
+ },
36
+ "glm-5:cloud": {
37
+ "context_length": 204800, # 200k
38
+ "description": "ZhipuAI GLM-5 (cloud)",
39
+ },
40
+ "glm-5.1:cloud": {
41
+ "context_length": 204800, # 200k
42
+ "description": "ZhipuAI GLM-5.1 (cloud)",
43
+ },
44
+ "minimax-m2.7:cloud": {
45
+ "context_length": 199680, # 195k
46
+ "description": "MiniMax M2.7 (cloud)",
47
+ },
48
+ "qwen3.5:cloud": {
49
+ "context_length": 204800, # 200k
50
+ "description": "Alibaba Qwen 3.5 (cloud)",
51
+ },
52
+ }
53
+
54
+ OLLAMA_ENDPOINT = "http://localhost:11434/v1"
55
+ OLLAMA_API_KEY = "ollama" # Ollama's local API doesn't need a real key
56
+
57
+
58
+ # ── Helpers ─────────────────────────────────────────────────────────────────
59
+
60
+
61
+ def _model_key(model_tag: str) -> str:
62
+ """Derive a unique extra_models.json key from an ollama tag.
63
+
64
+ e.g. ``glm-5:cloud`` → ``ollama-glm-5-cloud``
65
+ """
66
+ return "ollama-" + model_tag.replace(":", "-").replace("/", "-")
67
+
68
+
69
+ def _ollama_available() -> bool:
70
+ """Return True if the ``ollama`` CLI is on PATH."""
71
+ return shutil.which("ollama") is not None
72
+
73
+
74
+ def _pull_model(model_tag: str) -> bool:
75
+ """Run ``ollama pull <model_tag>``, streaming output to the terminal.
76
+
77
+ Returns True on success, False on failure.
78
+ """
79
+ emit_info(f"🐕 Pulling {model_tag} via ollama …")
80
+ try:
81
+ result = subprocess.run(
82
+ ["ollama", "pull", model_tag],
83
+ capture_output=True,
84
+ text=True,
85
+ timeout=600,
86
+ )
87
+ if result.returncode != 0:
88
+ stderr = result.stderr.strip()
89
+ emit_error(f"ollama pull failed (exit {result.returncode}): {stderr}")
90
+ return False
91
+
92
+ stdout = result.stdout.strip()
93
+ if stdout:
94
+ emit_info(stdout)
95
+ return True
96
+ except subprocess.TimeoutExpired:
97
+ emit_error("ollama pull timed out after 10 minutes")
98
+ return False
99
+ except Exception as exc:
100
+ emit_error(f"Failed to run ollama pull: {exc}")
101
+ return False
102
+
103
+
104
+ class _ExtraModelsNotADict(Exception):
105
+ """Sentinel: extra_models.json parsed to something other than a dict."""
106
+
107
+
108
+ def _register_model(model_tag: str) -> bool:
109
+ """Write (or update) the model entry in extra_models.json.
110
+
111
+ Uses :func:`code_puppy.atomic_json.mutate_json` for a bounded, locked,
112
+ atomically-written read-modify-write -- this file is also touched by
113
+ add_model_menu.py and the aws_bedrock/azure_foundry plugins, so an
114
+ unlocked write here could lose one of those concurrent updates.
115
+ Returns True on success.
116
+ """
117
+ meta = CLOUD_MODELS[model_tag]
118
+ key = _model_key(model_tag)
119
+ already_registered = False
120
+
121
+ def _mutate(current: Any) -> dict[str, Any]:
122
+ nonlocal already_registered
123
+ if not isinstance(current, dict):
124
+ raise _ExtraModelsNotADict()
125
+ already_registered = key in current
126
+ current[key] = {
127
+ "type": "custom_openai",
128
+ "name": model_tag,
129
+ "custom_endpoint": {
130
+ "url": OLLAMA_ENDPOINT,
131
+ "api_key": OLLAMA_API_KEY,
132
+ },
133
+ "context_length": meta["context_length"],
134
+ "supported_settings": ["temperature", "top_p"],
135
+ }
136
+ return current
137
+
138
+ try:
139
+ atomic_json.mutate_json(EXTRA_MODELS_FILE, _mutate, default={})
140
+ except _ExtraModelsNotADict:
141
+ emit_error("extra_models.json must be a dict, not a list")
142
+ return False
143
+ except atomic_json.JsonFileCorrupt as exc:
144
+ emit_error(f"Corrupt extra_models.json: {exc}")
145
+ return False
146
+ except Exception as exc:
147
+ emit_error(f"Failed to write extra_models.json: {exc}")
148
+ return False
149
+
150
+ if already_registered:
151
+ emit_info(f"Model {key} already registered \u2014 updating entry")
152
+ emit_success(f"Registered {key} in extra_models.json")
153
+ return True
154
+
155
+
156
+ def _test_model_auth(model_tag: str) -> tuple[bool, str]:
157
+ """Test if the model requires authentication.
158
+
159
+ Returns (authorized: bool, message: str).
160
+ If unauthorized, message contains guidance for the user.
161
+ """
162
+ import json as json_mod
163
+ import urllib.request
164
+
165
+ test_payload = json_mod.dumps(
166
+ {
167
+ "model": model_tag,
168
+ "messages": [{"role": "user", "content": "hi"}],
169
+ "stream": False,
170
+ }
171
+ ).encode("utf-8")
172
+
173
+ req = urllib.request.Request(
174
+ f"{OLLAMA_ENDPOINT}/chat/completions",
175
+ data=test_payload,
176
+ headers={
177
+ "Content-Type": "application/json",
178
+ "Authorization": f"Bearer {OLLAMA_API_KEY}",
179
+ },
180
+ method="POST",
181
+ )
182
+
183
+ try:
184
+ with urllib.request.urlopen(req, timeout=10):
185
+ # 200 = good to go
186
+ return (True, "")
187
+ except urllib.error.HTTPError as e:
188
+ body = e.read().decode("utf-8", errors="replace")
189
+ # Check for auth errors
190
+ if e.code == 401 or "unauthorized" in body.lower():
191
+ return (False, _auth_help_message(model_tag))
192
+ if e.code == 500 and (
193
+ "internal service error" in body.lower() or "unauthorized" in body.lower()
194
+ ):
195
+ # Cloud models often return 500 instead of 401
196
+ return (False, _auth_help_message(model_tag))
197
+ return (False, f"HTTP {e.code}: {body[:200]}")
198
+ except Exception as e:
199
+ return (False, f"Connection test failed: {e}")
200
+
201
+
202
+ def _auth_help_message(model_tag: str) -> str:
203
+ """Generate a helpful auth guidance message."""
204
+ return f"""🔐 Authentication Required for {model_tag}
205
+
206
+ This is a cloud-hosted model (756B+ parameters) that requires Ollama Cloud access.
207
+
208
+ To use this model:
209
+ 1. Run: ollama login
210
+ 2. Visit https://ollama.com to create an account
211
+ 3. Subscribe to Ollama Cloud (cloud models aren't free)
212
+ 4. Accept the terms for {model_tag.split(":")[0]}
213
+
214
+ After logging in, you can use the model with:
215
+ /model {_model_key(model_tag)}
216
+ """
217
+
218
+
219
+ def _run_ollama_login() -> bool:
220
+ """Run ``ollama login`` interactively in the user's terminal.
221
+
222
+ This will open a browser for OAuth flow. Returns True if login succeeded.
223
+ """
224
+ emit_info(
225
+ "🔐 Launching 'ollama login' — this will open your browser for authentication..."
226
+ )
227
+ emit_info(" (Press Ctrl+C here if you want to cancel and do it manually later)")
228
+ emit_info("")
229
+
230
+ try:
231
+ # Run ollama login with stdout/stderr connected to terminal
232
+ # so the user can see the browser-open message and any instructions
233
+ result = subprocess.run(
234
+ ["ollama", "login"],
235
+ capture_output=False, # Let it flow to terminal
236
+ text=True,
237
+ timeout=120, # 2 minutes — OAuth can take a while
238
+ )
239
+
240
+ if result.returncode == 0:
241
+ emit_success("✅ Login completed!")
242
+ return True
243
+ else:
244
+ emit_error(f"ollama login exited with code {result.returncode}")
245
+ return False
246
+ except subprocess.TimeoutExpired:
247
+ emit_error("ollama login timed out after 2 minutes")
248
+ return False
249
+ except Exception as exc:
250
+ emit_error(f"Failed to run ollama login: {exc}")
251
+ return False
252
+
253
+
254
+ def _start_ollama_serve() -> Optional[subprocess.Popen]:
255
+ """Start ``ollama serve`` as a background subprocess if not already running.
256
+
257
+ Returns the Popen handle, or None if already running / on failure.
258
+ """
259
+ # Quick liveness check — hit the version endpoint
260
+ try:
261
+ result = subprocess.run(
262
+ ["ollama", "list"],
263
+ capture_output=True,
264
+ text=True,
265
+ timeout=5,
266
+ )
267
+ if result.returncode == 0:
268
+ emit_info("🟢 Ollama is already running")
269
+ return None
270
+ except Exception:
271
+ pass
272
+
273
+ emit_info("🚀 Starting ollama serve in the background …")
274
+ try:
275
+ proc = subprocess.Popen(
276
+ ["ollama", "serve"],
277
+ stdout=subprocess.DEVNULL,
278
+ stderr=subprocess.DEVNULL,
279
+ )
280
+ emit_success(f"ollama serve started (pid {proc.pid})")
281
+ return proc
282
+ except Exception as exc:
283
+ emit_error(f"Could not start ollama serve: {exc}")
284
+ return None
285
+
286
+
287
+ # ── Command handler ─────────────────────────────────────────────────────────
288
+
289
+
290
+ def _handle_ollama_setup(command: str, name: str) -> Any:
291
+ """Handle ``/ollama-setup [model]``."""
292
+ if name != "ollama-setup":
293
+ return None # Not our command
294
+
295
+ parts = command.split(maxsplit=1)
296
+ model_tag = parts[1].strip() if len(parts) > 1 else ""
297
+
298
+ # No argument → show available models
299
+ if not model_tag:
300
+ lines = ["🦙 Available Ollama cloud models:\n"]
301
+ for tag, meta in CLOUD_MODELS.items():
302
+ lines.append(f" • {tag:25s} — {meta['description']}")
303
+ lines.append("\nUsage: /ollama-setup <model>")
304
+ emit_info("\n".join(lines))
305
+ return True
306
+
307
+ # Fuzzy-ish match: allow partial names like "glm" → "glm-5:cloud"
308
+ matched = _resolve_model(model_tag)
309
+ if matched is None:
310
+ emit_error(f"Unknown model '{model_tag}'. Available: {', '.join(CLOUD_MODELS)}")
311
+ return True
312
+
313
+ # Pre-flight: is ollama installed?
314
+ if not _ollama_available():
315
+ emit_error(
316
+ "ollama CLI not found on PATH. "
317
+ "Install it from https://ollama.com and try again."
318
+ )
319
+ return True
320
+
321
+ # 1. Ensure ollama serve is up
322
+ _start_ollama_serve()
323
+
324
+ # 2. Pull the model
325
+ if not _pull_model(matched):
326
+ return True
327
+
328
+ # 3. Register in extra_models.json
329
+ _register_model(matched)
330
+
331
+ # 4. Test auth / accessibility
332
+ emit_info(f"🔍 Testing {matched} accessibility...")
333
+ authorized, msg = _test_model_auth(matched)
334
+
335
+ if authorized:
336
+ emit_success(
337
+ f"🎉 Done! Switch to the model with: /model {_model_key(matched)}"
338
+ )
339
+ else:
340
+ emit_warning(msg)
341
+ emit_info("")
342
+ emit_info(
343
+ "💡 Want me to run 'ollama login' for you? (This will open your browser)"
344
+ )
345
+ emit_info(
346
+ " Type 'yes' to proceed, or anything else to skip and do it manually later."
347
+ )
348
+
349
+ # We can't do interactive input here (custom commands shouldn't block)
350
+ # So we just run it — worst case it fails and they do it manually
351
+ login_ok = _run_ollama_login()
352
+
353
+ if login_ok:
354
+ # Re-test auth after login
355
+ emit_info("🔍 Re-testing accessibility after login...")
356
+ authorized, msg = _test_model_auth(matched)
357
+
358
+ if authorized:
359
+ emit_success(
360
+ f"🎉 All set! Switch to the model with: /model {_model_key(matched)}"
361
+ )
362
+ else:
363
+ emit_warning("Still not authorized after login.")
364
+ emit_info(
365
+ f"📋 Model registered as '{_model_key(matched)}'. "
366
+ f"You may need to subscribe to Ollama Cloud at https://ollama.com, "
367
+ f"then use /model {_model_key(matched)}"
368
+ )
369
+ else:
370
+ emit_info(
371
+ f"📋 Model registered as '{_model_key(matched)}' but needs auth. "
372
+ f"Run 'ollama login' manually, then use /model {_model_key(matched)}"
373
+ )
374
+
375
+ return True
376
+
377
+
378
+ def _resolve_model(user_input: str) -> Optional[str]:
379
+ """Resolve user input to an exact cloud model tag.
380
+
381
+ Supports exact match and unambiguous prefix matching.
382
+ """
383
+ lowered = user_input.lower().strip()
384
+
385
+ # Exact match first
386
+ for tag in CLOUD_MODELS:
387
+ if tag.lower() == lowered:
388
+ return tag
389
+
390
+ # Prefix / substring match
391
+ candidates = [t for t in CLOUD_MODELS if lowered in t.lower()]
392
+ if len(candidates) == 1:
393
+ return candidates[0]
394
+
395
+ return None
396
+
397
+
398
+ # ── Help entry ──────────────────────────────────────────────────────────────
399
+
400
+
401
+ def _custom_help():
402
+ model_names = ", ".join(CLOUD_MODELS)
403
+ return [
404
+ ("ollama-setup", f"Pull & register an Ollama cloud model ({model_names})"),
405
+ ]
406
+
407
+
408
+ # ── Register ────────────────────────────────────────────────────────────────
409
+
410
+
411
+ def _completion_provider():
412
+ from code_puppy_core_plugins.ollama_setup.completer import OllamaSetupCompleter
413
+
414
+ return OllamaSetupCompleter()
415
+
416
+
417
+ register_callback("register_completion_provider", _completion_provider)
418
+ register_callback("custom_command", _handle_ollama_setup)
419
+ register_callback("custom_command_help", _custom_help)
File without changes