bytebuddhi 0.1.4rc1__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 (360) hide show
  1. bytebuddhi-0.1.4rc1/.gitignore +153 -0
  2. bytebuddhi-0.1.4rc1/PKG-INFO +328 -0
  3. bytebuddhi-0.1.4rc1/README.md +251 -0
  4. bytebuddhi-0.1.4rc1/alembic/README +1 -0
  5. bytebuddhi-0.1.4rc1/alembic/env.py +118 -0
  6. bytebuddhi-0.1.4rc1/alembic/script.py.mako +28 -0
  7. bytebuddhi-0.1.4rc1/alembic/versions/36144d2c114a_add_agent_checkpoints_table.py +48 -0
  8. bytebuddhi-0.1.4rc1/alembic/versions/4dad8f1bf999_add_rls_policies.py +388 -0
  9. bytebuddhi-0.1.4rc1/alembic/versions/7a8e102b345c_add_memory_items_table.py +55 -0
  10. bytebuddhi-0.1.4rc1/alembic/versions/94ae091b2313_initial_migration.py +184 -0
  11. bytebuddhi-0.1.4rc1/alembic/versions/a9c8e7d6b5f4_drop_unwired_rls.py +73 -0
  12. bytebuddhi-0.1.4rc1/alembic/versions/b1c2d3e4f5a6_add_external_identities.py +57 -0
  13. bytebuddhi-0.1.4rc1/alembic/versions/c3d4e5f6a7b8_add_agent_runs_and_events.py +83 -0
  14. bytebuddhi-0.1.4rc1/alembic/versions/d4e5f6a7b8c9_add_run_lease_columns.py +36 -0
  15. bytebuddhi-0.1.4rc1/alembic.ini +150 -0
  16. bytebuddhi-0.1.4rc1/app/__init__.py +16 -0
  17. bytebuddhi-0.1.4rc1/app/_version.py +32 -0
  18. bytebuddhi-0.1.4rc1/app/application/__init__.py +8 -0
  19. bytebuddhi-0.1.4rc1/app/application/agent/__init__.py +17 -0
  20. bytebuddhi-0.1.4rc1/app/application/agent/context.py +295 -0
  21. bytebuddhi-0.1.4rc1/app/application/agent/context_projector.py +97 -0
  22. bytebuddhi-0.1.4rc1/app/application/agent/errors.py +136 -0
  23. bytebuddhi-0.1.4rc1/app/application/agent/orchestrator.py +800 -0
  24. bytebuddhi-0.1.4rc1/app/application/agent/registry.py +208 -0
  25. bytebuddhi-0.1.4rc1/app/application/agent/runtime.py +803 -0
  26. bytebuddhi-0.1.4rc1/app/application/agent/state.py +117 -0
  27. bytebuddhi-0.1.4rc1/app/application/agent/types.py +42 -0
  28. bytebuddhi-0.1.4rc1/app/application/auth/__init__.py +1 -0
  29. bytebuddhi-0.1.4rc1/app/application/auth/config.py +18 -0
  30. bytebuddhi-0.1.4rc1/app/application/auth/identity_data.py +17 -0
  31. bytebuddhi-0.1.4rc1/app/application/auth/oauth_service.py +353 -0
  32. bytebuddhi-0.1.4rc1/app/application/auth/pkce.py +25 -0
  33. bytebuddhi-0.1.4rc1/app/application/auth/registry.py +19 -0
  34. bytebuddhi-0.1.4rc1/app/application/code/in_memory_index.py +70 -0
  35. bytebuddhi-0.1.4rc1/app/application/code/intelligence_service.py +360 -0
  36. bytebuddhi-0.1.4rc1/app/application/dto/__init__.py +27 -0
  37. bytebuddhi-0.1.4rc1/app/application/dto/chat_dto.py +51 -0
  38. bytebuddhi-0.1.4rc1/app/application/dto/project_dto.py +45 -0
  39. bytebuddhi-0.1.4rc1/app/application/execution/command_executor.py +128 -0
  40. bytebuddhi-0.1.4rc1/app/application/llm/__init__.py +1 -0
  41. bytebuddhi-0.1.4rc1/app/application/llm/catalog.py +88 -0
  42. bytebuddhi-0.1.4rc1/app/application/llm/routing.py +71 -0
  43. bytebuddhi-0.1.4rc1/app/application/memory/classifier.py +177 -0
  44. bytebuddhi-0.1.4rc1/app/application/memory/deduplicator.py +71 -0
  45. bytebuddhi-0.1.4rc1/app/application/memory/orchestrator.py +367 -0
  46. bytebuddhi-0.1.4rc1/app/application/memory/ranking.py +83 -0
  47. bytebuddhi-0.1.4rc1/app/application/policy/command_policy.py +166 -0
  48. bytebuddhi-0.1.4rc1/app/application/policy/tool_policy.py +156 -0
  49. bytebuddhi-0.1.4rc1/app/application/ports/__init__.py +8 -0
  50. bytebuddhi-0.1.4rc1/app/application/ports/output/__init__.py +7 -0
  51. bytebuddhi-0.1.4rc1/app/application/ports/output/auth/__init__.py +1 -0
  52. bytebuddhi-0.1.4rc1/app/application/ports/output/auth/oauth_identity_provider.py +35 -0
  53. bytebuddhi-0.1.4rc1/app/application/ports/output/auth/oauth_state_store.py +33 -0
  54. bytebuddhi-0.1.4rc1/app/application/ports/output/cache/__init__.py +0 -0
  55. bytebuddhi-0.1.4rc1/app/application/ports/output/cache/cache_service.py +31 -0
  56. bytebuddhi-0.1.4rc1/app/application/ports/output/code/code_index.py +44 -0
  57. bytebuddhi-0.1.4rc1/app/application/ports/output/code/code_parser.py +27 -0
  58. bytebuddhi-0.1.4rc1/app/application/ports/output/connectors/connector.py +44 -0
  59. bytebuddhi-0.1.4rc1/app/application/ports/output/connectors/credential_provider.py +28 -0
  60. bytebuddhi-0.1.4rc1/app/application/ports/output/execution/process_manager.py +139 -0
  61. bytebuddhi-0.1.4rc1/app/application/ports/output/llm/__init__.py +0 -0
  62. bytebuddhi-0.1.4rc1/app/application/ports/output/llm/llm_provider.py +64 -0
  63. bytebuddhi-0.1.4rc1/app/application/ports/output/llm/model_catalog.py +31 -0
  64. bytebuddhi-0.1.4rc1/app/application/ports/output/llm/model_gateway.py +133 -0
  65. bytebuddhi-0.1.4rc1/app/application/ports/output/logger.py +46 -0
  66. bytebuddhi-0.1.4rc1/app/application/ports/output/mcp/mcp_client.py +38 -0
  67. bytebuddhi-0.1.4rc1/app/application/ports/output/memory/memory_store.py +60 -0
  68. bytebuddhi-0.1.4rc1/app/application/ports/output/observability/context.py +111 -0
  69. bytebuddhi-0.1.4rc1/app/application/ports/output/observability/meter.py +47 -0
  70. bytebuddhi-0.1.4rc1/app/application/ports/output/observability/noop.py +142 -0
  71. bytebuddhi-0.1.4rc1/app/application/ports/output/observability/tracer.py +102 -0
  72. bytebuddhi-0.1.4rc1/app/application/ports/output/repository/__init__.py +0 -0
  73. bytebuddhi-0.1.4rc1/app/application/ports/output/repository/code_chunk_repository.py +70 -0
  74. bytebuddhi-0.1.4rc1/app/application/ports/output/repository/conversation_repository.py +33 -0
  75. bytebuddhi-0.1.4rc1/app/application/ports/output/repository/embedding_repository.py +74 -0
  76. bytebuddhi-0.1.4rc1/app/application/ports/output/repository/external_identity_repository.py +36 -0
  77. bytebuddhi-0.1.4rc1/app/application/ports/output/repository/file_repository.py +97 -0
  78. bytebuddhi-0.1.4rc1/app/application/ports/output/repository/message_repository.py +33 -0
  79. bytebuddhi-0.1.4rc1/app/application/ports/output/repository/project_repository.py +43 -0
  80. bytebuddhi-0.1.4rc1/app/application/ports/output/repository/user_repository.py +48 -0
  81. bytebuddhi-0.1.4rc1/app/application/ports/output/storage/__init__.py +7 -0
  82. bytebuddhi-0.1.4rc1/app/application/ports/output/storage/artifact_store.py +68 -0
  83. bytebuddhi-0.1.4rc1/app/application/ports/output/storage/file_storage_service.py +62 -0
  84. bytebuddhi-0.1.4rc1/app/application/ports/output/web/__init__.py +7 -0
  85. bytebuddhi-0.1.4rc1/app/application/ports/output/web/fetch.py +18 -0
  86. bytebuddhi-0.1.4rc1/app/application/ports/output/web/render.py +23 -0
  87. bytebuddhi-0.1.4rc1/app/application/ports/output/web/search.py +23 -0
  88. bytebuddhi-0.1.4rc1/app/application/runs/__init__.py +13 -0
  89. bytebuddhi-0.1.4rc1/app/application/runs/admission.py +77 -0
  90. bytebuddhi-0.1.4rc1/app/application/runs/bus.py +54 -0
  91. bytebuddhi-0.1.4rc1/app/application/runs/config.py +32 -0
  92. bytebuddhi-0.1.4rc1/app/application/runs/coordinator.py +587 -0
  93. bytebuddhi-0.1.4rc1/app/application/runs/errors.py +51 -0
  94. bytebuddhi-0.1.4rc1/app/application/runs/identity.py +25 -0
  95. bytebuddhi-0.1.4rc1/app/application/runs/metrics.py +38 -0
  96. bytebuddhi-0.1.4rc1/app/application/runs/reaper.py +57 -0
  97. bytebuddhi-0.1.4rc1/app/application/runs/records.py +74 -0
  98. bytebuddhi-0.1.4rc1/app/application/runs/sequence.py +30 -0
  99. bytebuddhi-0.1.4rc1/app/application/runs/status.py +47 -0
  100. bytebuddhi-0.1.4rc1/app/application/runs/store.py +391 -0
  101. bytebuddhi-0.1.4rc1/app/application/runs/writer.py +126 -0
  102. bytebuddhi-0.1.4rc1/app/application/runtime/__init__.py +1 -0
  103. bytebuddhi-0.1.4rc1/app/application/runtime/admission.py +54 -0
  104. bytebuddhi-0.1.4rc1/app/application/runtime/approval.py +200 -0
  105. bytebuddhi-0.1.4rc1/app/application/runtime/cancellation.py +181 -0
  106. bytebuddhi-0.1.4rc1/app/application/runtime/events.py +156 -0
  107. bytebuddhi-0.1.4rc1/app/application/services/__init__.py +14 -0
  108. bytebuddhi-0.1.4rc1/app/application/services/file_processing_service.py +247 -0
  109. bytebuddhi-0.1.4rc1/app/application/tools/__init__.py +11 -0
  110. bytebuddhi-0.1.4rc1/app/application/tools/builtin/code_tools.py +205 -0
  111. bytebuddhi-0.1.4rc1/app/application/tools/builtin/command_tools.py +73 -0
  112. bytebuddhi-0.1.4rc1/app/application/tools/builtin/delegation_tools.py +101 -0
  113. bytebuddhi-0.1.4rc1/app/application/tools/builtin/echo_tool.py +32 -0
  114. bytebuddhi-0.1.4rc1/app/application/tools/builtin/filesystem_tools.py +124 -0
  115. bytebuddhi-0.1.4rc1/app/application/tools/builtin/web_research.py +90 -0
  116. bytebuddhi-0.1.4rc1/app/application/tools/context.py +96 -0
  117. bytebuddhi-0.1.4rc1/app/application/tools/definition.py +97 -0
  118. bytebuddhi-0.1.4rc1/app/application/tools/executor.py +253 -0
  119. bytebuddhi-0.1.4rc1/app/application/tools/registry.py +163 -0
  120. bytebuddhi-0.1.4rc1/app/application/use_cases/__init__.py +15 -0
  121. bytebuddhi-0.1.4rc1/app/application/use_cases/agent/__init__.py +13 -0
  122. bytebuddhi-0.1.4rc1/app/application/use_cases/agent/execute_task.py +196 -0
  123. bytebuddhi-0.1.4rc1/app/application/use_cases/chat/__init__.py +0 -0
  124. bytebuddhi-0.1.4rc1/app/application/use_cases/chat/create_conversation.py +35 -0
  125. bytebuddhi-0.1.4rc1/app/application/use_cases/chat/send_message.py +52 -0
  126. bytebuddhi-0.1.4rc1/app/application/use_cases/project/__init__.py +0 -0
  127. bytebuddhi-0.1.4rc1/app/application/use_cases/project/create_project.py +47 -0
  128. bytebuddhi-0.1.4rc1/app/application/use_cases/project/get_project.py +35 -0
  129. bytebuddhi-0.1.4rc1/app/application/use_cases/project/list_projects.py +33 -0
  130. bytebuddhi-0.1.4rc1/app/application/use_cases/project/resolve_project_by_local_path.py +34 -0
  131. bytebuddhi-0.1.4rc1/app/application/web/__init__.py +1 -0
  132. bytebuddhi-0.1.4rc1/app/application/web/content_normalizer.py +24 -0
  133. bytebuddhi-0.1.4rc1/app/application/web/extractor.py +329 -0
  134. bytebuddhi-0.1.4rc1/app/application/web/limits.py +37 -0
  135. bytebuddhi-0.1.4rc1/app/application/web/models.py +236 -0
  136. bytebuddhi-0.1.4rc1/app/application/web/research_service.py +559 -0
  137. bytebuddhi-0.1.4rc1/app/application/web/url_policy.py +245 -0
  138. bytebuddhi-0.1.4rc1/app/application/workspace/filesystem_service.py +192 -0
  139. bytebuddhi-0.1.4rc1/app/application/workspace/resolution_service.py +135 -0
  140. bytebuddhi-0.1.4rc1/app/domain/__init__.py +8 -0
  141. bytebuddhi-0.1.4rc1/app/domain/exceptions/__init__.py +56 -0
  142. bytebuddhi-0.1.4rc1/app/domain/exceptions/auth_exceptions.py +26 -0
  143. bytebuddhi-0.1.4rc1/app/domain/exceptions/base.py +6 -0
  144. bytebuddhi-0.1.4rc1/app/domain/exceptions/connector_exceptions.py +54 -0
  145. bytebuddhi-0.1.4rc1/app/domain/exceptions/conversation_exceptions.py +22 -0
  146. bytebuddhi-0.1.4rc1/app/domain/exceptions/execution_exceptions.py +8 -0
  147. bytebuddhi-0.1.4rc1/app/domain/exceptions/project_exceptions.py +29 -0
  148. bytebuddhi-0.1.4rc1/app/domain/exceptions/web_exceptions.py +98 -0
  149. bytebuddhi-0.1.4rc1/app/domain/exceptions/workspace_exceptions.py +66 -0
  150. bytebuddhi-0.1.4rc1/app/domain/models/__init__.py +53 -0
  151. bytebuddhi-0.1.4rc1/app/domain/models/agent.py +173 -0
  152. bytebuddhi-0.1.4rc1/app/domain/models/artifact.py +60 -0
  153. bytebuddhi-0.1.4rc1/app/domain/models/code_chunk.py +55 -0
  154. bytebuddhi-0.1.4rc1/app/domain/models/code_intelligence.py +166 -0
  155. bytebuddhi-0.1.4rc1/app/domain/models/context.py +65 -0
  156. bytebuddhi-0.1.4rc1/app/domain/models/context_snapshot.py +79 -0
  157. bytebuddhi-0.1.4rc1/app/domain/models/conversation.py +58 -0
  158. bytebuddhi-0.1.4rc1/app/domain/models/credential.py +77 -0
  159. bytebuddhi-0.1.4rc1/app/domain/models/embedding.py +47 -0
  160. bytebuddhi-0.1.4rc1/app/domain/models/environment_policy.py +114 -0
  161. bytebuddhi-0.1.4rc1/app/domain/models/execution_context.py +109 -0
  162. bytebuddhi-0.1.4rc1/app/domain/models/external_identity.py +58 -0
  163. bytebuddhi-0.1.4rc1/app/domain/models/file.py +65 -0
  164. bytebuddhi-0.1.4rc1/app/domain/models/mcp.py +55 -0
  165. bytebuddhi-0.1.4rc1/app/domain/models/memory.py +202 -0
  166. bytebuddhi-0.1.4rc1/app/domain/models/message.py +65 -0
  167. bytebuddhi-0.1.4rc1/app/domain/models/observability.py +277 -0
  168. bytebuddhi-0.1.4rc1/app/domain/models/project.py +88 -0
  169. bytebuddhi-0.1.4rc1/app/domain/models/user.py +119 -0
  170. bytebuddhi-0.1.4rc1/app/domain/models/workspace.py +125 -0
  171. bytebuddhi-0.1.4rc1/app/domain/services/__init__.py +18 -0
  172. bytebuddhi-0.1.4rc1/app/domain/services/conversation_context_service.py +159 -0
  173. bytebuddhi-0.1.4rc1/app/domain/services/project_indexing_service.py +154 -0
  174. bytebuddhi-0.1.4rc1/app/domain/services/quota_management_service.py +89 -0
  175. bytebuddhi-0.1.4rc1/app/domain/value_objects/__init__.py +22 -0
  176. bytebuddhi-0.1.4rc1/app/domain/value_objects/email.py +107 -0
  177. bytebuddhi-0.1.4rc1/app/domain/value_objects/file_path.py +145 -0
  178. bytebuddhi-0.1.4rc1/app/domain/value_objects/identity_provider.py +43 -0
  179. bytebuddhi-0.1.4rc1/app/domain/value_objects/language.py +161 -0
  180. bytebuddhi-0.1.4rc1/app/infrastructure/__init__.py +8 -0
  181. bytebuddhi-0.1.4rc1/app/infrastructure/auth/__init__.py +11 -0
  182. bytebuddhi-0.1.4rc1/app/infrastructure/auth/jwt_handler.py +164 -0
  183. bytebuddhi-0.1.4rc1/app/infrastructure/auth/oauth/__init__.py +1 -0
  184. bytebuddhi-0.1.4rc1/app/infrastructure/auth/oauth/factory.py +28 -0
  185. bytebuddhi-0.1.4rc1/app/infrastructure/auth/oauth/github_provider.py +207 -0
  186. bytebuddhi-0.1.4rc1/app/infrastructure/auth/oauth/google_id_token.py +19 -0
  187. bytebuddhi-0.1.4rc1/app/infrastructure/auth/oauth/google_provider.py +156 -0
  188. bytebuddhi-0.1.4rc1/app/infrastructure/auth/oauth/memory_state_store.py +70 -0
  189. bytebuddhi-0.1.4rc1/app/infrastructure/auth/oauth/redis_state_store.py +60 -0
  190. bytebuddhi-0.1.4rc1/app/infrastructure/auth/oauth/state.py +15 -0
  191. bytebuddhi-0.1.4rc1/app/infrastructure/auth/password_hasher.py +113 -0
  192. bytebuddhi-0.1.4rc1/app/infrastructure/config/__init__.py +0 -0
  193. bytebuddhi-0.1.4rc1/app/infrastructure/config/local_config.py +132 -0
  194. bytebuddhi-0.1.4rc1/app/infrastructure/config/log_rotation.py +63 -0
  195. bytebuddhi-0.1.4rc1/app/infrastructure/config/logger.py +73 -0
  196. bytebuddhi-0.1.4rc1/app/infrastructure/config/profile.py +103 -0
  197. bytebuddhi-0.1.4rc1/app/infrastructure/config/settings.py +316 -0
  198. bytebuddhi-0.1.4rc1/app/infrastructure/connectors/credentials/env_credential_provider.py +98 -0
  199. bytebuddhi-0.1.4rc1/app/infrastructure/connectors/github/github_connector.py +493 -0
  200. bytebuddhi-0.1.4rc1/app/infrastructure/execution/local_process_manager.py +428 -0
  201. bytebuddhi-0.1.4rc1/app/infrastructure/external/__init__.py +1 -0
  202. bytebuddhi-0.1.4rc1/app/infrastructure/http/external_client.py +378 -0
  203. bytebuddhi-0.1.4rc1/app/infrastructure/llm/__init__.py +17 -0
  204. bytebuddhi-0.1.4rc1/app/infrastructure/llm/anthropic_gateway.py +109 -0
  205. bytebuddhi-0.1.4rc1/app/infrastructure/llm/anthropic_provider.py +186 -0
  206. bytebuddhi-0.1.4rc1/app/infrastructure/llm/langchain_support.py +172 -0
  207. bytebuddhi-0.1.4rc1/app/infrastructure/llm/message_converter.py +46 -0
  208. bytebuddhi-0.1.4rc1/app/infrastructure/llm/openai_gateway.py +115 -0
  209. bytebuddhi-0.1.4rc1/app/infrastructure/llm/openai_provider.py +207 -0
  210. bytebuddhi-0.1.4rc1/app/infrastructure/llm/provider_factory.py +223 -0
  211. bytebuddhi-0.1.4rc1/app/infrastructure/mcp/client_manager.py +289 -0
  212. bytebuddhi-0.1.4rc1/app/infrastructure/mcp/mock_mcp_client.py +76 -0
  213. bytebuddhi-0.1.4rc1/app/infrastructure/observability/__init__.py +47 -0
  214. bytebuddhi-0.1.4rc1/app/infrastructure/observability/noop.py +21 -0
  215. bytebuddhi-0.1.4rc1/app/infrastructure/observability/otel_meter.py +93 -0
  216. bytebuddhi-0.1.4rc1/app/infrastructure/observability/otel_provider.py +146 -0
  217. bytebuddhi-0.1.4rc1/app/infrastructure/observability/otel_tracer.py +224 -0
  218. bytebuddhi-0.1.4rc1/app/infrastructure/parser/extractors/base.py +82 -0
  219. bytebuddhi-0.1.4rc1/app/infrastructure/parser/extractors/python_extractor.py +329 -0
  220. bytebuddhi-0.1.4rc1/app/infrastructure/parser/extractors/ts_js_extractor.py +314 -0
  221. bytebuddhi-0.1.4rc1/app/infrastructure/parser/tree_sitter_parser.py +143 -0
  222. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/__init__.py +0 -0
  223. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/__init__.py +0 -0
  224. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/checkpoint_saver.py +319 -0
  225. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/database.py +67 -0
  226. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/models.py +346 -0
  227. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/reaper_lock.py +56 -0
  228. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/repositories/__init__.py +37 -0
  229. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/repositories/code_chunk_repository_impl.py +83 -0
  230. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/repositories/conversation_repository_impl.py +157 -0
  231. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/repositories/embedding_repository_impl.py +88 -0
  232. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/repositories/external_identity_repository_impl.py +115 -0
  233. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/repositories/file_repository_impl.py +114 -0
  234. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/repositories/message_repository_impl.py +168 -0
  235. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/repositories/postgres_memory_store.py +186 -0
  236. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/repositories/project_repository_impl.py +199 -0
  237. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/repositories/user_repository_impl.py +103 -0
  238. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/postgres/run_store.py +390 -0
  239. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/redis/__init__.py +0 -0
  240. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/redis/cache_service_impl.py +158 -0
  241. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/redis/cancellation_store.py +57 -0
  242. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/redis/client.py +80 -0
  243. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/redis/run_admission.py +92 -0
  244. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/redis/run_fanout.py +112 -0
  245. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/sessions.py +20 -0
  246. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/sqlite/checkpoint.py +164 -0
  247. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/sqlite/database.py +264 -0
  248. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/sqlite/maintenance.py +177 -0
  249. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/sqlite/repositories.py +839 -0
  250. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/sqlite/run_store.py +495 -0
  251. bytebuddhi-0.1.4rc1/app/infrastructure/persistence/sqlite/sqlite_memory_store.py +251 -0
  252. bytebuddhi-0.1.4rc1/app/infrastructure/storage/__init__.py +5 -0
  253. bytebuddhi-0.1.4rc1/app/infrastructure/storage/local_artifact_store.py +148 -0
  254. bytebuddhi-0.1.4rc1/app/infrastructure/storage/local_storage_service.py +124 -0
  255. bytebuddhi-0.1.4rc1/app/infrastructure/web/__init__.py +1 -0
  256. bytebuddhi-0.1.4rc1/app/infrastructure/web/fetch/__init__.py +1 -0
  257. bytebuddhi-0.1.4rc1/app/infrastructure/web/fetch/httpx_fetcher.py +223 -0
  258. bytebuddhi-0.1.4rc1/app/infrastructure/web/lifecycle.py +126 -0
  259. bytebuddhi-0.1.4rc1/app/infrastructure/web/render/__init__.py +1 -0
  260. bytebuddhi-0.1.4rc1/app/infrastructure/web/render/noop.py +18 -0
  261. bytebuddhi-0.1.4rc1/app/infrastructure/web/render/playwright_renderer.py +339 -0
  262. bytebuddhi-0.1.4rc1/app/infrastructure/web/search/__init__.py +1 -0
  263. bytebuddhi-0.1.4rc1/app/infrastructure/web/search/duckduckgo.py +151 -0
  264. bytebuddhi-0.1.4rc1/app/interfaces/__init__.py +7 -0
  265. bytebuddhi-0.1.4rc1/app/interfaces/api/__init__.py +0 -0
  266. bytebuddhi-0.1.4rc1/app/interfaces/api/dependencies.py +676 -0
  267. bytebuddhi-0.1.4rc1/app/interfaces/api/main.py +170 -0
  268. bytebuddhi-0.1.4rc1/app/interfaces/api/middleware/__init__.py +15 -0
  269. bytebuddhi-0.1.4rc1/app/interfaces/api/middleware/auth_middleware.py +128 -0
  270. bytebuddhi-0.1.4rc1/app/interfaces/api/middleware/error_handler.py +86 -0
  271. bytebuddhi-0.1.4rc1/app/interfaces/api/middleware/rate_limiter.py +138 -0
  272. bytebuddhi-0.1.4rc1/app/interfaces/api/middleware/request_limit.py +26 -0
  273. bytebuddhi-0.1.4rc1/app/interfaces/api/middleware/security_headers.py +14 -0
  274. bytebuddhi-0.1.4rc1/app/interfaces/api/routes/__init__.py +5 -0
  275. bytebuddhi-0.1.4rc1/app/interfaces/api/routes/agent.py +70 -0
  276. bytebuddhi-0.1.4rc1/app/interfaces/api/routes/auth.py +332 -0
  277. bytebuddhi-0.1.4rc1/app/interfaces/api/routes/chat.py +385 -0
  278. bytebuddhi-0.1.4rc1/app/interfaces/api/routes/files.py +647 -0
  279. bytebuddhi-0.1.4rc1/app/interfaces/api/routes/health.py +103 -0
  280. bytebuddhi-0.1.4rc1/app/interfaces/api/routes/models.py +33 -0
  281. bytebuddhi-0.1.4rc1/app/interfaces/api/routes/oauth.py +192 -0
  282. bytebuddhi-0.1.4rc1/app/interfaces/api/routes/projects.py +450 -0
  283. bytebuddhi-0.1.4rc1/app/interfaces/api/routes/runs.py +256 -0
  284. bytebuddhi-0.1.4rc1/app/interfaces/api/run_runtime.py +173 -0
  285. bytebuddhi-0.1.4rc1/app/interfaces/api/run_stream.py +102 -0
  286. bytebuddhi-0.1.4rc1/app/interfaces/api/schemas/__init__.py +77 -0
  287. bytebuddhi-0.1.4rc1/app/interfaces/api/schemas/agent_schema.py +36 -0
  288. bytebuddhi-0.1.4rc1/app/interfaces/api/schemas/auth_schema.py +76 -0
  289. bytebuddhi-0.1.4rc1/app/interfaces/api/schemas/chat_schema.py +113 -0
  290. bytebuddhi-0.1.4rc1/app/interfaces/api/schemas/common.py +131 -0
  291. bytebuddhi-0.1.4rc1/app/interfaces/api/schemas/file_schema.py +124 -0
  292. bytebuddhi-0.1.4rc1/app/interfaces/api/schemas/model_schema.py +17 -0
  293. bytebuddhi-0.1.4rc1/app/interfaces/api/schemas/project_schema.py +81 -0
  294. bytebuddhi-0.1.4rc1/app/interfaces/api/schemas/run_schema.py +77 -0
  295. bytebuddhi-0.1.4rc1/app/interfaces/api/sse/__init__.py +5 -0
  296. bytebuddhi-0.1.4rc1/app/interfaces/api/sse/stream_handler.py +115 -0
  297. bytebuddhi-0.1.4rc1/app/interfaces/cli/__init__.py +1 -0
  298. bytebuddhi-0.1.4rc1/app/interfaces/cli/__main__.py +5 -0
  299. bytebuddhi-0.1.4rc1/app/interfaces/cli/app.py +183 -0
  300. bytebuddhi-0.1.4rc1/app/interfaces/cli/bootstrap.py +168 -0
  301. bytebuddhi-0.1.4rc1/app/interfaces/cli/credentials.py +349 -0
  302. bytebuddhi-0.1.4rc1/app/interfaces/cli/dispatch.py +217 -0
  303. bytebuddhi-0.1.4rc1/app/interfaces/cli/doctor.py +285 -0
  304. bytebuddhi-0.1.4rc1/app/interfaces/cli/errors.py +68 -0
  305. bytebuddhi-0.1.4rc1/app/interfaces/cli/exit_codes.py +13 -0
  306. bytebuddhi-0.1.4rc1/app/interfaces/cli/gateway_dispatch.py +533 -0
  307. bytebuddhi-0.1.4rc1/app/interfaces/cli/identity.py +95 -0
  308. bytebuddhi-0.1.4rc1/app/interfaces/cli/main.py +32 -0
  309. bytebuddhi-0.1.4rc1/app/interfaces/cli/managed_install.py +445 -0
  310. bytebuddhi-0.1.4rc1/app/interfaces/cli/oauth_login.py +122 -0
  311. bytebuddhi-0.1.4rc1/app/interfaces/cli/parser.py +225 -0
  312. bytebuddhi-0.1.4rc1/app/interfaces/cli/profile_data.py +84 -0
  313. bytebuddhi-0.1.4rc1/app/interfaces/cli/render.py +264 -0
  314. bytebuddhi-0.1.4rc1/app/interfaces/cli/runner.py +281 -0
  315. bytebuddhi-0.1.4rc1/app/interfaces/cli/uninstall.py +56 -0
  316. bytebuddhi-0.1.4rc1/app/interfaces/cli/update.py +143 -0
  317. bytebuddhi-0.1.4rc1/app/interfaces/composition.py +321 -0
  318. bytebuddhi-0.1.4rc1/app/interfaces/gateway/__init__.py +24 -0
  319. bytebuddhi-0.1.4rc1/app/interfaces/gateway/client.py +743 -0
  320. bytebuddhi-0.1.4rc1/app/interfaces/gateway/config.py +220 -0
  321. bytebuddhi-0.1.4rc1/app/interfaces/gateway/errors.py +95 -0
  322. bytebuddhi-0.1.4rc1/app/interfaces/gateway/manager.py +440 -0
  323. bytebuddhi-0.1.4rc1/app/interfaces/gateway/models.py +83 -0
  324. bytebuddhi-0.1.4rc1/app/interfaces/gateway/process.py +178 -0
  325. bytebuddhi-0.1.4rc1/app/interfaces/gateway/server.py +138 -0
  326. bytebuddhi-0.1.4rc1/app/interfaces/gateway/state.py +105 -0
  327. bytebuddhi-0.1.4rc1/app/interfaces/tui/__init__.py +1 -0
  328. bytebuddhi-0.1.4rc1/app/interfaces/tui/app.py +353 -0
  329. bytebuddhi-0.1.4rc1/app/interfaces/tui/app.tcss +46 -0
  330. bytebuddhi-0.1.4rc1/app/interfaces/tui/events.py +162 -0
  331. bytebuddhi-0.1.4rc1/app/interfaces/tui/main.py +64 -0
  332. bytebuddhi-0.1.4rc1/app/interfaces/tui/messages.py +15 -0
  333. bytebuddhi-0.1.4rc1/app/interfaces/tui/screens.py +78 -0
  334. bytebuddhi-0.1.4rc1/app/interfaces/tui/session.py +153 -0
  335. bytebuddhi-0.1.4rc1/app/interfaces/tui/state.py +109 -0
  336. bytebuddhi-0.1.4rc1/app/interfaces/tui/stream.py +128 -0
  337. bytebuddhi-0.1.4rc1/app/interfaces/tui/widgets/__init__.py +1 -0
  338. bytebuddhi-0.1.4rc1/app/interfaces/tui/widgets/composer.py +29 -0
  339. bytebuddhi-0.1.4rc1/app/interfaces/tui/widgets/sidebar.py +61 -0
  340. bytebuddhi-0.1.4rc1/app/interfaces/tui/widgets/status_bar.py +12 -0
  341. bytebuddhi-0.1.4rc1/app/interfaces/tui/widgets/transcript.py +75 -0
  342. bytebuddhi-0.1.4rc1/pyproject.toml +127 -0
  343. bytebuddhi-0.1.4rc1/scripts/create_migration.py +61 -0
  344. bytebuddhi-0.1.4rc1/scripts/export_desktop_contracts.py +106 -0
  345. bytebuddhi-0.1.4rc1/scripts/generate_checksums.py +54 -0
  346. bytebuddhi-0.1.4rc1/scripts/generate_sbom.py +131 -0
  347. bytebuddhi-0.1.4rc1/scripts/install.ps1 +203 -0
  348. bytebuddhi-0.1.4rc1/scripts/install.sh +210 -0
  349. bytebuddhi-0.1.4rc1/scripts/migrate.py +50 -0
  350. bytebuddhi-0.1.4rc1/scripts/release_manifest.py +77 -0
  351. bytebuddhi-0.1.4rc1/scripts/rollback_migration.py +55 -0
  352. bytebuddhi-0.1.4rc1/scripts/run_tests.py +62 -0
  353. bytebuddhi-0.1.4rc1/scripts/setup.py +101 -0
  354. bytebuddhi-0.1.4rc1/scripts/setup_db.py +147 -0
  355. bytebuddhi-0.1.4rc1/scripts/start_dev.py +58 -0
  356. bytebuddhi-0.1.4rc1/scripts/sync_version.py +216 -0
  357. bytebuddhi-0.1.4rc1/scripts/test_connection.py +127 -0
  358. bytebuddhi-0.1.4rc1/scripts/validate_clean_machine.py +127 -0
  359. bytebuddhi-0.1.4rc1/scripts/verify_signatures.py +195 -0
  360. bytebuddhi-0.1.4rc1/vscode-extension/README.md +16 -0
@@ -0,0 +1,153 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ share/python-wheels/
20
+ *.egg-info/
21
+ .installed.cfg
22
+ *.egg
23
+ MANIFEST
24
+ pip-log.txt
25
+ pip-delete-this-directory.txt
26
+
27
+ # Virtual Environments
28
+ .venv/
29
+ venv/
30
+ ENV/
31
+ env/
32
+ .env.local
33
+ .env.*.local
34
+
35
+ # PyCharm
36
+ .idea/
37
+ *.iml
38
+ *.iws
39
+ .idea_modules/
40
+
41
+ # VSCode
42
+ .vscode/
43
+ *.code-workspace
44
+
45
+ # Jupyter Notebook
46
+ .ipynb_checkpoints
47
+ *.ipynb
48
+
49
+ # pytest
50
+ .pytest_cache/
51
+ .coverage
52
+ .coverage.*
53
+ htmlcov/
54
+ .tox/
55
+ .nox/
56
+ coverage.xml
57
+ *.cover
58
+ .hypothesis/
59
+
60
+ # mypy
61
+ .mypy_cache/
62
+ .dmypy.json
63
+ dmypy.json
64
+
65
+ # Ruff
66
+ .ruff_cache/
67
+
68
+ # Environment variables
69
+ .env
70
+ .env.local
71
+ .env.*.local
72
+
73
+ # Database
74
+ *.db
75
+ *.sqlite
76
+ *.sqlite3
77
+
78
+ # Logs
79
+ *.log
80
+ logs/
81
+ *.log.*
82
+
83
+ # OS
84
+ .DS_Store
85
+ .DS_Store*
86
+ .DS_Store?
87
+ ._*
88
+ .Spotlight-V100
89
+ .Trashes
90
+ ehthumbs.db
91
+ Thumbs.db
92
+ *~
93
+
94
+ # Alembic
95
+ alembic/versions/__pycache__/
96
+
97
+ # Redis
98
+ dump.rdb
99
+
100
+ # Docker
101
+ .dockerignore
102
+
103
+ # uv
104
+ # uv.lock is the authoritative deployment lockfile and must be committed.
105
+
106
+ # Temporary files
107
+ *.tmp
108
+ *.temp
109
+ *.swp
110
+ *.swo
111
+ *~
112
+
113
+ # IDE
114
+ *.sublime-project
115
+ *.sublime-workspace
116
+
117
+ # Testing
118
+ .pytest_cache/
119
+ test-results/
120
+ .coverage
121
+ htmlcov/
122
+
123
+ # Documentation builds
124
+ docs/_build/
125
+ site/
126
+
127
+ # Local development
128
+ .local/
129
+ local/
130
+ tmp/
131
+ temp/
132
+
133
+ vscode-extension/node_modules/
134
+ vscode-extension/out/
135
+ desktop/node_modules/
136
+ desktop/out/
137
+ desktop/release/
138
+ desktop/test-results/
139
+ desktop/playwright-report/
140
+ desktop/blob-report/
141
+ *.tsbuildinfo
142
+ *.pem
143
+ *.key
144
+ *.cert
145
+ secrets/
146
+ .secrets/
147
+
148
+ # code-review-graph
149
+ .claude/
150
+ .windsurfrules
151
+ AGENTS.md
152
+ GEMINI.md
153
+ CLAUDE.md
@@ -0,0 +1,328 @@
1
+ Metadata-Version: 2.5
2
+ Name: bytebuddhi
3
+ Version: 0.1.4-rc.1
4
+ Summary: AI-powered coding assistant and agent platform
5
+ Project-URL: Repository, https://github.com/Navin45/bytebuddhi
6
+ Project-URL: Documentation, https://github.com/Navin45/bytebuddhi/tree/main/docs
7
+ Project-URL: Issues, https://github.com/Navin45/bytebuddhi/issues
8
+ License-Expression: MIT
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Framework :: FastAPI
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Topic :: Software Development :: Libraries
15
+ Classifier: Typing :: Typed
16
+ Requires-Python: >=3.13
17
+ Requires-Dist: aiofiles>=25.1.0
18
+ Requires-Dist: alembic>=1.18.1
19
+ Requires-Dist: anthropic>=0.76.0
20
+ Requires-Dist: asyncpg>=0.31.0
21
+ Requires-Dist: bcrypt>=5.0.0
22
+ Requires-Dist: fastapi>=0.128.0
23
+ Requires-Dist: gitpython>=3.1.46
24
+ Requires-Dist: google-auth>=2.41.0
25
+ Requires-Dist: greenlet>=3.3.1
26
+ Requires-Dist: gunicorn>=26.2.0
27
+ Requires-Dist: hiredis>=3.3.0
28
+ Requires-Dist: httpx>=0.28.1
29
+ Requires-Dist: langchain-anthropic>=1.3.1
30
+ Requires-Dist: langchain-openai>=1.1.7
31
+ Requires-Dist: langchain>=1.2.7
32
+ Requires-Dist: langgraph>=1.0.7
33
+ Requires-Dist: mcp>=2.2.0
34
+ Requires-Dist: numpy>=2.4.1
35
+ Requires-Dist: openai>=2.15.0
36
+ Requires-Dist: opentelemetry-api>=1.30.0
37
+ Requires-Dist: opentelemetry-exporter-otlp>=1.30.0
38
+ Requires-Dist: opentelemetry-sdk>=1.30.0
39
+ Requires-Dist: orjson>=3.11.5
40
+ Requires-Dist: passlib[bcrypt]>=1.7.4
41
+ Requires-Dist: pgvector>=0.4.2
42
+ Requires-Dist: psycopg2-binary>=2.9.11
43
+ Requires-Dist: pydantic-settings>=2.12.0
44
+ Requires-Dist: pydantic[email]>=2.12.5
45
+ Requires-Dist: python-dateutil>=2.9.0.post0
46
+ Requires-Dist: python-dotenv>=1.2.1
47
+ Requires-Dist: python-jose[cryptography]>=3.5.0
48
+ Requires-Dist: python-multipart>=0.0.22
49
+ Requires-Dist: redis>=7.1.0
50
+ Requires-Dist: sqlalchemy[mypy]>=2.0.46
51
+ Requires-Dist: sse-starlette>=3.2.0
52
+ Requires-Dist: structlog>=25.5.0
53
+ Requires-Dist: tenacity>=9.1.2
54
+ Requires-Dist: textual<9,>=8.2.8
55
+ Requires-Dist: tiktoken>=0.12.0
56
+ Requires-Dist: tree-sitter-javascript>=0.25.0
57
+ Requires-Dist: tree-sitter-python>=0.25.0
58
+ Requires-Dist: tree-sitter-typescript>=0.23.2
59
+ Requires-Dist: tree-sitter>=0.25.2
60
+ Requires-Dist: uvicorn[standard]>=0.40.0
61
+ Requires-Dist: watchdog>=6.0.0
62
+ Requires-Dist: websockets>=16.1.1
63
+ Provides-Extra: dev
64
+ Requires-Dist: ipdb>=0.13.13; extra == 'dev'
65
+ Requires-Dist: ipython>=9.9.0; extra == 'dev'
66
+ Requires-Dist: mypy>=1.19.1; extra == 'dev'
67
+ Requires-Dist: pytest-asyncio>=1.3.0; extra == 'dev'
68
+ Requires-Dist: pytest-cov>=7.0.0; extra == 'dev'
69
+ Requires-Dist: pytest-mock>=3.15.1; extra == 'dev'
70
+ Requires-Dist: pytest>=9.0.2; extra == 'dev'
71
+ Requires-Dist: ruff>=0.14.14; extra == 'dev'
72
+ Requires-Dist: types-passlib>=1.7.7.20250602; extra == 'dev'
73
+ Requires-Dist: types-redis>=4.6.0.20241004; extra == 'dev'
74
+ Provides-Extra: web-render
75
+ Requires-Dist: playwright>=1.49.0; extra == 'web-render'
76
+ Description-Content-Type: text/markdown
77
+
78
+ # ByteBuddhi
79
+
80
+ ByteBuddhi is an AI coding and agent platform. The CLI and terminal interface talk to one gateway. The gateway is the existing FastAPI application. Application use cases stay authoritative.
81
+
82
+ ```text
83
+ Textual TUI / CLI
84
+ ↓
85
+ GatewayClient
86
+ ↓
87
+ FastAPI
88
+ ↓
89
+ Run protocol
90
+ ↓
91
+ AgentRuntime
92
+ ```
93
+
94
+ PostgreSQL is the durable source of truth for runs and events. Redis fans live notifications out to gateway workers. A WebSocket delivers those events to the client. Disconnecting the socket does not cancel the run. `POST /api/v1/runs/{run_id}/cancel` does.
95
+
96
+ Phase 1 established the gateway transport. Phase 2 makes `POST /api/v1/runs` return `202` with `queued` and streams the run. It does not add a second agent runtime.
97
+
98
+ ```text
99
+ CLI / TUI / VS Code
100
+ ↓
101
+ ByteBuddhi Gateway
102
+ ↓
103
+ FastAPI
104
+ ↓
105
+ Application use cases
106
+ ↓
107
+ AgentRuntime
108
+ ↓
109
+ Models / Tools / Memory / MCP / DB
110
+ ```
111
+
112
+ `bytebuddhi run --embedded` still calls `ExecuteTaskUseCase` in-process. That mode is explicit. A gateway failure does not fall back to it.
113
+
114
+ The runtime does not change when you pick a different model. Provider credentials enable adapters; they do not redefine the architecture.
115
+
116
+ ## Architecture
117
+
118
+ ```text
119
+ CLI / VS Code
120
+ ↓
121
+ GatewayClient or HTTP
122
+ ↓
123
+ FastAPI
124
+ ↓
125
+ ExecuteTaskUseCase
126
+ ↓
127
+ ExecutionContext
128
+ ↓
129
+ AgentRuntime / MultiAgentOrchestrator
130
+ ↓
131
+ ModelGateway (catalog + routing)
132
+ ↓
133
+ Provider adapters (OpenAI, Anthropic, OpenAI-compatible, …)
134
+ ↓
135
+ ToolExecutor → Memory, Artifacts, Process, Web, MCP, Connectors
136
+ ```
137
+
138
+ ## Capabilities
139
+
140
+ - Single-agent loop and bounded multi-agent delegation
141
+ - Workspace-scoped filesystem and command tools
142
+ - Memory (working SQLite + durable PostgreSQL) and artifacts
143
+ - Code intelligence (Tree-sitter)
144
+ - Connectors and MCP behind the same tool policy
145
+ - Web research with SSRF controls
146
+ - OpenTelemetry traces/metrics with redaction
147
+ - JWT API (password, Google, GitHub). The gateway is the authority for CLI identity. `--embedded` can still use a local principal.
148
+
149
+ ## Installation
150
+
151
+ ### One-Command CLI Install
152
+
153
+ **macOS / Linux (bash/zsh):**
154
+ ```bash
155
+ curl -fsSL https://github.com/Navin45/bytebuddhi/releases/latest/download/install.sh | bash
156
+ ```
157
+
158
+ **Windows (PowerShell):**
159
+ ```powershell
160
+ irm https://github.com/Navin45/bytebuddhi/releases/latest/download/install.ps1 | iex
161
+ ```
162
+
163
+ ### Desktop App
164
+
165
+ Download installers from [GitHub Releases](https://github.com/Navin45/bytebuddhi/releases/latest):
166
+ - **Windows:** `ByteBuddhi-Setup-<version>.exe`
167
+ - **macOS:** `ByteBuddhi-<version>-arm64.dmg` / `ByteBuddhi-<version>-x64.dmg`
168
+ - **Linux:** `ByteBuddhi-<version>-x64.AppImage` / `.deb`
169
+
170
+ ### Run
171
+
172
+ ```bash
173
+ bytebuddhi
174
+ ```
175
+
176
+ Launch the terminal UI:
177
+ ```bash
178
+ bytebuddhi tui
179
+ ```
180
+
181
+ Check for updates:
182
+ ```bash
183
+ bytebuddhi update --check
184
+ ```
185
+
186
+ ### Developer Setup (From Source)
187
+
188
+ ```bash
189
+ git clone https://github.com/Navin45/bytebuddhi.git
190
+ cd bytebuddhi
191
+ uv sync
192
+ cp .env.example .env
193
+ ```
194
+
195
+ Requires Python 3.13+, PostgreSQL 16+ with pgvector, and Redis when distributed cancellation is enabled.
196
+
197
+ ## Configuration
198
+
199
+ `.env` is for local development only. Production injects the same variables from a secret manager. See `.env.example`.
200
+
201
+ Authoritative settings live in `app/infrastructure/config/settings.py` (`Settings`). API, CLI, and Docker read that model.
202
+
203
+ ## Model selection
204
+
205
+ ```env
206
+ DEFAULT_MODEL_PROVIDER=openai
207
+ DEFAULT_MODEL_NAME=gpt-4-turbo-preview
208
+ OPENAI_API_KEY=...
209
+ ```
210
+
211
+ `DEFAULT_MODEL_*` is only the default. Users may select any **enabled and available** catalog model without restarting:
212
+
213
+ - `GET /api/v1/models`
214
+ - `POST /api/v1/chat/conversations/{id}/messages` with `{ "model": { "provider", "model" } }`
215
+ - `bytebuddhi run --provider openai --model …`
216
+ - VS Code: **ByteBuddhi: Select Model**
217
+
218
+ Credentials stay server-side. There is no user BYOK. Custom OpenAI-compatible URLs are operator-configured only. See [Model gateway](docs/models.md).
219
+
220
+ You do not need every provider key. Enable only the providers you run.
221
+
222
+ ## Running locally
223
+
224
+ ```bash
225
+ docker compose up -d redis
226
+ uv run alembic upgrade head
227
+ uv run uvicorn app.interfaces.api.main:app --host 127.0.0.1 --port 8000 --reload
228
+ ```
229
+
230
+ - API: `http://127.0.0.1:8000/api/v1`
231
+ - OpenAPI (debug): `http://127.0.0.1:8000/api/docs`
232
+ - Liveness: `GET /api/v1/health/live`
233
+ - Readiness: `GET /api/v1/health/ready`
234
+
235
+ ## Docker / production
236
+
237
+ ```bash
238
+ docker build -t bytebuddhi:local .
239
+ POSTGRES_PASSWORD=... JWT_SECRET_KEY=... OPENAI_API_KEY=... \
240
+ docker compose -f docker-compose.prod.yml up --build
241
+ ```
242
+
243
+ `docker-compose.yml` is development (`--reload`). `docker-compose.prod.yml` is the production-shaped API + PostgreSQL + Redis stack. Browser rendering stays off unless isolated. Full operator contract: [Production](docs/production.md).
244
+
245
+ ## CLI
246
+
247
+ ```bash
248
+ uv run bytebuddhi --help
249
+ uv run bytebuddhi --version
250
+ uv run bytebuddhi gateway start
251
+ uv run bytebuddhi login --provider google
252
+ uv run bytebuddhi models
253
+ uv run bytebuddhi run "Explain this repository"
254
+ ```
255
+
256
+ Normal CLI commands call the gateway with `Authorization: Bearer`. `bytebuddhi run` creates a run (`202`) and prints events as they arrive. `--json` prints one JSON object per line. The local gateway listens on `127.0.0.1:8765` unless you set `BYTEBUDDHI_GATEWAY_HOST` / `BYTEBUDDHI_GATEWAY_PORT` or pass `--host` / `--port`. `bytebuddhi serve` runs that same FastAPI app in the foreground. Production Gunicorn is unchanged.
257
+
258
+ `bytebuddhi run --embedded` is the in-process path. See [CLI](docs/cli.md).
259
+
260
+ ## Terminal interface
261
+
262
+ ```bash
263
+ uv run bytebuddhi tui
264
+ ```
265
+
266
+ `bytebuddhi tui` is another gateway client. It uses the same URL resolution, local gateway startup, credentials, and `GatewayClient` as the CLI. It does not execute agents, and it does not read PostgreSQL or Redis.
267
+
268
+ A local URL starts the managed gateway when it is not already running. `BYTEBUDDHI_GATEWAY_URL=https://...` connects to that remote gateway and does not start a local process. There is no embedded TUI mode. A missing credential tells you to run `bytebuddhi login`.
269
+
270
+ Enter sends one run. Shift+Enter inserts a newline. Esc requests cancellation and the transcript waits for `run_cancelled`. Closing the TUI disconnects the client and leaves the run running on the gateway. A dropped WebSocket reconnects to the same run id, replays from the last sequence, and does not create a second run. `run_interrupted` is shown as INTERRUPTED.
271
+
272
+ ## Desktop
273
+
274
+ ```bash
275
+ cd desktop
276
+ pnpm install
277
+ pnpm dev
278
+ ```
279
+
280
+ The Electron app is a third client of the same gateway. It does not embed `AgentRuntime`. See [Desktop](docs/desktop.md).
281
+
282
+ ## VS Code
283
+
284
+ ```bash
285
+ cd vscode-extension
286
+ npm install
287
+ npm run compile
288
+ npm test
289
+ npm run package
290
+ ```
291
+
292
+ Sign in with JWT. Select models from the backend catalog. See [VS Code](docs/vscode.md).
293
+
294
+ ## Security
295
+
296
+ - Trusted identity is never taken from prompts, tool args, or web content
297
+ - Workspace containment, command policy, and HIGH-risk approval provenance
298
+ - SSRF controls for web fetch/render
299
+ - No secrets in catalog responses, events, or default logs
300
+ - Production fail-closed JWT, CORS, workspace mode, and Playwright isolation
301
+
302
+ ## Development and testing
303
+
304
+ ```bash
305
+ uv run ruff check .
306
+ uv run ruff format --check .
307
+ uv run mypy app/
308
+ uv run pytest tests/ -v
309
+ cd vscode-extension && npm run compile && npm run lint && npm test
310
+ ```
311
+
312
+ Live LLM smoke tests are opt-in (`LIVE_LLM_PROVIDER` + provider key) and are not required for the default suite. CI stores live credentials as GitHub environment secrets and does not run that job on fork pull requests.
313
+
314
+ ## Limitations
315
+
316
+ Documented in [Production](docs/production.md) and [CLI](docs/cli.md). Notably: process-local rate limits, local/PV artifacts (not object storage), Playwright off unless isolated, no silent model failover. Run admission is global when Redis is available. A dead worker's run becomes `interrupted` and is not replayed. The CLI gateway client does not honor ambient `HTTP(S)_PROXY`, so bearer tokens are not forwarded to an implicit proxy. Closing a client does not cancel a run.
317
+
318
+ ## Documentation
319
+
320
+ - [Production](docs/production.md)
321
+ - [Model gateway](docs/models.md)
322
+ - [HLD](docs/hld.md) / [LLD](docs/lld.md)
323
+ - [CLI](docs/cli.md) / [VS Code](docs/vscode.md) / [Desktop](docs/desktop.md)
324
+ - [Web research](docs/web_research.md)
325
+
326
+ ## License
327
+
328
+ MIT. See [LICENSE](LICENSE).