heavenbase 0.1.0.1.dev0__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 (258) hide show
  1. heavenbase-0.1.0.1.dev0/LICENSE +21 -0
  2. heavenbase-0.1.0.1.dev0/PKG-INFO +377 -0
  3. heavenbase-0.1.0.1.dev0/README.md +293 -0
  4. heavenbase-0.1.0.1.dev0/pyproject.toml +51 -0
  5. heavenbase-0.1.0.1.dev0/requirements-daft.txt +2 -0
  6. heavenbase-0.1.0.1.dev0/requirements-dev.txt +8 -0
  7. heavenbase-0.1.0.1.dev0/requirements-full.txt +10 -0
  8. heavenbase-0.1.0.1.dev0/requirements-interop.txt +5 -0
  9. heavenbase-0.1.0.1.dev0/requirements-sql.txt +1 -0
  10. heavenbase-0.1.0.1.dev0/requirements.txt +11 -0
  11. heavenbase-0.1.0.1.dev0/setup.cfg +18 -0
  12. heavenbase-0.1.0.1.dev0/src/heavenbase/__init__.py +154 -0
  13. heavenbase-0.1.0.1.dev0/src/heavenbase/_bootstrap.py +90 -0
  14. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/__init__.py +80 -0
  15. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/base.py +280 -0
  16. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/elasticsearch/__init__.py +7 -0
  17. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/elasticsearch/backend.py +228 -0
  18. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/families.py +42 -0
  19. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/file/__init__.py +11 -0
  20. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/file/base.py +210 -0
  21. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/file/json.py +22 -0
  22. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/file/pickle.py +22 -0
  23. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/inmem/__init__.py +7 -0
  24. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/inmem/backend.py +67 -0
  25. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/registry.py +391 -0
  26. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/sql/__init__.py +25 -0
  27. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/sql/base.py +637 -0
  28. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/sql/duckdb.py +18 -0
  29. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/sql/mssql.py +22 -0
  30. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/sql/mysql.py +18 -0
  31. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/sql/oceanbase.py +17 -0
  32. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/sql/oracle.py +18 -0
  33. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/sql/postgres.py +18 -0
  34. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/sql/sqlite.py +18 -0
  35. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/sql/starrocks.py +130 -0
  36. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/sql/trino.py +17 -0
  37. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/type_registry.py +163 -0
  38. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/vector/__init__.py +15 -0
  39. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/vector/chroma.py +359 -0
  40. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/vector/lance.py +282 -0
  41. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/vector/milvus.py +559 -0
  42. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/vector/pgvector.py +82 -0
  43. heavenbase-0.1.0.1.dev0/src/heavenbase/backends/vector/pinecone.py +398 -0
  44. heavenbase-0.1.0.1.dev0/src/heavenbase/benchmark/__init__.py +46 -0
  45. heavenbase-0.1.0.1.dev0/src/heavenbase/benchmark/model.py +235 -0
  46. heavenbase-0.1.0.1.dev0/src/heavenbase/benchmark/report.py +237 -0
  47. heavenbase-0.1.0.1.dev0/src/heavenbase/benchmark/runner.py +473 -0
  48. heavenbase-0.1.0.1.dev0/src/heavenbase/benchmark/scenario.py +281 -0
  49. heavenbase-0.1.0.1.dev0/src/heavenbase/capsule/__init__.py +32 -0
  50. heavenbase-0.1.0.1.dev0/src/heavenbase/capsule/capture.py +311 -0
  51. heavenbase-0.1.0.1.dev0/src/heavenbase/capsule/docstring.py +57 -0
  52. heavenbase-0.1.0.1.dev0/src/heavenbase/capsule/errors.py +28 -0
  53. heavenbase-0.1.0.1.dev0/src/heavenbase/capsule/manifest.py +90 -0
  54. heavenbase-0.1.0.1.dev0/src/heavenbase/capsule/registry.py +448 -0
  55. heavenbase-0.1.0.1.dev0/src/heavenbase/capsule/runtime.py +515 -0
  56. heavenbase-0.1.0.1.dev0/src/heavenbase/capsule/schema.py +38 -0
  57. heavenbase-0.1.0.1.dev0/src/heavenbase/capsule/serialize.py +66 -0
  58. heavenbase-0.1.0.1.dev0/src/heavenbase/capsule/signature.py +128 -0
  59. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/__init__.py +27 -0
  60. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/app.py +93 -0
  61. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/backends/__init__.py +9 -0
  62. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/backends/argparse.py +96 -0
  63. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/backends/click.py +87 -0
  64. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/backends/typer.py +150 -0
  65. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/groups/__init__.py +12 -0
  66. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/groups/config.py +189 -0
  67. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/groups/llm.py +780 -0
  68. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/groups/mcp.py +295 -0
  69. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/groups/prompt.py +165 -0
  70. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/groups/root.py +34 -0
  71. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/groups/ws.py +157 -0
  72. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/output.py +59 -0
  73. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/registry.py +118 -0
  74. heavenbase-0.1.0.1.dev0/src/heavenbase/cli/spec.py +143 -0
  75. heavenbase-0.1.0.1.dev0/src/heavenbase/discovery/__init__.py +258 -0
  76. heavenbase-0.1.0.1.dev0/src/heavenbase/entity/__init__.py +20 -0
  77. heavenbase-0.1.0.1.dev0/src/heavenbase/entity/base.py +210 -0
  78. heavenbase-0.1.0.1.dev0/src/heavenbase/entity/compiler.py +235 -0
  79. heavenbase-0.1.0.1.dev0/src/heavenbase/entity/fields.py +218 -0
  80. heavenbase-0.1.0.1.dev0/src/heavenbase/entity/ref.py +88 -0
  81. heavenbase-0.1.0.1.dev0/src/heavenbase/entity/system/__init__.py +11 -0
  82. heavenbase-0.1.0.1.dev0/src/heavenbase/entity/system/catalog.py +75 -0
  83. heavenbase-0.1.0.1.dev0/src/heavenbase/entity/system/config.py +28 -0
  84. heavenbase-0.1.0.1.dev0/src/heavenbase/entity/system/metaschema.py +60 -0
  85. heavenbase-0.1.0.1.dev0/src/heavenbase/ext.py +142 -0
  86. heavenbase-0.1.0.1.dev0/src/heavenbase/extensions/__init__.py +23 -0
  87. heavenbase-0.1.0.1.dev0/src/heavenbase/extensions/base.py +156 -0
  88. heavenbase-0.1.0.1.dev0/src/heavenbase/extensions/builtin.py +51 -0
  89. heavenbase-0.1.0.1.dev0/src/heavenbase/frame/__init__.py +222 -0
  90. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/__init__.py +50 -0
  91. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/filters.py +238 -0
  92. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/plugins.py +88 -0
  93. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/reasons.py +97 -0
  94. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/registry.py +58 -0
  95. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/search/__init__.py +7 -0
  96. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/search/elasticsearch.py +97 -0
  97. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/seed.py +135 -0
  98. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/sql/__init__.py +10 -0
  99. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/sql/base.py +223 -0
  100. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/vector/__init__.py +21 -0
  101. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/vector/base.py +28 -0
  102. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/vector/chroma.py +99 -0
  103. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/vector/lance.py +98 -0
  104. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/vector/milvus.py +114 -0
  105. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/vector/pgvector.py +53 -0
  106. heavenbase-0.1.0.1.dev0/src/heavenbase/handlers/vector/pinecone.py +109 -0
  107. heavenbase-0.1.0.1.dev0/src/heavenbase/interop/__init__.py +60 -0
  108. heavenbase-0.1.0.1.dev0/src/heavenbase/interop/base.py +243 -0
  109. heavenbase-0.1.0.1.dev0/src/heavenbase/interop/daft.py +70 -0
  110. heavenbase-0.1.0.1.dev0/src/heavenbase/interop/export.py +79 -0
  111. heavenbase-0.1.0.1.dev0/src/heavenbase/interop/mapping.py +304 -0
  112. heavenbase-0.1.0.1.dev0/src/heavenbase/interop/numpy.py +47 -0
  113. heavenbase-0.1.0.1.dev0/src/heavenbase/interop/pandas.py +52 -0
  114. heavenbase-0.1.0.1.dev0/src/heavenbase/interop/pyarrow.py +49 -0
  115. heavenbase-0.1.0.1.dev0/src/heavenbase/interop/pydantic.py +108 -0
  116. heavenbase-0.1.0.1.dev0/src/heavenbase/interop/sql.py +47 -0
  117. heavenbase-0.1.0.1.dev0/src/heavenbase/mcp/__init__.py +42 -0
  118. heavenbase-0.1.0.1.dev0/src/heavenbase/prompt/__init__.py +18 -0
  119. heavenbase-0.1.0.1.dev0/src/heavenbase/prompt/compose.py +117 -0
  120. heavenbase-0.1.0.1.dev0/src/heavenbase/prompt/name.py +85 -0
  121. heavenbase-0.1.0.1.dev0/src/heavenbase/prompt/prompt.py +582 -0
  122. heavenbase-0.1.0.1.dev0/src/heavenbase/prompt/translation.py +350 -0
  123. heavenbase-0.1.0.1.dev0/src/heavenbase/query/__init__.py +386 -0
  124. heavenbase-0.1.0.1.dev0/src/heavenbase/query/_planner.py +60 -0
  125. heavenbase-0.1.0.1.dev0/src/heavenbase/registry/__init__.py +11 -0
  126. heavenbase-0.1.0.1.dev0/src/heavenbase/registry/base.py +84 -0
  127. heavenbase-0.1.0.1.dev0/src/heavenbase/registry/workspace.py +270 -0
  128. heavenbase-0.1.0.1.dev0/src/heavenbase/resources/__init__.py +8 -0
  129. heavenbase-0.1.0.1.dev0/src/heavenbase/resources/configs/bootstrap.yaml +178 -0
  130. heavenbase-0.1.0.1.dev0/src/heavenbase/resources/configs/default.yaml +957 -0
  131. heavenbase-0.1.0.1.dev0/src/heavenbase/resources/prompts.py +85 -0
  132. heavenbase-0.1.0.1.dev0/src/heavenbase/resources/sql.py +250 -0
  133. heavenbase-0.1.0.1.dev0/src/heavenbase/schema/__init__.py +165 -0
  134. heavenbase-0.1.0.1.dev0/src/heavenbase/storage/__init__.py +138 -0
  135. heavenbase-0.1.0.1.dev0/src/heavenbase/storage/profiles.py +96 -0
  136. heavenbase-0.1.0.1.dev0/src/heavenbase/strategies/__init__.py +32 -0
  137. heavenbase-0.1.0.1.dev0/src/heavenbase/strategies/base.py +23 -0
  138. heavenbase-0.1.0.1.dev0/src/heavenbase/strategies/external_ref.py +13 -0
  139. heavenbase-0.1.0.1.dev0/src/heavenbase/strategies/graph_edge.py +13 -0
  140. heavenbase-0.1.0.1.dev0/src/heavenbase/strategies/inline_column.py +13 -0
  141. heavenbase-0.1.0.1.dev0/src/heavenbase/strategies/inverted_index.py +13 -0
  142. heavenbase-0.1.0.1.dev0/src/heavenbase/strategies/json_field.py +13 -0
  143. heavenbase-0.1.0.1.dev0/src/heavenbase/strategies/registry.py +48 -0
  144. heavenbase-0.1.0.1.dev0/src/heavenbase/strategies/side_table.py +13 -0
  145. heavenbase-0.1.0.1.dev0/src/heavenbase/strategies/storage.py +80 -0
  146. heavenbase-0.1.0.1.dev0/src/heavenbase/strategies/vector_index.py +13 -0
  147. heavenbase-0.1.0.1.dev0/src/heavenbase/toolkit/__init__.py +29 -0
  148. heavenbase-0.1.0.1.dev0/src/heavenbase/toolkit/anthropic.py +47 -0
  149. heavenbase-0.1.0.1.dev0/src/heavenbase/toolkit/errors.py +13 -0
  150. heavenbase-0.1.0.1.dev0/src/heavenbase/toolkit/mcp.py +209 -0
  151. heavenbase-0.1.0.1.dev0/src/heavenbase/toolkit/server.py +66 -0
  152. heavenbase-0.1.0.1.dev0/src/heavenbase/toolkit/toolkit.py +522 -0
  153. heavenbase-0.1.0.1.dev0/src/heavenbase/toolkit/workspace_tools.py +757 -0
  154. heavenbase-0.1.0.1.dev0/src/heavenbase/types/__init__.py +97 -0
  155. heavenbase-0.1.0.1.dev0/src/heavenbase/types/array.py +79 -0
  156. heavenbase-0.1.0.1.dev0/src/heavenbase/types/artifact.py +89 -0
  157. heavenbase-0.1.0.1.dev0/src/heavenbase/types/base.py +263 -0
  158. heavenbase-0.1.0.1.dev0/src/heavenbase/types/boolean.py +68 -0
  159. heavenbase-0.1.0.1.dev0/src/heavenbase/types/categorical.py +146 -0
  160. heavenbase-0.1.0.1.dev0/src/heavenbase/types/date.py +88 -0
  161. heavenbase-0.1.0.1.dev0/src/heavenbase/types/families.py +77 -0
  162. heavenbase-0.1.0.1.dev0/src/heavenbase/types/float.py +21 -0
  163. heavenbase-0.1.0.1.dev0/src/heavenbase/types/hyperg.py +189 -0
  164. heavenbase-0.1.0.1.dev0/src/heavenbase/types/identifier.py +34 -0
  165. heavenbase-0.1.0.1.dev0/src/heavenbase/types/integer.py +21 -0
  166. heavenbase-0.1.0.1.dev0/src/heavenbase/types/json.py +85 -0
  167. heavenbase-0.1.0.1.dev0/src/heavenbase/types/limits.py +63 -0
  168. heavenbase-0.1.0.1.dev0/src/heavenbase/types/long_text.py +52 -0
  169. heavenbase-0.1.0.1.dev0/src/heavenbase/types/medium_text.py +52 -0
  170. heavenbase-0.1.0.1.dev0/src/heavenbase/types/short_text.py +52 -0
  171. heavenbase-0.1.0.1.dev0/src/heavenbase/types/timestamp.py +113 -0
  172. heavenbase-0.1.0.1.dev0/src/heavenbase/types/vector.py +86 -0
  173. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/__init__.py +563 -0
  174. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/cmd.py +213 -0
  175. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/coerce.py +65 -0
  176. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/color.py +371 -0
  177. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/config.py +1645 -0
  178. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/config_api.py +178 -0
  179. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/containers.py +23 -0
  180. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/db/__init__.py +60 -0
  181. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/db/database.py +1219 -0
  182. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/db/ddl.py +163 -0
  183. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/db/dialects.py +42 -0
  184. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/db/display.py +118 -0
  185. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/db/processor.py +392 -0
  186. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/db/readonly.py +66 -0
  187. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/db/registry.py +199 -0
  188. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/db/response.py +490 -0
  189. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/db/spec.py +301 -0
  190. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/db/types.py +185 -0
  191. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/db_path.py +62 -0
  192. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/debug.py +224 -0
  193. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/files.py +723 -0
  194. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/hash.py +143 -0
  195. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/ids.py +264 -0
  196. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/llm/__init__.py +32 -0
  197. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/llm/adapters.py +923 -0
  198. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/llm/base.py +1629 -0
  199. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/llm/cache.py +493 -0
  200. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/llm/image.py +257 -0
  201. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/llm/mock.py +211 -0
  202. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/llm/repair.py +197 -0
  203. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/llm/response.py +165 -0
  204. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/llm/session.py +195 -0
  205. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/llm/spec.py +401 -0
  206. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/log.py +604 -0
  207. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/naming.py +77 -0
  208. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/network.py +80 -0
  209. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/ops.py +160 -0
  210. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/parallel.py +477 -0
  211. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/registry_identity.py +175 -0
  212. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/rng.py +581 -0
  213. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/serialize.py +791 -0
  214. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/spec.py +190 -0
  215. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/strings.py +622 -0
  216. heavenbase-0.1.0.1.dev0/src/heavenbase/utils/typing.py +63 -0
  217. heavenbase-0.1.0.1.dev0/src/heavenbase/version.py +7 -0
  218. heavenbase-0.1.0.1.dev0/src/heavenbase/workspace/__init__.py +2109 -0
  219. heavenbase-0.1.0.1.dev0/src/heavenbase/workspace/_crud.py +232 -0
  220. heavenbase-0.1.0.1.dev0/src/heavenbase/workspace/_query.py +53 -0
  221. heavenbase-0.1.0.1.dev0/src/heavenbase/workspace/_registry.py +51 -0
  222. heavenbase-0.1.0.1.dev0/src/heavenbase/workspace/_system.py +155 -0
  223. heavenbase-0.1.0.1.dev0/src/heavenbase/workspace/_writer.py +55 -0
  224. heavenbase-0.1.0.1.dev0/src/heavenbase/workspace/catalog.py +89 -0
  225. heavenbase-0.1.0.1.dev0/src/heavenbase/workspace/presets.py +103 -0
  226. heavenbase-0.1.0.1.dev0/src/heavenbase.egg-info/PKG-INFO +377 -0
  227. heavenbase-0.1.0.1.dev0/src/heavenbase.egg-info/SOURCES.txt +257 -0
  228. heavenbase-0.1.0.1.dev0/src/heavenbase.egg-info/dependency_links.txt +1 -0
  229. heavenbase-0.1.0.1.dev0/src/heavenbase.egg-info/entry_points.txt +2 -0
  230. heavenbase-0.1.0.1.dev0/src/heavenbase.egg-info/requires.txt +47 -0
  231. heavenbase-0.1.0.1.dev0/src/heavenbase.egg-info/top_level.txt +1 -0
  232. heavenbase-0.1.0.1.dev0/tests/test_backends.py +1252 -0
  233. heavenbase-0.1.0.1.dev0/tests/test_benchmark_script.py +94 -0
  234. heavenbase-0.1.0.1.dev0/tests/test_capsule_toolkit.py +336 -0
  235. heavenbase-0.1.0.1.dev0/tests/test_cli_core.py +571 -0
  236. heavenbase-0.1.0.1.dev0/tests/test_config_manager.py +285 -0
  237. heavenbase-0.1.0.1.dev0/tests/test_config_spec.py +182 -0
  238. heavenbase-0.1.0.1.dev0/tests/test_core.py +1434 -0
  239. heavenbase-0.1.0.1.dev0/tests/test_database.py +382 -0
  240. heavenbase-0.1.0.1.dev0/tests/test_extensions.py +76 -0
  241. heavenbase-0.1.0.1.dev0/tests/test_external_backends.py +436 -0
  242. heavenbase-0.1.0.1.dev0/tests/test_interop.py +284 -0
  243. heavenbase-0.1.0.1.dev0/tests/test_interop_daft.py +57 -0
  244. heavenbase-0.1.0.1.dev0/tests/test_llm.py +1766 -0
  245. heavenbase-0.1.0.1.dev0/tests/test_llm_cache.py +340 -0
  246. heavenbase-0.1.0.1.dev0/tests/test_llm_session_tools.py +222 -0
  247. heavenbase-0.1.0.1.dev0/tests/test_logical_types.py +527 -0
  248. heavenbase-0.1.0.1.dev0/tests/test_mcp.py +450 -0
  249. heavenbase-0.1.0.1.dev0/tests/test_native_backends.py +646 -0
  250. heavenbase-0.1.0.1.dev0/tests/test_parallel.py +413 -0
  251. heavenbase-0.1.0.1.dev0/tests/test_prompt.py +383 -0
  252. heavenbase-0.1.0.1.dev0/tests/test_public_api.py +263 -0
  253. heavenbase-0.1.0.1.dev0/tests/test_routing_inspection.py +2053 -0
  254. heavenbase-0.1.0.1.dev0/tests/test_schema_ir.py +136 -0
  255. heavenbase-0.1.0.1.dev0/tests/test_thread_safety.py +410 -0
  256. heavenbase-0.1.0.1.dev0/tests/test_toolkit_anthropic.py +89 -0
  257. heavenbase-0.1.0.1.dev0/tests/test_utils_basic.py +393 -0
  258. heavenbase-0.1.0.1.dev0/tests/test_workspace_presets.py +58 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RubikSQL Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,377 @@
1
+ Metadata-Version: 2.4
2
+ Name: heavenbase
3
+ Version: 0.1.0.1.dev0
4
+ Summary: HeavenBase: an agent-native polyglot engine for structured data management. Your data, speakable by agents.
5
+ Author-email: RubikSQL Team <chenzui1@huawei.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 RubikSQL Team
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/orgs/RubikSQL
29
+ Project-URL: Repository, https://github.com/RubikSQL/HeavenBase
30
+ Project-URL: Bug Tracker, https://github.com/RubikSQL/HeavenBase/issues
31
+ Keywords: semantic-layer,entity,vector-db,agents,heavenbase,hvnb
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: Topic :: Database
35
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
36
+ Classifier: Programming Language :: Python :: 3
37
+ Classifier: Operating System :: OS Independent
38
+ Requires-Python: <3.14,>=3.10
39
+ Description-Content-Type: text/markdown
40
+ License-File: LICENSE
41
+ Requires-Dist: pyyaml>=6.0
42
+ Requires-Dist: omegaconf>=2.3
43
+ Requires-Dist: cloudpickle>=3.0
44
+ Requires-Dist: fastmcp>=3.0
45
+ Requires-Dist: openai>=1.0
46
+ Requires-Dist: anthropic>=0.105
47
+ Requires-Dist: sqlalchemy>=2.0
48
+ Requires-Dist: typer>=0.12
49
+ Requires-Dist: click>=8.1
50
+ Requires-Dist: prompt_toolkit>=3.0
51
+ Requires-Dist: pandas>=1.5
52
+ Provides-Extra: dev
53
+ Requires-Dist: black>=24.0; extra == "dev"
54
+ Requires-Dist: flake8>=6.0; extra == "dev"
55
+ Requires-Dist: pytest>=7.0; extra == "dev"
56
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
57
+ Requires-Dist: numpy>=1.24; extra == "dev"
58
+ Requires-Dist: pillow>=10.0; extra == "dev"
59
+ Requires-Dist: pre-commit>=4.0; extra == "dev"
60
+ Requires-Dist: virtualenv>=20.0; extra == "dev"
61
+ Provides-Extra: interop
62
+ Requires-Dist: pydantic>=1.10; extra == "interop"
63
+ Requires-Dist: pandas>=2.0; extra == "interop"
64
+ Requires-Dist: pyarrow>=12.0; extra == "interop"
65
+ Requires-Dist: numpy>=1.24; extra == "interop"
66
+ Requires-Dist: sqlalchemy>=2.0; extra == "interop"
67
+ Provides-Extra: daft
68
+ Requires-Dist: daft>=0.4; extra == "daft"
69
+ Requires-Dist: pyarrow>=12.0; extra == "daft"
70
+ Provides-Extra: sql
71
+ Requires-Dist: sqlalchemy>=2.0; extra == "sql"
72
+ Provides-Extra: full
73
+ Requires-Dist: sqlalchemy>=2.0; extra == "full"
74
+ Requires-Dist: numpy>=1.24; extra == "full"
75
+ Requires-Dist: pillow>=10.0; extra == "full"
76
+ Requires-Dist: pymongo>=4.0; extra == "full"
77
+ Requires-Dist: litellm>=1.0; extra == "full"
78
+ Requires-Dist: psycopg2-binary>=2.9; extra == "full"
79
+ Requires-Dist: pgvector>=0.3; extra == "full"
80
+ Requires-Dist: lancedb>=0.22; extra == "full"
81
+ Requires-Dist: pylance>=0.34; extra == "full"
82
+ Requires-Dist: elasticsearch>=8.0; extra == "full"
83
+ Dynamic: license-file
84
+
85
+ # HeavenBase
86
+
87
+ HeavenBase is an agent-native polyglot data engine for structured data management.
88
+ You define one logical model, connect the storage systems you already use, and expose one workspace API to applications and agents.
89
+
90
+ It is not a database replacement. It is the layer that tells agents what data exists, what it means, where it lives, how to query it, and which tool surface they can use safely.
91
+
92
+ ```python
93
+ import heavenbase as hb
94
+ ```
95
+
96
+ ## Release Status
97
+
98
+ HeavenBase is being prepared for an initial developer release.
99
+ The current package has a working workspace facade, entity DSL, query planner, system catalog rows, storage routing, backend handler registry, MCP workspace tools, LLM utilities, prompt storage, config management, interop helpers, and a CLI.
100
+
101
+ Expect a developer-facing API, useful local defaults, and visible diagnostics.
102
+ Do not expect a fully stabilized production control plane yet: provider-native pushdown is still being deepened, some operations intentionally fall back to scan-style execution, and full workspace manifest import/export is still future work.
103
+
104
+ ## Why HeavenBase
105
+
106
+ Agents fail less often because they cannot reason, and more often because they cannot see the data landscape:
107
+
108
+ - they do not know a silo exists
109
+ - they have stale schema or source maps
110
+ - they miss domain vocabulary
111
+ - they retrieve only a convenient top-k slice
112
+ - they cannot relate data, playbooks, prompts, tools, and memory
113
+
114
+ HeavenBase addresses that by putting data, metadata, domain knowledge, prompts, tools, and agent memory into one typed workspace. Agents can discover `Catalog` rows for concrete objects, inspect `MetaSchema` rows for structure, and query typed entities through the same API.
115
+
116
+ ## What Ships Today
117
+
118
+ - `HeavenBase` workspaces for schemas, backends, routing, data, Catalog, MetaSchema, audit, repair, and MCP exposure.
119
+ - `Entity` classes with `hb.field(...)`, logical types, defaults, compute hooks, query-compute hooks, JSON schema compilation, and stable `object_id` identity.
120
+ - Query surfaces through Python expressions and Mongo-style JSON filters, both lowering into `QuerySpec`.
121
+ - Field-level storage placement with strategies such as `InlineColumn`, `JsonField`, `SideTable`, `VectorIndex`, `InvertedIndex`, `GraphEdge`, and `ExternalRef`.
122
+ - Built-in backend families for in-memory, file JSON/pickle, SQL, vector stores, and search.
123
+ - Handler-based query compilation with `QueryBuilder.explain()` diagnostics for backend, strategy, handler mode, fallback, and unsupported reasons.
124
+ - `Catalog` for object discovery and `MetaSchema` for workspace structure.
125
+ - Workspace MCP profiles for agent, full/admin, memory, and memstate-style project memory tools.
126
+ - `hb.LLM` and `hb llm` for configured chat, embeddings, image generation, sessions, MCP tool loops, caching, and provider/gateway routing.
127
+ - `CM_HVNB`, `ConfigEngine`, prompt utilities, SQL helpers, interop helpers, and a small public capability index.
128
+
129
+ ## Install
130
+
131
+ For the package release:
132
+
133
+ ```bash
134
+ pip install heavenbase
135
+ hb setup
136
+ ```
137
+
138
+ For source development, `uv` is the recommended path:
139
+
140
+ ```bash
141
+ git clone https://github.com/RubikSQL/HeavenBase.git
142
+ cd HeavenBase
143
+ uv sync --extra dev
144
+ uv run hb setup
145
+ ```
146
+
147
+ The project pins the default local `uv` interpreter through `.python-version` while keeping package support for Python 3.10 through 3.13.
148
+
149
+ Optional extras are available when you need more providers:
150
+
151
+ ```bash
152
+ pip install "heavenbase[full]"
153
+ uv sync --extra full
154
+ ```
155
+
156
+ ## First Workspace
157
+
158
+ Use the `debug` preset first. It needs no Docker services and creates local SQLite plus in-memory vector/search backends.
159
+
160
+ ```python
161
+ import heavenbase as hb
162
+
163
+
164
+ class Product(hb.Entity):
165
+ name = hb.field(hb.ShortText).desc("Display name")
166
+ body = hb.field(hb.LongText).desc("Searchable description")
167
+ price = hb.field(hb.Float).desc("List price")
168
+ tags = hb.field(hb.Array[hb.ShortText]).default([])
169
+
170
+
171
+ ws = hb.HeavenBase("shop", preset="debug")
172
+ ws.register(Product)
173
+
174
+ desk_id = ws.upsert(
175
+ Product,
176
+ {
177
+ "name": "Oak desk",
178
+ "body": "Writing desk with cable tray",
179
+ "price": 129.0,
180
+ "tags": ["office", "furniture"],
181
+ },
182
+ )
183
+
184
+ frame = (
185
+ ws.query(Product)
186
+ .where(Product.price < 150)
187
+ .where(Product.tags.array_contains("office"))
188
+ .select("name", "price")
189
+ .execute()
190
+ )
191
+
192
+ print(desk_id)
193
+ print(frame.rows())
194
+ ```
195
+
196
+ Every row has exactly one `object_id`. If you omit it and provide `name`, HeavenBase derives a deterministic ID from the entity schema and row name.
197
+
198
+ ## Query and Explain
199
+
200
+ Python expressions and JSON filters share the same planner:
201
+
202
+ ```python
203
+ cheap = ws.query(Product).where(Product.price < 100).count()
204
+
205
+ json_frame = ws.query_json(
206
+ Product,
207
+ {
208
+ "filter": {"body": {"$match": "desk"}},
209
+ "select": ["name", "price"],
210
+ "limit": 5,
211
+ },
212
+ ).execute()
213
+
214
+ plan = ws.query(Product).where(Product.body.match("desk")).explain()
215
+
216
+ print(cheap)
217
+ print(json_frame.rows())
218
+ print(plan["steps"][0]["handler_mode"])
219
+ ```
220
+
221
+ Result projection keeps `object_id` so agents can display compact rows and still call `get`, `set`, `delete`, `query`, or `explain` later with stable identity.
222
+
223
+ ## Agent Discovery
224
+
225
+ HeavenBase writes system rows automatically:
226
+
227
+ ```python
228
+ catalog_rows = ws.query(hb.Catalog).select("target_entity", "target_id", "name").execute().rows()
229
+ schema_rows = (
230
+ ws.query(hb.MetaSchema)
231
+ .where(hb.MetaSchema.kind == "field")
232
+ .where(hb.MetaSchema.subject_id == Product.schema().entity_id)
233
+ .select("field", "dtype", "desc")
234
+ .execute()
235
+ .rows()
236
+ )
237
+
238
+ print(catalog_rows)
239
+ print(schema_rows)
240
+ ```
241
+
242
+ Use `Catalog` to find concrete objects. Use `MetaSchema` to learn entities, fields, storage placement, backends, capabilities, and extensions.
243
+
244
+ ## Workspace MCP
245
+
246
+ Any workspace can become an MCP toolkit:
247
+
248
+ ```python
249
+ print(ws.to_mcp_json(name="shop-mcp", profile="agent", transport="http", host="127.0.0.1", port=7001))
250
+ ws.serve(name="shop-mcp", profile="agent", transport="http", host="127.0.0.1", port=7001)
251
+ ```
252
+
253
+ The `agent` profile exposes a compact schema/data surface: `define_entity`, `list_entities`, `describe_entity`, `upsert`, `get`, `set`, `count`, `query`, and `explain`.
254
+ Use `profile="full"` for trusted administrative flows, `profile="memory"` for note-style memory, and `profile="memstate"` for versioned project memory.
255
+
256
+ ## CLI
257
+
258
+ The `hb` command is a shallow layer over the same APIs:
259
+
260
+ ```bash
261
+ hb --help
262
+ hb setup
263
+ hb ws list
264
+ hb ws presets show debug
265
+ hb config get heavenbase.workspace.default_preset
266
+ hb cfg set heavenbase.llm.default_preset mock
267
+ hb llm chat --preset mock --provider mock --gateway mock --no-stream "hello"
268
+ hb llm embed "semantic text" --preview
269
+ hb prompt create demo.hello --template "Hello, {name}" --tr-key name
270
+ hb prompt render demo.hello --args '{"name":"Ada"}'
271
+ ```
272
+
273
+ `hb setup` initializes global HeavenBase config and the default workspace. Runtime state lives under the HeavenBase config root, not in a new project-local folder.
274
+
275
+ ## Backends and Presets
276
+
277
+ Start with presets:
278
+
279
+ | Preset | Backends | Use case |
280
+ | --- | --- | --- |
281
+ | `debug` | SQLite `main`, in-memory `vec`, in-memory `search` | Demos, tests, and first-run development with no Docker. |
282
+ | `local-lts` | Postgres `main`, LanceDB `vec`, Elasticsearch `search` | Durable local development with the repo service stack. |
283
+ | `web-lts` | Postgres-compatible `main`, pgvector `vec`, hosted search | Managed or shared deployments. |
284
+
285
+ Use explicit backend maps when deployment placement matters:
286
+
287
+ ```python
288
+ ws = hb.HeavenBase(
289
+ "custom-shop",
290
+ backends={
291
+ "main": {"type": "sqlite", "database": ":memory:"},
292
+ "vec": {"type": "inmem"},
293
+ },
294
+ )
295
+ ```
296
+
297
+ Built-in backend families include `inmem`, `json`, `pickle`, `sqlite`, `duckdb`, `postgres`, `pgvector`, `mysql`, `oceanbase`, `mssql`, `oracle`, `trino`, `starrocks`, `lance`, `chroma`, `milvus`, `pinecone`, and `elasticsearch`. Optional providers require their Python drivers and reachable services.
298
+
299
+ Inspect support from code:
300
+
301
+ ```python
302
+ hb.capabilities.backends(hb.Vector, op="near")
303
+ ws.capabilities.ops(hb.ShortText, hb.InlineColumn, backend="main")
304
+ ```
305
+
306
+ ## LLM Utilities
307
+
308
+ `hb.LLM` resolves presets, model aliases, providers, gateways, request defaults, and cache settings from `CM_HVNB`.
309
+
310
+ ```python
311
+ import heavenbase as hb
312
+
313
+ llm = hb.LLM(preset="mock")
314
+ print(llm.chat("Reply with hb-ok"))
315
+ ```
316
+
317
+ The default online provider is OpenRouter through an OpenAI-compatible gateway. Configure credentials through environment variables such as `OPENROUTER_API_KEY`, or switch to local/mock providers for tests and demos.
318
+
319
+ ## Development
320
+
321
+ Use the repo wrappers:
322
+
323
+ ```bash
324
+ bash scripts/sync.bash
325
+ bash scripts/test.bash tests/test_config_spec.py::test_config_engine_forbids_unknowns_and_requires_fields -q
326
+ bash scripts/flake.bash -a
327
+ ```
328
+
329
+ For the continuous benchmark suite:
330
+
331
+ ```bash
332
+ bash scripts/benchmark.bash
333
+ ```
334
+
335
+ External database tests are designed to skip or use the Docker stack when services are unavailable. For direct local service setup, use:
336
+
337
+ ```bash
338
+ bash ./scripts/docker-restart.bash /d/databases/
339
+ ```
340
+
341
+ ## Repository Map
342
+
343
+ | Path | Purpose |
344
+ | --- | --- |
345
+ | `src/heavenbase/` | Runtime package. |
346
+ | `src/heavenbase/workspace/` | Workspace facade, CRUD, query, registry, system rows, presets. |
347
+ | `src/heavenbase/entity/` | Entity DSL, field specs, system entities, JSON compiler. |
348
+ | `src/heavenbase/query/` | Query expressions, JSON query parsing, query specs. |
349
+ | `src/heavenbase/backends/` | Built-in backend implementations and backend registry. |
350
+ | `src/heavenbase/handlers/` | Operation handler registry and backend compilers. |
351
+ | `src/heavenbase/strategies/` | Storage strategy markers. |
352
+ | `src/heavenbase/toolkit/` and `src/heavenbase/mcp/` | Toolkit and MCP surfaces. |
353
+ | `src/heavenbase/utils/` | Config, LLM, SQL, serialization, paths, hashing, logging, and runtime helpers. |
354
+ | `docs/` | Design notes, capability matrix, plans, and implementation docs. |
355
+ | `demos/` | Runnable onboarding and focused backend/provider examples. |
356
+ | `tests/` | Core, backend, interop, LLM, MCP, CLI, and thread-safety coverage. |
357
+
358
+ Start with `demos/00_first_install.py`, then `demos/01_workspace_entity_crud.py`, `demos/02_query_surfaces.py`, and `demos/03_catalog_browse.py`.
359
+
360
+ ## Boundaries
361
+
362
+ - Capability registration does not guarantee provider-native pushdown. Check `QueryBuilder.explain()` for `handler_mode`, `near_filter_mode`, and fallback reasons.
363
+ - Multi-backend writes are coordinated by the workspace but not a distributed transaction system. Keep cross-backend invariants simple.
364
+ - File backends are local development tools. Treat pickle stores as trusted-local only.
365
+ - Workspace persistence is backend-driven; full workspace manifest import/export is not shipped yet.
366
+ - Some docs and demos are implementation references rather than polished onboarding paths. The primary demo path is listed in `demos/README.md`.
367
+
368
+ ## Documentation
369
+
370
+ - Package docs: `docs/`
371
+ - Demos: `demos/README.md`
372
+ - Workspace presets: `docs/WORKSPACE_PRESETS.md`
373
+ - Configuration: `docs/CONFIG_SPEC.md`
374
+ - Identity rules: `docs/ID_SEMANTICS.md`
375
+ - MCP: `docs/MCP.md`
376
+ - LLM: `docs/LLM.md`
377
+ - Capability matrix: `docs/CAPABILITIES.md`
@@ -0,0 +1,293 @@
1
+ # HeavenBase
2
+
3
+ HeavenBase is an agent-native polyglot data engine for structured data management.
4
+ You define one logical model, connect the storage systems you already use, and expose one workspace API to applications and agents.
5
+
6
+ It is not a database replacement. It is the layer that tells agents what data exists, what it means, where it lives, how to query it, and which tool surface they can use safely.
7
+
8
+ ```python
9
+ import heavenbase as hb
10
+ ```
11
+
12
+ ## Release Status
13
+
14
+ HeavenBase is being prepared for an initial developer release.
15
+ The current package has a working workspace facade, entity DSL, query planner, system catalog rows, storage routing, backend handler registry, MCP workspace tools, LLM utilities, prompt storage, config management, interop helpers, and a CLI.
16
+
17
+ Expect a developer-facing API, useful local defaults, and visible diagnostics.
18
+ Do not expect a fully stabilized production control plane yet: provider-native pushdown is still being deepened, some operations intentionally fall back to scan-style execution, and full workspace manifest import/export is still future work.
19
+
20
+ ## Why HeavenBase
21
+
22
+ Agents fail less often because they cannot reason, and more often because they cannot see the data landscape:
23
+
24
+ - they do not know a silo exists
25
+ - they have stale schema or source maps
26
+ - they miss domain vocabulary
27
+ - they retrieve only a convenient top-k slice
28
+ - they cannot relate data, playbooks, prompts, tools, and memory
29
+
30
+ HeavenBase addresses that by putting data, metadata, domain knowledge, prompts, tools, and agent memory into one typed workspace. Agents can discover `Catalog` rows for concrete objects, inspect `MetaSchema` rows for structure, and query typed entities through the same API.
31
+
32
+ ## What Ships Today
33
+
34
+ - `HeavenBase` workspaces for schemas, backends, routing, data, Catalog, MetaSchema, audit, repair, and MCP exposure.
35
+ - `Entity` classes with `hb.field(...)`, logical types, defaults, compute hooks, query-compute hooks, JSON schema compilation, and stable `object_id` identity.
36
+ - Query surfaces through Python expressions and Mongo-style JSON filters, both lowering into `QuerySpec`.
37
+ - Field-level storage placement with strategies such as `InlineColumn`, `JsonField`, `SideTable`, `VectorIndex`, `InvertedIndex`, `GraphEdge`, and `ExternalRef`.
38
+ - Built-in backend families for in-memory, file JSON/pickle, SQL, vector stores, and search.
39
+ - Handler-based query compilation with `QueryBuilder.explain()` diagnostics for backend, strategy, handler mode, fallback, and unsupported reasons.
40
+ - `Catalog` for object discovery and `MetaSchema` for workspace structure.
41
+ - Workspace MCP profiles for agent, full/admin, memory, and memstate-style project memory tools.
42
+ - `hb.LLM` and `hb llm` for configured chat, embeddings, image generation, sessions, MCP tool loops, caching, and provider/gateway routing.
43
+ - `CM_HVNB`, `ConfigEngine`, prompt utilities, SQL helpers, interop helpers, and a small public capability index.
44
+
45
+ ## Install
46
+
47
+ For the package release:
48
+
49
+ ```bash
50
+ pip install heavenbase
51
+ hb setup
52
+ ```
53
+
54
+ For source development, `uv` is the recommended path:
55
+
56
+ ```bash
57
+ git clone https://github.com/RubikSQL/HeavenBase.git
58
+ cd HeavenBase
59
+ uv sync --extra dev
60
+ uv run hb setup
61
+ ```
62
+
63
+ The project pins the default local `uv` interpreter through `.python-version` while keeping package support for Python 3.10 through 3.13.
64
+
65
+ Optional extras are available when you need more providers:
66
+
67
+ ```bash
68
+ pip install "heavenbase[full]"
69
+ uv sync --extra full
70
+ ```
71
+
72
+ ## First Workspace
73
+
74
+ Use the `debug` preset first. It needs no Docker services and creates local SQLite plus in-memory vector/search backends.
75
+
76
+ ```python
77
+ import heavenbase as hb
78
+
79
+
80
+ class Product(hb.Entity):
81
+ name = hb.field(hb.ShortText).desc("Display name")
82
+ body = hb.field(hb.LongText).desc("Searchable description")
83
+ price = hb.field(hb.Float).desc("List price")
84
+ tags = hb.field(hb.Array[hb.ShortText]).default([])
85
+
86
+
87
+ ws = hb.HeavenBase("shop", preset="debug")
88
+ ws.register(Product)
89
+
90
+ desk_id = ws.upsert(
91
+ Product,
92
+ {
93
+ "name": "Oak desk",
94
+ "body": "Writing desk with cable tray",
95
+ "price": 129.0,
96
+ "tags": ["office", "furniture"],
97
+ },
98
+ )
99
+
100
+ frame = (
101
+ ws.query(Product)
102
+ .where(Product.price < 150)
103
+ .where(Product.tags.array_contains("office"))
104
+ .select("name", "price")
105
+ .execute()
106
+ )
107
+
108
+ print(desk_id)
109
+ print(frame.rows())
110
+ ```
111
+
112
+ Every row has exactly one `object_id`. If you omit it and provide `name`, HeavenBase derives a deterministic ID from the entity schema and row name.
113
+
114
+ ## Query and Explain
115
+
116
+ Python expressions and JSON filters share the same planner:
117
+
118
+ ```python
119
+ cheap = ws.query(Product).where(Product.price < 100).count()
120
+
121
+ json_frame = ws.query_json(
122
+ Product,
123
+ {
124
+ "filter": {"body": {"$match": "desk"}},
125
+ "select": ["name", "price"],
126
+ "limit": 5,
127
+ },
128
+ ).execute()
129
+
130
+ plan = ws.query(Product).where(Product.body.match("desk")).explain()
131
+
132
+ print(cheap)
133
+ print(json_frame.rows())
134
+ print(plan["steps"][0]["handler_mode"])
135
+ ```
136
+
137
+ Result projection keeps `object_id` so agents can display compact rows and still call `get`, `set`, `delete`, `query`, or `explain` later with stable identity.
138
+
139
+ ## Agent Discovery
140
+
141
+ HeavenBase writes system rows automatically:
142
+
143
+ ```python
144
+ catalog_rows = ws.query(hb.Catalog).select("target_entity", "target_id", "name").execute().rows()
145
+ schema_rows = (
146
+ ws.query(hb.MetaSchema)
147
+ .where(hb.MetaSchema.kind == "field")
148
+ .where(hb.MetaSchema.subject_id == Product.schema().entity_id)
149
+ .select("field", "dtype", "desc")
150
+ .execute()
151
+ .rows()
152
+ )
153
+
154
+ print(catalog_rows)
155
+ print(schema_rows)
156
+ ```
157
+
158
+ Use `Catalog` to find concrete objects. Use `MetaSchema` to learn entities, fields, storage placement, backends, capabilities, and extensions.
159
+
160
+ ## Workspace MCP
161
+
162
+ Any workspace can become an MCP toolkit:
163
+
164
+ ```python
165
+ print(ws.to_mcp_json(name="shop-mcp", profile="agent", transport="http", host="127.0.0.1", port=7001))
166
+ ws.serve(name="shop-mcp", profile="agent", transport="http", host="127.0.0.1", port=7001)
167
+ ```
168
+
169
+ The `agent` profile exposes a compact schema/data surface: `define_entity`, `list_entities`, `describe_entity`, `upsert`, `get`, `set`, `count`, `query`, and `explain`.
170
+ Use `profile="full"` for trusted administrative flows, `profile="memory"` for note-style memory, and `profile="memstate"` for versioned project memory.
171
+
172
+ ## CLI
173
+
174
+ The `hb` command is a shallow layer over the same APIs:
175
+
176
+ ```bash
177
+ hb --help
178
+ hb setup
179
+ hb ws list
180
+ hb ws presets show debug
181
+ hb config get heavenbase.workspace.default_preset
182
+ hb cfg set heavenbase.llm.default_preset mock
183
+ hb llm chat --preset mock --provider mock --gateway mock --no-stream "hello"
184
+ hb llm embed "semantic text" --preview
185
+ hb prompt create demo.hello --template "Hello, {name}" --tr-key name
186
+ hb prompt render demo.hello --args '{"name":"Ada"}'
187
+ ```
188
+
189
+ `hb setup` initializes global HeavenBase config and the default workspace. Runtime state lives under the HeavenBase config root, not in a new project-local folder.
190
+
191
+ ## Backends and Presets
192
+
193
+ Start with presets:
194
+
195
+ | Preset | Backends | Use case |
196
+ | --- | --- | --- |
197
+ | `debug` | SQLite `main`, in-memory `vec`, in-memory `search` | Demos, tests, and first-run development with no Docker. |
198
+ | `local-lts` | Postgres `main`, LanceDB `vec`, Elasticsearch `search` | Durable local development with the repo service stack. |
199
+ | `web-lts` | Postgres-compatible `main`, pgvector `vec`, hosted search | Managed or shared deployments. |
200
+
201
+ Use explicit backend maps when deployment placement matters:
202
+
203
+ ```python
204
+ ws = hb.HeavenBase(
205
+ "custom-shop",
206
+ backends={
207
+ "main": {"type": "sqlite", "database": ":memory:"},
208
+ "vec": {"type": "inmem"},
209
+ },
210
+ )
211
+ ```
212
+
213
+ Built-in backend families include `inmem`, `json`, `pickle`, `sqlite`, `duckdb`, `postgres`, `pgvector`, `mysql`, `oceanbase`, `mssql`, `oracle`, `trino`, `starrocks`, `lance`, `chroma`, `milvus`, `pinecone`, and `elasticsearch`. Optional providers require their Python drivers and reachable services.
214
+
215
+ Inspect support from code:
216
+
217
+ ```python
218
+ hb.capabilities.backends(hb.Vector, op="near")
219
+ ws.capabilities.ops(hb.ShortText, hb.InlineColumn, backend="main")
220
+ ```
221
+
222
+ ## LLM Utilities
223
+
224
+ `hb.LLM` resolves presets, model aliases, providers, gateways, request defaults, and cache settings from `CM_HVNB`.
225
+
226
+ ```python
227
+ import heavenbase as hb
228
+
229
+ llm = hb.LLM(preset="mock")
230
+ print(llm.chat("Reply with hb-ok"))
231
+ ```
232
+
233
+ The default online provider is OpenRouter through an OpenAI-compatible gateway. Configure credentials through environment variables such as `OPENROUTER_API_KEY`, or switch to local/mock providers for tests and demos.
234
+
235
+ ## Development
236
+
237
+ Use the repo wrappers:
238
+
239
+ ```bash
240
+ bash scripts/sync.bash
241
+ bash scripts/test.bash tests/test_config_spec.py::test_config_engine_forbids_unknowns_and_requires_fields -q
242
+ bash scripts/flake.bash -a
243
+ ```
244
+
245
+ For the continuous benchmark suite:
246
+
247
+ ```bash
248
+ bash scripts/benchmark.bash
249
+ ```
250
+
251
+ External database tests are designed to skip or use the Docker stack when services are unavailable. For direct local service setup, use:
252
+
253
+ ```bash
254
+ bash ./scripts/docker-restart.bash /d/databases/
255
+ ```
256
+
257
+ ## Repository Map
258
+
259
+ | Path | Purpose |
260
+ | --- | --- |
261
+ | `src/heavenbase/` | Runtime package. |
262
+ | `src/heavenbase/workspace/` | Workspace facade, CRUD, query, registry, system rows, presets. |
263
+ | `src/heavenbase/entity/` | Entity DSL, field specs, system entities, JSON compiler. |
264
+ | `src/heavenbase/query/` | Query expressions, JSON query parsing, query specs. |
265
+ | `src/heavenbase/backends/` | Built-in backend implementations and backend registry. |
266
+ | `src/heavenbase/handlers/` | Operation handler registry and backend compilers. |
267
+ | `src/heavenbase/strategies/` | Storage strategy markers. |
268
+ | `src/heavenbase/toolkit/` and `src/heavenbase/mcp/` | Toolkit and MCP surfaces. |
269
+ | `src/heavenbase/utils/` | Config, LLM, SQL, serialization, paths, hashing, logging, and runtime helpers. |
270
+ | `docs/` | Design notes, capability matrix, plans, and implementation docs. |
271
+ | `demos/` | Runnable onboarding and focused backend/provider examples. |
272
+ | `tests/` | Core, backend, interop, LLM, MCP, CLI, and thread-safety coverage. |
273
+
274
+ Start with `demos/00_first_install.py`, then `demos/01_workspace_entity_crud.py`, `demos/02_query_surfaces.py`, and `demos/03_catalog_browse.py`.
275
+
276
+ ## Boundaries
277
+
278
+ - Capability registration does not guarantee provider-native pushdown. Check `QueryBuilder.explain()` for `handler_mode`, `near_filter_mode`, and fallback reasons.
279
+ - Multi-backend writes are coordinated by the workspace but not a distributed transaction system. Keep cross-backend invariants simple.
280
+ - File backends are local development tools. Treat pickle stores as trusted-local only.
281
+ - Workspace persistence is backend-driven; full workspace manifest import/export is not shipped yet.
282
+ - Some docs and demos are implementation references rather than polished onboarding paths. The primary demo path is listed in `demos/README.md`.
283
+
284
+ ## Documentation
285
+
286
+ - Package docs: `docs/`
287
+ - Demos: `demos/README.md`
288
+ - Workspace presets: `docs/WORKSPACE_PRESETS.md`
289
+ - Configuration: `docs/CONFIG_SPEC.md`
290
+ - Identity rules: `docs/ID_SEMANTICS.md`
291
+ - MCP: `docs/MCP.md`
292
+ - LLM: `docs/LLM.md`
293
+ - Capability matrix: `docs/CAPABILITIES.md`