cconnect 2.2.1__tar.gz → 2.2.3__tar.gz

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 (238) hide show
  1. {cconnect-2.2.1 → cconnect-2.2.3}/PKG-INFO +1 -1
  2. {cconnect-2.2.1 → cconnect-2.2.3}/cconnect.egg-info/PKG-INFO +1 -1
  3. {cconnect-2.2.1 → cconnect-2.2.3}/cconnect.egg-info/SOURCES.txt +1 -0
  4. {cconnect-2.2.1 → cconnect-2.2.3}/core/databases/engines.json +13 -1
  5. cconnect-2.2.3/core/packs/cconnect-extras/backgrounds/doodles.json +8 -0
  6. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/pack.json +1 -1
  7. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/schema.json +1 -1
  8. {cconnect-2.2.1 → cconnect-2.2.3}/core/release.py +1 -1
  9. {cconnect-2.2.1 → cconnect-2.2.3}/mcps/__init__.py +1 -0
  10. {cconnect-2.2.1 → cconnect-2.2.3}/mcps/databases.py +9 -6
  11. {cconnect-2.2.1 → cconnect-2.2.3}/routers/chat.py +2 -1
  12. {cconnect-2.2.1 → cconnect-2.2.3}/routers/databases.py +11 -0
  13. {cconnect-2.2.1 → cconnect-2.2.3}/routers/projects.py +7 -1
  14. {cconnect-2.2.1 → cconnect-2.2.3}/routers/sessions.py +11 -0
  15. {cconnect-2.2.1 → cconnect-2.2.3}/services/chat_list.py +12 -7
  16. {cconnect-2.2.1 → cconnect-2.2.3}/services/cli_settings.py +36 -4
  17. {cconnect-2.2.1 → cconnect-2.2.3}/services/database_data.py +158 -14
  18. {cconnect-2.2.1 → cconnect-2.2.3}/services/database_engines.py +1 -0
  19. {cconnect-2.2.1 → cconnect-2.2.3}/services/git_ops.py +5 -1
  20. {cconnect-2.2.1 → cconnect-2.2.3}/services/project_watch.py +62 -34
  21. {cconnect-2.2.1 → cconnect-2.2.3}/services/sessions.py +32 -11
  22. {cconnect-2.2.1 → cconnect-2.2.3}/services/system_monitor.py +10 -1
  23. {cconnect-2.2.1 → cconnect-2.2.3}/cconnect.egg-info/dependency_links.txt +0 -0
  24. {cconnect-2.2.1 → cconnect-2.2.3}/cconnect.egg-info/entry_points.txt +0 -0
  25. {cconnect-2.2.1 → cconnect-2.2.3}/cconnect.egg-info/requires.txt +0 -0
  26. {cconnect-2.2.1 → cconnect-2.2.3}/cconnect.egg-info/top_level.txt +0 -0
  27. {cconnect-2.2.1 → cconnect-2.2.3}/core/__init__.py +0 -0
  28. {cconnect-2.2.1 → cconnect-2.2.3}/core/access.py +0 -0
  29. {cconnect-2.2.1 → cconnect-2.2.3}/core/app.py +0 -0
  30. {cconnect-2.2.1 → cconnect-2.2.3}/core/capture/manifest.json +0 -0
  31. {cconnect-2.2.1 → cconnect-2.2.3}/core/capture/offscreen.html +0 -0
  32. {cconnect-2.2.1 → cconnect-2.2.3}/core/capture/offscreen.js +0 -0
  33. {cconnect-2.2.1 → cconnect-2.2.3}/core/capture/worker.js +0 -0
  34. {cconnect-2.2.1 → cconnect-2.2.3}/core/cli.py +0 -0
  35. {cconnect-2.2.1 → cconnect-2.2.3}/core/cli_manager.py +0 -0
  36. {cconnect-2.2.1 → cconnect-2.2.3}/core/config.py +0 -0
  37. {cconnect-2.2.1 → cconnect-2.2.3}/core/db.py +0 -0
  38. {cconnect-2.2.1 → cconnect-2.2.3}/core/display.py +0 -0
  39. {cconnect-2.2.1 → cconnect-2.2.3}/core/migrations/env.py +0 -0
  40. {cconnect-2.2.1 → cconnect-2.2.3}/core/migrations/script.py.mako +0 -0
  41. {cconnect-2.2.1 → cconnect-2.2.3}/core/migrations/versions/20261107_7d5d3c3df2d8_baseline.py +0 -0
  42. {cconnect-2.2.1 → cconnect-2.2.3}/core/migrations/versions/20261107_ba9d242701ac_trash_timestamps.py +0 -0
  43. {cconnect-2.2.1 → cconnect-2.2.3}/core/migrations/versions/20261107_e27b5df5f03a_server_state.py +0 -0
  44. {cconnect-2.2.1 → cconnect-2.2.3}/core/migrations/versions/20261108_4c1f0a9e2b7d_mcp_catalogs.py +0 -0
  45. {cconnect-2.2.1 → cconnect-2.2.3}/core/models.py +0 -0
  46. {cconnect-2.2.1 → cconnect-2.2.3}/core/packages.py +0 -0
  47. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/builtin.json +0 -0
  48. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect/accents.json +0 -0
  49. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect/pack.json +0 -0
  50. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect/terminal/black.json +0 -0
  51. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect/themes/cconnect-dark.json +0 -0
  52. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect/themes/cconnect-light.json +0 -0
  53. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/backgrounds/cyberpunk.json +0 -0
  54. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/backgrounds/darkwave.json +0 -0
  55. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/campbell.json +0 -0
  56. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/catppuccin-latte.json +0 -0
  57. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/catppuccin-mocha.json +0 -0
  58. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/claude-dark.json +0 -0
  59. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/claude-light.json +0 -0
  60. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/dark-plus.json +0 -0
  61. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/dracula.json +0 -0
  62. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/github-dark-hc.json +0 -0
  63. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/github-dark.json +0 -0
  64. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/github-dimmed.json +0 -0
  65. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/github-light-hc.json +0 -0
  66. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/github-light.json +0 -0
  67. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/gruvbox-dark.json +0 -0
  68. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/light-plus.json +0 -0
  69. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/monokai.json +0 -0
  70. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/nord.json +0 -0
  71. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/one-dark.json +0 -0
  72. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/one-half-dark.json +0 -0
  73. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/one-half-light.json +0 -0
  74. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/rose-pine.json +0 -0
  75. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/solarized-dark.json +0 -0
  76. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/solarized-light.json +0 -0
  77. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/tango-dark.json +0 -0
  78. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/tango-light.json +0 -0
  79. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/tokyo-night.json +0 -0
  80. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/ubuntu.json +0 -0
  81. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/vscode-dark-modern.json +0 -0
  82. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/vscode-hc-dark.json +0 -0
  83. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/vscode-hc-light.json +0 -0
  84. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/terminal/vscode-light-modern.json +0 -0
  85. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/ayu-dark.json +0 -0
  86. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/ayu-light.json +0 -0
  87. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/ayu-mirage.json +0 -0
  88. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/catppuccin-latte.json +0 -0
  89. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/catppuccin-mocha.json +0 -0
  90. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/claude-dark.json +0 -0
  91. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/claude-light.json +0 -0
  92. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/dracula.json +0 -0
  93. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/everforest-dark.json +0 -0
  94. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/everforest-light.json +0 -0
  95. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/github-dark-hc.json +0 -0
  96. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/github-dark.json +0 -0
  97. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/github-dimmed.json +0 -0
  98. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/github-light-hc.json +0 -0
  99. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/github-light.json +0 -0
  100. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/gruvbox-dark.json +0 -0
  101. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/kanagawa.json +0 -0
  102. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/monokai.json +0 -0
  103. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/nord.json +0 -0
  104. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/one-dark.json +0 -0
  105. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/rose-pine.json +0 -0
  106. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/solarized-dark.json +0 -0
  107. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/solarized-light.json +0 -0
  108. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/tokyo-night.json +0 -0
  109. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/ubuntu-dark.json +0 -0
  110. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/ubuntu-light.json +0 -0
  111. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/vscode-dark-modern.json +0 -0
  112. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/vscode-dark-plus.json +0 -0
  113. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/vscode-light-modern.json +0 -0
  114. {cconnect-2.2.1 → cconnect-2.2.3}/core/packs/cconnect-extras/themes/vscode-light-plus.json +0 -0
  115. {cconnect-2.2.1 → cconnect-2.2.3}/core/paths.py +0 -0
  116. {cconnect-2.2.1 → cconnect-2.2.3}/core/process_job.py +0 -0
  117. {cconnect-2.2.1 → cconnect-2.2.3}/core/process_tree.py +0 -0
  118. {cconnect-2.2.1 → cconnect-2.2.3}/core/prompts/BLOCKS.md +0 -0
  119. {cconnect-2.2.1 → cconnect-2.2.3}/core/prompts/BROWSER.md +0 -0
  120. {cconnect-2.2.1 → cconnect-2.2.3}/core/prompts/CCONNECT.md +0 -0
  121. {cconnect-2.2.1 → cconnect-2.2.3}/core/prompts/COMMIT.md +0 -0
  122. {cconnect-2.2.1 → cconnect-2.2.3}/core/prompts/INSTALL.md +0 -0
  123. {cconnect-2.2.1 → cconnect-2.2.3}/core/prompts/MODS.md +0 -0
  124. {cconnect-2.2.1 → cconnect-2.2.3}/core/prompts/SUGGESTIONS.md +0 -0
  125. {cconnect-2.2.1 → cconnect-2.2.3}/core/prompts/TOOLS.md +0 -0
  126. {cconnect-2.2.1 → cconnect-2.2.3}/core/rate_limit.py +0 -0
  127. {cconnect-2.2.1 → cconnect-2.2.3}/core/responses.py +0 -0
  128. {cconnect-2.2.1 → cconnect-2.2.3}/core/scripts/browse.py +0 -0
  129. {cconnect-2.2.1 → cconnect-2.2.3}/core/scripts/mcp_bridge.py +0 -0
  130. {cconnect-2.2.1 → cconnect-2.2.3}/core/scripts/page_frame.js +0 -0
  131. {cconnect-2.2.1 → cconnect-2.2.3}/core/scripts/page_icon.js +0 -0
  132. {cconnect-2.2.1 → cconnect-2.2.3}/core/sdk.py +0 -0
  133. {cconnect-2.2.1 → cconnect-2.2.3}/core/settings_defs.py +0 -0
  134. {cconnect-2.2.1 → cconnect-2.2.3}/core/slugs.py +0 -0
  135. {cconnect-2.2.1 → cconnect-2.2.3}/core/ws.py +0 -0
  136. {cconnect-2.2.1 → cconnect-2.2.3}/mcps/browser.py +0 -0
  137. {cconnect-2.2.1 → cconnect-2.2.3}/mcps/check_progress.py +0 -0
  138. {cconnect-2.2.1 → cconnect-2.2.3}/mcps/components.py +0 -0
  139. {cconnect-2.2.1 → cconnect-2.2.3}/mcps/definition.py +0 -0
  140. {cconnect-2.2.1 → cconnect-2.2.3}/mcps/delegate.py +0 -0
  141. {cconnect-2.2.1 → cconnect-2.2.3}/mcps/media.py +0 -0
  142. {cconnect-2.2.1 → cconnect-2.2.3}/mcps/packs.py +0 -0
  143. {cconnect-2.2.1 → cconnect-2.2.3}/mcps/session.py +0 -0
  144. {cconnect-2.2.1 → cconnect-2.2.3}/mcps/shared_files.py +0 -0
  145. {cconnect-2.2.1 → cconnect-2.2.3}/mcps/terminal.py +0 -0
  146. {cconnect-2.2.1 → cconnect-2.2.3}/middleware/__init__.py +0 -0
  147. {cconnect-2.2.1 → cconnect-2.2.3}/middleware/error_handler.py +0 -0
  148. {cconnect-2.2.1 → cconnect-2.2.3}/middleware/public_auth.py +0 -0
  149. {cconnect-2.2.1 → cconnect-2.2.3}/middleware/security.py +0 -0
  150. {cconnect-2.2.1 → cconnect-2.2.3}/pyproject.toml +0 -0
  151. {cconnect-2.2.1 → cconnect-2.2.3}/routers/__init__.py +0 -0
  152. {cconnect-2.2.1 → cconnect-2.2.3}/routers/accounts.py +0 -0
  153. {cconnect-2.2.1 → cconnect-2.2.3}/routers/agents.py +0 -0
  154. {cconnect-2.2.1 → cconnect-2.2.3}/routers/browser.py +0 -0
  155. {cconnect-2.2.1 → cconnect-2.2.3}/routers/capabilities.py +0 -0
  156. {cconnect-2.2.1 → cconnect-2.2.3}/routers/claude.py +0 -0
  157. {cconnect-2.2.1 → cconnect-2.2.3}/routers/cli.py +0 -0
  158. {cconnect-2.2.1 → cconnect-2.2.3}/routers/git.py +0 -0
  159. {cconnect-2.2.1 → cconnect-2.2.3}/routers/health.py +0 -0
  160. {cconnect-2.2.1 → cconnect-2.2.3}/routers/list.py +0 -0
  161. {cconnect-2.2.1 → cconnect-2.2.3}/routers/network.py +0 -0
  162. {cconnect-2.2.1 → cconnect-2.2.3}/routers/packs.py +0 -0
  163. {cconnect-2.2.1 → cconnect-2.2.3}/routers/pages.py +0 -0
  164. {cconnect-2.2.1 → cconnect-2.2.3}/routers/settings.py +0 -0
  165. {cconnect-2.2.1 → cconnect-2.2.3}/routers/shared.py +0 -0
  166. {cconnect-2.2.1 → cconnect-2.2.3}/routers/system.py +0 -0
  167. {cconnect-2.2.1 → cconnect-2.2.3}/routers/terminal.py +0 -0
  168. {cconnect-2.2.1 → cconnect-2.2.3}/schemas/__init__.py +0 -0
  169. {cconnect-2.2.1 → cconnect-2.2.3}/schemas/accounts.py +0 -0
  170. {cconnect-2.2.1 → cconnect-2.2.3}/schemas/chat.py +0 -0
  171. {cconnect-2.2.1 → cconnect-2.2.3}/schemas/chat_events.py +0 -0
  172. {cconnect-2.2.1 → cconnect-2.2.3}/schemas/contract.py +0 -0
  173. {cconnect-2.2.1 → cconnect-2.2.3}/schemas/network.py +0 -0
  174. {cconnect-2.2.1 → cconnect-2.2.3}/services/__init__.py +0 -0
  175. {cconnect-2.2.1 → cconnect-2.2.3}/services/accounts.py +0 -0
  176. {cconnect-2.2.1 → cconnect-2.2.3}/services/acp_events.py +0 -0
  177. {cconnect-2.2.1 → cconnect-2.2.3}/services/acp_peer.py +0 -0
  178. {cconnect-2.2.1 → cconnect-2.2.3}/services/agent_connections.py +0 -0
  179. {cconnect-2.2.1 → cconnect-2.2.3}/services/agent_mcp.py +0 -0
  180. {cconnect-2.2.1 → cconnect-2.2.3}/services/agent_registry.py +0 -0
  181. {cconnect-2.2.1 → cconnect-2.2.3}/services/agent_sessions.py +0 -0
  182. {cconnect-2.2.1 → cconnect-2.2.3}/services/agents.py +0 -0
  183. {cconnect-2.2.1 → cconnect-2.2.3}/services/api_errors.py +0 -0
  184. {cconnect-2.2.1 → cconnect-2.2.3}/services/attachments.py +0 -0
  185. {cconnect-2.2.1 → cconnect-2.2.3}/services/blocks.py +0 -0
  186. {cconnect-2.2.1 → cconnect-2.2.3}/services/browser.py +0 -0
  187. {cconnect-2.2.1 → cconnect-2.2.3}/services/categories.py +0 -0
  188. {cconnect-2.2.1 → cconnect-2.2.3}/services/claude_assets.py +0 -0
  189. {cconnect-2.2.1 → cconnect-2.2.3}/services/claude_manage.py +0 -0
  190. {cconnect-2.2.1 → cconnect-2.2.3}/services/claude_runtime.py +0 -0
  191. {cconnect-2.2.1 → cconnect-2.2.3}/services/claude_status.py +0 -0
  192. {cconnect-2.2.1 → cconnect-2.2.3}/services/cli_info.py +0 -0
  193. {cconnect-2.2.1 → cconnect-2.2.3}/services/cli_login.py +0 -0
  194. {cconnect-2.2.1 → cconnect-2.2.3}/services/control_requests.py +0 -0
  195. {cconnect-2.2.1 → cconnect-2.2.3}/services/database_tunnels.py +0 -0
  196. {cconnect-2.2.1 → cconnect-2.2.3}/services/databases.py +0 -0
  197. {cconnect-2.2.1 → cconnect-2.2.3}/services/delegate_runner.py +0 -0
  198. {cconnect-2.2.1 → cconnect-2.2.3}/services/delegate_runs.py +0 -0
  199. {cconnect-2.2.1 → cconnect-2.2.3}/services/delegates.py +0 -0
  200. {cconnect-2.2.1 → cconnect-2.2.3}/services/diffs.py +0 -0
  201. {cconnect-2.2.1 → cconnect-2.2.3}/services/directories.py +0 -0
  202. {cconnect-2.2.1 → cconnect-2.2.3}/services/directory_watch.py +0 -0
  203. {cconnect-2.2.1 → cconnect-2.2.3}/services/elicitation.py +0 -0
  204. {cconnect-2.2.1 → cconnect-2.2.3}/services/event_rows.py +0 -0
  205. {cconnect-2.2.1 → cconnect-2.2.3}/services/files.py +0 -0
  206. {cconnect-2.2.1 → cconnect-2.2.3}/services/git.py +0 -0
  207. {cconnect-2.2.1 → cconnect-2.2.3}/services/hook_events.py +0 -0
  208. {cconnect-2.2.1 → cconnect-2.2.3}/services/live_sessions.py +0 -0
  209. {cconnect-2.2.1 → cconnect-2.2.3}/services/mcp_lazy.py +0 -0
  210. {cconnect-2.2.1 → cconnect-2.2.3}/services/memory_pressure.py +0 -0
  211. {cconnect-2.2.1 → cconnect-2.2.3}/services/mods.py +0 -0
  212. {cconnect-2.2.1 → cconnect-2.2.3}/services/network.py +0 -0
  213. {cconnect-2.2.1 → cconnect-2.2.3}/services/pack_format.py +0 -0
  214. {cconnect-2.2.1 → cconnect-2.2.3}/services/packs.py +0 -0
  215. {cconnect-2.2.1 → cconnect-2.2.3}/services/pages.py +0 -0
  216. {cconnect-2.2.1 → cconnect-2.2.3}/services/persistent_sessions.py +0 -0
  217. {cconnect-2.2.1 → cconnect-2.2.3}/services/processes.py +0 -0
  218. {cconnect-2.2.1 → cconnect-2.2.3}/services/project_files.py +0 -0
  219. {cconnect-2.2.1 → cconnect-2.2.3}/services/projects.py +0 -0
  220. {cconnect-2.2.1 → cconnect-2.2.3}/services/prompt_cache.py +0 -0
  221. {cconnect-2.2.1 → cconnect-2.2.3}/services/providers.py +0 -0
  222. {cconnect-2.2.1 → cconnect-2.2.3}/services/questions.py +0 -0
  223. {cconnect-2.2.1 → cconnect-2.2.3}/services/repo.py +0 -0
  224. {cconnect-2.2.1 → cconnect-2.2.3}/services/rewind.py +0 -0
  225. {cconnect-2.2.1 → cconnect-2.2.3}/services/settings_store.py +0 -0
  226. {cconnect-2.2.1 → cconnect-2.2.3}/services/shared.py +0 -0
  227. {cconnect-2.2.1 → cconnect-2.2.3}/services/shared_links.py +0 -0
  228. {cconnect-2.2.1 → cconnect-2.2.3}/services/shared_watch.py +0 -0
  229. {cconnect-2.2.1 → cconnect-2.2.3}/services/speedtest.py +0 -0
  230. {cconnect-2.2.1 → cconnect-2.2.3}/services/system_watch.py +0 -0
  231. {cconnect-2.2.1 → cconnect-2.2.3}/services/terminal.py +0 -0
  232. {cconnect-2.2.1 → cconnect-2.2.3}/services/todos.py +0 -0
  233. {cconnect-2.2.1 → cconnect-2.2.3}/services/tool_calls.py +0 -0
  234. {cconnect-2.2.1 → cconnect-2.2.3}/services/tool_props.py +0 -0
  235. {cconnect-2.2.1 → cconnect-2.2.3}/services/trash.py +0 -0
  236. {cconnect-2.2.1 → cconnect-2.2.3}/services/usage.py +0 -0
  237. {cconnect-2.2.1 → cconnect-2.2.3}/services/visibility.py +0 -0
  238. {cconnect-2.2.1 → cconnect-2.2.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cconnect
3
- Version: 2.2.1
3
+ Version: 2.2.3
4
4
  Summary: Remote bridge between the CConnect client and Claude Code
5
5
  Author: jahirtrap
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cconnect
3
- Version: 2.2.1
3
+ Version: 2.2.3
4
4
  Summary: Remote bridge between the CConnect client and Claude Code
5
5
  Author: jahirtrap
6
6
  License-Expression: MIT
@@ -43,6 +43,7 @@ core/packs/cconnect/pack.json
43
43
  core/packs/cconnect-extras/pack.json
44
44
  core/packs/cconnect-extras/backgrounds/cyberpunk.json
45
45
  core/packs/cconnect-extras/backgrounds/darkwave.json
46
+ core/packs/cconnect-extras/backgrounds/doodles.json
46
47
  core/packs/cconnect-extras/terminal/campbell.json
47
48
  core/packs/cconnect-extras/terminal/catppuccin-latte.json
48
49
  core/packs/cconnect-extras/terminal/catppuccin-mocha.json
@@ -19,6 +19,11 @@
19
19
  "primary_key": null,
20
20
  "columns": null,
21
21
  "binary": "X'{hex}'",
22
+ "quote": "\"",
23
+ "auto_increment": "",
24
+ "identity_sync": "",
25
+ "identity_insert_on": "",
26
+ "identity_insert_off": "",
22
27
  "hidden_schemas": ["information_schema", "INFORMATION_SCHEMA"],
23
28
  "options": [],
24
29
  "extensions": [],
@@ -55,6 +60,8 @@
55
60
  "read_only": ["SET TRANSACTION READ ONLY"],
56
61
  "timeout": "SET LOCAL statement_timeout = {milliseconds}",
57
62
  "binary": "decode('{hex}', 'hex')",
63
+ "auto_increment": "GENERATED BY DEFAULT AS IDENTITY",
64
+ "identity_sync": "SELECT setval(pg_get_serial_sequence('{table}', '{column}'), COALESCE((SELECT max({column}) FROM {table}), 0) + 1, false);",
58
65
  "hidden_schemas": ["information_schema", "pg_catalog", "pg_toast"],
59
66
  "returning": "cte"
60
67
  },
@@ -69,6 +76,8 @@
69
76
  "connect_timeout": "connect_timeout",
70
77
  "read_only": ["SET TRANSACTION READ ONLY"],
71
78
  "timeout": "SET SESSION max_execution_time = {milliseconds}",
79
+ "quote": "`",
80
+ "auto_increment": "AUTO_INCREMENT",
72
81
  "hidden_schemas": ["information_schema", "mysql", "performance_schema", "sys"]
73
82
  },
74
83
  {
@@ -89,6 +98,9 @@
89
98
  "sqlglot": "tsql",
90
99
  "connect_timeout": "login_timeout",
91
100
  "binary": "0x{hex}",
101
+ "auto_increment": "IDENTITY(1,1)",
102
+ "identity_insert_on": "SET IDENTITY_INSERT {table} ON;",
103
+ "identity_insert_off": "SET IDENTITY_INSERT {table} OFF;",
92
104
  "hidden_schemas": ["INFORMATION_SCHEMA", "sys", "guest"]
93
105
  },
94
106
  {
@@ -126,7 +138,7 @@
126
138
  {"id": "aurora_dsql", "extends": "postgresql", "label": "Amazon Aurora DSQL", "dialect": "auroradsql+psycopg", "packages": ["aurora-dsql-sqlalchemy", "psycopg[binary]"], "distributions": ["aurora-dsql-sqlalchemy", "psycopg"], "returning": null},
127
139
  {"id": "athena", "label": "Amazon Athena", "dialect": "awsathena+rest", "packages": ["pyathena[sqlalchemy]"], "distributions": ["pyathena"], "port": 443, "sqlglot": "athena", "options": ["s3_staging_dir", "work_group"]},
128
140
  {"id": "dynamodb", "label": "Amazon DynamoDB", "dialect": "dynamodb", "packages": ["pydynamodb"], "distributions": ["pydynamodb"], "port": 443, "options": ["region_name"]},
129
- {"id": "redshift", "extends": "postgresql", "label": "Amazon Redshift", "home": "dev", "dialect": "redshift+psycopg2", "packages": ["sqlalchemy-redshift", "psycopg2-binary"], "distributions": ["sqlalchemy-redshift", "psycopg2-binary"], "port": 5439, "sqlglot": "redshift", "timeout": null, "returning": null},
141
+ {"id": "redshift", "extends": "postgresql", "label": "Amazon Redshift", "home": "dev", "dialect": "redshift+psycopg2", "packages": ["sqlalchemy-redshift", "psycopg2-binary"], "distributions": ["sqlalchemy-redshift", "psycopg2-binary"], "port": 5439, "sqlglot": "redshift", "timeout": null, "auto_increment": "IDENTITY(1,1)", "identity_sync": "", "returning": null},
130
142
  {"id": "drill", "label": "Apache Drill", "dialect": "drill+sadrill", "packages": ["sqlalchemy-drill"], "distributions": ["sqlalchemy-drill"], "port": 8047, "sqlglot": "drill"},
131
143
  {"id": "druid", "label": "Apache Druid", "dialect": "druid", "packages": ["pydruid[sqlalchemy]"], "distributions": ["pydruid"], "port": 8082, "sqlglot": "druid"},
132
144
  {"id": "hive", "label": "Apache Hive", "dialect": "hive", "packages": ["pyhive[hive_pure_sasl]"], "distributions": ["pyhive"], "port": 10000, "sqlglot": "hive"},
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "Doodles",
3
+ "fit": "tile",
4
+ "opacity": 18,
5
+ "brightness": 100,
6
+ "blur": 0,
7
+ "saturation": 100
8
+ }
@@ -2,6 +2,6 @@
2
2
  "schema": 1,
3
3
  "id": "cconnect-extras",
4
4
  "name": "CConnect Extras",
5
- "version": "1.0.0",
5
+ "version": "1.1.0",
6
6
  "author": "CConnect"
7
7
  }
@@ -106,7 +106,7 @@
106
106
  "x": { "min": 0, "max": 100 },
107
107
  "y": { "min": 0, "max": 100 }
108
108
  },
109
- "backgroundFits": ["cover", "contain"],
109
+ "backgroundFits": ["cover", "contain", "tile"],
110
110
  "accentSources": { "dynamic": "dynamic", "theme": "theme" },
111
111
  "fontKinds": ["text", "mono", "symbols", "emoji"],
112
112
  "fontFormats": ["woff2", "woff", "ttf", "otf"],
@@ -1,5 +1,5 @@
1
1
  """The version contract, read by the API and by the packaging metadata."""
2
2
 
3
- VERSION = "2.2.1"
3
+ VERSION = "2.2.3"
4
4
  SUPPORTED_APP = ">=2.2.0"
5
5
  SUPPORTED_CLI = ">=2.1.318"
@@ -69,6 +69,7 @@ def _discover(context: dict) -> list[tuple[Any, Any]]:
69
69
  def _probe(capabilities: Iterable[str]) -> dict:
70
70
  return {
71
71
  "request_compact": lambda *_args: None,
72
+ "reload": lambda *_args: None,
72
73
  "session_info": lambda: {},
73
74
  "emit": lambda *_args, **_kwargs: None,
74
75
  "ask_user": lambda *_args, **_kwargs: None,
@@ -105,7 +105,8 @@ DB_MANAGE = Definition(
105
105
  " a connection and update changes the fields given; remove deletes the connection, never the database; test"
106
106
  " connects without saving. install and uninstall put an engine's driver on the server or take it off. open"
107
107
  " opens a SQLite or DuckDB file as a connection for this session. export writes a table or a query to the"
108
- " shared folder as CSV, or a table as SQL inserts, and shows the file to the user.",
108
+ " shared folder as CSV, or a table, a schema or the whole database as SQL with its structure and rows, and"
109
+ " shows the file to the user.",
109
110
  {
110
111
  "type": "object",
111
112
  "properties": {
@@ -141,10 +142,10 @@ DB_MANAGE = Definition(
141
142
  },
142
143
  "description": "add and update: an SSH tunnel through another machine, with the server's ssh client.",
143
144
  },
144
- "schema": {"type": "string", "description": "export: the table's schema, the default one when left out."},
145
- "table": {"type": "string", "description": "export: the table to write."},
145
+ "schema": {"type": "string", "description": "export: the schema to write, or the table's; the default one when left out."},
146
+ "table": {"type": "string", "description": "export: the table to write. Without table and sql, the schema or the whole database is written."},
146
147
  "sql": {"type": "string", "description": "export: a query that reads, written instead of a table."},
147
- "format": {"type": "string", "enum": list(database_data.TABLE_FORMATS), "description": "export: csv, or sql for a table's inserts; csv when left out."},
148
+ "format": {"type": "string", "enum": list(database_data.TABLE_FORMATS), "description": "export: csv or sql for a table, csv when left out; a schema or a database is always sql."},
148
149
  },
149
150
  "required": ["action"],
150
151
  },
@@ -499,10 +500,12 @@ def _export_file(args: dict, folder: Path) -> str:
499
500
  scope = _scope(args)
500
501
  if args.get("sql"):
501
502
  written = database_data.export_query(scope, args["sql"], folder)
502
- else:
503
+ elif args.get("table"):
503
504
  written = database_data.export_table(
504
- scope, args.get("schema") or None, args.get("table") or "", None, False, "", args.get("format") or database_data.CSV, folder,
505
+ scope, args.get("schema") or None, args["table"], None, False, "", args.get("format") or database_data.CSV, folder,
505
506
  )
507
+ else:
508
+ written = database_data.export_dump(scope, args.get("schema") or None, folder=folder)
506
509
  return Path(written).name
507
510
 
508
511
 
@@ -543,7 +543,8 @@ async def chat_ws(ws: WebSocket):
543
543
 
544
544
  elif mtype == "set_generation":
545
545
  if session is not None:
546
- if msg.cwd is not None and session.state.session_id is None:
546
+ settled = session.state.session_id is not None or session.running or session.resident_alive
547
+ if msg.cwd is not None and not settled:
547
548
  session.state.cwd = msg.cwd or DEFAULT_CWD
548
549
  if msg.model is not None:
549
550
  session.state.model = msg.model
@@ -86,6 +86,10 @@ class TableExport(Browse):
86
86
  format: Literal[database_data.CSV, database_data.SQL] = database_data.CSV
87
87
 
88
88
 
89
+ class SchemaExport(Scoped):
90
+ schema_name: Optional[str] = Field(None, alias="schema")
91
+
92
+
89
93
  def _failed(exc: Exception) -> Response:
90
94
  if isinstance(exc, databases.DatabaseError) and exc.reason == database_data.WRITES:
91
95
  return api_response(status=403)
@@ -236,3 +240,10 @@ async def export_table(connection_id: str, body: TableExport, x_security_key: st
236
240
  @router.post("/databases/{connection_id}/export/query")
237
241
  async def export_query(connection_id: str, body: Statement, x_security_key: str = Header("")):
238
242
  return await _reading(connection_id, x_security_key, lambda: {"path": database_data.export_query(databases.Scope(connection_id, body.database), body.sql)})
243
+
244
+
245
+ @router.post("/databases/{connection_id}/export/dump")
246
+ async def export_dump(connection_id: str, body: SchemaExport, x_security_key: str = Header("")):
247
+ return await _reading(
248
+ connection_id, x_security_key, lambda: {"path": database_data.export_dump(databases.Scope(connection_id, body.database), body.schema_name)},
249
+ )
@@ -66,7 +66,13 @@ async def projects_ws(ws: WebSocket):
66
66
  while True:
67
67
  msg = await ws.receive_json()
68
68
  if msg.get("type") == "watch":
69
- await asyncio.to_thread(project_watch.hub.watch, queue, str(msg.get("project_key") or ""))
69
+ folders = msg.get("folders")
70
+ await asyncio.to_thread(
71
+ project_watch.hub.watch,
72
+ queue,
73
+ str(msg.get("project_key") or ""),
74
+ frozenset(map(str, folders)) if isinstance(folders, list) else frozenset(),
75
+ )
70
76
  except WebSocketDisconnect:
71
77
  pass
72
78
  except Exception as exc:
@@ -292,6 +292,7 @@ def _session_cwd(project: str, session_id: str) -> str:
292
292
 
293
293
  @router.get("/sessions/{session_id}/checkpoints")
294
294
  def get_session_checkpoints(session_id: str, project: str, until: str | None = None):
295
+ project = sessions_service.newest_project_key(session_id, project)
295
296
  try:
296
297
  return api_response(data=sessions_service.list_checkpoints(project, session_id, until))
297
298
  except ValueError as exc:
@@ -319,6 +320,13 @@ async def rewind_session(session_id: str, body: RewindBody):
319
320
  return api_response(data=result)
320
321
 
321
322
 
323
+ @router.delete("/sessions/{session_id}/rewind")
324
+ def cancel_rewind(session_id: str):
325
+ rewind_service.clear_pending(session_id)
326
+ chat_list.hub.refresh_session(session_id)
327
+ return api_response(message="rewind cancelled")
328
+
329
+
322
330
  @router.get("/sessions/{session_id}/images/{message_uuid}/{index}")
323
331
  def get_session_image(request: Request, session_id: str, message_uuid: str, index: int, project: str, trashed: bool = False):
324
332
  try:
@@ -354,6 +362,8 @@ def get_session_messages(
354
362
  ):
355
363
  if limit < 1 or limit > 500:
356
364
  raise HTTPException(status_code=400, detail="invalid limit")
365
+ if not trashed:
366
+ project = sessions_service.newest_project_key(session_id, project)
357
367
  try:
358
368
  items, earlier = sessions_service.session_segment(project, session_id, {
359
369
  "simple": simple,
@@ -380,6 +390,7 @@ def get_session_messages(
380
390
  "start_index": start,
381
391
  "has_more": start > 0,
382
392
  "earlier": earlier,
393
+ "project": project,
383
394
  "context_tokens": sessions_service.context_tokens_in(tail),
384
395
  "cache": prompt_cache.from_entries(tail),
385
396
  "request_bytes": weight[0],
@@ -64,7 +64,7 @@ class ChatListHub:
64
64
  self._resident: set[str] = set()
65
65
  self._hidden: set[str] = set()
66
66
  self._projects: dict[str, dict] = {}
67
- self._sig_cache: dict[str, tuple] = {}
67
+ self._sig_cache: dict[tuple[str, str], tuple] = {}
68
68
  self._folders: dict[str, Folder] = {}
69
69
  self._followers: set[Callable[[set[str]], None]] = set()
70
70
  self._subscribers: set[asyncio.Queue] = set()
@@ -223,9 +223,9 @@ class ChatListHub:
223
223
  def _poll_loop(self):
224
224
  while not self._stop.wait(_POLL_SECONDS):
225
225
  with self._scanning:
226
- before = {sid: cached[0] for sid, cached in self._sig_cache.items()}
226
+ before = {key: cached[0] for key, cached in self._sig_cache.items()}
227
227
  self._rescan(True, None)
228
- written = {sid for sid, cached in self._sig_cache.items() if before.get(sid) != cached[0]}
228
+ written = {key[1] for key, cached in self._sig_cache.items() if before.get(key) != cached[0]}
229
229
  self._tell_followers(written)
230
230
 
231
231
  def _tell_followers(self, written: set[str]):
@@ -242,7 +242,7 @@ class ChatListHub:
242
242
  return False, None
243
243
  sid = file.stem
244
244
  sig = (st.st_mtime, st.st_size)
245
- cached = self._sig_cache.get(sid)
245
+ cached = self._sig_cache.get((pkey, sid))
246
246
  if cached is not None and cached[0] == sig:
247
247
  return True, cached[1]
248
248
  cwd, preview, title, color, entrypoint, has_content = sessions_service._session_meta(file)
@@ -259,7 +259,7 @@ class ChatListHub:
259
259
  "title": title,
260
260
  "color": color,
261
261
  }
262
- self._sig_cache[sid] = (sig, meta)
262
+ self._sig_cache[(pkey, sid)] = (sig, meta)
263
263
  return True, meta
264
264
 
265
265
  def _scan_folder(self, directory: Path, live: set[str], known: Optional[Folder], names: Optional[set[str]]) -> Folder:
@@ -314,12 +314,17 @@ class ChatListHub:
314
314
  else:
315
315
  folders[pkey] = self._scan_folder(directory, live, known, touched.get(pkey) if touched else None)
316
316
  self._folders = folders
317
- seen = {sid for _project, _listed, found in folders.values() for sid in found}
317
+ seen = {(pkey, sid) for pkey, (_project, _listed, found) in folders.items() for sid in found}
318
+ newest: dict[str, dict] = {}
318
319
  for pkey, (project, listed, _found) in folders.items():
319
320
  if project is not None:
320
321
  projects[pkey] = dict(project)
321
322
  for sid, meta in listed.items():
322
- sessions[sid] = self._with_activity(sid, sessions_service.with_pinned(sid, meta))
323
+ known = newest.get(sid)
324
+ if known is None or meta["last_active"] > known["last_active"]:
325
+ newest[sid] = meta
326
+ for sid, meta in newest.items():
327
+ sessions[sid] = self._with_activity(sid, sessions_service.with_pinned(sid, meta))
323
328
  if len(self._sig_cache) > len(seen):
324
329
  self._sig_cache = {k: v for k, v in self._sig_cache.items() if k in seen}
325
330
  for key, meta in projects_service.snapshot().items():
@@ -5,11 +5,14 @@ from __future__ import annotations
5
5
  import json
6
6
  from dataclasses import dataclass
7
7
  from pathlib import Path
8
- from typing import Any, Optional
8
+ from typing import Any, Callable, Optional
9
9
 
10
10
  from services import files
11
11
 
12
12
  _SETTINGS_FILE = "settings.json"
13
+ _ATTRIBUTION = "attribution"
14
+ _ATTRIBUTION_PARTS = ("commit", "pr")
15
+ _LEGACY_ATTRIBUTION = "includeCoAuthoredBy"
13
16
 
14
17
  MAX_SAFE_INTEGER = 9007199254740991
15
18
 
@@ -23,6 +26,31 @@ class CliSettingDef:
23
26
  minimum: Optional[int] = None
24
27
  maximum: Optional[int] = None
25
28
  unset_by: Any = None
29
+ read: Optional[Callable[[dict], Any]] = None
30
+ write: Optional[Callable[[dict, Any], None]] = None
31
+
32
+
33
+ def _attributed(data: dict) -> Optional[bool]:
34
+ """Whether commits carry the trailer: the CLI hides it with empty commit and pr texts."""
35
+ stored = data.get(_ATTRIBUTION)
36
+ if isinstance(stored, dict):
37
+ return any(stored.get(part) != "" for part in _ATTRIBUTION_PARTS)
38
+ if isinstance(stored, bool):
39
+ return stored
40
+ legacy = data.get(_LEGACY_ATTRIBUTION)
41
+ return legacy if isinstance(legacy, bool) else None
42
+
43
+
44
+ def _attribute(data: dict, enabled: Optional[bool]) -> None:
45
+ stored = data.get(_ATTRIBUTION)
46
+ kept = {key: value for key, value in stored.items() if key not in _ATTRIBUTION_PARTS} if isinstance(stored, dict) else {}
47
+ data.pop(_LEGACY_ATTRIBUTION, None)
48
+ if enabled is False:
49
+ data[_ATTRIBUTION] = {**kept, **dict.fromkeys(_ATTRIBUTION_PARTS, "")}
50
+ elif kept:
51
+ data[_ATTRIBUTION] = kept
52
+ else:
53
+ data.pop(_ATTRIBUTION, None)
26
54
 
27
55
 
28
56
  SETTINGS: dict[str, CliSettingDef] = {
@@ -67,11 +95,13 @@ SETTINGS: dict[str, CliSettingDef] = {
67
95
  description="Let a session started here be taken over from claude.ai",
68
96
  ),
69
97
  "co_authored": CliSettingDef(
70
- json_key="attribution",
98
+ json_key=_ATTRIBUTION,
71
99
  default=True,
72
100
  type=bool,
73
101
  description="Add the Co-Authored-By trailer to the commits and pull requests Claude writes",
74
102
  unset_by=True,
103
+ read=_attributed,
104
+ write=_attribute,
75
105
  ),
76
106
  "session_upload": CliSettingDef(
77
107
  json_key="autoUploadSessions",
@@ -153,7 +183,7 @@ def _valid(value: Any, expected: type) -> bool:
153
183
 
154
184
  def _stored(key: str) -> Any:
155
185
  defn = SETTINGS[key]
156
- value = lookup(_read(), defn.json_key)
186
+ value = defn.read(_read()) if defn.read else lookup(_read(), defn.json_key)
157
187
  return value if _valid(value, defn.type) else None
158
188
 
159
189
 
@@ -217,7 +247,9 @@ def set(key: str, value: Any) -> None:
217
247
  if defn.maximum is not None and value > defn.maximum:
218
248
  raise ValueError(f"{key} must be at most {defn.maximum}")
219
249
  data = _read()
220
- if not blank:
250
+ if defn.write:
251
+ defn.write(data, None if blank else value)
252
+ elif not blank:
221
253
  assign(data, defn.json_key, value)
222
254
  elif value is None or _valid(lookup(data, defn.json_key), defn.type):
223
255
  discard(data, defn.json_key)
@@ -738,16 +738,161 @@ def _renderer(column: Any, engine: Engine, binary: str) -> Callable[[Any], str]:
738
738
  return render
739
739
 
740
740
 
741
- def _write_inserts(target: Path, engine: Engine, entry: dict, reflected: Table, source: Any) -> None:
742
- binary = database_engines.spec_of(entry)["binary"]
741
+ def _quoted(engine: Engine, schema: Optional[str], name: str) -> str:
742
+ quote = engine.dialect.identifier_preparer.quote
743
+ return ".".join(quote(part) for part in (schema, name) if part)
744
+
745
+
746
+ def _names(engine: Engine, names: list[str]) -> str:
743
747
  quote = engine.dialect.identifier_preparer.quote
744
- name = ".".join(quote(part) for part in (reflected.schema, reflected.name) if part)
745
- columns = ", ".join(quote(column.name) for column in reflected.columns)
748
+ return ", ".join(quote(name) for name in names)
749
+
750
+
751
+ def _optional(read: Callable[[], Any], fallback: Any = None) -> Any:
752
+ try:
753
+ return read()
754
+ except (NotImplementedError, SQLAlchemyError):
755
+ return fallback
756
+
757
+
758
+ def _insert_lines(handle: Any, engine: Engine, entry: dict, reflected: Table, source: Any) -> None:
759
+ binary = database_engines.spec_of(entry)["binary"]
760
+ name = _quoted(engine, reflected.schema, reflected.name)
761
+ columns = _names(engine, [column.name for column in reflected.columns])
746
762
  renderers = [_renderer(column, engine, binary) for column in reflected.columns]
747
- with target.open("w", encoding="utf-8", newline="\n") as handle:
748
- for row in source:
749
- values = ", ".join(render(value) for render, value in zip(renderers, row))
750
- handle.write(f"INSERT INTO {name} ({columns}) VALUES ({values});\n")
763
+ for row in source:
764
+ values = ", ".join(render(value) for render, value in zip(renderers, row))
765
+ handle.write(f"INSERT INTO {name} ({columns}) VALUES ({values});\n")
766
+
767
+
768
+ def _default_ddl(default: str) -> str:
769
+ expression = default.strip()
770
+ if "(" in expression and not (expression.startswith("(") and expression.endswith(")")):
771
+ return f"({expression})"
772
+ return expression
773
+
774
+
775
+ def _column_ddl(engine: Engine, column: dict, auto_increment: str) -> str:
776
+ parts = [_names(engine, [column["name"]])]
777
+ if column["type"]:
778
+ parts.append(column["type"])
779
+ if not column["nullable"]:
780
+ parts.append("NOT NULL")
781
+ if column["auto"] and auto_increment:
782
+ parts.append(auto_increment)
783
+ elif column["default"] is not None:
784
+ parts.append(f"DEFAULT {_default_ddl(column['default'])}")
785
+ return " ".join(parts)
786
+
787
+
788
+ def _table_ddl(engine: Engine, item: dict, connection: Connection, schema: Optional[str], name: str) -> tuple[list[str], list[str]]:
789
+ inspector = inspect(connection)
790
+ primary = _optional(lambda: _primary(connection, item, schema, name), [])
791
+ columns = [_column(column, primary) for column in _columns(connection, item, schema, name)]
792
+ lines = [_column_ddl(engine, column, item["auto_increment"]) for column in columns]
793
+ if primary:
794
+ lines.append(f"PRIMARY KEY ({_names(engine, primary)})")
795
+ for key in (_foreign(found) for found in _optional(lambda: inspector.get_foreign_keys(name, schema=schema), [])):
796
+ if key["columns"] and key["table"] and key["referred"]:
797
+ referred = _quoted(engine, key["schema"], key["table"])
798
+ lines.append(f"FOREIGN KEY ({_names(engine, key['columns'])}) REFERENCES {referred} ({_names(engine, key['referred'])})")
799
+ target = _quoted(engine, schema, name)
800
+ statements = ["CREATE TABLE " + target + " (\n " + ",\n ".join(lines) + "\n);"]
801
+ for index in (_index(found) for found in _optional(lambda: inspector.get_indexes(name, schema=schema), [])):
802
+ if index["name"] and index["columns"] and index["columns"] != primary:
803
+ unique = "UNIQUE " if index["unique"] else ""
804
+ statements.append(f"CREATE {unique}INDEX {_names(engine, [index['name']])} ON {target} ({_names(engine, index['columns'])});")
805
+ return statements, [column["name"] for column in columns if column["auto"]]
806
+
807
+
808
+ def _identity_lines(item: dict, key: str, table: str, columns: list[str]) -> list[str]:
809
+ template = item[key]
810
+ if not template or not columns:
811
+ return []
812
+ return [template.format(table=table, column=column) for column in columns]
813
+
814
+
815
+ def _view_ddl(engine: Engine, connection: Connection, schema: Optional[str], name: str) -> Optional[str]:
816
+ definition = _optional(lambda: inspect(connection).get_view_definition(name, schema=schema))
817
+ if not definition:
818
+ return None
819
+ body = str(definition).strip().rstrip(";")
820
+ if re.match(r"(?is)\s*create\s", body):
821
+ return f"{body};"
822
+ return f"CREATE VIEW {_quoted(engine, schema, name)} AS {body};"
823
+
824
+
825
+ def _dependency_order(connection: Connection, schema: Optional[str], names: list[str]) -> list[str]:
826
+ inspector = inspect(connection)
827
+ needs = {
828
+ name: {
829
+ str(key.get("referred_table"))
830
+ for key in _optional(lambda: inspector.get_foreign_keys(name, schema=schema), [])
831
+ if key.get("referred_table") in names and key.get("referred_table") != name
832
+ }
833
+ for name in names
834
+ }
835
+ ordered: list[str] = []
836
+ while needs:
837
+ ready = sorted(name for name, wanted in needs.items() if wanted <= set(ordered)) or sorted(needs)
838
+ ordered.extend(ready)
839
+ for name in ready:
840
+ del needs[name]
841
+ return ordered
842
+
843
+
844
+ def _catalog(connection: Connection, scope: databases.Scope, schema: Optional[str]) -> tuple[list[str], list[str]]:
845
+ inspector = inspect(connection)
846
+ tables = sorted(inspector.get_table_names(schema=schema))
847
+ views = sorted({*inspector.get_view_names(schema=schema), *_materialized(scope, schema)})
848
+ return tables, views
849
+
850
+
851
+ def _dump_schemas(scope: databases.Scope, schema: Optional[str], name: Optional[str]) -> list[Optional[str]]:
852
+ listed = schemas(scope)
853
+ if listed["databases"] is not None:
854
+ raise databases.DatabaseError(INVALID)
855
+ chosen = [schema] if schema or name else (listed["schemas"] or [None])
856
+ return [None if place in (None, listed["default"]) else place for place in chosen]
857
+
858
+
859
+ def export_dump(
860
+ scope: databases.Scope,
861
+ schema: Optional[str] = None,
862
+ name: Optional[str] = None,
863
+ sort: Optional[str] = None,
864
+ descending: bool = False,
865
+ where: str = "",
866
+ folder: Optional[Path] = None,
867
+ ) -> str:
868
+ engine, entry = databases.engine_for(scope)
869
+ item = database_engines.spec_of(entry)
870
+ places = _dump_schemas(scope, schema, name)
871
+ target = _export_file(entry, name or schema or scope.database or entry["name"], SQL, folder)
872
+ with _reading(scope, EXPORT_SECONDS) as connection, target.open("w", encoding="utf-8", newline="\n") as handle:
873
+ for place in places:
874
+ tables, views = _catalog(connection, scope, place)
875
+ if name:
876
+ tables, views = ([] if name in views else [name]), ([name] if name in views else [])
877
+ elif place:
878
+ handle.write(f"CREATE SCHEMA {_names(engine, [place])};\n\n")
879
+ for table in _dependency_order(connection, place, tables):
880
+ statements, auto = _table_ddl(engine, item, connection, place, table)
881
+ qualified = _quoted(engine, place, table)
882
+ for statement in statements + _identity_lines(item, "identity_insert_on", qualified, auto[:1]):
883
+ handle.write(f"{statement}\n")
884
+ reflected = _reflect(scope, connection, place, table)
885
+ selected = _ordered(_filtered(scope, reflected, where), reflected, sort, descending)
886
+ result = connection.execution_options(stream_results=True).execute(selected)
887
+ _insert_lines(handle, engine, entry, reflected, result)
888
+ for statement in _identity_lines(item, "identity_insert_off", qualified, auto[:1]) + _identity_lines(item, "identity_sync", qualified, auto):
889
+ handle.write(f"{statement}\n")
890
+ handle.write("\n")
891
+ for view in views:
892
+ statement = _view_ddl(engine, connection, place, view)
893
+ if statement:
894
+ handle.write(f"{statement}\n\n")
895
+ return _relative(target)
751
896
 
752
897
 
753
898
  def export_table(
@@ -762,16 +907,15 @@ def export_table(
762
907
  ) -> str:
763
908
  if format not in TABLE_FORMATS:
764
909
  raise databases.DatabaseError(INVALID, format)
765
- engine, entry = databases.engine_for(scope)
766
- target = _export_file(entry, name, format, folder)
910
+ if format == SQL:
911
+ return export_dump(scope, schema, name, sort, descending, where, folder)
912
+ entry = databases.require(scope.connection)
913
+ target = _export_file(entry, name, CSV, folder)
767
914
  with _reading(scope, EXPORT_SECONDS) as connection:
768
915
  reflected = _reflect(scope, connection, schema, name)
769
916
  selected = _ordered(_filtered(scope, reflected, where), reflected, sort, descending)
770
917
  result = connection.execution_options(stream_results=True).execute(selected)
771
- if format == CSV:
772
- _write_csv(target, list(result.keys()), result)
773
- else:
774
- _write_inserts(target, engine, entry, reflected, result)
918
+ _write_csv(target, list(result.keys()), result)
775
919
  return _relative(target)
776
920
 
777
921
 
@@ -133,6 +133,7 @@ def listed() -> list[dict]:
133
133
  "port": item["port"],
134
134
  "packages": item["packages"],
135
135
  "options": item["options"],
136
+ "quote": item["quote"],
136
137
  "installed": installed(engine),
137
138
  }
138
139
  for engine, item in ENGINES.items()
@@ -1,6 +1,7 @@
1
1
  """Git operations the commit panel performs, on top of the single git runner."""
2
2
 
3
3
  import re
4
+ import subprocess
4
5
  import threading
5
6
  from pathlib import Path
6
7
  from typing import Optional
@@ -30,7 +31,10 @@ def lock_for(repo: Path) -> threading.Lock:
30
31
 
31
32
 
32
33
  def _read(repo: Path, *args: str, timeout: int = _TIMEOUT) -> Optional[str]:
33
- result = git.run(repo, *args, timeout=timeout)
34
+ try:
35
+ result = git.run(repo, *args, timeout=timeout)
36
+ except (OSError, subprocess.SubprocessError):
37
+ return None
34
38
  return result.stdout.strip() if result.returncode == 0 else None
35
39
 
36
40