memini 0.1.0rc1__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 (260) hide show
  1. memini-0.1.0rc1/LICENSE +202 -0
  2. memini-0.1.0rc1/PKG-INFO +71 -0
  3. memini-0.1.0rc1/README.md +38 -0
  4. memini-0.1.0rc1/pyproject.toml +112 -0
  5. memini-0.1.0rc1/pyproject.toml.orig +99 -0
  6. memini-0.1.0rc1/src/memini/__init__.py +5 -0
  7. memini-0.1.0rc1/src/memini/__main__.py +6 -0
  8. memini-0.1.0rc1/src/memini/api/__init__.py +19 -0
  9. memini-0.1.0rc1/src/memini/api/admin_errors.py +68 -0
  10. memini-0.1.0rc1/src/memini/api/agent_runs.py +469 -0
  11. memini-0.1.0rc1/src/memini/api/app.py +276 -0
  12. memini-0.1.0rc1/src/memini/api/auth.py +192 -0
  13. memini-0.1.0rc1/src/memini/api/comms.py +191 -0
  14. memini-0.1.0rc1/src/memini/api/database.py +30 -0
  15. memini-0.1.0rc1/src/memini/api/decisions.py +140 -0
  16. memini-0.1.0rc1/src/memini/api/errors.py +224 -0
  17. memini-0.1.0rc1/src/memini/api/extract.py +178 -0
  18. memini-0.1.0rc1/src/memini/api/forget.py +156 -0
  19. memini-0.1.0rc1/src/memini/api/health.py +129 -0
  20. memini-0.1.0rc1/src/memini/api/ingest.py +469 -0
  21. memini-0.1.0rc1/src/memini/api/limits.py +503 -0
  22. memini-0.1.0rc1/src/memini/api/mcp.py +169 -0
  23. memini-0.1.0rc1/src/memini/api/metrics.py +422 -0
  24. memini-0.1.0rc1/src/memini/api/persons.py +373 -0
  25. memini-0.1.0rc1/src/memini/api/query.py +148 -0
  26. memini-0.1.0rc1/src/memini/api/request_id.py +79 -0
  27. memini-0.1.0rc1/src/memini/api/runs.py +119 -0
  28. memini-0.1.0rc1/src/memini/api/sources.py +978 -0
  29. memini-0.1.0rc1/src/memini/api/status.py +71 -0
  30. memini-0.1.0rc1/src/memini/api/tokens.py +158 -0
  31. memini-0.1.0rc1/src/memini/api/workspaces.py +79 -0
  32. memini-0.1.0rc1/src/memini/auth/__init__.py +72 -0
  33. memini-0.1.0rc1/src/memini/auth/authentication.py +156 -0
  34. memini-0.1.0rc1/src/memini/auth/authorization.py +205 -0
  35. memini-0.1.0rc1/src/memini/auth/principal.py +45 -0
  36. memini-0.1.0rc1/src/memini/auth/tokens.py +243 -0
  37. memini-0.1.0rc1/src/memini/bench/__init__.py +59 -0
  38. memini-0.1.0rc1/src/memini/bench/corpus.py +277 -0
  39. memini-0.1.0rc1/src/memini/bench/measure.py +124 -0
  40. memini-0.1.0rc1/src/memini/bench/queries.py +134 -0
  41. memini-0.1.0rc1/src/memini/bench/report.py +310 -0
  42. memini-0.1.0rc1/src/memini/bench/repository.py +213 -0
  43. memini-0.1.0rc1/src/memini/bench/runner.py +1086 -0
  44. memini-0.1.0rc1/src/memini/chunking/__init__.py +194 -0
  45. memini-0.1.0rc1/src/memini/chunking/chunker.py +584 -0
  46. memini-0.1.0rc1/src/memini/chunking/languages.py +414 -0
  47. memini-0.1.0rc1/src/memini/chunking/markdown.py +393 -0
  48. memini-0.1.0rc1/src/memini/chunking/model.py +213 -0
  49. memini-0.1.0rc1/src/memini/chunking/payloads.py +453 -0
  50. memini-0.1.0rc1/src/memini/chunking/text.py +163 -0
  51. memini-0.1.0rc1/src/memini/cli/__init__.py +597 -0
  52. memini-0.1.0rc1/src/memini/cli/admin.py +191 -0
  53. memini-0.1.0rc1/src/memini/cli/arguments.py +248 -0
  54. memini-0.1.0rc1/src/memini/cli/bench.py +321 -0
  55. memini-0.1.0rc1/src/memini/cli/client.py +493 -0
  56. memini-0.1.0rc1/src/memini/cli/common.py +221 -0
  57. memini-0.1.0rc1/src/memini/cli/comms.py +181 -0
  58. memini-0.1.0rc1/src/memini/cli/credentials.py +385 -0
  59. memini-0.1.0rc1/src/memini/cli/decisions.py +341 -0
  60. memini-0.1.0rc1/src/memini/cli/evaluate.py +193 -0
  61. memini-0.1.0rc1/src/memini/cli/evaluate_decisions.py +225 -0
  62. memini-0.1.0rc1/src/memini/cli/export.py +116 -0
  63. memini-0.1.0rc1/src/memini/cli/extract.py +102 -0
  64. memini-0.1.0rc1/src/memini/cli/forget.py +96 -0
  65. memini-0.1.0rc1/src/memini/cli/index.py +89 -0
  66. memini-0.1.0rc1/src/memini/cli/output.py +117 -0
  67. memini-0.1.0rc1/src/memini/cli/persons.py +408 -0
  68. memini-0.1.0rc1/src/memini/cli/push.py +877 -0
  69. memini-0.1.0rc1/src/memini/cli/recipes.py +103 -0
  70. memini-0.1.0rc1/src/memini/cli/replay.py +147 -0
  71. memini-0.1.0rc1/src/memini/cli/runs.py +199 -0
  72. memini-0.1.0rc1/src/memini/cli/search.py +155 -0
  73. memini-0.1.0rc1/src/memini/cli/serve.py +325 -0
  74. memini-0.1.0rc1/src/memini/cli/sources.py +995 -0
  75. memini-0.1.0rc1/src/memini/cli/status.py +224 -0
  76. memini-0.1.0rc1/src/memini/cli/tokens.py +187 -0
  77. memini-0.1.0rc1/src/memini/comms/__init__.py +88 -0
  78. memini-0.1.0rc1/src/memini/comms/model.py +408 -0
  79. memini-0.1.0rc1/src/memini/comms/service.py +888 -0
  80. memini-0.1.0rc1/src/memini/config.py +1265 -0
  81. memini-0.1.0rc1/src/memini/config_reference.py +915 -0
  82. memini-0.1.0rc1/src/memini/credentials/__init__.py +127 -0
  83. memini-0.1.0rc1/src/memini/credentials/crypto.py +205 -0
  84. memini-0.1.0rc1/src/memini/credentials/errors.py +134 -0
  85. memini-0.1.0rc1/src/memini/credentials/model.py +163 -0
  86. memini-0.1.0rc1/src/memini/credentials/rotation.py +139 -0
  87. memini-0.1.0rc1/src/memini/credentials/store.py +680 -0
  88. memini-0.1.0rc1/src/memini/db/__init__.py +40 -0
  89. memini-0.1.0rc1/src/memini/db/connection.py +89 -0
  90. memini-0.1.0rc1/src/memini/db/limits.py +116 -0
  91. memini-0.1.0rc1/src/memini/db/migrate.py +153 -0
  92. memini-0.1.0rc1/src/memini/db/migrations/0001_extensions.sql +7 -0
  93. memini-0.1.0rc1/src/memini/db/migrations/0002_core_schema.sql +287 -0
  94. memini-0.1.0rc1/src/memini/db/migrations/0003_jobs.sql +97 -0
  95. memini-0.1.0rc1/src/memini/db/migrations/0004_index_state.sql +57 -0
  96. memini-0.1.0rc1/src/memini/db/migrations/0005_chunks_and_symbols.sql +162 -0
  97. memini-0.1.0rc1/src/memini/db/migrations/0006_document_chunks.sql +15 -0
  98. memini-0.1.0rc1/src/memini/db/migrations/0007_credentials.sql +64 -0
  99. memini-0.1.0rc1/src/memini/db/migrations/0008_knowledge.sql +478 -0
  100. memini-0.1.0rc1/src/memini/db/migrations/0009_workspace_llm_policy.sql +19 -0
  101. memini-0.1.0rc1/src/memini/db/migrations/0010_lexical_stemming.sql +44 -0
  102. memini-0.1.0rc1/src/memini/db/migrations/0011_payload_chunks.sql +40 -0
  103. memini-0.1.0rc1/src/memini/db/migrations/0012_stream_history.sql +20 -0
  104. memini-0.1.0rc1/src/memini/db/migrations/0013_forget_and_retention.sql +77 -0
  105. memini-0.1.0rc1/src/memini/db/migrations/0014_persons.sql +125 -0
  106. memini-0.1.0rc1/src/memini/db/migrations/0015_raw_responses.sql +128 -0
  107. memini-0.1.0rc1/src/memini/db/migrations/0016_agent_runs.sql +139 -0
  108. memini-0.1.0rc1/src/memini/db/migrations/0017_knowledge_vectors.sql +37 -0
  109. memini-0.1.0rc1/src/memini/db/statements.py +174 -0
  110. memini-0.1.0rc1/src/memini/decisions/__init__.py +61 -0
  111. memini-0.1.0rc1/src/memini/decisions/model.py +332 -0
  112. memini-0.1.0rc1/src/memini/decisions/reads.py +74 -0
  113. memini-0.1.0rc1/src/memini/decisions/service.py +258 -0
  114. memini-0.1.0rc1/src/memini/embeddings/__init__.py +54 -0
  115. memini-0.1.0rc1/src/memini/embeddings/base.py +233 -0
  116. memini-0.1.0rc1/src/memini/embeddings/factory.py +88 -0
  117. memini-0.1.0rc1/src/memini/embeddings/fake.py +66 -0
  118. memini-0.1.0rc1/src/memini/embeddings/local.py +246 -0
  119. memini-0.1.0rc1/src/memini/embeddings/model_files.py +225 -0
  120. memini-0.1.0rc1/src/memini/embeddings/openai_compatible.py +242 -0
  121. memini-0.1.0rc1/src/memini/embeddings/reuse.py +99 -0
  122. memini-0.1.0rc1/src/memini/embeddings/runtime.py +186 -0
  123. memini-0.1.0rc1/src/memini/evaluation/__init__.py +79 -0
  124. memini-0.1.0rc1/src/memini/evaluation/decisions/__init__.py +79 -0
  125. memini-0.1.0rc1/src/memini/evaluation/decisions/candidates.py +156 -0
  126. memini-0.1.0rc1/src/memini/evaluation/decisions/dataset.py +695 -0
  127. memini-0.1.0rc1/src/memini/evaluation/decisions/llm.py +174 -0
  128. memini-0.1.0rc1/src/memini/evaluation/decisions/matching.py +236 -0
  129. memini-0.1.0rc1/src/memini/evaluation/decisions/report.py +560 -0
  130. memini-0.1.0rc1/src/memini/evaluation/decisions/runner.py +520 -0
  131. memini-0.1.0rc1/src/memini/evaluation/decisions/stubs.py +285 -0
  132. memini-0.1.0rc1/src/memini/evaluation/metrics.py +120 -0
  133. memini-0.1.0rc1/src/memini/evaluation/report.py +450 -0
  134. memini-0.1.0rc1/src/memini/evaluation/runner.py +586 -0
  135. memini-0.1.0rc1/src/memini/evaluation/suite.py +514 -0
  136. memini-0.1.0rc1/src/memini/evaluation/variants.py +300 -0
  137. memini-0.1.0rc1/src/memini/executors/__init__.py +27 -0
  138. memini-0.1.0rc1/src/memini/executors/agent/__init__.py +117 -0
  139. memini-0.1.0rc1/src/memini/executors/agent/model.py +360 -0
  140. memini-0.1.0rc1/src/memini/executors/agent/session.py +931 -0
  141. memini-0.1.0rc1/src/memini/executors/budget.py +107 -0
  142. memini-0.1.0rc1/src/memini/executors/client.py +388 -0
  143. memini-0.1.0rc1/src/memini/executors/core.py +245 -0
  144. memini-0.1.0rc1/src/memini/executors/egress.py +379 -0
  145. memini-0.1.0rc1/src/memini/executors/oauth.py +143 -0
  146. memini-0.1.0rc1/src/memini/executors/service.py +592 -0
  147. memini-0.1.0rc1/src/memini/executors/source.py +436 -0
  148. memini-0.1.0rc1/src/memini/executors/transport.py +277 -0
  149. memini-0.1.0rc1/src/memini/extraction/__init__.py +55 -0
  150. memini-0.1.0rc1/src/memini/extraction/candidates.py +315 -0
  151. memini-0.1.0rc1/src/memini/extraction/inputs.py +131 -0
  152. memini-0.1.0rc1/src/memini/extraction/job.py +504 -0
  153. memini-0.1.0rc1/src/memini/extraction/llm.py +683 -0
  154. memini-0.1.0rc1/src/memini/extraction/model.py +236 -0
  155. memini-0.1.0rc1/src/memini/extraction/reextract.py +439 -0
  156. memini-0.1.0rc1/src/memini/filters.py +432 -0
  157. memini-0.1.0rc1/src/memini/git/__init__.py +90 -0
  158. memini-0.1.0rc1/src/memini/git/command.py +500 -0
  159. memini-0.1.0rc1/src/memini/git/errors.py +110 -0
  160. memini-0.1.0rc1/src/memini/git/mirror.py +858 -0
  161. memini-0.1.0rc1/src/memini/git/options.py +85 -0
  162. memini-0.1.0rc1/src/memini/git/remote.py +201 -0
  163. memini-0.1.0rc1/src/memini/gitsync/__init__.py +79 -0
  164. memini-0.1.0rc1/src/memini/gitsync/content.py +206 -0
  165. memini-0.1.0rc1/src/memini/gitsync/handler.py +183 -0
  166. memini-0.1.0rc1/src/memini/gitsync/model.py +157 -0
  167. memini-0.1.0rc1/src/memini/gitsync/rules.py +157 -0
  168. memini-0.1.0rc1/src/memini/gitsync/sync.py +802 -0
  169. memini-0.1.0rc1/src/memini/ids.py +61 -0
  170. memini-0.1.0rc1/src/memini/index/__init__.py +111 -0
  171. memini-0.1.0rc1/src/memini/index/fingerprint.py +368 -0
  172. memini-0.1.0rc1/src/memini/index/raw.py +250 -0
  173. memini-0.1.0rc1/src/memini/index/rebuild.py +390 -0
  174. memini-0.1.0rc1/src/memini/index/vectors.py +223 -0
  175. memini-0.1.0rc1/src/memini/index/writer.py +536 -0
  176. memini-0.1.0rc1/src/memini/ingest/__init__.py +150 -0
  177. memini-0.1.0rc1/src/memini/ingest/checkpoint.py +63 -0
  178. memini-0.1.0rc1/src/memini/ingest/filtering.py +98 -0
  179. memini-0.1.0rc1/src/memini/ingest/indexing.py +47 -0
  180. memini-0.1.0rc1/src/memini/ingest/model.py +311 -0
  181. memini-0.1.0rc1/src/memini/ingest/store.py +520 -0
  182. memini-0.1.0rc1/src/memini/ingest/validate.py +389 -0
  183. memini-0.1.0rc1/src/memini/intake/__init__.py +91 -0
  184. memini-0.1.0rc1/src/memini/intake/plan.py +403 -0
  185. memini-0.1.0rc1/src/memini/intake/state.py +113 -0
  186. memini-0.1.0rc1/src/memini/jobs/__init__.py +62 -0
  187. memini-0.1.0rc1/src/memini/jobs/extraction.py +59 -0
  188. memini-0.1.0rc1/src/memini/jobs/queue.py +313 -0
  189. memini-0.1.0rc1/src/memini/jobs/scheduler.py +255 -0
  190. memini-0.1.0rc1/src/memini/jobs/worker.py +333 -0
  191. memini-0.1.0rc1/src/memini/knowledge/__init__.py +118 -0
  192. memini-0.1.0rc1/src/memini/knowledge/journal.py +451 -0
  193. memini-0.1.0rc1/src/memini/knowledge/model.py +439 -0
  194. memini-0.1.0rc1/src/memini/knowledge/reader.py +335 -0
  195. memini-0.1.0rc1/src/memini/llm/__init__.py +75 -0
  196. memini-0.1.0rc1/src/memini/llm/_endpoint.py +484 -0
  197. memini-0.1.0rc1/src/memini/llm/gate.py +371 -0
  198. memini-0.1.0rc1/src/memini/llm/model.py +170 -0
  199. memini-0.1.0rc1/src/memini/llm/workspace.py +74 -0
  200. memini-0.1.0rc1/src/memini/logs.py +420 -0
  201. memini-0.1.0rc1/src/memini/mcp/__init__.py +36 -0
  202. memini-0.1.0rc1/src/memini/mcp/comms.py +427 -0
  203. memini-0.1.0rc1/src/memini/mcp/decisions.py +284 -0
  204. memini-0.1.0rc1/src/memini/mcp/endpoint.py +69 -0
  205. memini-0.1.0rc1/src/memini/mcp/query.py +299 -0
  206. memini-0.1.0rc1/src/memini/mcp/server.py +178 -0
  207. memini-0.1.0rc1/src/memini/mcp/status.py +134 -0
  208. memini-0.1.0rc1/src/memini/mcp/text.py +62 -0
  209. memini-0.1.0rc1/src/memini/mcp/tools.py +122 -0
  210. memini-0.1.0rc1/src/memini/metrics.py +420 -0
  211. memini-0.1.0rc1/src/memini/payloads.py +768 -0
  212. memini-0.1.0rc1/src/memini/persons/__init__.py +146 -0
  213. memini-0.1.0rc1/src/memini/persons/directory.py +544 -0
  214. memini-0.1.0rc1/src/memini/persons/identities.py +302 -0
  215. memini-0.1.0rc1/src/memini/persons/lookup.py +174 -0
  216. memini-0.1.0rc1/src/memini/persons/model.py +197 -0
  217. memini-0.1.0rc1/src/memini/persons/resolve.py +370 -0
  218. memini-0.1.0rc1/src/memini/provenance.py +34 -0
  219. memini-0.1.0rc1/src/memini/prune.py +350 -0
  220. memini-0.1.0rc1/src/memini/py.typed +0 -0
  221. memini-0.1.0rc1/src/memini/query/__init__.py +81 -0
  222. memini-0.1.0rc1/src/memini/query/model.py +415 -0
  223. memini-0.1.0rc1/src/memini/query/reader.py +625 -0
  224. memini-0.1.0rc1/src/memini/query/service.py +369 -0
  225. memini-0.1.0rc1/src/memini/recipes/__init__.py +187 -0
  226. memini-0.1.0rc1/src/memini/recipes/bundled/__init__.py +9 -0
  227. memini-0.1.0rc1/src/memini/recipes/calls.py +195 -0
  228. memini-0.1.0rc1/src/memini/recipes/model.py +402 -0
  229. memini-0.1.0rc1/src/memini/recipes/parsing.py +324 -0
  230. memini-0.1.0rc1/src/memini/recipes/reading.py +908 -0
  231. memini-0.1.0rc1/src/memini/recipes/schema.py +23 -0
  232. memini-0.1.0rc1/src/memini/recipes/selectors.py +214 -0
  233. memini-0.1.0rc1/src/memini/recipes/templates.py +210 -0
  234. memini-0.1.0rc1/src/memini/recipes/times.py +331 -0
  235. memini-0.1.0rc1/src/memini/recipes/validate.py +655 -0
  236. memini-0.1.0rc1/src/memini/redaction/__init__.py +109 -0
  237. memini-0.1.0rc1/src/memini/redaction/detectors.py +398 -0
  238. memini-0.1.0rc1/src/memini/redaction/redact.py +176 -0
  239. memini-0.1.0rc1/src/memini/removal/__init__.py +74 -0
  240. memini-0.1.0rc1/src/memini/removal/core.py +102 -0
  241. memini-0.1.0rc1/src/memini/removal/forget.py +207 -0
  242. memini-0.1.0rc1/src/memini/removal/retention.py +183 -0
  243. memini-0.1.0rc1/src/memini/rerank/__init__.py +29 -0
  244. memini-0.1.0rc1/src/memini/rerank/factory.py +51 -0
  245. memini-0.1.0rc1/src/memini/rerank/local.py +358 -0
  246. memini-0.1.0rc1/src/memini/responses/__init__.py +139 -0
  247. memini-0.1.0rc1/src/memini/responses/replay.py +643 -0
  248. memini-0.1.0rc1/src/memini/responses/store.py +760 -0
  249. memini-0.1.0rc1/src/memini/runs.py +800 -0
  250. memini-0.1.0rc1/src/memini/search/__init__.py +71 -0
  251. memini-0.1.0rc1/src/memini/search/engine.py +371 -0
  252. memini-0.1.0rc1/src/memini/search/errors.py +32 -0
  253. memini-0.1.0rc1/src/memini/search/fusion.py +66 -0
  254. memini-0.1.0rc1/src/memini/search/model.py +419 -0
  255. memini-0.1.0rc1/src/memini/search/patterns.py +145 -0
  256. memini-0.1.0rc1/src/memini/search/retrieval.py +558 -0
  257. memini-0.1.0rc1/src/memini/sources.py +1340 -0
  258. memini-0.1.0rc1/src/memini/status.py +722 -0
  259. memini-0.1.0rc1/src/memini/token_admin.py +189 -0
  260. memini-0.1.0rc1/src/memini/workspaces.py +219 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,71 @@
1
+ Metadata-Version: 2.4
2
+ Name: memini
3
+ Version: 0.1.0rc1
4
+ Summary: Self-hosted knowledge service: code, messages and meeting notes in; MCP and HTTP out.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Classifier: Development Status :: 1 - Planning
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Classifier: Typing :: Typed
12
+ Requires-Dist: cryptography>=50.0.2
13
+ Requires-Dist: fastapi>=0.164.0
14
+ Requires-Dist: httpx2>=2.16.2
15
+ Requires-Dist: mcp>=2.3.0
16
+ Requires-Dist: pgvector>=0.5.1
17
+ Requires-Dist: psycopg[binary,pool]>=3.3.9
18
+ Requires-Dist: pydantic>=2.14.3
19
+ Requires-Dist: tree-sitter>=0.26.1
20
+ Requires-Dist: tree-sitter-go>=0.25.0
21
+ Requires-Dist: tree-sitter-javascript>=0.25.0
22
+ Requires-Dist: tree-sitter-python>=0.25.0
23
+ Requires-Dist: tree-sitter-ruby>=0.23.1
24
+ Requires-Dist: tree-sitter-typescript>=0.23.2
25
+ Requires-Dist: uvicorn>=0.54.0
26
+ Requires-Dist: numpy>=2.5.5 ; extra == 'local-embeddings'
27
+ Requires-Dist: onnxruntime>=1.32.0 ; extra == 'local-embeddings'
28
+ Requires-Dist: tokenizers>=0.23.3 ; extra == 'local-embeddings'
29
+ Requires-Python: >=3.12
30
+ Project-URL: Repository, https://github.com/npavlov/memini
31
+ Provides-Extra: local-embeddings
32
+ Description-Content-Type: text/markdown
33
+
34
+ # Memini
35
+
36
+ [![CI](https://github.com/npavlov/memini/actions/workflows/ci.yml/badge.svg)](https://github.com/npavlov/memini/actions/workflows/ci.yml)
37
+ [![Security](https://github.com/npavlov/memini/actions/workflows/security.yml/badge.svg)](https://github.com/npavlov/memini/actions/workflows/security.yml)
38
+ [![Latest GitHub release including prereleases](https://img.shields.io/github/v/release/npavlov/memini?include_prereleases&sort=date&label=release)](https://github.com/npavlov/memini/releases)
39
+
40
+ Memini is a self-hosted search and decision journal for code repositories, work conversations and meeting notes. Search results link to the source file, message or transcript that supports them.
41
+
42
+ ## Install
43
+
44
+ Start with **4 CPU cores, 8 GB RAM and 20 GB of free SSD** on x86-64 or arm64. You need Docker with Compose 2.24 or later. Ollama runs the embedding model locally. A GPU is optional and speeds up the first index.
45
+
46
+ - **Build from source** with Git, Docker and Ollama. Follow the [installation guide](docs/install.md#what-you-need) through step 5 to start the service and save the first admin token.
47
+ - **Use a published image** when a matching release tag and GHCR image are available. This [Docker-only installation](docs/install.md#install-a-published-image-with-docker-only) runs Ollama inside Compose too.
48
+ - **Connect to an existing server** with just the CLI. After the RC is published to PyPI, use Python 3.12+ and `pipx install memini==0.1.0rc1`. Set `MEMINI_URL` to the server address and `MEMINI_TOKEN_FILE` to the token file supplied by its operator. Check access with `memini workspace list`.
49
+
50
+ From the checkout, `docker compose ps` should show healthy services, and `bin/memini workspace list` should list the workspaces your token can read. For a failed health check or an unreachable model, see [installation troubleshooting](docs/install.md#troubleshooting).
51
+
52
+ ## First steps
53
+
54
+ Create a workspace, import one example email conversation and find who proposed changing archive retention. The [first search walkthrough](docs/first-search.md) includes the sample data, commands and expected results. To start with code, [index one file from a Git repository](docs/install.md#6-a-workspace-and-a-repository) and search for its bootstrap function.
55
+
56
+ ## Intake
57
+
58
+ | What you have | How to bring it in |
59
+ |---|---|
60
+ | A Git repository | [Register the repository and schedule a sync](docs/install.md#6-a-workspace-and-a-repository). Memini tracks the selected ref. |
61
+ | Mail, chat, notes or wiki exports | [Push records from a file or the HTTP API](docs/intake.md#without-an-agent). Use one source per mailbox to keep accounts separate. |
62
+ | A mailbox or chat available inside an agent session | [Give the agent a bounded import](docs/intake.md#with-an-agent). It can push complete threads or capture a recipe's MCP responses. |
63
+ | An MCP server reachable from the service | [Set up a scheduled MCP source](docs/intake.md#scheduled-mcp-intake). |
64
+
65
+ ## Use Memini
66
+
67
+ - Locate an implementation by symbol and open its file at the indexed commit. [Code search](docs/mcp/search_code.md) · [Read source](docs/mcp/read_source.md)
68
+ - Find who agreed to a change, read the evidence, and follow later decisions that replaced it. [Decision history](docs/mcp/get_decision.md)
69
+ - Find messages addressed to a person or meetings they attended. [Messages](docs/mcp/list_messages.md) · [Meetings](docs/mcp/list_meetings.md)
70
+
71
+ Browse the **[online user knowledge base](https://npavlov.github.io/memini/)** or its [version in this checkout](docs/index.md) for setup, Intake, CLI and MCP tools, security, backup, upgrades and troubleshooting. For development and project history, see [Contributing](CONTRIBUTING.md), the [changelog](CHANGELOG.md) and the [Apache-2.0 license](LICENSE). [Report a vulnerability privately](SECURITY.md).
@@ -0,0 +1,38 @@
1
+ # Memini
2
+
3
+ [![CI](https://github.com/npavlov/memini/actions/workflows/ci.yml/badge.svg)](https://github.com/npavlov/memini/actions/workflows/ci.yml)
4
+ [![Security](https://github.com/npavlov/memini/actions/workflows/security.yml/badge.svg)](https://github.com/npavlov/memini/actions/workflows/security.yml)
5
+ [![Latest GitHub release including prereleases](https://img.shields.io/github/v/release/npavlov/memini?include_prereleases&sort=date&label=release)](https://github.com/npavlov/memini/releases)
6
+
7
+ Memini is a self-hosted search and decision journal for code repositories, work conversations and meeting notes. Search results link to the source file, message or transcript that supports them.
8
+
9
+ ## Install
10
+
11
+ Start with **4 CPU cores, 8 GB RAM and 20 GB of free SSD** on x86-64 or arm64. You need Docker with Compose 2.24 or later. Ollama runs the embedding model locally. A GPU is optional and speeds up the first index.
12
+
13
+ - **Build from source** with Git, Docker and Ollama. Follow the [installation guide](docs/install.md#what-you-need) through step 5 to start the service and save the first admin token.
14
+ - **Use a published image** when a matching release tag and GHCR image are available. This [Docker-only installation](docs/install.md#install-a-published-image-with-docker-only) runs Ollama inside Compose too.
15
+ - **Connect to an existing server** with just the CLI. After the RC is published to PyPI, use Python 3.12+ and `pipx install memini==0.1.0rc1`. Set `MEMINI_URL` to the server address and `MEMINI_TOKEN_FILE` to the token file supplied by its operator. Check access with `memini workspace list`.
16
+
17
+ From the checkout, `docker compose ps` should show healthy services, and `bin/memini workspace list` should list the workspaces your token can read. For a failed health check or an unreachable model, see [installation troubleshooting](docs/install.md#troubleshooting).
18
+
19
+ ## First steps
20
+
21
+ Create a workspace, import one example email conversation and find who proposed changing archive retention. The [first search walkthrough](docs/first-search.md) includes the sample data, commands and expected results. To start with code, [index one file from a Git repository](docs/install.md#6-a-workspace-and-a-repository) and search for its bootstrap function.
22
+
23
+ ## Intake
24
+
25
+ | What you have | How to bring it in |
26
+ |---|---|
27
+ | A Git repository | [Register the repository and schedule a sync](docs/install.md#6-a-workspace-and-a-repository). Memini tracks the selected ref. |
28
+ | Mail, chat, notes or wiki exports | [Push records from a file or the HTTP API](docs/intake.md#without-an-agent). Use one source per mailbox to keep accounts separate. |
29
+ | A mailbox or chat available inside an agent session | [Give the agent a bounded import](docs/intake.md#with-an-agent). It can push complete threads or capture a recipe's MCP responses. |
30
+ | An MCP server reachable from the service | [Set up a scheduled MCP source](docs/intake.md#scheduled-mcp-intake). |
31
+
32
+ ## Use Memini
33
+
34
+ - Locate an implementation by symbol and open its file at the indexed commit. [Code search](docs/mcp/search_code.md) · [Read source](docs/mcp/read_source.md)
35
+ - Find who agreed to a change, read the evidence, and follow later decisions that replaced it. [Decision history](docs/mcp/get_decision.md)
36
+ - Find messages addressed to a person or meetings they attended. [Messages](docs/mcp/list_messages.md) · [Meetings](docs/mcp/list_meetings.md)
37
+
38
+ Browse the **[online user knowledge base](https://npavlov.github.io/memini/)** or its [version in this checkout](docs/index.md) for setup, Intake, CLI and MCP tools, security, backup, upgrades and troubleshooting. For development and project history, see [Contributing](CONTRIBUTING.md), the [changelog](CHANGELOG.md) and the [Apache-2.0 license](LICENSE). [Report a vulnerability privately](SECURITY.md).
@@ -0,0 +1,112 @@
1
+ [project]
2
+ name = "memini"
3
+ version = "0.1.0rc1"
4
+ description = "Self-hosted knowledge service: code, messages and meeting notes in; MCP and HTTP out."
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ license = "Apache-2.0"
8
+ license-files = ["LICENSE"]
9
+ classifiers = [
10
+ "Development Status :: 1 - Planning",
11
+ "Programming Language :: Python :: 3",
12
+ "Programming Language :: Python :: 3.12",
13
+ "Programming Language :: Python :: 3.13",
14
+ "Typing :: Typed",
15
+ ]
16
+ dependencies = [
17
+ "cryptography>=50.0.2",
18
+ "fastapi>=0.164.0",
19
+ "httpx2>=2.16.2",
20
+ "mcp>=2.3.0",
21
+ "pgvector>=0.5.1",
22
+ "psycopg[binary,pool]>=3.3.9",
23
+ "pydantic>=2.14.3",
24
+ "tree-sitter>=0.26.1",
25
+ "tree-sitter-go>=0.25.0",
26
+ "tree-sitter-javascript>=0.25.0",
27
+ "tree-sitter-python>=0.25.0",
28
+ "tree-sitter-ruby>=0.23.1",
29
+ "tree-sitter-typescript>=0.23.2",
30
+ "uvicorn>=0.54.0",
31
+ ]
32
+
33
+ [project.scripts]
34
+ memini = "memini.cli:main"
35
+
36
+ [project.urls]
37
+ Repository = "https://github.com/npavlov/memini"
38
+
39
+ [project.optional-dependencies]
40
+ local-embeddings = [
41
+ "numpy>=2.5.5",
42
+ "onnxruntime>=1.32.0",
43
+ "tokenizers>=0.23.3",
44
+ ]
45
+
46
+ [build-system]
47
+ requires = ["uv_build>=0.10.0,<0.14"]
48
+ build-backend = "uv_build"
49
+
50
+ [dependency-groups]
51
+ dev = [
52
+ "anyio>=4.16.0",
53
+ "httpx2>=2.16.2",
54
+ "pyright[nodejs]>=1.1.414",
55
+ "pytest>=9.2.0",
56
+ "ruff>=0.17.5",
57
+ ]
58
+
59
+ [tool.ruff]
60
+ line-length = 100
61
+ target-version = "py312"
62
+ src = [
63
+ "src",
64
+ "tests",
65
+ ]
66
+ extend-exclude = [
67
+ "tests/fixtures",
68
+ "eval",
69
+ ]
70
+
71
+ [tool.ruff.lint]
72
+ select = [
73
+ "E",
74
+ "W",
75
+ "F",
76
+ "I",
77
+ "B",
78
+ "UP",
79
+ "SIM",
80
+ "S",
81
+ "PT",
82
+ "RUF",
83
+ ]
84
+
85
+ [tool.ruff.lint.per-file-ignores]
86
+ "tests/**" = ["S101"]
87
+
88
+ [tool.pyright]
89
+ include = [
90
+ "src",
91
+ "tests",
92
+ "scripts",
93
+ "integrations",
94
+ ]
95
+ exclude = ["tests/fixtures"]
96
+ pythonVersion = "3.12"
97
+ typeCheckingMode = "strict"
98
+ venvPath = "."
99
+ venv = ".venv"
100
+
101
+ [tool.pytest.ini_options]
102
+ testpaths = ["tests"]
103
+ addopts = [
104
+ "-ra",
105
+ "--strict-markers",
106
+ "--strict-config",
107
+ ]
108
+ xfail_strict = true
109
+ markers = [
110
+ "integration: needs Postgres with pgvector (make db, or MEMINI_TEST_DATABASE_URL); make test-integration",
111
+ "git: runs the git executable (skipped where it is not installed); part of make test",
112
+ ]
@@ -0,0 +1,99 @@
1
+ [project]
2
+ name = "memini"
3
+ version = "0.1.0rc1"
4
+ description = "Self-hosted knowledge service: code, messages and meeting notes in; MCP and HTTP out."
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ license = "Apache-2.0"
8
+ license-files = ["LICENSE"]
9
+ classifiers = [
10
+ "Development Status :: 1 - Planning",
11
+ "Programming Language :: Python :: 3",
12
+ "Programming Language :: Python :: 3.12",
13
+ "Programming Language :: Python :: 3.13",
14
+ "Typing :: Typed",
15
+ ]
16
+ dependencies = [
17
+ "cryptography>=50.0.2",
18
+ "fastapi>=0.164.0",
19
+ "httpx2>=2.16.2",
20
+ "mcp>=2.3.0",
21
+ "pgvector>=0.5.1",
22
+ "psycopg[binary,pool]>=3.3.9",
23
+ "pydantic>=2.14.3",
24
+ "tree-sitter>=0.26.1",
25
+ "tree-sitter-go>=0.25.0",
26
+ "tree-sitter-javascript>=0.25.0",
27
+ "tree-sitter-python>=0.25.0",
28
+ "tree-sitter-ruby>=0.23.1",
29
+ "tree-sitter-typescript>=0.23.2",
30
+ "uvicorn>=0.54.0",
31
+ ]
32
+
33
+ [project.scripts]
34
+ memini = "memini.cli:main"
35
+
36
+ [project.urls]
37
+ Repository = "https://github.com/npavlov/memini"
38
+
39
+ [project.optional-dependencies]
40
+ local-embeddings = [
41
+ "numpy>=2.5.5",
42
+ "onnxruntime>=1.32.0",
43
+ "tokenizers>=0.23.3",
44
+ ]
45
+
46
+ [build-system]
47
+ # The range must contain the uv that builds: CI and the image pin 0.13.9, a local uv may be older.
48
+ # The upper bound is the next minor release, as uv's docs advise: uv_build may break in one.
49
+ requires = ["uv_build>=0.10.0,<0.14"]
50
+ build-backend = "uv_build"
51
+
52
+ [dependency-groups]
53
+ dev = [
54
+ "anyio>=4.16.0",
55
+ "httpx2>=2.16.2",
56
+ "pyright[nodejs]>=1.1.414",
57
+ "pytest>=9.2.0",
58
+ "ruff>=0.17.5",
59
+ ]
60
+
61
+ [tool.ruff]
62
+ line-length = 100
63
+ target-version = "py312"
64
+ src = ["src", "tests"]
65
+ extend-exclude = ["tests/fixtures", "eval"] # inputs for parsers and the eval, not code of this project
66
+
67
+ [tool.ruff.lint]
68
+ select = [
69
+ "E", # pycodestyle errors
70
+ "W", # pycodestyle warnings
71
+ "F", # pyflakes
72
+ "I", # isort
73
+ "B", # bugbear
74
+ "UP", # pyupgrade
75
+ "SIM", # simplify
76
+ "S", # bandit
77
+ "PT", # pytest style
78
+ "RUF", # ruff-specific
79
+ ]
80
+
81
+ [tool.ruff.lint.per-file-ignores]
82
+ "tests/**" = ["S101"] # assert is how pytest checks
83
+
84
+ [tool.pyright]
85
+ include = ["src", "tests", "scripts", "integrations"]
86
+ exclude = ["tests/fixtures"]
87
+ pythonVersion = "3.12"
88
+ typeCheckingMode = "strict"
89
+ venvPath = "."
90
+ venv = ".venv"
91
+
92
+ [tool.pytest.ini_options]
93
+ testpaths = ["tests"]
94
+ addopts = ["-ra", "--strict-markers", "--strict-config"]
95
+ xfail_strict = true
96
+ markers = [
97
+ "integration: needs Postgres with pgvector (make db, or MEMINI_TEST_DATABASE_URL); make test-integration",
98
+ "git: runs the git executable (skipped where it is not installed); part of make test",
99
+ ]
@@ -0,0 +1,5 @@
1
+ """Memini: a self-hosted knowledge service for code, messages and meeting notes."""
2
+
3
+ from importlib.metadata import version
4
+
5
+ __version__: str = version("memini")
@@ -0,0 +1,6 @@
1
+ """``python -m memini``: the same as the ``memini`` command."""
2
+
3
+ from memini.cli import main
4
+
5
+ if __name__ == "__main__":
6
+ raise SystemExit(main())
@@ -0,0 +1,19 @@
1
+ """The HTTP API: a FastAPI application built by :func:`create_app`."""
2
+
3
+ from memini.api.app import OPENAPI_URL, V1_PREFIX, create_app
4
+ from memini.api.errors import ApiError, ErrorResponse
5
+ from memini.api.health import DEFAULT_READINESS_TIMEOUT, ReadinessCheck
6
+ from memini.api.request_id import REQUEST_ID_HEADER, current_request_id, request_id_var
7
+
8
+ __all__ = [
9
+ "DEFAULT_READINESS_TIMEOUT",
10
+ "OPENAPI_URL",
11
+ "REQUEST_ID_HEADER",
12
+ "V1_PREFIX",
13
+ "ApiError",
14
+ "ErrorResponse",
15
+ "ReadinessCheck",
16
+ "create_app",
17
+ "current_request_id",
18
+ "request_id_var",
19
+ ]
@@ -0,0 +1,68 @@
1
+ """From the errors of the administration library to the API's error shape.
2
+
3
+ Wrap a call into :mod:`memini.workspaces`, :mod:`memini.sources`, :mod:`memini.token_admin` or
4
+ the run reads of :mod:`memini.runs` in :func:`admin_errors`. What each error becomes:
5
+
6
+ - :class:`~memini.workspaces.NotFoundError`: 404 ``not_found``. A workspace, source, stream, run or
7
+ token the token may not see is reported like one that does not exist.
8
+ - :class:`~memini.auth.WorkspaceLimitError`: 403 ``workspace_limited``: the token is limited to
9
+ one workspace and the write would reach beyond it.
10
+ - :class:`~memini.workspaces.WorkspaceExistsError`, :class:`~memini.sources.SourceExistsError`:
11
+ 409 ``conflict``.
12
+ - :class:`~memini.sources.SourceBusyError`: 409 ``source_busy``: a job of the source runs; try
13
+ again when it is done.
14
+ - :class:`~memini.sources.NotSyncableError`: 409 ``not_syncable``.
15
+ - :class:`~memini.sources.InvalidSourceError`: 422 ``invalid_source``. Its message names the
16
+ setting and the reason and never the value, so it is passed on: a location can hold a
17
+ credential, and it is not repeated.
18
+ """
19
+
20
+ from collections.abc import Generator
21
+ from contextlib import contextmanager
22
+
23
+ from memini.api.errors import ApiError
24
+ from memini.auth import WorkspaceLimitError
25
+ from memini.sources import (
26
+ InvalidSourceError,
27
+ NotSyncableError,
28
+ SourceBusyError,
29
+ SourceExistsError,
30
+ )
31
+ from memini.workspaces import NotFoundError, WorkspaceExistsError
32
+
33
+ __all__ = ["admin_errors"]
34
+
35
+
36
+ @contextmanager
37
+ def admin_errors() -> Generator[None]:
38
+ """Raise the :class:`ApiError` for an error of the administration library; see the module."""
39
+ try:
40
+ yield
41
+ except NotFoundError as error:
42
+ raise ApiError(404, "not_found", f"No such {error.what}.") from None
43
+ except WorkspaceLimitError:
44
+ raise ApiError(
45
+ 403,
46
+ "workspace_limited",
47
+ "The token is limited to one workspace; this needs a token that is not.",
48
+ ) from None
49
+ except WorkspaceExistsError:
50
+ raise ApiError(409, "conflict", "A workspace of that name exists.") from None
51
+ except SourceExistsError:
52
+ raise ApiError(409, "conflict", "The workspace has a source of that name.") from None
53
+ except SourceBusyError:
54
+ raise ApiError(
55
+ 409,
56
+ "source_busy",
57
+ "A job of the source is running; try again when it is done.",
58
+ ) from None
59
+ except NotSyncableError:
60
+ raise ApiError(
61
+ 409, "not_syncable", "Sources of this kind are not synced by the service."
62
+ ) from None
63
+ except InvalidSourceError as error:
64
+ raise ApiError(
65
+ 422,
66
+ "invalid_source",
67
+ f"The source setting {error.setting} is not valid: {error.reason}.",
68
+ ) from None