hindsight-api-slim 1.2.0__tar.gz → 1.2.2__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 (402) hide show
  1. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/PKG-INFO +17 -13
  2. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/__init__.py +1 -1
  3. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/admin/cli.py +176 -3
  4. hindsight_api_slim-1.2.2/hindsight_api/admin/reembed.py +506 -0
  5. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/_owned.py +1 -1
  6. hindsight_api_slim-1.2.2/hindsight_api/alembic/versions/05867433a58c_add_banks_with_attachments_in_window_routine.py +134 -0
  7. hindsight_api_slim-1.2.2/hindsight_api/alembic/versions/300fe58170e9_knowledge_keywords_without_language.py +53 -0
  8. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c8d1e4f7a20b_add_bank_aliases.py +1 -1
  9. hindsight_api_slim-1.2.2/hindsight_api/alembic/versions/d3e8a1f5c7b2_add_graph_maintenance_queue_claimed_at.py +61 -0
  10. hindsight_api_slim-1.2.2/hindsight_api/alembic/versions/d3f8a1c6e9b2_oracle_index_composite_foreign_keys.py +77 -0
  11. hindsight_api_slim-1.2.2/hindsight_api/alembic/versions/k7b1c2d3e4f5_add_knowledge_banks.py +167 -0
  12. hindsight_api_slim-1.2.2/hindsight_api/alembic/versions/kbtok1a2b3c4_add_content_tokens_to_kb_documents.py +50 -0
  13. hindsight_api_slim-1.2.2/hindsight_api/api/content_disposition.py +19 -0
  14. hindsight_api_slim-1.2.2/hindsight_api/api/gzip_offload.py +62 -0
  15. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/api/http.py +479 -145
  16. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/api/mcp.py +9 -9
  17. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/api/unknown_params.py +1 -1
  18. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/config.py +649 -147
  19. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/config_resolver.py +18 -4
  20. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/aiohttp_session.py +12 -1
  21. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/audit.py +1 -1
  22. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/bank_aliases.py +12 -7
  23. hindsight_api_slim-1.2.2/hindsight_api/engine/bank_life.py +89 -0
  24. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/bank_stats_cache.py +28 -19
  25. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/bank_templates.py +45 -15
  26. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/consolidation/consolidator.py +139 -20
  27. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/consolidation/prompts.py +2 -2
  28. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/cross_encoder.py +146 -71
  29. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/db/base.py +50 -1
  30. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/db/ops.py +32 -9
  31. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/db/ops_oracle.py +68 -48
  32. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/db/ops_postgresql.py +93 -38
  33. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/db/oracle.py +25 -2
  34. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/db/postgresql.py +72 -4
  35. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/decision_model.py +114 -21
  36. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/decision_rerank_interface.py +139 -13
  37. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/document_history.py +1 -1
  38. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/embeddings.py +146 -4
  39. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/graph_maintenance.py +5 -4
  40. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/interface.py +0 -21
  41. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/llm_interface.py +44 -36
  42. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/llm_wrapper.py +184 -48
  43. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/local_device.py +29 -16
  44. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/maintenance.py +97 -8
  45. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/__init__.py +14 -6
  46. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/base.py +196 -41
  47. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/counts.py +110 -17
  48. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/curation.py +70 -15
  49. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/documents.py +50 -99
  50. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/engine_curation.py +3 -2
  51. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/entity_resolver.py +21 -1
  52. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/graph.py +45 -16
  53. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/links.py +2 -14
  54. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/reads.py +76 -33
  55. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/recall.py +1 -1
  56. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/retain.py +25 -20
  57. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/writes.py +28 -17
  58. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/postgres.py +17 -4
  59. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memory_engine.py +1616 -915
  60. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/mental_model_refresh.py +11 -1
  61. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/multi_llm.py +34 -5
  62. hindsight_api_slim-1.2.2/hindsight_api/engine/observation_tree.py +618 -0
  63. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/operation_metadata.py +31 -0
  64. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/page_markdown.py +6 -6
  65. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/parsers/iris.py +4 -2
  66. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/parsers/llama_parse.py +4 -2
  67. hindsight_api_slim-1.2.2/hindsight_api/engine/permit_wait.py +77 -0
  68. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/prompt_utils.py +3 -2
  69. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/anthropic_llm.py +65 -100
  70. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/claude_code_llm.py +11 -2
  71. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/codex_llm.py +46 -19
  72. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/cursor_llm.py +10 -1
  73. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/fireworks_llm.py +30 -59
  74. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/gemini_cache.py +34 -7
  75. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/gemini_llm.py +61 -77
  76. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/litellm_llm.py +39 -2
  77. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/openai_compatible_llm.py +169 -108
  78. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/openai_responses_llm.py +40 -5
  79. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/tools_via_schema.py +156 -6
  80. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/xai_oauth_llm.py +10 -1
  81. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/query_analyzer.py +11 -4
  82. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/reflect/agent.py +185 -39
  83. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/reflect/delta_ops.py +13 -36
  84. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/reflect/models.py +12 -0
  85. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/reflect/prompts.py +13 -4
  86. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/reflect/structured_doc.py +43 -1
  87. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/reflect/tools.py +97 -13
  88. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/remote_retry.py +30 -4
  89. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/response_models.py +133 -4
  90. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/attachment_store.py +131 -1
  91. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/bank_utils.py +21 -122
  92. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/embedding_processing.py +10 -1
  93. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/embedding_utils.py +83 -1
  94. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/entity_labels.py +20 -0
  95. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/fact_extraction.py +103 -45
  96. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/fact_storage.py +6 -3
  97. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/orchestrator.py +588 -268
  98. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/timing.py +18 -6
  99. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/bm25_term_selection.py +1 -1
  100. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/decision_reranker.py +20 -7
  101. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/reranking.py +41 -8
  102. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/tracer.py +19 -21
  103. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/source_facts.py +14 -3
  104. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/sql/postgresql.py +20 -15
  105. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/storage/base.py +12 -0
  106. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/storage/postgresql.py +20 -0
  107. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/temporal_language_detection.py +30 -16
  108. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/token_encoding.py +6 -1
  109. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/transfer/__init__.py +0 -6
  110. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/transfer/export.py +31 -315
  111. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/transfer/importer.py +94 -58
  112. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/transfer/schema.py +7 -7
  113. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/__init__.py +31 -0
  114. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/loader.py +7 -3
  115. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/mcp.py +3 -1
  116. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/operation_validator.py +337 -6
  117. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/validator_instrumentation.py +3 -2
  118. hindsight_api_slim-1.2.2/hindsight_api/knowledge/bank_config.py +142 -0
  119. hindsight_api_slim-1.2.2/hindsight_api/knowledge/embedders.py +840 -0
  120. hindsight_api_slim-1.2.2/hindsight_api/knowledge/ingest_strategy.py +168 -0
  121. hindsight_api_slim-1.2.2/hindsight_api/knowledge/media.py +641 -0
  122. hindsight_api_slim-1.2.2/hindsight_api/knowledge/routes.py +964 -0
  123. hindsight_api_slim-1.2.2/hindsight_api/knowledge/service.py +2500 -0
  124. hindsight_api_slim-1.2.2/hindsight_api/knowledge/store.py +1402 -0
  125. hindsight_api_slim-1.2.2/hindsight_api/knowledge/text_passages.py +253 -0
  126. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/main.py +8 -1
  127. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/mcp_local.py +1 -1
  128. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/mcp_tools.py +269 -234
  129. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/metrics.py +30 -1
  130. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/migrations.py +25 -19
  131. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/models.py +7 -0
  132. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/provider_auth.py +11 -0
  133. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/tracing.py +1 -1
  134. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/utils.py +26 -0
  135. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/webhooks/models.py +21 -2
  136. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/worker/backpressure.py +36 -1
  137. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/worker/main.py +3 -1
  138. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/worker/poller.py +125 -23
  139. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/pyproject.toml +21 -13
  140. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/.gitignore +0 -0
  141. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/LICENSE +0 -0
  142. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/README.md +0 -0
  143. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/_cross_loop.py +0 -0
  144. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/_pg_extensions.py +0 -0
  145. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/_pg_search.py +0 -0
  146. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/_text_search.py +0 -0
  147. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/_thread_limits.py +0 -0
  148. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/_vector_index.py +0 -0
  149. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/admin/__init__.py +0 -0
  150. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/README +0 -0
  151. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/_dialect.py +0 -0
  152. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/_new_schema_indexes.py +0 -0
  153. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/env.py +0 -0
  154. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/script.py.mako +0 -0
  155. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/2071c7518f88_add_memory_links_bank_id_index.py +0 -0
  156. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/2eee35aa3cfc_case_insensitive_entities_trgm_index.py +0 -0
  157. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py +0 -0
  158. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/7c2e5a9d1f40_entities_bank_scoped_trgm_index.py +0 -0
  159. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/86f7a033d372_repair_mental_models_subtype_at_head.py +0 -0
  160. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/8c6fa6f7230b_merge_v053_divergent_heads.py +0 -0
  161. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/9f8e7d6c5b4a_memory_links_deferrable_fk.py +0 -0
  162. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/a1b2c3d4e5f6_add_file_storage_table.py +0 -0
  163. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/a1c9e7f3b2d8_observation_history_drop_memory_units_fk.py +0 -0
  164. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/a1d3f5b7c9e2_widen_remaining_bank_id_to_text.py +0 -0
  165. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/a2b3c4d5e6f7_add_text_signals_column.py +0 -0
  166. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/a2b3c4d5e6f8_add_gin_index_source_memory_ids.py +0 -0
  167. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/a2v3w4x5y6z7_add_last_refreshed_source_query.py +0 -0
  168. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/a3b4c5d6e7f8_add_consolidation_failed_at_to_memory_units.py +0 -0
  169. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/a4b5c6d7e8f9_fix_per_bank_vector_index_type.py +0 -0
  170. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/a6c4e8f1b203_add_reasoning_tokens_to_llm_requests.py +0 -0
  171. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/a7b8c9d0e1f2_split_history_into_own_tables.py +0 -0
  172. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py +0 -0
  173. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/a8c1e4f7b0d3_add_operation_retention_indexes.py +0 -0
  174. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/a9b8c7d6e5f4_add_knowledge_pages.py +0 -0
  175. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/aa2b3c4d5e6f_nullable_event_date.py +0 -0
  176. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/b2429c65cc20_banks_needing_consolidation_hybrid_probe.py +0 -0
  177. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/b2d4f6a8c1e3_repair_maintenance_routines_public.py +0 -0
  178. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/b3c4d5e6f7a8_add_content_hash_to_chunks.py +0 -0
  179. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/b3c4d5e6f7g8_add_temporal_date_indexes.py +0 -0
  180. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/b3e8d1c6f4a9_entity_kind_partial_trgm_index.py +0 -0
  181. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/b3w4x5y6z7a8_add_structured_content_to_mental_models.py +0 -0
  182. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/b4c5d6e7f8a9_backfill_observation_scopes.py +0 -0
  183. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/b57a7c9e0d13_add_bank_stats_cache.py +0 -0
  184. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/b5a4c3e2f1d8_add_graph_maintenance_queue.py +0 -0
  185. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/b5d4e3f2a1c9_backfill_entity_cooccurrences_event_time.py +0 -0
  186. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/b6d2f8a4c1e7_maintenance_routines_schema_local.py +0 -0
  187. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/b7c4d8e9f1a2_add_chunks_table.py +0 -0
  188. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/b8c9d0e1f2a3_vchord_cosine_opclass.py +0 -0
  189. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/b8d3f1a6c2e4_add_mental_models_last_refresh_failed_at.py +0 -0
  190. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c1a2b3d4e5f6_enable_pg_trgm_and_entities_trgm_index.py +0 -0
  191. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c1d2e3f4a5b6_merge_graph_queue_and_vchord_heads.py +0 -0
  192. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c2d3e4f5g6h7_add_audit_log_table.py +0 -0
  193. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c3d4e5f6g7h8_add_history_to_mental_models.py +0 -0
  194. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c3e5a7b9d1f4_widen_history_bank_id_to_text.py +0 -0
  195. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c3f7a1b9d2e4_backfill_observation_search_vector.py +0 -0
  196. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c4e8a1b7d2f6_memory_units_bank_updated_at_index.py +0 -0
  197. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c4f7a91b2d38_add_entity_maintenance_queue.py +0 -0
  198. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c4x5y6z7a8b9_backsweep_orphan_observations_v2.py +0 -0
  199. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c5d6e7f8a9b0_add_bank_id_to_memory_links.py +0 -0
  200. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c7d1e9a4b3f2_add_archive_causal_links.py +0 -0
  201. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c7e2f9a4d1b8_clear_placeholder_memory_dates.py +0 -0
  202. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c7e9f1a3b5d2_maintenance_routines_skip_vanished_schemas.py +0 -0
  203. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c8b4e2a71f95_maintenance_routines_skip_locked_schemas.py +0 -0
  204. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c8e2f4a6b1d3_oracle_mental_models_text_index.py +0 -0
  205. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c8e5f2a3b4d1_add_retain_params_to_documents.py +0 -0
  206. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/c9a1b2d3e4f5_add_invalidated_memory_units.py +0 -0
  207. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/d1e2f3a4b5c6_drop_v1_mental_model_structured_content.py +0 -0
  208. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/d2e3f4a5b6c7_add_memory_links_expansion_indexes.py +0 -0
  209. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/d3e4f5a6b7c8_add_llm_requests_table.py +0 -0
  210. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/d4e5f6g7h8i9_gin_source_memory_ids_fastupdate_off.py +0 -0
  211. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/d4f6a8c2e1b3_drop_archive_embedding_column.py +0 -0
  212. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/d4f7a2c9e1b5_scheduled_full_refresh.py +0 -0
  213. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/d4f8b1c6e903_add_bank_alias_is_primary.py +0 -0
  214. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/d5e6f7a8b9c0_add_bank_internal_id_and_per_bank_hnsw.py +0 -0
  215. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/d5y6z7a8b9c0_backfill_mental_models_subtype.py +0 -0
  216. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/d6e7f8a9b0c1_drop_documents_metadata_column.py +0 -0
  217. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/d7b2f8a1c934_add_schemas_with_expired_operations_routine.py +0 -0
  218. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/d9c1a7b4e2f6_async_operations_serialization_key.py +0 -0
  219. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/d9f6a3b4c5e2_rename_bank_to_interactions.py +0 -0
  220. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/e0a1b2c3d4e5_disposition_to_3_traits.py +0 -0
  221. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/e1b2c3d4f5a6_drop_unused_indexes.py +0 -0
  222. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/e1f2a3b4c5d6_merge_heads_embedding_drop_and_links_index.py +0 -0
  223. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/e2f4a6c8b0d1_add_attachments.py +0 -0
  224. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/e4a7c1b9d2f6_drop_memory_units_access_count.py +0 -0
  225. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/e4f5a6b7c8d9_add_webhooks_tables.py +0 -0
  226. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/e5b1c7d3a902_merge_trgm_index_and_reasoning_tokens.py +0 -0
  227. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/e5f6a7b8c9d0_add_maintenance_routines.py +0 -0
  228. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/e5f6g7h8i9j0_cascade_delete_ops_on_bank_delete.py +0 -0
  229. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/e7c3a91f4b62_add_mental_model_last_memory_seen_at.py +0 -0
  230. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/e7c3a9f1b2d5_drop_archive_search_vector_column.py +0 -0
  231. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/e8c1a4f7b2d9_drop_global_memory_units_vector_indexes.py +0 -0
  232. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/e9b2c7d1f3a4_drop_entity_memory_links.py +0 -0
  233. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/f1a2b3c4d5e6_add_memory_links_composite_index.py +0 -0
  234. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/f2a6d8c4b1e9_drop_stale_global_memory_units_vector_index.py +0 -0
  235. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/f2a7c9d4b168_add_mental_models_cron_index.py +0 -0
  236. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/f2a9c4e7b1d3_widen_mental_model_id_refs.py +0 -0
  237. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/f3a5b7c9d1e2_drop_memory_units_bm25_matview.py +0 -0
  238. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/f4d1c2b3a5e6_add_scheduled_mental_model_refresh_routine.py +0 -0
  239. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/f6g7h8i9j0k1_chunk_fk_cascade_delete.py +0 -0
  240. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/f7g8h9i0j1k2_add_webhook_http_config.py +0 -0
  241. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/g2a3b4c5d6e7_add_tags_column.py +0 -0
  242. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/g2h3i4j5k6l7_remove_opinion_fact_type.py +0 -0
  243. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/g7h8i9j0k1l2_backsweep_orphan_observations.py +0 -0
  244. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/h3c4d5e6f7g8_mental_models_v4.py +0 -0
  245. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/h3i4j5k6l7m8_merge_heads_and_add_unit_entities_index.py +0 -0
  246. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/i4d5e6f7g8h9_delete_opinions.py +0 -0
  247. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/i4j5k6l7m8n9_add_cancelled_status_to_async_operations.py +0 -0
  248. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/j5e6f7g8h9i0_mental_model_versions.py +0 -0
  249. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/k6f7g8h9i0j1_add_directive_subtype.py +0 -0
  250. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/k6l7m8n9o0p1_create_observation_sources_table.py +0 -0
  251. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/l7g8h9i0j1k2_add_worker_columns.py +0 -0
  252. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/m3rg3h3ad5f6_merge_deferrable_fk_and_cooccurrence_backfill.py +0 -0
  253. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/m8h9i0j1k2l3_mental_model_id_to_text.py +0 -0
  254. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py +0 -0
  255. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/o0j1k2l3m4n5_migrate_mental_models_data.py +0 -0
  256. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/o1a2b3c4d5e6_oracle_baseline.py +0 -0
  257. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py +0 -0
  258. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/p4q5r6s7t8u9_configurable_bm25_language.py +0 -0
  259. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/q2l3m4n5o6p7_fix_mental_model_fact_type.py +0 -0
  260. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/r3m4n5o6p7q8_add_reflect_response_to_reflections.py +0 -0
  261. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/rename_personality_to_disposition.py +0 -0
  262. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/s4n5o6p7q8r9_add_consolidated_at_to_memory_units.py +0 -0
  263. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py +0 -0
  264. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/u6p7q8r9s0t1_mental_models_text_id.py +0 -0
  265. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/v7q8r9s0t1u2_add_max_tokens_to_mental_models.py +0 -0
  266. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/w8r9s0t1u2v3_fix_mental_models_pk_isolation.py +0 -0
  267. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/x9s0t1u2v3w4_add_bank_config_column.py +0 -0
  268. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/y0t1u2v3w4x5_add_result_metadata_gin_index.py +0 -0
  269. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/alembic/versions/z1u2v3w4x5y6_add_observation_tags_to_memory_units.py +0 -0
  270. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/api/__init__.py +0 -0
  271. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/api/admission.py +0 -0
  272. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/api/disconnect.py +0 -0
  273. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/api/observability.py +0 -0
  274. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/api/passthrough_headers.py +0 -0
  275. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/banner.py +0 -0
  276. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/cancellation.py +0 -0
  277. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/daemon.py +0 -0
  278. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/db_url.py +0 -0
  279. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/__init__.py +0 -0
  280. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/background_writes.py +0 -0
  281. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/bank_attribution.py +0 -0
  282. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/bank_info_cache.py +0 -0
  283. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/cache_affinity.py +0 -0
  284. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/causal_links.py +0 -0
  285. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/chinese_temporal_periods.py +0 -0
  286. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/chunk_ids.py +0 -0
  287. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/consolidation/__init__.py +0 -0
  288. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/consolidation/triage.py +0 -0
  289. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/db/__init__.py +0 -0
  290. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/db/optional_routines.py +0 -0
  291. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/db/pool_instrumentation.py +0 -0
  292. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/db/result.py +0 -0
  293. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/db_budget.py +0 -0
  294. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/db_utils.py +0 -0
  295. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/directives/__init__.py +0 -0
  296. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/directives/models.py +0 -0
  297. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/fact_budget.py +0 -0
  298. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/jina_mlx_reranker.py +0 -0
  299. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/llm_trace.py +0 -0
  300. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/llm_transport.py +0 -0
  301. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/__init__.py +0 -0
  302. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/admin.py +0 -0
  303. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/banks.py +0 -0
  304. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/consolidation.py +0 -0
  305. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/expand.py +0 -0
  306. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/link_expansion.py +0 -0
  307. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/memories/pg/transfer.py +0 -0
  308. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/metadata_utils.py +0 -0
  309. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/parsers/__init__.py +0 -0
  310. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/parsers/base.py +0 -0
  311. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/parsers/markitdown.py +0 -0
  312. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/prompt_preview.py +0 -0
  313. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/__init__.py +0 -0
  314. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/chatgpt_auth.py +0 -0
  315. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/chatgpt_llm.py +0 -0
  316. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/cloud_auth.py +0 -0
  317. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/cloud_logo.png +0 -0
  318. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/codex_auth.py +0 -0
  319. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/github_copilot_llm.py +0 -0
  320. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/litellm_router_llm.py +0 -0
  321. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/llamacpp_llm.py +0 -0
  322. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/llm_debug.py +0 -0
  323. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/mock_llm.py +0 -0
  324. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/none_llm.py +0 -0
  325. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/nous_auth.py +0 -0
  326. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/nous_llm.py +0 -0
  327. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/oauth_store_lock.py +0 -0
  328. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/openai_compatible_headers.py +0 -0
  329. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/providers/xai_oauth_auth.py +0 -0
  330. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/reflect/__init__.py +0 -0
  331. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/reflect/observations.py +0 -0
  332. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/reflect/presentation.py +0 -0
  333. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/reflect/retractions.py +0 -0
  334. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/reflect/tokenization.py +0 -0
  335. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/reflect/tools_schema.py +0 -0
  336. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/__init__.py +0 -0
  337. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/attachment_content.py +0 -0
  338. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/chunk_storage.py +0 -0
  339. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/embedding_coalescer.py +0 -0
  340. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/entity_processing.py +0 -0
  341. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/fold.py +0 -0
  342. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/link_creation.py +0 -0
  343. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/memory_budget.py +0 -0
  344. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/retain/types.py +0 -0
  345. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/schema.py +0 -0
  346. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/__init__.py +0 -0
  347. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/fusion.py +0 -0
  348. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/graph_retrieval.py +0 -0
  349. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/recall_boost.py +0 -0
  350. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/retrieval.py +0 -0
  351. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/tag_resolution.py +0 -0
  352. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/tags.py +0 -0
  353. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/temporal_extraction.py +0 -0
  354. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/think_utils.py +0 -0
  355. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/trace.py +0 -0
  356. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/search/types.py +0 -0
  357. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/source_scope.py +0 -0
  358. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/sql/__init__.py +0 -0
  359. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/sql/base.py +0 -0
  360. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/sql/oracle.py +0 -0
  361. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/storage/__init__.py +0 -0
  362. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/storage/azure.py +0 -0
  363. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/storage/gcs.py +0 -0
  364. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/storage/s3.py +0 -0
  365. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/stored_dates.py +0 -0
  366. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/structured_output.py +0 -0
  367. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/task_backend.py +0 -0
  368. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/tei_retry.py +0 -0
  369. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/temporal_periods.py +0 -0
  370. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/time_filter.py +0 -0
  371. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/transfer/stream_archive.py +0 -0
  372. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/trigram.py +0 -0
  373. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/engine/vector_index_health.py +0 -0
  374. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/bank_tables.py +0 -0
  375. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/base.py +0 -0
  376. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/builtin/__init__.py +0 -0
  377. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/builtin/memory_defense_regex.py +0 -0
  378. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/builtin/tenant.py +0 -0
  379. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/context.py +0 -0
  380. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/http.py +0 -0
  381. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/llm_request.py +0 -0
  382. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/memory_defense.py +0 -0
  383. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/model_call.py +0 -0
  384. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/extensions/tenant.py +0 -0
  385. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/http_probe.py +0 -0
  386. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/liveness.py +0 -0
  387. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/loop_lag.py +0 -0
  388. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/loop_watchdog.py +0 -0
  389. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/metrics_multiworker.py +0 -0
  390. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/operation_runs.py +0 -0
  391. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/pg0.py +0 -0
  392. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/profiling.py +0 -0
  393. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/py.typed +0 -0
  394. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/schema_context.py +0 -0
  395. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/server.py +0 -0
  396. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/webhooks/__init__.py +0 -0
  397. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/webhooks/manager.py +0 -0
  398. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/webhooks/url_guard.py +0 -0
  399. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/worker/__init__.py +0 -0
  400. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/worker/background.py +0 -0
  401. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/worker/exceptions.py +0 -0
  402. {hindsight_api_slim-1.2.0 → hindsight_api_slim-1.2.2}/hindsight_api/worker/stage.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: hindsight-api-slim
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Summary: Hindsight: Agent Memory That Learns
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -15,7 +15,7 @@ Requires-Dist: claude-agent-sdk>=0.2.121
15
15
  Requires-Dist: cohere>=5.0.0
16
16
  Requires-Dist: croniter>=2.0.0
17
17
  Requires-Dist: cryptography>=50.0.0
18
- Requires-Dist: dateparser>=1.4.2
18
+ Requires-Dist: dateparser>=1.5.0
19
19
  Requires-Dist: fastapi[standard]>=0.120.3
20
20
  Requires-Dist: fastmcp>=3.2.0
21
21
  Requires-Dist: filelock>=3.20.1
@@ -51,7 +51,7 @@ Requires-Dist: python-multipart>=0.0.22
51
51
  Requires-Dist: regex>=2026.9.3
52
52
  Requires-Dist: rich>=13.0.0
53
53
  Requires-Dist: sqlalchemy<2.1,>=2.0.44
54
- Requires-Dist: toktok-rs>=0.3.0
54
+ Requires-Dist: toktok-rs>=0.5.0
55
55
  Requires-Dist: typer>=0.9.0
56
56
  Requires-Dist: urllib3>=2.7.0
57
57
  Requires-Dist: uvicorn>=0.38.0
@@ -59,6 +59,7 @@ Requires-Dist: uvloop>=0.22.1; sys_platform != 'win32'
59
59
  Requires-Dist: winloop>=0.1.0; sys_platform == 'win32'
60
60
  Requires-Dist: wsproto>=1.0.0
61
61
  Provides-Extra: all
62
+ Requires-Dist: av>=18.1.0; extra == 'all'
62
63
  Requires-Dist: einops>=0.8.2; extra == 'all'
63
64
  Requires-Dist: flashrank>=0.2.0; extra == 'all'
64
65
  Requires-Dist: huggingface-hub>=0.20.0; extra == 'all'
@@ -66,33 +67,36 @@ Requires-Dist: mlx-lm>=0.31.1; (sys_platform == 'darwin' and platform_machine ==
66
67
  Requires-Dist: mlx>=0.31.0; (sys_platform == 'darwin' and platform_machine == 'arm64') and extra == 'all'
67
68
  Requires-Dist: numpy>=1.26.0; extra == 'all'
68
69
  Requires-Dist: onnxruntime>=1.17.0; extra == 'all'
69
- Requires-Dist: pg0-embedded>=0.15.2; extra == 'all'
70
+ Requires-Dist: pg0-embedded>=0.17.0; extra == 'all'
70
71
  Requires-Dist: safetensors>=0.6.2; extra == 'all'
71
- Requires-Dist: sentence-transformers>=5.0.0; extra == 'all'
72
- Requires-Dist: tokenizers<=0.23.0,>=0.22.0; extra == 'all'
72
+ Requires-Dist: sentence-transformers>=6.2.0; extra == 'all'
73
+ Requires-Dist: tokenizers<0.24.0,>=0.23.1; extra == 'all'
73
74
  Requires-Dist: torch>=2.11.0; extra == 'all'
74
- Requires-Dist: transformers>=5.5.0; extra == 'all'
75
+ Requires-Dist: torchvision>=0.26.0; extra == 'all'
76
+ Requires-Dist: transformers>=5.22.1; extra == 'all'
75
77
  Provides-Extra: embedded-db
76
- Requires-Dist: pg0-embedded>=0.15.2; extra == 'embedded-db'
78
+ Requires-Dist: pg0-embedded>=0.17.0; extra == 'embedded-db'
77
79
  Provides-Extra: local-llm
78
80
  Requires-Dist: huggingface-hub>=0.20.0; extra == 'local-llm'
79
81
  Requires-Dist: llama-cpp-python[server]>=0.3.0; extra == 'local-llm'
80
82
  Provides-Extra: local-ml
83
+ Requires-Dist: av>=18.1.0; extra == 'local-ml'
81
84
  Requires-Dist: einops>=0.8.2; extra == 'local-ml'
82
85
  Requires-Dist: flashrank>=0.2.0; extra == 'local-ml'
83
86
  Requires-Dist: mlx-lm>=0.31.1; (sys_platform == 'darwin' and platform_machine == 'arm64') and extra == 'local-ml'
84
87
  Requires-Dist: mlx>=0.31.0; (sys_platform == 'darwin' and platform_machine == 'arm64') and extra == 'local-ml'
85
88
  Requires-Dist: safetensors>=0.6.2; extra == 'local-ml'
86
- Requires-Dist: sentence-transformers>=5.0.0; extra == 'local-ml'
87
- Requires-Dist: tokenizers<=0.23.0,>=0.22.0; extra == 'local-ml'
89
+ Requires-Dist: sentence-transformers>=6.2.0; extra == 'local-ml'
90
+ Requires-Dist: tokenizers<0.24.0,>=0.23.1; extra == 'local-ml'
88
91
  Requires-Dist: torch>=2.11.0; extra == 'local-ml'
89
- Requires-Dist: transformers>=5.5.0; extra == 'local-ml'
92
+ Requires-Dist: torchvision>=0.26.0; extra == 'local-ml'
93
+ Requires-Dist: transformers>=5.22.1; extra == 'local-ml'
90
94
  Provides-Extra: local-onnx
91
95
  Requires-Dist: huggingface-hub>=0.20.0; extra == 'local-onnx'
92
96
  Requires-Dist: numpy>=1.26.0; extra == 'local-onnx'
93
97
  Requires-Dist: onnxruntime>=1.17.0; extra == 'local-onnx'
94
- Requires-Dist: tokenizers<=0.23.0,>=0.22.0; extra == 'local-onnx'
95
- Requires-Dist: transformers>=5.5.0; extra == 'local-onnx'
98
+ Requires-Dist: tokenizers<0.24.0,>=0.23.1; extra == 'local-onnx'
99
+ Requires-Dist: transformers>=5.22.1; extra == 'local-onnx'
96
100
  Provides-Extra: oracle
97
101
  Requires-Dist: oracledb>=2.5.0; extra == 'oracle'
98
102
  Provides-Extra: test
@@ -40,7 +40,7 @@ from ._thread_limits import apply_default_thread_limits
40
40
 
41
41
  apply_default_thread_limits()
42
42
 
43
- __version__ = "1.2.0"
43
+ __version__ = "1.2.2"
44
44
 
45
45
  # name -> (module, attribute). Kept as data so `__all__`, `__dir__` and the resolver cannot drift.
46
46
  _LAZY_EXPORTS: "dict[str, tuple[str, str]]" = {
@@ -23,6 +23,7 @@ import typer
23
23
  from ..config import DEFAULT_DATABASE_SCHEMA, HindsightConfig, load_dotenv_for_entrypoint
24
24
  from ..db_url import is_oracle_url
25
25
  from ..engine.memories import get_memories, sql_memories
26
+ from ..engine.retain.attachment_store import ATTACHMENT_SWEEP_GRACE, reclaim_unreferenced_attachments
26
27
  from ..engine.retain.bank_utils import _vector_index_clause, bank_indexes_are_store_owned
27
28
  from ..engine.schema import fq_table_explicit as _fq_table
28
29
  from ..engine.storage import bank_storage_prefix, create_file_storage
@@ -36,6 +37,8 @@ from ..engine.vector_index_health import (
36
37
  from ..extensions import TenantExtension, load_extension
37
38
  from ..pg0 import parse_pg0_url, resolve_database_url
38
39
  from ..schema_context import _current_schema
40
+ from ..utils import configure_stdio
41
+ from .reembed import SchemaReembed, finish_schema, reembed_schema
39
42
 
40
43
  # Setup logging
41
44
  logging.basicConfig(
@@ -80,6 +83,12 @@ BACKUP_TABLES = [
80
83
  "async_operations",
81
84
  "webhooks",
82
85
  "file_storage",
86
+ # Knowledge banks: documents FK to banks, passages FK to documents.
87
+ "kb_documents",
88
+ "kb_passages",
89
+ "kb_passage_vectors",
90
+ "kb_staged_passages",
91
+ "kb_staged_passage_vectors",
83
92
  "audit_log",
84
93
  "llm_requests",
85
94
  "graph_maintenance_queue",
@@ -720,6 +729,9 @@ class RepairSweep:
720
729
  rebuilt_search_vectors: int = 0
721
730
  # Counted apart from ``banks``, which stays empty on a backend without per-bank indexes.
722
731
  banks_scanned: int = 0
732
+ # Attachments their document does not reference, left by retains that failed
733
+ # (#6350), with --attachments; in a dry run, how many would be removed.
734
+ unreferenced_attachments: int = 0
723
735
 
724
736
 
725
737
  async def _run_repair_bank(
@@ -729,6 +741,7 @@ async def _run_repair_bank(
729
741
  schema: str | None,
730
742
  bank_id: str | None,
731
743
  dry_run: bool,
744
+ attachments: bool = False,
732
745
  ) -> RepairSweep:
733
746
  """Reconcile per-(bank, fact_type) vector index coverage, and remove orphan observations.
734
747
 
@@ -751,6 +764,12 @@ async def _run_repair_bank(
751
764
  orphan_observations = 0
752
765
  rebuilt_search_vectors = 0
753
766
  banks_scanned = 0
767
+ unreferenced_attachments = 0
768
+ # The daily sweep's rule with no lower bound, so it collects what leaked before
769
+ # the sweep existed. get_memories(), not the SQL store: whether an attachment is
770
+ # referenced is a question about the document, which a custom store may own.
771
+ attachments_before = datetime.now(timezone.utc) - ATTACHMENT_SWEEP_GRACE
772
+ attachments_after = datetime(1970, 1, 1, tzinfo=timezone.utc)
754
773
  try:
755
774
  for target_schema in schemas:
756
775
  # The whole schema is inside the guard, not just list_bank_ids. Planning a
@@ -769,7 +788,9 @@ async def _run_repair_bank(
769
788
  schema_results: list[BankIndexResult] = []
770
789
  schema_orphans = 0
771
790
  schema_rebuilt = 0
791
+ schema_attachments = 0
772
792
  schema_banks_done = 0
793
+ schema_file_storage = _admin_file_storage(conn, target_schema) if attachments else None
773
794
  try:
774
795
  bank_ids = [bank_id] if bank_id else await list_bank_ids(conn, target_schema)
775
796
  for bid in bank_ids:
@@ -784,11 +805,27 @@ async def _run_repair_bank(
784
805
  schema_rebuilt += await pg_store.admin_rebuild_observation_search_vectors(
785
806
  conn=conn, schema=target_schema, bank_id=bid, dry_run=dry_run
786
807
  )
808
+ if schema_file_storage is not None:
809
+ # The shared rule resolves tables through fq_table.
810
+ token = _current_schema.set(target_schema)
811
+ try:
812
+ schema_attachments += await reclaim_unreferenced_attachments(
813
+ conn,
814
+ schema_file_storage,
815
+ get_memories(),
816
+ bid,
817
+ created_after=attachments_after,
818
+ created_before=attachments_before,
819
+ dry_run=dry_run,
820
+ )
821
+ finally:
822
+ _current_schema.reset(token)
787
823
  schema_banks_done += 1
788
824
  except Exception as exc: # noqa: BLE001 — one bad schema must not abort the sweep
789
825
  results.extend(schema_results)
790
826
  orphan_observations += schema_orphans
791
827
  rebuilt_search_vectors += schema_rebuilt
828
+ unreferenced_attachments += schema_attachments
792
829
  banks_scanned += schema_banks_done
793
830
  done = f", {schema_banks_done} of {len(bank_ids)} bank(s) done" if schema_banks_done else ""
794
831
  typer.echo(f" schema '{target_schema}': skipped ({exc}){done}", err=True)
@@ -813,6 +850,7 @@ async def _run_repair_bank(
813
850
  results.extend(schema_results)
814
851
  orphan_observations += schema_orphans
815
852
  rebuilt_search_vectors += schema_rebuilt
853
+ unreferenced_attachments += schema_attachments
816
854
  banks_scanned += schema_banks_done
817
855
  # Only in --all mode: an index whose bank row is gone is unreachable
818
856
  # from every bank-scoped path, so this is the one place that can collect
@@ -848,6 +886,11 @@ async def _run_repair_bank(
848
886
  f"{sum(r.failed for r in schema_results)} failed, "
849
887
  f"{schema_orphans} orphan observation(s) {'to remove (dry-run)' if dry_run else 'removed'}, "
850
888
  f"{schema_rebuilt} observation keyword index(es) {'to rebuild (dry-run)' if dry_run else 'rebuilt'}"
889
+ + (
890
+ f", {schema_attachments} unreferenced attachment(s) {'to remove (dry-run)' if dry_run else 'removed'}"
891
+ if attachments
892
+ else ""
893
+ )
851
894
  )
852
895
  return RepairSweep(
853
896
  banks=results,
@@ -855,6 +898,7 @@ async def _run_repair_bank(
855
898
  orphan_observations=orphan_observations,
856
899
  rebuilt_search_vectors=rebuilt_search_vectors,
857
900
  banks_scanned=banks_scanned,
901
+ unreferenced_attachments=unreferenced_attachments,
858
902
  )
859
903
  finally:
860
904
  await conn.close()
@@ -884,6 +928,12 @@ def repair_bank(
884
928
  "--dry-run",
885
929
  help="Report what would be repaired without creating, dropping or deleting anything.",
886
930
  ),
931
+ attachments: bool = typer.Option(
932
+ False,
933
+ "--attachments",
934
+ help="Also delete attachments their document does not reference (left by retains that failed), "
935
+ "however old. Reads each document that has attachments.",
936
+ ),
887
937
  ):
888
938
  """Repair a bank's derived state: vector index coverage, orphan observations, and (under
889
939
  VectorChord) the observations' keyword index.
@@ -924,6 +974,15 @@ def repair_bank(
924
974
  Reach for the command when you want convergence without waiting for a write:
925
975
  after a restore or upgrade, after a backend switch, or to shed indexes in
926
976
  bulk on a deployment recovering from lock-table exhaustion (#3485).
977
+
978
+ With --attachments, also deletes the images and files of retains that failed
979
+ after the API stored them: attachments, a day or more old, that their
980
+ document's text does not reference — the document was never created, or the
981
+ update that brought them failed. The daily maintenance sweep applies the same
982
+ rule to the past week only; this covers everything before it (#6350). It reads
983
+ every document that has an attachment, through the memories store, so it is
984
+ opt-in rather than part of every repair.
985
+
927
986
  Idempotent and safe to re-run.
928
987
  """
929
988
  if bool(bank_id) == all_banks:
@@ -958,6 +1017,7 @@ def repair_bank(
958
1017
  schema=schema,
959
1018
  bank_id=bank_id,
960
1019
  dry_run=dry_run,
1020
+ attachments=attachments,
961
1021
  )
962
1022
  )
963
1023
  results = sweep.banks
@@ -977,6 +1037,12 @@ def repair_bank(
977
1037
  f"{sweep.orphan_observations} orphan observation(s) {'to remove (dry-run)' if dry_run else 'removed'}, "
978
1038
  f"{sweep.rebuilt_search_vectors} observation keyword index(es) "
979
1039
  f"{'to rebuild (dry-run)' if dry_run else 'rebuilt'}"
1040
+ + (
1041
+ f", {sweep.unreferenced_attachments} unreferenced attachment(s) "
1042
+ f"{'to remove (dry-run)' if dry_run else 'removed'}"
1043
+ if attachments
1044
+ else ""
1045
+ )
980
1046
  )
981
1047
  # Both are reported before either exits. They are independent — a sweep can have
982
1048
  # failed builds in one schema and be unable to look at another — and raising on
@@ -1098,6 +1164,15 @@ async def _move_bank_rows(
1098
1164
  raise RenameBankError(f"bank '{old_bank_id}' does not exist in schema '{schema}'")
1099
1165
  if await conn.fetchval(f"SELECT 1 FROM {banks} WHERE bank_id = $1", new_bank_id):
1100
1166
  raise RenameBankError(f"bank '{new_bank_id}' already exists in schema '{schema}'")
1167
+ # The API refuses a bank under another bank's alias (it would take the name over,
1168
+ # since a real bank wins resolution). Onto its own alias is the end of the
1169
+ # migration aliases exist for: the alias is the bank's id now, so it goes.
1170
+ aliases = _fq_table("bank_aliases", schema)
1171
+ alias_owner = await conn.fetchval(f"SELECT bank_id FROM {aliases} WHERE alias = $1", new_bank_id)
1172
+ if alias_owner is not None and alias_owner != old_bank_id:
1173
+ raise RenameBankError(f"'{new_bank_id}' is an alias of bank '{alias_owner}' in schema '{schema}'")
1174
+ if alias_owner is not None: # a dry run rolls this back with the rest
1175
+ await conn.execute(f"DELETE FROM {aliases} WHERE alias = $1", new_bank_id)
1101
1176
  # An operation's task_payload names its bank, so one run after the rename
1102
1177
  # would work on (and could recreate) the old id.
1103
1178
  active = await conn.fetchval(
@@ -1507,7 +1582,7 @@ def import_bank_command(
1507
1582
  f"{result.facts_imported} fact(s), {result.observations_imported} observation(s), "
1508
1583
  f"{result.mental_models_imported} mental model(s), "
1509
1584
  f"{result.mental_model_history_imported} mm-history row(s), "
1510
- f"{result.knowledge_pages_imported} knowledge page(s), {result.directives_imported} directive(s), "
1585
+ f"{result.knowledge_pages_imported} page(s), {result.directives_imported} directive(s), "
1511
1586
  f"{result.webhooks_imported} webhook(s), {result.history_rows_imported} history row(s)"
1512
1587
  )
1513
1588
 
@@ -1708,6 +1783,105 @@ def worker_status(
1708
1783
  typer.echo("")
1709
1784
 
1710
1785
 
1786
+ async def _run_reembed(
1787
+ db_url: str, schemas: list[str], *, finish: bool, batch_size: int, concurrency: int, sleep_s: float
1788
+ ) -> list[SchemaReembed]:
1789
+ from ..engine.embeddings import create_embeddings_from_env, embedding_model_id
1790
+
1791
+ resolved_url = await resolve_database_url(db_url)
1792
+ embeddings = None
1793
+ if not finish:
1794
+ embeddings = create_embeddings_from_env()
1795
+ await embeddings.initialize()
1796
+ typer.echo(f"New embedding model: {embedding_model_id(embeddings)}")
1797
+ conn = await _admin_connect(db_url)
1798
+ results: list[SchemaReembed] = []
1799
+ try:
1800
+ for target_schema in schemas:
1801
+ if finish:
1802
+ results.append(await finish_schema(conn, target_schema))
1803
+ else:
1804
+ assert embeddings is not None
1805
+ typer.echo(f"Re-embedding schema '{target_schema}'...")
1806
+ results.append(
1807
+ await reembed_schema(
1808
+ conn,
1809
+ resolved_url,
1810
+ target_schema,
1811
+ embeddings,
1812
+ batch_size=batch_size,
1813
+ concurrency=concurrency,
1814
+ sleep_s=sleep_s,
1815
+ )
1816
+ )
1817
+ finally:
1818
+ await conn.close()
1819
+ return results
1820
+
1821
+
1822
+ @app.command(name="reembed")
1823
+ def reembed(
1824
+ schema: str | None = typer.Option(
1825
+ None, "--schema", "-s", help="Schema to re-embed. Mutually exclusive with --all-schemas."
1826
+ ),
1827
+ all_schemas: bool = typer.Option(
1828
+ False, "--all-schemas", help="Re-embed the base schema and every discovered tenant schema, one at a time."
1829
+ ),
1830
+ finish: bool = typer.Option(
1831
+ False, "--finish", help="Remove the write guard, once every server runs the new embedding model."
1832
+ ),
1833
+ batch_size: int = typer.Option(256, "--batch-size", help="Rows embedded and written per transaction."),
1834
+ concurrency: int = typer.Option(
1835
+ 4,
1836
+ "--concurrency",
1837
+ min=1,
1838
+ help="Batches sent to the embedding model at once. Postgres still sees one connection.",
1839
+ ),
1840
+ sleep_s: float = typer.Option(0.0, "--sleep", help="Seconds to pause between batches, to go easy on Postgres."),
1841
+ ):
1842
+ """Re-embed every stored vector with the embedding model configured in the environment.
1843
+
1844
+ Run it with the NEW model's HINDSIGHT_API_EMBEDDINGS_* settings; servers keep running on the
1845
+ old one. Recall keeps working on the old vectors (without their index) while the new ones are
1846
+ written to a side column in small batches; then a short write lock swaps the columns. From
1847
+ then on Postgres refuses vector writes from servers still on the old model (workers retry
1848
+ them later, HTTP answers 503): restart every server with the new model, then run
1849
+ `reembed --finish`. Until a server restarts its recall embeds queries with the old model.
1850
+
1851
+ PostgreSQL only. Resumable: re-run after an interruption and it continues.
1852
+ """
1853
+ if bool(schema) == all_schemas:
1854
+ typer.echo("Error: pass exactly one of --schema <name> or --all-schemas.", err=True)
1855
+ raise typer.Exit(2)
1856
+ config = HindsightConfig.from_env()
1857
+ if not config.database_url:
1858
+ typer.echo("Error: Database URL not configured.", err=True)
1859
+ raise typer.Exit(1)
1860
+ if is_oracle_url(config.database_url):
1861
+ typer.echo("Error: reembed is PostgreSQL-only.", err=True)
1862
+ raise typer.Exit(1)
1863
+ if get_memories().store_owned:
1864
+ typer.echo("Error: a custom memories store owns the vectors; it must re-embed them itself.", err=True)
1865
+ raise typer.Exit(1)
1866
+
1867
+ schemas = [schema] if schema else asyncio.run(_resolve_schemas(config.database_schema))
1868
+ results = asyncio.run(
1869
+ _run_reembed(
1870
+ config.database_url,
1871
+ schemas,
1872
+ finish=finish,
1873
+ batch_size=batch_size,
1874
+ concurrency=concurrency,
1875
+ sleep_s=sleep_s,
1876
+ )
1877
+ )
1878
+ for r in results:
1879
+ rows = f", {r.rows_embedded} rows embedded" if r.rows_embedded else ""
1880
+ typer.echo(f" {r.schema}: {r.status}{rows}")
1881
+ if not finish:
1882
+ typer.echo("Next: restart every server with the new model, then run `hindsight-admin reembed --finish`.")
1883
+
1884
+
1711
1885
  @app.command(
1712
1886
  name="chatgpt",
1713
1887
  context_settings={"allow_extra_args": True, "ignore_unknown_options": True, "help_option_names": []},
@@ -1719,10 +1893,8 @@ def chatgpt(ctx: typer.Context):
1719
1893
  raise typer.Exit(chatgpt_main(ctx.args))
1720
1894
 
1721
1895
 
1722
- # Not listed in --help yet.
1723
1896
  @app.command(
1724
1897
  name="cloud",
1725
- hidden=True,
1726
1898
  context_settings={"allow_extra_args": True, "ignore_unknown_options": True, "help_option_names": []},
1727
1899
  )
1728
1900
  def cloud(ctx: typer.Context):
@@ -1733,6 +1905,7 @@ def cloud(ctx: typer.Context):
1733
1905
 
1734
1906
 
1735
1907
  def main():
1908
+ configure_stdio()
1736
1909
  load_dotenv_for_entrypoint()
1737
1910
  app()
1738
1911