alysis-code 0.13.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (458) hide show
  1. alysis_code/__init__.py +3 -0
  2. alysis_code/__main__.py +4 -0
  3. alysis_code/_build_info.py +14 -0
  4. alysis_code/account_login.py +468 -0
  5. alysis_code/agent/README.md +35 -0
  6. alysis_code/agent/__init__.py +11 -0
  7. alysis_code/agent/acceptance_contract.py +2217 -0
  8. alysis_code/agent/blast_radius.py +1403 -0
  9. alysis_code/agent/cache_keepalive.py +227 -0
  10. alysis_code/agent/completion_certificate.py +366 -0
  11. alysis_code/agent/completion_gate.py +306 -0
  12. alysis_code/agent/empty_response_stall.py +403 -0
  13. alysis_code/agent/errors.py +28 -0
  14. alysis_code/agent/llm_calls.py +475 -0
  15. alysis_code/agent/mutation_classification.py +227 -0
  16. alysis_code/agent/prompt_context.py +2508 -0
  17. alysis_code/agent/read_ledger.py +253 -0
  18. alysis_code/agent/regression_baseline.py +642 -0
  19. alysis_code/agent/reproduction_first.py +610 -0
  20. alysis_code/agent/sensitive_output.py +629 -0
  21. alysis_code/agent/session.py +3218 -0
  22. alysis_code/agent/steering.py +191 -0
  23. alysis_code/agent/subagent_execution.py +5177 -0
  24. alysis_code/agent/subagent_workspace.py +666 -0
  25. alysis_code/agent/tools_assembly.py +4728 -0
  26. alysis_code/agent/turn/__init__.py +101 -0
  27. alysis_code/agent/turn/core.py +8483 -0
  28. alysis_code/agent/turn/events.py +113 -0
  29. alysis_code/agent/turn/exploration.py +590 -0
  30. alysis_code/agent/turn/interventions.py +65 -0
  31. alysis_code/agent/turn/read_cache.py +420 -0
  32. alysis_code/agent/turn/snapshot.py +179 -0
  33. alysis_code/agent/turn_contract.py +661 -0
  34. alysis_code/agent/turn_path.py +129 -0
  35. alysis_code/agent/verification.py +2885 -0
  36. alysis_code/agent/verification_commands.py +512 -0
  37. alysis_code/agent/verification_evidence.py +738 -0
  38. alysis_code/agent_loop.py +693 -0
  39. alysis_code/agent_runtimes/__init__.py +51 -0
  40. alysis_code/agent_runtimes/base.py +114 -0
  41. alysis_code/agent_runtimes/builtins.py +129 -0
  42. alysis_code/agent_runtimes/codex_cli.py +664 -0
  43. alysis_code/agent_runtimes/host.py +263 -0
  44. alysis_code/agent_runtimes/registry.py +64 -0
  45. alysis_code/agent_runtimes/service.py +150 -0
  46. alysis_code/agentbox_client.py +416 -0
  47. alysis_code/agentbox_integration.py +310 -0
  48. alysis_code/alysis_cloud.py +152 -0
  49. alysis_code/approval_scope.py +276 -0
  50. alysis_code/assets/README.md +33 -0
  51. alysis_code/assets/__init__.py +126 -0
  52. alysis_code/assets/asset_read_core.py +281 -0
  53. alysis_code/assets/budget_allocator.py +456 -0
  54. alysis_code/assets/comprehender.py +759 -0
  55. alysis_code/assets/index.py +654 -0
  56. alysis_code/assets/ingestion.py +275 -0
  57. alysis_code/assets/legacy_migration.py +413 -0
  58. alysis_code/assets/models.py +263 -0
  59. alysis_code/assets/ocr.py +239 -0
  60. alysis_code/assets/owl/ascii/f-000.txt +13 -0
  61. alysis_code/assets/owl/ascii/f-001.txt +13 -0
  62. alysis_code/assets/owl/ascii/f-002.txt +13 -0
  63. alysis_code/assets/owl/ascii/f-003.txt +13 -0
  64. alysis_code/assets/owl/ascii/f-004.txt +13 -0
  65. alysis_code/assets/owl/ascii/f-005.txt +13 -0
  66. alysis_code/assets/owl/ascii/f-006.txt +13 -0
  67. alysis_code/assets/owl/ascii/f-007.txt +13 -0
  68. alysis_code/assets/owl/ascii/f-008.txt +13 -0
  69. alysis_code/assets/owl/ascii/f-009.txt +13 -0
  70. alysis_code/assets/owl/ascii/f-010.txt +13 -0
  71. alysis_code/assets/owl/ascii/f-011.txt +13 -0
  72. alysis_code/assets/owl/ascii/f-012.txt +13 -0
  73. alysis_code/assets/owl/ascii/f-013.txt +13 -0
  74. alysis_code/assets/owl/ascii/f-014.txt +13 -0
  75. alysis_code/assets/owl/ascii/f-015.txt +13 -0
  76. alysis_code/assets/owl/ascii/f-016.txt +13 -0
  77. alysis_code/assets/owl/ascii/f-017.txt +13 -0
  78. alysis_code/assets/owl/ascii/f-018.txt +13 -0
  79. alysis_code/assets/owl/ascii/f-019.txt +13 -0
  80. alysis_code/assets/owl/ascii/f-020.txt +13 -0
  81. alysis_code/assets/owl/index.html +98 -0
  82. alysis_code/assets/owl/show-owl.sh +761 -0
  83. alysis_code/assets/paths.py +49 -0
  84. alysis_code/assets/plan_binding.py +326 -0
  85. alysis_code/assets/planner_context.py +466 -0
  86. alysis_code/assets/planner_tools.py +184 -0
  87. alysis_code/assets/prompts.py +101 -0
  88. alysis_code/assets/replanner_context.py +239 -0
  89. alysis_code/assets/surface.py +521 -0
  90. alysis_code/assets/untrusted_content.py +48 -0
  91. alysis_code/assets/usage_logger.py +94 -0
  92. alysis_code/assets/worker_mirror.py +428 -0
  93. alysis_code/assets/worker_section.py +303 -0
  94. alysis_code/assets/worker_tools.py +468 -0
  95. alysis_code/atomic_io.py +83 -0
  96. alysis_code/auth_diagnostics.py +272 -0
  97. alysis_code/background_runner.py +366 -0
  98. alysis_code/branding.py +270 -0
  99. alysis_code/budget_policy.py +390 -0
  100. alysis_code/build_identity.py +465 -0
  101. alysis_code/builtin_hooks/__init__.py +7 -0
  102. alysis_code/builtin_hooks/notify_done_windows.py +65 -0
  103. alysis_code/bwrap_etc.py +76 -0
  104. alysis_code/cancellation.py +41 -0
  105. alysis_code/capabilities.py +137 -0
  106. alysis_code/chatgpt_codex_static_provider.py +133 -0
  107. alysis_code/cli.py +51 -0
  108. alysis_code/cli_impl/__init__.py +1 -0
  109. alysis_code/cli_impl/assets_cli.py +537 -0
  110. alysis_code/cli_impl/assets_modal.py +412 -0
  111. alysis_code/cli_impl/chat/__init__.py +156 -0
  112. alysis_code/cli_impl/chat/commands.py +2616 -0
  113. alysis_code/cli_impl/chat/loop.py +4508 -0
  114. alysis_code/cli_impl/chat/mid_turn_policy.py +125 -0
  115. alysis_code/cli_impl/chat/rendering.py +444 -0
  116. alysis_code/cli_impl/chat/state.py +124 -0
  117. alysis_code/cli_impl/chat_resume.py +830 -0
  118. alysis_code/cli_impl/chat_slash_completer.py +258 -0
  119. alysis_code/cli_impl/commands/__init__.py +11 -0
  120. alysis_code/cli_impl/commands/_shared.py +89 -0
  121. alysis_code/cli_impl/commands/auth.py +623 -0
  122. alysis_code/cli_impl/commands/chat_resume_helpers.py +1531 -0
  123. alysis_code/cli_impl/commands/chat_state.py +158 -0
  124. alysis_code/cli_impl/commands/chat_status.py +1248 -0
  125. alysis_code/cli_impl/commands/chat_terminal.py +942 -0
  126. alysis_code/cli_impl/commands/chat_tui_panels.py +1018 -0
  127. alysis_code/cli_impl/commands/cli_common.py +1223 -0
  128. alysis_code/cli_impl/commands/cli_surface.py +77 -0
  129. alysis_code/cli_impl/commands/config.py +131 -0
  130. alysis_code/cli_impl/commands/conventions.py +85 -0
  131. alysis_code/cli_impl/commands/execution_helpers.py +350 -0
  132. alysis_code/cli_impl/commands/extensions.py +401 -0
  133. alysis_code/cli_impl/commands/forge.py +1282 -0
  134. alysis_code/cli_impl/commands/forge_asset_view.py +121 -0
  135. alysis_code/cli_impl/commands/forge_helpers.py +1215 -0
  136. alysis_code/cli_impl/commands/hooks.py +737 -0
  137. alysis_code/cli_impl/commands/ide_bridge.py +31 -0
  138. alysis_code/cli_impl/commands/mcp.py +700 -0
  139. alysis_code/cli_impl/commands/profile.py +453 -0
  140. alysis_code/cli_impl/commands/prompt_helpers.py +307 -0
  141. alysis_code/cli_impl/commands/report.py +88 -0
  142. alysis_code/cli_impl/commands/root.py +1118 -0
  143. alysis_code/cli_impl/commands/sandbox.py +184 -0
  144. alysis_code/cli_impl/commands/server.py +54 -0
  145. alysis_code/cli_impl/commands/sessions.py +252 -0
  146. alysis_code/cli_impl/commands/skills.py +404 -0
  147. alysis_code/cli_impl/commands/startup.py +946 -0
  148. alysis_code/cli_impl/commands/tools.py +335 -0
  149. alysis_code/cli_impl/commands/update.py +364 -0
  150. alysis_code/cli_impl/commands/welcome.py +972 -0
  151. alysis_code/cli_impl/config_menu.py +3882 -0
  152. alysis_code/cli_impl/forge.py +4509 -0
  153. alysis_code/cli_impl/forge_recovery.py +485 -0
  154. alysis_code/cli_impl/setup_wizard.py +2409 -0
  155. alysis_code/cli_impl/tui/__init__.py +58 -0
  156. alysis_code/cli_impl/tui/app.py +4551 -0
  157. alysis_code/cli_impl/tui/config.py +32 -0
  158. alysis_code/cli_impl/tui/config_flow.py +2754 -0
  159. alysis_code/cli_impl/tui/config_overlay.py +566 -0
  160. alysis_code/cli_impl/tui/content.py +78 -0
  161. alysis_code/cli_impl/tui/footer.py +218 -0
  162. alysis_code/cli_impl/tui/forge_status.py +136 -0
  163. alysis_code/cli_impl/tui/markdown.py +244 -0
  164. alysis_code/cli_impl/tui/owl.py +109 -0
  165. alysis_code/cli_impl/tui/plan_meta.py +477 -0
  166. alysis_code/cli_impl/tui/setup_app.py +519 -0
  167. alysis_code/cli_impl/tui/setup_flow.py +1622 -0
  168. alysis_code/cli_impl/tui/state.py +101 -0
  169. alysis_code/cli_impl/tui/subagent_identity.py +66 -0
  170. alysis_code/cli_impl/tui/subagent_panel.py +186 -0
  171. alysis_code/cli_impl/tui/surface.py +796 -0
  172. alysis_code/cli_impl/tui/transcript.py +514 -0
  173. alysis_code/cli_impl/tui/update_prompt.py +79 -0
  174. alysis_code/cli_impl/tui/workspace_guard.py +384 -0
  175. alysis_code/clipboard.py +172 -0
  176. alysis_code/code_review.py +1211 -0
  177. alysis_code/compaction/__init__.py +28 -0
  178. alysis_code/compaction/conversation_compactor.py +2932 -0
  179. alysis_code/compaction/importance.py +177 -0
  180. alysis_code/compaction/settings.py +297 -0
  181. alysis_code/compaction/tool_output_offload.py +447 -0
  182. alysis_code/config.py +3509 -0
  183. alysis_code/conflict_auto_resolver.py +895 -0
  184. alysis_code/context/__init__.py +1 -0
  185. alysis_code/context/tool_schema_budgeter.py +220 -0
  186. alysis_code/crash_diagnostics.py +282 -0
  187. alysis_code/custom_tools/README.md +34 -0
  188. alysis_code/custom_tools/__init__.py +43 -0
  189. alysis_code/custom_tools/discovery.py +903 -0
  190. alysis_code/custom_tools/runtime.py +1516 -0
  191. alysis_code/custom_tools/session.py +227 -0
  192. alysis_code/custom_tools/trust.py +232 -0
  193. alysis_code/diff_paths.py +113 -0
  194. alysis_code/direction_change.py +293 -0
  195. alysis_code/dispatch_timing.py +306 -0
  196. alysis_code/durable_service_manager.py +1236 -0
  197. alysis_code/edit_discipline.py +659 -0
  198. alysis_code/error_text.py +73 -0
  199. alysis_code/execution_budget.py +411 -0
  200. alysis_code/execution_context.py +915 -0
  201. alysis_code/execution_deadline.py +1065 -0
  202. alysis_code/execution_shared.py +1904 -0
  203. alysis_code/extensions/README.md +30 -0
  204. alysis_code/extensions/__init__.py +93 -0
  205. alysis_code/extensions/activation.py +138 -0
  206. alysis_code/extensions/install.py +1436 -0
  207. alysis_code/extensions/manifest.py +487 -0
  208. alysis_code/extensions/models.py +74 -0
  209. alysis_code/extensions/paths.py +56 -0
  210. alysis_code/extensions/registry.json +4 -0
  211. alysis_code/extensions/registry.py +52 -0
  212. alysis_code/extensions/state.py +83 -0
  213. alysis_code/extensions/workspace_trust.py +101 -0
  214. alysis_code/failed_task_evidence.py +369 -0
  215. alysis_code/failure_category.py +315 -0
  216. alysis_code/feedback_report.py +1647 -0
  217. alysis_code/file_classification.py +485 -0
  218. alysis_code/forge.py +2064 -0
  219. alysis_code/forge_completion.py +362 -0
  220. alysis_code/forge_events.py +475 -0
  221. alysis_code/frontmatter_utils.py +95 -0
  222. alysis_code/git_evidence.py +1181 -0
  223. alysis_code/git_ops.py +560 -0
  224. alysis_code/git_safe.py +62 -0
  225. alysis_code/git_worktrees.py +190 -0
  226. alysis_code/hooks/README.md +33 -0
  227. alysis_code/hooks/__init__.py +67 -0
  228. alysis_code/hooks/audit.py +171 -0
  229. alysis_code/hooks/config.py +225 -0
  230. alysis_code/hooks/dispatcher.py +1110 -0
  231. alysis_code/hooks/models.py +447 -0
  232. alysis_code/hooks/trust.py +202 -0
  233. alysis_code/host_actions.py +543 -0
  234. alysis_code/host_browser.py +103 -0
  235. alysis_code/ide/__init__.py +5 -0
  236. alysis_code/ide/activity_events.py +399 -0
  237. alysis_code/ide/approvals.py +337 -0
  238. alysis_code/ide/artifacts.py +153 -0
  239. alysis_code/ide/browser_egress_proxy.py +1076 -0
  240. alysis_code/ide/cdp_websocket_transport.py +1192 -0
  241. alysis_code/ide/change_ledger.py +1721 -0
  242. alysis_code/ide/context_blocks.py +979 -0
  243. alysis_code/ide/event_stream.py +531 -0
  244. alysis_code/ide/forge_protocol.py +3112 -0
  245. alysis_code/ide/forge_request_ledger.py +737 -0
  246. alysis_code/ide/health.py +965 -0
  247. alysis_code/ide/managed_browser.py +2251 -0
  248. alysis_code/ide/management_protocol.py +3414 -0
  249. alysis_code/ide/mcp_oauth_coordinator.py +744 -0
  250. alysis_code/ide/mcp_oauth_lifecycle.py +1504 -0
  251. alysis_code/ide/prompt_queue.py +1070 -0
  252. alysis_code/ide/protocol.py +191 -0
  253. alysis_code/ide/resumable_swarm.py +1543 -0
  254. alysis_code/ide/session_search.py +295 -0
  255. alysis_code/ide/stdio_bridge.py +9935 -0
  256. alysis_code/ide/structured_state.py +1579 -0
  257. alysis_code/ide/swarm_protocol.py +816 -0
  258. alysis_code/integration_gate.py +506 -0
  259. alysis_code/interactive_input_guard.py +39 -0
  260. alysis_code/interactive_plan_mode.py +26 -0
  261. alysis_code/internal_artifacts.py +179 -0
  262. alysis_code/knowledge_base.py +1409 -0
  263. alysis_code/knowledge_capture.py +1190 -0
  264. alysis_code/knowledge_librarian.py +605 -0
  265. alysis_code/language_policy.py +34 -0
  266. alysis_code/litellm_static_provider.py +535 -0
  267. alysis_code/llm/__init__.py +1 -0
  268. alysis_code/llm/anthropic_messages.py +2288 -0
  269. alysis_code/llm/base.py +71 -0
  270. alysis_code/llm/cache_capabilities.py +985 -0
  271. alysis_code/llm/cache_control_blocks.py +244 -0
  272. alysis_code/llm/cache_policy.py +388 -0
  273. alysis_code/llm/factory.py +373 -0
  274. alysis_code/llm/gemini_generate_content.py +2652 -0
  275. alysis_code/llm/gemini_interactions.py +739 -0
  276. alysis_code/llm/metadata.py +450 -0
  277. alysis_code/llm/openai_compat.py +2947 -0
  278. alysis_code/llm/openai_responses.py +2604 -0
  279. alysis_code/llm/protocols.py +609 -0
  280. alysis_code/llm/provider_limits.py +525 -0
  281. alysis_code/llm/request_plan.py +389 -0
  282. alysis_code/llm/request_shape.py +238 -0
  283. alysis_code/llm/streaming.py +108 -0
  284. alysis_code/llm/temperature_compat.py +78 -0
  285. alysis_code/llm/types.py +195 -0
  286. alysis_code/llm/usage_normalization.py +222 -0
  287. alysis_code/llm_error_display.py +315 -0
  288. alysis_code/logging_redaction.py +326 -0
  289. alysis_code/managed_host_deadline.py +196 -0
  290. alysis_code/mcp/README.md +33 -0
  291. alysis_code/mcp/__init__.py +24 -0
  292. alysis_code/mcp/client.py +1137 -0
  293. alysis_code/mcp/config.py +597 -0
  294. alysis_code/mcp/errors.py +113 -0
  295. alysis_code/mcp/forge_scope.py +154 -0
  296. alysis_code/mcp/jsonrpc.py +214 -0
  297. alysis_code/mcp/manager.py +2308 -0
  298. alysis_code/mcp/models.py +666 -0
  299. alysis_code/mcp/oauth.py +972 -0
  300. alysis_code/mcp/oauth_runtime.py +310 -0
  301. alysis_code/mcp/oauth_store.py +276 -0
  302. alysis_code/mcp/prompts.py +329 -0
  303. alysis_code/mcp/resources.py +295 -0
  304. alysis_code/mcp/roots.py +106 -0
  305. alysis_code/mcp/server_requests.py +75 -0
  306. alysis_code/mcp/token_store.py +859 -0
  307. alysis_code/mcp/transport_http.py +1338 -0
  308. alysis_code/mcp/transport_stdio.py +1267 -0
  309. alysis_code/mcp/untrusted_content.py +119 -0
  310. alysis_code/merge_conflict_reviewer.py +729 -0
  311. alysis_code/model_catalog/__init__.py +1 -0
  312. alysis_code/model_catalog/chatgpt_codex_subscription_snapshot.json +186 -0
  313. alysis_code/model_catalog/litellm_model_prices_snapshot.json +44715 -0
  314. alysis_code/model_catalog/litellm_model_prices_snapshot.meta.json +17 -0
  315. alysis_code/model_metadata_policy.py +223 -0
  316. alysis_code/model_metadata_utils.py +103 -0
  317. alysis_code/model_registry.py +1420 -0
  318. alysis_code/model_router.py +147 -0
  319. alysis_code/permission_policy.py +1016 -0
  320. alysis_code/personas.py +451 -0
  321. alysis_code/pipeline_facts.py +233 -0
  322. alysis_code/plan_assistant.py +4763 -0
  323. alysis_code/plan_mode.py +393 -0
  324. alysis_code/plan_reconciliation.py +1228 -0
  325. alysis_code/plan_repair.py +652 -0
  326. alysis_code/plan_validation.py +1099 -0
  327. alysis_code/planning_constraints.py +904 -0
  328. alysis_code/policy.py +95 -0
  329. alysis_code/preview_server.py +457 -0
  330. alysis_code/process_reaping.py +566 -0
  331. alysis_code/profile_presets.py +1834 -0
  332. alysis_code/profiles.py +666 -0
  333. alysis_code/provider_auth/__init__.py +29 -0
  334. alysis_code/provider_auth/base.py +99 -0
  335. alysis_code/provider_auth/openai_codex.py +951 -0
  336. alysis_code/provider_auth/registry.py +76 -0
  337. alysis_code/provider_auth/store.py +125 -0
  338. alysis_code/provider_diagnostics.py +1209 -0
  339. alysis_code/provider_model_catalog.py +685 -0
  340. alysis_code/provider_telemetry.py +1699 -0
  341. alysis_code/provider_url.py +75 -0
  342. alysis_code/reasoning_contracts.py +911 -0
  343. alysis_code/remote_sync.py +350 -0
  344. alysis_code/replanning.py +1195 -0
  345. alysis_code/repo_scan.py +1152 -0
  346. alysis_code/request_estimation.py +296 -0
  347. alysis_code/review_gate.py +617 -0
  348. alysis_code/run_lock.py +1141 -0
  349. alysis_code/run_outcome.py +58 -0
  350. alysis_code/run_provenance.py +774 -0
  351. alysis_code/run_state.py +445 -0
  352. alysis_code/runtime_artifacts.py +116 -0
  353. alysis_code/runtime_context_features.py +78 -0
  354. alysis_code/runtime_kind.py +52 -0
  355. alysis_code/safety/__init__.py +11 -0
  356. alysis_code/safety/mcp_sanitize.py +29 -0
  357. alysis_code/safety/safe_http.py +297 -0
  358. alysis_code/safety/subagent_report.py +184 -0
  359. alysis_code/sandbox_doctor.py +682 -0
  360. alysis_code/sandbox_runner.py +1025 -0
  361. alysis_code/sandbox_settings.py +423 -0
  362. alysis_code/serialized_paths.py +355 -0
  363. alysis_code/server/__init__.py +3 -0
  364. alysis_code/server/app.py +367 -0
  365. alysis_code/server/auth.py +34 -0
  366. alysis_code/server/job_config.py +30 -0
  367. alysis_code/server/settings.py +215 -0
  368. alysis_code/server/store.py +193 -0
  369. alysis_code/server/worker_runner.py +657 -0
  370. alysis_code/service_persistence.py +355 -0
  371. alysis_code/session_artifacts.py +108 -0
  372. alysis_code/session_metrics.py +331 -0
  373. alysis_code/session_store.py +624 -0
  374. alysis_code/skills/README.md +34 -0
  375. alysis_code/skills/__init__.py +104 -0
  376. alysis_code/skills/conventions.py +84 -0
  377. alysis_code/skills/discovery.py +176 -0
  378. alysis_code/skills/eval_models.py +232 -0
  379. alysis_code/skills/eval_runner.py +372 -0
  380. alysis_code/skills/evals.py +1344 -0
  381. alysis_code/skills/install.py +293 -0
  382. alysis_code/skills/loader.py +118 -0
  383. alysis_code/skills/matching.py +103 -0
  384. alysis_code/skills/models.py +71 -0
  385. alysis_code/skills/paths.py +56 -0
  386. alysis_code/skills/prompting.py +500 -0
  387. alysis_code/skills/scaffold.py +142 -0
  388. alysis_code/skills/state.py +441 -0
  389. alysis_code/skills/transactions.py +125 -0
  390. alysis_code/skills/validation.py +304 -0
  391. alysis_code/step_budget.py +238 -0
  392. alysis_code/subagent_labels.py +49 -0
  393. alysis_code/subagents.py +1072 -0
  394. alysis_code/surface/__init__.py +80 -0
  395. alysis_code/surface/base.py +305 -0
  396. alysis_code/surface/console.py +387 -0
  397. alysis_code/surface/events.py +372 -0
  398. alysis_code/surface/hidden_surface.py +529 -0
  399. alysis_code/surface/noop_surface.py +219 -0
  400. alysis_code/surface/rich_surface.py +1555 -0
  401. alysis_code/surface/styles.py +67 -0
  402. alysis_code/surface/theme.py +455 -0
  403. alysis_code/surface/types.py +100 -0
  404. alysis_code/swarm_backend.py +926 -0
  405. alysis_code/swarm_orchestrator.py +4020 -0
  406. alysis_code/swarm_scheduler.py +441 -0
  407. alysis_code/swarm_trace.py +429 -0
  408. alysis_code/swarm_worker.py +2119 -0
  409. alysis_code/swarm_write_guard.py +348 -0
  410. alysis_code/task_dependencies.py +170 -0
  411. alysis_code/task_readiness.py +992 -0
  412. alysis_code/task_scope.py +2148 -0
  413. alysis_code/terminal_manager.py +762 -0
  414. alysis_code/terminal_ownership.py +460 -0
  415. alysis_code/text_normalization.py +30 -0
  416. alysis_code/token_budget.py +97 -0
  417. alysis_code/tools/README.md +34 -0
  418. alysis_code/tools/__init__.py +1 -0
  419. alysis_code/tools/artifacts.py +127 -0
  420. alysis_code/tools/availability.py +188 -0
  421. alysis_code/tools/fs.py +1456 -0
  422. alysis_code/tools/git.py +461 -0
  423. alysis_code/tools/history.py +229 -0
  424. alysis_code/tools/http_timeout.py +78 -0
  425. alysis_code/tools/image_generation.py +552 -0
  426. alysis_code/tools/registry.py +2936 -0
  427. alysis_code/tools/repo_map.py +476 -0
  428. alysis_code/tools/search.py +563 -0
  429. alysis_code/tools/shell.py +135 -0
  430. alysis_code/tools/symbols.py +1350 -0
  431. alysis_code/tools/test_discovery.py +643 -0
  432. alysis_code/tools/web.py +482 -0
  433. alysis_code/tools/web_search.py +2012 -0
  434. alysis_code/tools/web_search_dashscope.py +557 -0
  435. alysis_code/tools/web_search_ddgs.py +221 -0
  436. alysis_code/tools/web_search_provider_adapters.py +1429 -0
  437. alysis_code/tools/web_search_tavily.py +194 -0
  438. alysis_code/updates.py +933 -0
  439. alysis_code/usage_tracker.py +1990 -0
  440. alysis_code/verification_command_analysis.py +1004 -0
  441. alysis_code/verification_contract.py +574 -0
  442. alysis_code/verification_failure_summary.py +273 -0
  443. alysis_code/verification_repair.py +385 -0
  444. alysis_code/verify_gate.py +3129 -0
  445. alysis_code/web_research.py +1872 -0
  446. alysis_code/web_search_adapters.py +66 -0
  447. alysis_code/web_search_policy.py +27 -0
  448. alysis_code/workspace_binding.py +389 -0
  449. alysis_code/workspace_binding_ui.py +408 -0
  450. alysis_code/workspace_context.py +273 -0
  451. alysis_code/workspace_isolation.py +138 -0
  452. alysis_code/workspace_provisioning.py +455 -0
  453. alysis_code-0.13.0.dist-info/METADATA +507 -0
  454. alysis_code-0.13.0.dist-info/RECORD +458 -0
  455. alysis_code-0.13.0.dist-info/WHEEL +4 -0
  456. alysis_code-0.13.0.dist-info/entry_points.txt +3 -0
  457. alysis_code-0.13.0.dist-info/licenses/LICENSE +176 -0
  458. alysis_code-0.13.0.dist-info/licenses/NOTICE +4 -0
@@ -0,0 +1,1223 @@
1
+ # ruff: noqa: F401,I001
2
+ # Many imports are intentionally kept as monkeypatch surfaces for tests/cli_impl.
3
+ from __future__ import annotations
4
+
5
+ import hashlib
6
+ import json
7
+ import os
8
+ import re
9
+ import select
10
+ import shutil
11
+ import signal
12
+ import subprocess
13
+ import sys
14
+ import threading
15
+ import time
16
+ from collections import deque
17
+ from collections.abc import Callable, Iterator
18
+ from contextlib import contextmanager
19
+ from dataclasses import dataclass, field
20
+ from datetime import datetime, timedelta, timezone
21
+ from difflib import get_close_matches
22
+ from pathlib import Path
23
+ from typing import TYPE_CHECKING, Any
24
+
25
+ import typer
26
+ from click import get_current_context
27
+ from click.core import ParameterSource
28
+ from platformdirs import user_data_dir
29
+
30
+ from ... import __version__
31
+ from ...assets.index import AssetIndex
32
+ from ...branding import env_get
33
+ from ...clipboard import ClipboardError, paste_clipboard_image
34
+ from ...config import (
35
+ _DEFAULT_TOOLBAR_ITEMS,
36
+ _VALID_TOOLBAR_ITEMS,
37
+ ApiKeyResolution,
38
+ AppConfig,
39
+ ConfigError,
40
+ clear_persisted_api_key,
41
+ clear_persisted_profile_key,
42
+ clone_cfg,
43
+ config_path,
44
+ credentials_path,
45
+ default_chat_history_path,
46
+ load_config,
47
+ load_persisted_profile_keys,
48
+ rename_persisted_profile_key,
49
+ resolve_api_key,
50
+ resolve_llm_timeout_s,
51
+ resolve_profile_api_key,
52
+ resolve_prompt_cache_key,
53
+ resolve_prompt_cache_retention,
54
+ save_config,
55
+ save_persisted_api_key,
56
+ save_persisted_profile_key,
57
+ set_config_value,
58
+ )
59
+ from ...conflict_auto_resolver import (
60
+ attempt_auto_resolve_conflict,
61
+ bump_conflict_attempt,
62
+ can_attempt_conflict_auto_resolve,
63
+ load_conflict_auto_resolve_settings,
64
+ )
65
+ from ...custom_tools import (
66
+ CustomToolCatalogEntry,
67
+ build_custom_tool_session_state,
68
+ global_custom_tools_root,
69
+ project_custom_tools_root,
70
+ trust_project_tool,
71
+ untrust_project_tool,
72
+ )
73
+ from ...execution_shared import (
74
+ build_execution_reporting_diff as _shared_build_execution_reporting_diff,
75
+ )
76
+ from ...execution_shared import (
77
+ build_execution_reporting_diff_with_commit_range as _shared_build_execution_reporting_diff_with_commit_range,
78
+ )
79
+ from ...execution_shared import (
80
+ build_task_execution_instruction as _shared_build_task_execution_instruction,
81
+ )
82
+ from ...execution_shared import (
83
+ build_task_execution_instruction_bundle as _shared_build_task_execution_instruction_bundle,
84
+ )
85
+ from ...execution_shared import (
86
+ build_task_local_workspace_reporting_diff as _shared_build_task_local_workspace_reporting_diff,
87
+ )
88
+ from ...execution_shared import (
89
+ build_workspace_snapshot_reporting_diff as _shared_build_workspace_snapshot_reporting_diff,
90
+ )
91
+ from ...execution_shared import (
92
+ capture_task_local_workspace_baseline as _shared_capture_task_local_workspace_baseline,
93
+ )
94
+ from ...execution_shared import (
95
+ cleanup_execution_private_sessions_dir as _shared_cleanup_execution_private_sessions_dir,
96
+ )
97
+ from ...execution_shared import (
98
+ cleanup_task_local_workspace_baseline as _shared_cleanup_task_local_workspace_baseline,
99
+ )
100
+ from ...execution_shared import (
101
+ execution_private_sessions_dir as _shared_execution_private_sessions_dir,
102
+ )
103
+ from ...execution_shared import (
104
+ git_changed_files as _shared_git_changed_files,
105
+ )
106
+ from ...execution_shared import (
107
+ mirror_selected_knowledge_into_worktree as _shared_mirror_selected_knowledge_into_worktree,
108
+ )
109
+ from ...execution_shared import (
110
+ prepare_task_execution_knowledge as _shared_prepare_task_execution_knowledge,
111
+ )
112
+ from ...execution_shared import (
113
+ resolve_managed_task_step_budget as _shared_resolve_managed_task_step_budget,
114
+ )
115
+ from ...execution_shared import (
116
+ safe_task_file_component as _shared_safe_task_file_component,
117
+ )
118
+ from ...execution_shared import (
119
+ select_task_image_paths_for_execution as _shared_select_task_image_paths_for_execution,
120
+ )
121
+ from ...execution_shared import (
122
+ snapshot_runtime_tree as _shared_snapshot_runtime_tree,
123
+ )
124
+ from ...execution_shared import (
125
+ snapshot_session_logs as _shared_snapshot_session_logs,
126
+ )
127
+ from ...execution_shared import (
128
+ snapshot_workspace_tree as _shared_snapshot_workspace_tree,
129
+ )
130
+ from ...execution_shared import (
131
+ write_exec_log_artifacts as _shared_write_exec_log_artifacts,
132
+ )
133
+ from ...execution_shared import (
134
+ write_execution_budget_artifact as _shared_write_execution_budget_artifact,
135
+ )
136
+ from ...execution_shared import (
137
+ write_execution_context_artifact as _shared_write_execution_context_artifact,
138
+ )
139
+ from ...execution_shared import (
140
+ write_patch_from_diff as _shared_write_patch_from_diff,
141
+ )
142
+ from ...extensions.install import (
143
+ EnableResult,
144
+ PluginInstallError,
145
+ TrustPromptRequest,
146
+ disable_plugin,
147
+ enable_plugin,
148
+ install_plugin,
149
+ uninstall_plugin,
150
+ )
151
+ from ...extensions.models import normalize_extension_id
152
+ from ...extensions.paths import project_extensions_path
153
+ from ...extensions.registry import find_by_id, load_registry
154
+ from ...extensions.registry import search as search_extensions
155
+ from ...extensions.state import (
156
+ compute_effective_enabled,
157
+ load_global_state,
158
+ load_project_overrides,
159
+ load_project_state,
160
+ )
161
+ from ...extensions.workspace_trust import is_workspace_trusted
162
+ from ...surface.styles import (
163
+ STYLE_CHROME,
164
+ STYLE_CONTENT,
165
+ STYLE_DESELECTED_DESC,
166
+ STYLE_DESELECTED_LABEL,
167
+ STYLE_DIM,
168
+ STYLE_EMPHASIS,
169
+ STYLE_ERROR,
170
+ STYLE_SELECTED_DESC,
171
+ STYLE_SELECTED_LABEL,
172
+ STYLE_SUBAGENT,
173
+ STYLE_SUCCESS,
174
+ STYLE_WARN,
175
+ )
176
+ from ...feedback_report import (
177
+ FeedbackReportError,
178
+ create_feedback_bundle,
179
+ create_feedback_github_issue_draft,
180
+ feedback_github_issue_status_lines,
181
+ resolve_feedback_workspace_root,
182
+ )
183
+ from ...git_ops import (
184
+ GitOpsError,
185
+ added_files_since,
186
+ changed_files_between,
187
+ checkout_branch,
188
+ commit_all,
189
+ current_branch,
190
+ delete_branch,
191
+ ensure_clean_for_pr,
192
+ ensure_git_available,
193
+ ensure_git_repo,
194
+ ensure_not_staged_paths,
195
+ ensure_not_staged_prefixes,
196
+ ensure_not_staged_runtime_artifacts,
197
+ format_patch_stdout,
198
+ generate_task_branch_name,
199
+ head_commit,
200
+ merge_no_ff,
201
+ stage_all,
202
+ staged_files,
203
+ unstage_staged_paths,
204
+ unstage_staged_prefixes,
205
+ unstage_staged_runtime_artifacts,
206
+ )
207
+ from ...forge import (
208
+ ForgeError,
209
+ RunPaths,
210
+ add_requirement,
211
+ add_task,
212
+ append_planner_chat,
213
+ append_planner_summary,
214
+ append_transcript_note,
215
+ attach_asset,
216
+ create_plan_run,
217
+ ensure_execution_dirs,
218
+ ensure_workspace_context_artifacts,
219
+ finalize_plan,
220
+ find_task,
221
+ format_workspace_context_summary_lines,
222
+ load_current_run_paths,
223
+ load_plan,
224
+ now_iso,
225
+ rebind_run_paths_to_workspace_binding,
226
+ refresh_current_run_pointer_if_tracking_same_run,
227
+ refresh_workspace_context_artifacts,
228
+ requirement_is_execution_ready,
229
+ requirement_text,
230
+ save_plan,
231
+ set_task_status,
232
+ write_task_report,
233
+ )
234
+ from ...hooks import (
235
+ HookDispatcher,
236
+ canonicalize_hook_event_name,
237
+ hook_audit_artifact_path,
238
+ is_project_hooks_config_trusted,
239
+ load_hook_config_file,
240
+ load_resolved_hooks_config,
241
+ load_trust_state,
242
+ project_hooks_config_path,
243
+ project_local_hooks_config_path,
244
+ read_hook_audit_events,
245
+ trust_project_hooks_config,
246
+ untrust_project_hooks_config,
247
+ user_hooks_config_path,
248
+ )
249
+ from ...interactive_input_guard import (
250
+ is_interactive_prompt_active,
251
+ is_interactive_prompt_terminal_owner,
252
+ )
253
+ from ...knowledge_base import rebuild_knowledge_index, write_issue_entry, write_task_attempt_entry
254
+ from ...knowledge_capture import (
255
+ RecordingSurface,
256
+ mark_knowledge_capture_promotion_skipped,
257
+ persist_execution_knowledge_capture,
258
+ promote_validated_knowledge_capture,
259
+ )
260
+ from ...knowledge_librarian import (
261
+ prepare_planner_knowledge as _prepare_planner_knowledge,
262
+ )
263
+ from ...knowledge_librarian import (
264
+ resolve_knowledge_workspace_root as _resolve_knowledge_workspace_root,
265
+ )
266
+ from ...litellm_static_provider import (
267
+ BUNDLED_MODEL_CATALOG_SOURCE,
268
+ get_bundled_model_catalog_provenance,
269
+ )
270
+ from ...llm_error_display import classify_llm_error_display
271
+ from ...mcp.config import load_resolved_mcp_config
272
+ from ...mcp.forge_scope import (
273
+ ForgeTaskMcpScope,
274
+ describe_task_mcp_scope,
275
+ normalize_task_mcp_scope,
276
+ )
277
+ from ...mcp.manager import (
278
+ ForgeTaskScopedMcpManager,
279
+ McpManager,
280
+ build_mcp_execution_context_summary,
281
+ create_forge_task_scoped_mcp_manager,
282
+ create_mcp_manager,
283
+ )
284
+ from ...mcp.models import ResolvedMcpServer
285
+ from ...mcp.oauth import (
286
+ McpOAuthError,
287
+ discover_authorization_server_metadata,
288
+ discover_authorization_server_metadata_from_url,
289
+ discover_protected_resource_metadata,
290
+ resolve_requested_scopes,
291
+ )
292
+ from ...mcp.oauth_runtime import perform_authorization_code_login
293
+ from ...mcp.oauth_store import (
294
+ McpOAuthTokenStoreError,
295
+ delete_oauth_token_record,
296
+ load_oauth_token_record,
297
+ )
298
+ from ...merge_conflict_reviewer import (
299
+ capture_merge_conflict_context,
300
+ list_unmerged_files,
301
+ review_merge_conflict,
302
+ try_abort_merge,
303
+ write_conflict_artifacts,
304
+ )
305
+ from ...model_metadata_utils import parse_non_negative_float, parse_positive_int
306
+ from ...model_router import ROLE_CODING, resolve_model_for_role
307
+ from ...plan_repair import (
308
+ PlannerRepairReport,
309
+ apply_plan_status,
310
+ clarification_goal_key,
311
+ plan_repair_event_payload,
312
+ plan_status,
313
+ record_plan_repair,
314
+ resolve_plan_repair_policy,
315
+ )
316
+ from ...plan_validation import validate_plan, validate_plan_against_assets
317
+ from ...remote_sync import (
318
+ RemoteSyncError,
319
+ ensure_pr_or_mr,
320
+ get_remote_url,
321
+ init_remote_record,
322
+ load_remote_settings_from_env,
323
+ push_base,
324
+ push_branch,
325
+ resolve_provider,
326
+ truncate_output,
327
+ write_remote_record,
328
+ )
329
+ from ...repo_scan import scan_workspace
330
+ from ...request_estimation import estimate_request_token_breakdown
331
+ from ...review_gate import ReviewError, review_task
332
+ from ...runtime_artifacts import has_grounded_rust_target_runtime_artifacts
333
+ from ...runtime_kind import RuntimeKind, normalize_runtime_kind
334
+ from ...sandbox_doctor import (
335
+ SandboxDiagnostic,
336
+ configured_sandbox_images,
337
+ diagnose_sandbox,
338
+ format_sandbox_problem_message,
339
+ pull_sandbox_images,
340
+ sandbox_env_summary,
341
+ )
342
+ from ...session_metrics import score_session_log
343
+ from ...session_store import (
344
+ SessionInfo,
345
+ canonical_workspace_path,
346
+ list_sessions,
347
+ local_session_owner,
348
+ read_session_events,
349
+ resolve_sessions_dir,
350
+ session_belongs_to_owner,
351
+ session_belongs_to_workspace,
352
+ )
353
+ from ...skills import (
354
+ build_explicit_skill_context_message,
355
+ discover_skills,
356
+ install_skill_bundle,
357
+ load_global_skill_state,
358
+ load_project_skill_state,
359
+ load_repo_conventions,
360
+ project_skill_root_for_family,
361
+ remove_managed_skill,
362
+ render_repo_conventions_context,
363
+ render_skill_info_text,
364
+ resolve_skill_by_name,
365
+ resolve_skill_catalog,
366
+ resolve_skill_catalog_entry,
367
+ resolve_skills_enabled,
368
+ save_global_skill_state,
369
+ save_project_skill_state,
370
+ scaffold_skill_bundle,
371
+ set_global_skill_disabled,
372
+ set_project_skill_override,
373
+ validate_skill_bundle,
374
+ )
375
+ from ...step_budget import DEFAULT_CHAT_MAX_STEPS
376
+ from ...swarm_orchestrator import run_swarm
377
+ from ...swarm_trace import SerializedSwarmTraceSink
378
+ from ...task_readiness import EXECUTION_UNREADY_SCOPE_WARNING
379
+ from ...task_scope import (
380
+ check_scope,
381
+ is_non_material_untracked_path,
382
+ list_changed_files_including_untracked,
383
+ list_untracked_packaging_metadata_paths,
384
+ normalize_scope_patterns,
385
+ )
386
+ from ...token_budget import compute_input_budget, estimate_tokens
387
+ from ...tools.availability import get_tool_availability, is_tool_unavailable_result
388
+ from ...tools.registry import (
389
+ iter_builtin_tool_metadata,
390
+ summarize_tool_output_chunk,
391
+ tool_input_preview,
392
+ )
393
+ from ...tools.web_search import resolve_web_search_runtime_status
394
+ from ...usage_tracker import aggregate_usage_from_session_logs, format_context_percent, format_usd
395
+ from ...verification_repair import TASK_STATUS_COMPLETED_UNVERIFIED
396
+ from ...verify_gate import (
397
+ VerifyError,
398
+ normalize_verify_mode,
399
+ resolve_authoritative_task_verify_command_selection,
400
+ resolve_verify_commands,
401
+ run_task_verification,
402
+ verify_run_result_to_payload,
403
+ )
404
+ from ...workspace_binding import (
405
+ WorkspaceAction,
406
+ WorkspaceBinding,
407
+ WorkspaceBindingError,
408
+ WorkspaceCandidate,
409
+ ensure_workspace_policy,
410
+ resolve_workspace_binding,
411
+ workspace_policy_violation_message,
412
+ )
413
+ from ...workspace_binding_ui import (
414
+ guarded_workspace_action_rows,
415
+ workspace_candidate_rows,
416
+ )
417
+ from ...workspace_binding_ui import (
418
+ resolve_startup_workspace_binding as _resolve_startup_workspace_binding_impl,
419
+ )
420
+ from ...workspace_context import resolve_workspace_context
421
+ from ..assets_cli import assets_app as forge_assets_app
422
+ from . import _patchable
423
+ from ._shared import (
424
+ Mode,
425
+ _console,
426
+ _resolve_tool_workspace_root,
427
+ _Table,
428
+ _terminal_width,
429
+ )
430
+ from .config import (
431
+ config_clear_api_key,
432
+ config_menu_cmd,
433
+ config_set,
434
+ config_set_api_key,
435
+ config_show,
436
+ )
437
+ from .conventions import conventions_list, conventions_render
438
+ from .extensions import (
439
+ _confirm_extension_state_change,
440
+ _ext_component_list,
441
+ _ext_trust_prompt,
442
+ _installed_record_for_id,
443
+ _print_enable_result,
444
+ _print_plugin_trust_request,
445
+ _workspace_trust_status,
446
+ ext_disable,
447
+ ext_enable,
448
+ ext_info,
449
+ ext_install,
450
+ ext_list,
451
+ ext_search,
452
+ ext_uninstall,
453
+ )
454
+ from .forge import (
455
+ forge_attach,
456
+ forge_exec,
457
+ forge_plan,
458
+ forge_review,
459
+ forge_run,
460
+ forge_show,
461
+ forge_status,
462
+ forge_swarm,
463
+ )
464
+ from .hooks import (
465
+ _HOOK_SESSION_SOURCES,
466
+ _HOOK_TOOL_EVENTS,
467
+ _HOOKS_INIT_TEMPLATE,
468
+ _collect_hook_source_statuses,
469
+ _find_hook_in_layer,
470
+ _hook_test_match_result,
471
+ _hooks_config_path_for_layer,
472
+ _HookSourceStatus,
473
+ _project_hooks_config_or_exit,
474
+ _set_hook_enabled,
475
+ hooks_disable,
476
+ hooks_doctor,
477
+ hooks_effective,
478
+ hooks_enable,
479
+ hooks_init,
480
+ hooks_list,
481
+ hooks_test,
482
+ hooks_trace,
483
+ hooks_trust,
484
+ hooks_untrust,
485
+ hooks_watch,
486
+ )
487
+ from .profile import (
488
+ _parse_profile_headers,
489
+ _profile_api_key_status,
490
+ profile_add,
491
+ profile_clear_key,
492
+ profile_list,
493
+ profile_preset,
494
+ profile_presets,
495
+ profile_remove,
496
+ profile_rename,
497
+ profile_set_key,
498
+ profile_show,
499
+ profile_use,
500
+ )
501
+ from .report import report_create
502
+ from .root import (
503
+ _default_session_api_key,
504
+ _doctor_table,
505
+ _tool_availability_rows,
506
+ _ToolAvailabilityRow,
507
+ _tools_table,
508
+ chat,
509
+ auth_app,
510
+ config_app,
511
+ conventions_app,
512
+ doctor,
513
+ ext_app,
514
+ forge_app,
515
+ hooks_app,
516
+ main,
517
+ mcp_app,
518
+ mcp_auth_app,
519
+ mcp_prompts_app,
520
+ profile_app,
521
+ report_app,
522
+ run,
523
+ sandbox_app,
524
+ server_app,
525
+ sessions_app,
526
+ setup,
527
+ skill_app,
528
+ tool_app,
529
+ )
530
+ from .root import (
531
+ app as _root_app,
532
+ )
533
+ from .root import (
534
+ tools as _root_tools,
535
+ )
536
+ from .sandbox import (
537
+ _print_sandbox_diagnostic,
538
+ _run_sandbox_doctor_command,
539
+ _run_sandbox_pull_command,
540
+ _run_sandbox_setup_command,
541
+ _sandbox_doctor_table,
542
+ sandbox_doctor,
543
+ sandbox_pull,
544
+ sandbox_setup,
545
+ )
546
+ from .server import server_start
547
+ from .sessions import (
548
+ sessions_list,
549
+ sessions_score,
550
+ sessions_show,
551
+ sessions_usage,
552
+ )
553
+ from .skills import (
554
+ _discover_skills_for_path,
555
+ _print_skill_catalog_issues,
556
+ _render_skill_validation_summary,
557
+ _resolve_skill_catalog_for_path,
558
+ _set_skill_enabled_state,
559
+ _skills_table,
560
+ skill_disable,
561
+ skill_enable,
562
+ skill_info,
563
+ skill_init,
564
+ skill_install,
565
+ skill_list,
566
+ skill_remove,
567
+ skill_validate,
568
+ )
569
+ from .tools import (
570
+ _CUSTOM_TOOLS_WIDE_TABLE_MIN_WIDTH,
571
+ _custom_tool_source_filename,
572
+ _custom_tool_source_location,
573
+ _custom_tools_list_renderable,
574
+ _custom_tools_stacked_list,
575
+ _custom_tools_table,
576
+ _discover_custom_tools_for_path,
577
+ _resolve_custom_tool_entries_by_name,
578
+ _select_project_tool_entry_or_exit,
579
+ tool_info,
580
+ tool_list,
581
+ tool_trust,
582
+ tool_untrust,
583
+ )
584
+
585
+ tools = _root_tools
586
+ app = _root_app
587
+
588
+ if TYPE_CHECKING:
589
+ from rich.console import Console
590
+ from rich.panel import Panel
591
+ from rich.table import Table
592
+
593
+
594
+ def _Panel(*args: Any, **kwargs: Any) -> Any:
595
+ from rich.panel import Panel
596
+
597
+ return Panel(*args, **kwargs)
598
+
599
+
600
+ def _table_grid(*args: Any, **kwargs: Any) -> Any:
601
+ from rich.table import Table
602
+
603
+ return Table.grid(*args, **kwargs)
604
+
605
+
606
+ def _forge_bar_text(
607
+ *,
608
+ text: str,
609
+ style: str = "dim",
610
+ bar_style: str = "bright_black",
611
+ ) -> Any:
612
+ from rich.text import Text
613
+
614
+ return Text.assemble(("│ ", bar_style), (str(text or ""), style))
615
+
616
+
617
+ def _print_forge_meta(*, console: Console, message: str, style: str = "dim") -> None:
618
+ console.print(_forge_bar_text(text=message, style=style), highlight=False)
619
+
620
+
621
+ def _forge_supports_unicode_glyphs(console: Console) -> bool:
622
+ # Legacy Windows consoles cannot render box-drawing/bullet glyphs; everything
623
+ # else is UTF-capable (the CLI reconfigures stdout to UTF-8 on startup), so we
624
+ # fall back to ASCII only when Rich flags a legacy console or a non-UTF encoding.
625
+ if bool(getattr(console, "legacy_windows", False)):
626
+ return False
627
+ encoding = str(getattr(console, "encoding", "") or "").lower()
628
+ return "utf" in encoding
629
+
630
+
631
+ def _forge_phase_rule(*, console: Console, label: str) -> Any:
632
+ from rich.rule import Rule
633
+
634
+ rule_char = "─" if _forge_supports_unicode_glyphs(console) else "-"
635
+ title = str(label or "").strip()
636
+ return Rule(title=title, characters=rule_char, style="bright_black", align="left")
637
+
638
+
639
+ def _print_forge_warning_messages(
640
+ *,
641
+ console: Console,
642
+ label: str,
643
+ warnings: list[str],
644
+ ) -> None:
645
+ for warning in warnings:
646
+ console.print(
647
+ _forge_bar_text(
648
+ text=f"{label}: {warning}",
649
+ style="yellow",
650
+ bar_style="yellow",
651
+ ),
652
+ highlight=False,
653
+ )
654
+
655
+
656
+ def _print_forge_error(*, console: Console, message: str) -> None:
657
+ console.print(
658
+ _forge_bar_text(
659
+ text=message,
660
+ style="red",
661
+ bar_style="red",
662
+ ),
663
+ highlight=False,
664
+ )
665
+
666
+
667
+ def _forge_task_status_counts(plan: dict[str, Any]) -> tuple[int, int, int]:
668
+ from ...swarm_scheduler import canonical_task_status
669
+
670
+ tasks = plan.get("tasks") or []
671
+ if not isinstance(tasks, list):
672
+ return 0, 0, 0
673
+
674
+ done = 0
675
+ failed = 0
676
+ remaining = 0
677
+ done_states = {"done", "already_satisfied", TASK_STATUS_COMPLETED_UNVERIFIED}
678
+ failure_states = {
679
+ "failed",
680
+ "verify_failed",
681
+ "candidate_rejected",
682
+ "changes_requested",
683
+ "merge_conflict",
684
+ "blocked_integration",
685
+ "blocked",
686
+ "interrupted",
687
+ "cancelled",
688
+ }
689
+ non_executable_obsolete_states = {"superseded", "invalidated"}
690
+ for task in tasks:
691
+ if not isinstance(task, dict):
692
+ remaining += 1
693
+ continue
694
+ status = canonical_task_status(str(task.get("status") or ""))
695
+ if status in done_states:
696
+ done += 1
697
+ elif status in failure_states:
698
+ failed += 1
699
+ elif status in non_executable_obsolete_states:
700
+ continue
701
+ else:
702
+ remaining += 1
703
+ return done, failed, remaining
704
+
705
+
706
+ def _forge_task_status_markup(status: str) -> str:
707
+ from ...swarm_scheduler import canonical_task_status
708
+
709
+ raw = str(status or "").strip()
710
+ canonical = canonical_task_status(raw)
711
+ display = raw or canonical or "planned"
712
+ if canonical in {"done", "completed", "already_satisfied"}:
713
+ return f"[bold]{display}[/bold]"
714
+ if canonical == TASK_STATUS_COMPLETED_UNVERIFIED:
715
+ # Completed, but nothing authoritative checked it — bold like the other
716
+ # completions, dimmed so the table still shows it is a weaker result.
717
+ return f"[bold bright_black]{display}[/bold bright_black]"
718
+ if canonical in {
719
+ "failed",
720
+ "verify_failed",
721
+ "candidate_rejected",
722
+ "changes_requested",
723
+ "merge_conflict",
724
+ "blocked_integration",
725
+ "blocked",
726
+ "interrupted",
727
+ "cancelled",
728
+ }:
729
+ return f"[red]{display}[/red]"
730
+ if canonical in {"in_progress", "running"}:
731
+ return display
732
+ if canonical in {"superseded", "invalidated"}:
733
+ return f"[bright_black]{display}[/bright_black]"
734
+ return f"[dim]{display}[/dim]"
735
+
736
+
737
+ def _forge_task_table(*, title: str = "Forge Tasks") -> Any:
738
+ from rich import box as rich_box
739
+
740
+ return _Table(
741
+ title=title,
742
+ box=rich_box.SIMPLE,
743
+ border_style=STYLE_CHROME,
744
+ header_style=STYLE_EMPHASIS,
745
+ title_style="dim",
746
+ expand=True,
747
+ padding=(0, 1),
748
+ )
749
+
750
+
751
+ def _forge_task_mcp_scope(task: dict[str, Any]) -> ForgeTaskMcpScope | None:
752
+ return normalize_task_mcp_scope(
753
+ task.get("mcp_scope"),
754
+ warning_prefix=f"Task {str(task.get('id') or '(unknown)')}",
755
+ )[0]
756
+
757
+
758
+ def _forge_task_mcp_summary_label(task: dict[str, Any]) -> str:
759
+ scope = _forge_task_mcp_scope(task)
760
+ if scope is None:
761
+ return "off"
762
+ if scope.allow_resources and scope.allowed_tools:
763
+ return "resources+tools"
764
+ if scope.allow_resources:
765
+ return "resources"
766
+ return f"{len(scope.allowed_tools)} tool(s)"
767
+
768
+
769
+ def _build_forge_task_scoped_mcp_manager(
770
+ *,
771
+ workspace_root: Path,
772
+ session_id: str,
773
+ task_scope: ForgeTaskMcpScope | None,
774
+ ) -> McpManager | ForgeTaskScopedMcpManager:
775
+ return create_forge_task_scoped_mcp_manager(
776
+ workspace_root=workspace_root,
777
+ session_id=session_id,
778
+ task_scope=task_scope,
779
+ )
780
+
781
+
782
+ def _build_forge_mcp_execution_context_section(
783
+ *,
784
+ task_scope: ForgeTaskMcpScope | None,
785
+ mcp_manager: McpManager | ForgeTaskScopedMcpManager,
786
+ ) -> str:
787
+ summary = mcp_manager.execution_context_summary()
788
+ lines = [
789
+ "## MCP Execution Context",
790
+ "",
791
+ f"- Task MCP Scope: {describe_task_mcp_scope(task_scope)}",
792
+ "- write_scope governs local file mutation. mcp_scope governs remote MCP actions.",
793
+ ]
794
+ servers = summary.get("servers")
795
+ if isinstance(servers, list) and servers:
796
+ lines.append("- Available MCP Servers:")
797
+ for raw_entry in servers:
798
+ if not isinstance(raw_entry, dict):
799
+ continue
800
+ server_id = str(raw_entry.get("server_id") or "").strip()
801
+ if not server_id:
802
+ continue
803
+ tool_names = [
804
+ str(name).strip() for name in raw_entry.get("tool_names") or [] if str(name).strip()
805
+ ]
806
+ tool_label = ", ".join(tool_names) if tool_names else "(none)"
807
+ resources_label = "yes" if raw_entry.get("resources_available") else "no"
808
+ lines.append(
809
+ f"- {server_id}: live_tools={tool_label}; generic_resources_available={resources_label}"
810
+ )
811
+ else:
812
+ lines.append("- Available MCP Servers: (none)")
813
+ return "\n".join(lines)
814
+
815
+
816
+ def _augment_workspace_context_with_mcp_execution_context(
817
+ *,
818
+ workspace_context: dict[str, Any] | None,
819
+ workspace_root: Path,
820
+ ) -> dict[str, Any] | None:
821
+ if workspace_context is None:
822
+ return None
823
+ payload = dict(workspace_context)
824
+ mcp_execution_context = build_mcp_execution_context_summary(
825
+ workspace_root=workspace_root,
826
+ runtime_kind=RuntimeKind.FORGE_EXEC,
827
+ )
828
+ if mcp_execution_context is not None:
829
+ payload["mcp_execution_context"] = mcp_execution_context
830
+ return payload
831
+
832
+
833
+ def _prompt_ask(*args: Any, **kwargs: Any) -> Any:
834
+ from rich.prompt import Prompt
835
+
836
+ return Prompt.ask(*args, **kwargs)
837
+
838
+
839
+ def _Live(*args: Any, **kwargs: Any) -> Any:
840
+ from rich.live import Live
841
+
842
+ return Live(*args, **kwargs)
843
+
844
+
845
+ def _cli_module_for_legacy_impl() -> Any:
846
+ return sys.modules.get("alysis_code.cli") or sys.modules[__name__]
847
+
848
+
849
+ def _agent_loop_module() -> Any:
850
+ from ... import agent_loop
851
+
852
+ return agent_loop
853
+
854
+
855
+ def build_tools(*args: Any, **kwargs: Any) -> Any:
856
+ return _agent_loop_module().build_tools(*args, **kwargs)
857
+
858
+
859
+ def create_session(*args: Any, **kwargs: Any) -> Any:
860
+ return _agent_loop_module().create_session(*args, **kwargs)
861
+
862
+
863
+ def refresh_session_environment_context_message(*args: Any, **kwargs: Any) -> Any:
864
+ return _agent_loop_module().refresh_session_environment_context_message(*args, **kwargs)
865
+
866
+
867
+ def refresh_session_workspace_binding_context_message(*args: Any, **kwargs: Any) -> Any:
868
+ return _agent_loop_module().refresh_session_workspace_binding_context_message(*args, **kwargs)
869
+
870
+
871
+ def resolve_session_active_workdir_path(*args: Any, **kwargs: Any) -> Any:
872
+ return _agent_loop_module().resolve_session_active_workdir_path(*args, **kwargs)
873
+
874
+
875
+ def resolve_workdir_relpath_within_workspace(*args: Any, **kwargs: Any) -> Any:
876
+ return _agent_loop_module().resolve_workdir_relpath_within_workspace(*args, **kwargs)
877
+
878
+
879
+ def resolve_session_active_workdir_relpath(*args: Any, **kwargs: Any) -> Any:
880
+ return _agent_loop_module().resolve_session_active_workdir_relpath(*args, **kwargs)
881
+
882
+
883
+ def set_session_active_workdir(*args: Any, **kwargs: Any) -> Any:
884
+ return _agent_loop_module().set_session_active_workdir(*args, **kwargs)
885
+
886
+
887
+ def run_agent(*args: Any, **kwargs: Any) -> Any:
888
+ return _agent_loop_module().run_agent(*args, **kwargs)
889
+
890
+
891
+ def _plan_mode_module() -> Any:
892
+ from ... import plan_mode
893
+
894
+ return plan_mode
895
+
896
+
897
+ def generate_plan_draft(*args: Any, **kwargs: Any) -> Any:
898
+ return _plan_mode_module().generate_plan_draft(*args, **kwargs)
899
+
900
+
901
+ def instruction_with_approved_plan(*args: Any, **kwargs: Any) -> Any:
902
+ return _plan_mode_module().instruction_with_approved_plan(*args, **kwargs)
903
+
904
+
905
+ def record_plan_usage(*args: Any, **kwargs: Any) -> Any:
906
+ return _plan_mode_module().record_plan_usage(*args, **kwargs)
907
+
908
+
909
+ def _plan_assistant_module() -> Any:
910
+ from ... import plan_assistant
911
+
912
+ return plan_assistant
913
+
914
+
915
+ def run_planner_turn(*args: Any, **kwargs: Any) -> Any:
916
+ return _plan_assistant_module().run_planner_turn(*args, **kwargs)
917
+
918
+
919
+ def prepare_planner_knowledge(*args: Any, **kwargs: Any) -> Any:
920
+ return _prepare_planner_knowledge(*args, **kwargs)
921
+
922
+
923
+ def resolve_knowledge_workspace_root(*args: Any, **kwargs: Any) -> Any:
924
+ return _resolve_knowledge_workspace_root(*args, **kwargs)
925
+
926
+
927
+ def apply_plan_update(*args: Any, **kwargs: Any) -> Any:
928
+ return _plan_assistant_module().apply_plan_update(*args, **kwargs)
929
+
930
+
931
+ def apply_guarded_planner_plan_update(*args: Any, **kwargs: Any) -> Any:
932
+ return _plan_assistant_module().apply_guarded_planner_plan_update(*args, **kwargs)
933
+
934
+
935
+ def summarize_plan_update(*args: Any, **kwargs: Any) -> Any:
936
+ return _plan_assistant_module().summarize_plan_update(*args, **kwargs)
937
+
938
+
939
+ def _plan_reconciliation_module() -> Any:
940
+ from ... import plan_reconciliation
941
+
942
+ return plan_reconciliation
943
+
944
+
945
+ def reconcile_plan_with_workspace(*args: Any, **kwargs: Any) -> Any:
946
+ return _plan_reconciliation_module().reconcile_plan_with_workspace(*args, **kwargs)
947
+
948
+
949
+ def summarize_plan_reconciliation(*args: Any, **kwargs: Any) -> Any:
950
+ return _plan_reconciliation_module().summarize_plan_reconciliation(*args, **kwargs)
951
+
952
+
953
+ def _compaction_conversation_module() -> Any:
954
+ from ...compaction import conversation_compactor
955
+
956
+ return conversation_compactor
957
+
958
+
959
+ def _memory_marker() -> str:
960
+ return str(_compaction_conversation_module().MEMORY_MARKER)
961
+
962
+
963
+ def _pins_marker() -> str:
964
+ return str(_compaction_conversation_module().PINS_MARKER)
965
+
966
+
967
+ def _sanitize_messages_for_estimation(*args: Any, **kwargs: Any) -> Any:
968
+ return _compaction_conversation_module().sanitize_messages_for_estimation(*args, **kwargs)
969
+
970
+
971
+ def _estimate_request_tokens(*args: Any, **kwargs: Any) -> Any:
972
+ return _compaction_conversation_module().estimate_request_tokens(*args, **kwargs)
973
+
974
+
975
+ def _resolve_compaction_settings(*args: Any, **kwargs: Any) -> Any:
976
+ from ...compaction.settings import resolve_compaction_settings
977
+
978
+ return resolve_compaction_settings(*args, **kwargs)
979
+
980
+
981
+ def _make_rich_surface(*, console: Console, show_status_line: bool = True) -> Any:
982
+ from ...surface.rich_surface import RichSurface
983
+
984
+ return RichSurface(console=console, show_status_line=show_status_line)
985
+
986
+
987
+ _SCOPE_MODES = {"off", "warn", "strict"}
988
+ _CHAT_MODES = {m.value for m in Mode}
989
+ _CHAT_TRACE_LEVELS = {"off", "compact", "full"}
990
+ _CHAT_RESUME_MAX_CANDIDATES = 50
991
+ _CHAT_RESUME_CONTEXT_MARKER = "<resume_context>"
992
+ _CHAT_RESUME_CONTEXT_MAX_CHARS = 20_000
993
+ _CHAT_RESUME_CONTEXT_MAX_CONVERSATION_MESSAGES = 10
994
+ _CHAT_RESUME_CONTEXT_MAX_TOOL_EVENTS = 80
995
+ _CHAT_RESUME_CONTEXT_MAX_PATHS = 80
996
+ _CHAT_RESUME_CONTEXT_MAX_COMMANDS = 40
997
+ _CHAT_RESUME_CONTEXT_MAX_VERIFY = 24
998
+ _CHAT_RESUME_CONTEXT_MAX_WARNINGS = 24
999
+ _CHAT_RESUME_CONTEXT_MAX_EVENT_TYPES = 80
1000
+ _CHAT_RESUME_CONTEXT_MAX_VALUE_CHARS = 600
1001
+ _CHAT_RESUME_CONTEXT_MAX_PATH_CANDIDATE_SCAN = 2_000
1002
+ _CHAT_RESUME_CONTEXT_PATH_KEY_FRAGMENTS = ("path", "file", "cwd")
1003
+ _CHAT_RESUME_SESSION_ID_MAX_CHARS = 200
1004
+ _MIN_TERMINAL_COLUMNS = 40
1005
+ _MIN_TERMINAL_ROWS = 10
1006
+ _SESSION_SUMMARY_MIN_MESSAGES = 4
1007
+ _SESSION_SUMMARY_MAX_MESSAGES = 12
1008
+ _SESSION_SUMMARY_MAX_TRANSCRIPT_CHARS = 2400
1009
+ _SESSION_SUMMARY_MAX_TITLE_WORDS = 6
1010
+ _CHAT_MODE_ALIASES = {
1011
+ "1": "review",
1012
+ "safe": "review",
1013
+ "review": "review",
1014
+ "2": "auto",
1015
+ "fast": "auto",
1016
+ "auto": "auto",
1017
+ "3": "readonly",
1018
+ "read": "readonly",
1019
+ "readonly": "readonly",
1020
+ "ro": "readonly",
1021
+ "4": "fullaccess",
1022
+ "full": "fullaccess",
1023
+ "fullaccess": "fullaccess",
1024
+ "full-access": "fullaccess",
1025
+ "full_access": "fullaccess",
1026
+ }
1027
+ _HOME_ACTION_ALIASES = {
1028
+ "1": "chat",
1029
+ "2": "run",
1030
+ "3": "setup",
1031
+ "4": "doctor",
1032
+ "5": "plan",
1033
+ "6": "quit",
1034
+ }
1035
+
1036
+
1037
+ def _ordered_unique_strings(values: list[str]) -> list[str]:
1038
+ seen: set[str] = set()
1039
+ ordered: list[str] = []
1040
+ for value in values:
1041
+ item = str(value).strip()
1042
+ if not item or item in seen:
1043
+ continue
1044
+ seen.add(item)
1045
+ ordered.append(item)
1046
+ return ordered
1047
+
1048
+
1049
+ _CHAT_RETIRED_COMMANDS = {"/keys", "/tour", "/examples", "/chat"}
1050
+ _CHAT_GLOBAL_VISIBLE_COMMANDS = [
1051
+ "/help",
1052
+ "/login",
1053
+ "/mode",
1054
+ "/persona",
1055
+ "/ask",
1056
+ "/status",
1057
+ "/subagents",
1058
+ "/terminals",
1059
+ "/pwd",
1060
+ "/usage",
1061
+ "/context",
1062
+ "/compact",
1063
+ "/clear",
1064
+ "/resume",
1065
+ "/stream",
1066
+ "/trace",
1067
+ "/config",
1068
+ "/toolbar",
1069
+ "/assets",
1070
+ "/image",
1071
+ "/forge",
1072
+ "/report",
1073
+ "/feedback",
1074
+ "/plan",
1075
+ "/skill",
1076
+ "/exit",
1077
+ ]
1078
+ _FORGE_COMMAND_TOKENS = [
1079
+ "/assistant",
1080
+ "/execute",
1081
+ "/goal",
1082
+ "/task",
1083
+ "/show",
1084
+ "/done",
1085
+ "/back",
1086
+ ]
1087
+ _FORGE_VISIBLE_COMMAND_TOKENS = [
1088
+ "/execute",
1089
+ "/goal",
1090
+ "/task",
1091
+ "/show",
1092
+ "/done",
1093
+ "/back",
1094
+ ]
1095
+ _FORGE_SHARED_CHAT_COMMANDS = [
1096
+ "/help",
1097
+ "/login",
1098
+ "/mode",
1099
+ "/status",
1100
+ "/subagents",
1101
+ "/terminals",
1102
+ "/pwd",
1103
+ "/usage",
1104
+ "/context",
1105
+ "/compact",
1106
+ "/resume",
1107
+ "/stream",
1108
+ "/trace",
1109
+ "/config",
1110
+ "/toolbar",
1111
+ "/assets",
1112
+ "/image",
1113
+ "/report",
1114
+ "/feedback",
1115
+ "/plan",
1116
+ "/skill",
1117
+ "/exit",
1118
+ ]
1119
+ _FORGE_SUGGESTION_COMMANDS = _ordered_unique_strings(
1120
+ _FORGE_SHARED_CHAT_COMMANDS + _FORGE_VISIBLE_COMMAND_TOKENS
1121
+ )
1122
+ _FORGE_COMPLETER_COMMANDS = _ordered_unique_strings(
1123
+ _FORGE_SHARED_CHAT_COMMANDS
1124
+ + [
1125
+ "/usage hud",
1126
+ "/usage hud on",
1127
+ "/usage hud off",
1128
+ "/usage hud status",
1129
+ "/terminals list",
1130
+ "/terminals show",
1131
+ "/terminals kill",
1132
+ "/terminals help",
1133
+ "/execute plan",
1134
+ "/goal",
1135
+ "/task",
1136
+ "/show",
1137
+ "/done",
1138
+ "/back",
1139
+ "/plan markdown",
1140
+ "/plan md",
1141
+ "/plan edit",
1142
+ ]
1143
+ )
1144
+ _CHAT_COMMANDS = _ordered_unique_strings(
1145
+ _CHAT_GLOBAL_VISIBLE_COMMANDS
1146
+ + _FORGE_COMMAND_TOKENS
1147
+ + [
1148
+ "/",
1149
+ "/cd",
1150
+ "/forge",
1151
+ "/ctx",
1152
+ "/terminals list",
1153
+ "/terminals show",
1154
+ "/terminals kill",
1155
+ "/terminals help",
1156
+ "/forge resume",
1157
+ "/model-info",
1158
+ "/model",
1159
+ "/plan mode",
1160
+ "/plan readonly",
1161
+ "/plan on",
1162
+ "/plan approve",
1163
+ "/plan off",
1164
+ "/plan status",
1165
+ "/plan draft",
1166
+ "/stream on",
1167
+ "/stream off",
1168
+ "/stream status",
1169
+ "/usage hud",
1170
+ "/usage hud on",
1171
+ "/usage hud off",
1172
+ "/usage hud status",
1173
+ "/terminals list",
1174
+ "/terminals show",
1175
+ "/terminals kill",
1176
+ "/terminals help",
1177
+ "/skill",
1178
+ "/paste-image",
1179
+ "/images",
1180
+ "/clear-images",
1181
+ "/clear",
1182
+ ]
1183
+ )
1184
+ _CHAT_PROMPT_TEXT = "> "
1185
+ _CHAT_PROMPT_FALLBACK_LABEL = ">"
1186
+ _CHAT_TOOLBAR_ITEM_ORDER = [
1187
+ "mode",
1188
+ "model",
1189
+ "stream",
1190
+ "trace",
1191
+ "images",
1192
+ "temp",
1193
+ "ctx",
1194
+ "subagents",
1195
+ "tokens",
1196
+ "cost",
1197
+ "forge",
1198
+ "plan",
1199
+ ]
1200
+ _CHAT_LLM_ERROR_MAX_CHARS = 520
1201
+ _CHAT_LLM_ERROR_REDACT_PATTERNS = [
1202
+ re.compile(r"sk-[A-Za-z0-9_\-]{16,}"),
1203
+ re.compile(r"(Bearer\s+)[A-Za-z0-9._\-]{8,}", re.IGNORECASE),
1204
+ re.compile(r"(Authorization\s*:\s*)(.+)", re.IGNORECASE),
1205
+ ]
1206
+ _CHAT_RESUME_SECRET_KEY_PATTERN = (
1207
+ r"[A-Z0-9_\-]*(?:API[_-]?KEY|ACCESS[_-]?TOKEN|REFRESH[_-]?TOKEN|SECRET|PASSWORD|PASSWD|PWD)"
1208
+ r"[A-Z0-9_\-]*"
1209
+ )
1210
+ _CHAT_RESUME_SECRET_JSON_VALUE_RE = re.compile(
1211
+ rf"(?i)([\"']?{_CHAT_RESUME_SECRET_KEY_PATTERN}[\"']?\s*:\s*)"
1212
+ r"(\"[^\"]*\"|'[^']*'|[^\s,;}]+)"
1213
+ )
1214
+ _CHAT_RESUME_SECRET_VALUE_RE = re.compile(
1215
+ rf"(?i)\b({_CHAT_RESUME_SECRET_KEY_PATTERN})"
1216
+ r"(\s*[:=]\s*)"
1217
+ r"(\"[^\"]*\"|'[^']*'|[^\s,;]+)"
1218
+ )
1219
+ _CHAT_RESUME_SECRET_ENV_RE = re.compile(rf"(?i)\b({_CHAT_RESUME_SECRET_KEY_PATTERN})=([^\s,;]+)")
1220
+ MAX_PLAN_ITERATIONS = 10
1221
+
1222
+
1223
+ __all__ = [name for name in globals() if (not name.startswith("__") or name == "__version__")]