pycontextdb 0.3.0__tar.gz → 0.4.0__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.
- pycontextdb-0.4.0/.github/pull_request_template.md +28 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/.github/workflows/ci.yml +47 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/CHANGELOG.md +51 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/COMMERCIAL.md +7 -3
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/CONTRIBUTING.md +7 -1
- pycontextdb-0.4.0/OPEN_CORE.md +80 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/PKG-INFO +47 -8
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/README.md +46 -7
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/__init__.py +31 -1
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/client.py +711 -127
- pycontextdb-0.4.0/contextdb/connectors/__init__.py +25 -0
- pycontextdb-0.4.0/contextdb/connectors/base.py +62 -0
- pycontextdb-0.4.0/contextdb/connectors/postgres.py +243 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/core/__init__.py +18 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/core/config.py +16 -0
- pycontextdb-0.4.0/contextdb/core/exceptions.py +99 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/core/models.py +58 -1
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/dynamics/retrieval.py +4 -1
- pycontextdb-0.4.0/contextdb/dynamics/trust.py +784 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/memory/factual.py +37 -1
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/store/base.py +58 -1
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/store/factory.py +7 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/store/postgres_store.py +449 -77
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/store/sqlite_store.py +97 -9
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/store/vector_index.py +14 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/utils/embeddings.py +138 -10
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/docs/api.md +20 -3
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/docs/architecture.md +14 -4
- pycontextdb-0.4.0/docs/connectors.md +56 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/docs/index.md +7 -0
- pycontextdb-0.4.0/docs/memory_evolution.md +124 -0
- pycontextdb-0.4.0/docs/postgres.md +148 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/docs/quickstart.md +17 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/pyproject.toml +1 -1
- pycontextdb-0.4.0/scripts/check_open_core_boundary.py +154 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/scripts/check_release.py +54 -1
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_config.py +6 -0
- pycontextdb-0.4.0/tests/unit/test_connectors.py +47 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_decision_scope.py +62 -0
- pycontextdb-0.4.0/tests/unit/test_embeddings.py +87 -0
- pycontextdb-0.4.0/tests/unit/test_init.py +81 -0
- pycontextdb-0.4.0/tests/unit/test_memory_evolution.py +456 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_models.py +52 -0
- pycontextdb-0.4.0/tests/unit/test_open_core_boundary.py +64 -0
- pycontextdb-0.4.0/tests/unit/test_pg_sql.py +94 -0
- pycontextdb-0.4.0/tests/unit/test_postgres_concurrency.py +454 -0
- pycontextdb-0.4.0/tests/unit/test_postgres_connector.py +80 -0
- pycontextdb-0.4.0/tests/unit/test_postgres_memory_evolution.py +411 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_store.py +110 -1
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_vector_index.py +24 -0
- pycontextdb-0.3.0/.github/pull_request_template.md +0 -10
- pycontextdb-0.3.0/contextdb/core/exceptions.py +0 -50
- pycontextdb-0.3.0/contextdb/dynamics/trust.py +0 -373
- pycontextdb-0.3.0/docs/postgres.md +0 -74
- pycontextdb-0.3.0/tests/unit/test_embeddings.py +0 -35
- pycontextdb-0.3.0/tests/unit/test_init.py +0 -31
- pycontextdb-0.3.0/tests/unit/test_pg_sql.py +0 -34
- pycontextdb-0.3.0/tests/unit/test_postgres_concurrency.py +0 -179
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/.github/CODEOWNERS +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/.github/copilot-instructions.md +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/.github/workflows/publish.yml +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/.gitignore +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/.pre-commit-config.yaml +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/LICENSE +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/NOTICE +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/ai-tools/.cursorrules +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/ai-tools/CLAUDE.md +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/ai-tools/README.md +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/ai-tools/llms-full.txt +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/ai-tools/llms.txt +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/assets/README.md +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/assets/architecture.png +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/assets/benchmarks.png +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/assets/hero.png +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/assets/performance.png +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/assets/problem.png +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/assets/quickstart.png +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/benchmarks/__init__.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/benchmarks/run_benchmarks.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/benchmarks/trust_bakeoff.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/agents/__init__.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/agents/memory_bus.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/agents/rl_manager.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/cli.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/core/clock.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/core/policy.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/core/slots.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/dynamics/__init__.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/dynamics/evolution.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/dynamics/formation.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/dynamics/salience.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/graphs/__init__.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/graphs/base.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/graphs/causal.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/graphs/entity.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/graphs/semantic.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/graphs/temporal.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/integrations/__init__.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/integrations/act.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/integrations/autogen.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/integrations/crewai.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/integrations/langchain.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/integrations/livekit.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/integrations/openai_tools.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/integrations/pipecat.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/integrations/prompting.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/mcp.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/memory/__init__.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/memory/experiential.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/memory/working.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/pool.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/privacy/__init__.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/privacy/audit.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/privacy/injection.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/privacy/pii_detector.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/privacy/retention.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/py.typed +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/serve.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/store/__init__.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/store/pg_sql.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/utils/__init__.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/utils/llm.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/contextdb/utils/migrations.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/docs/migrations.md +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/docs/multi_tenant.md +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/docs/prompts.md +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/docs/serve.md +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/docs/trust_policy.md +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/examples/customer_support.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/examples/multi_agent_team.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/examples/phone_agent.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/examples/research_assistant.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/legal/CLA-entity.md +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/legal/CLA-individual.md +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/legal/signed/README.md +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/mkdocs.yml +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/__init__.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/conftest.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/evals/__init__.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/evals/test_trust_model.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/integration/__init__.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/integration/test_client.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/integration/test_langchain_integration.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/pg_util.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/test_version.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/__init__.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_audit.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_evolution.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_formation.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_graphs.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_host_api.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_memory_bus.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_pii_detector.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_retention.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_retrieval.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_scoped_id_access.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_serve.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_trust_policy.py +0 -0
- {pycontextdb-0.3.0 → pycontextdb-0.4.0}/tests/unit/test_vector_scope.py +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
<!-- What changed, and why. Evals win over prose. -->
|
|
4
|
+
|
|
5
|
+
## Open-core classification
|
|
6
|
+
|
|
7
|
+
Select exactly one and justify placement against `OPEN_CORE.md`.
|
|
8
|
+
|
|
9
|
+
- [ ] No capability change — docs/tests/build/maintenance only.
|
|
10
|
+
- [ ] Semantic — portable offline correctness.
|
|
11
|
+
- [ ] Contract — interface/schema/protocol.
|
|
12
|
+
- [ ] Reference — minimal single-node implementation.
|
|
13
|
+
- [ ] Operated — multi-tenant/process/region/people/SLA coordination; this PR
|
|
14
|
+
does not belong in the public SDK.
|
|
15
|
+
|
|
16
|
+
**Why this repository is the correct side of the boundary:**
|
|
17
|
+
|
|
18
|
+
<!-- For mixed features, identify the open contract and private implementation. -->
|
|
19
|
+
|
|
20
|
+
## Checklist
|
|
21
|
+
|
|
22
|
+
- [ ] `pytest tests/evals/ -v` passes, or I explain why not.
|
|
23
|
+
- [ ] `python scripts/check_open_core_boundary.py` passes.
|
|
24
|
+
- [ ] `contextdb.init`, `factual.add`, `factual.recall`, and `search` keep working; new fields have backward-compatible defaults.
|
|
25
|
+
- [ ] No new runtime dependency without a discussion first.
|
|
26
|
+
- [ ] No hosted auth, entitlements, billing, control-plane, enterprise,
|
|
27
|
+
deployment, migration-orchestration, or fleet code entered the SDK.
|
|
28
|
+
- [ ] Substantial contribution: I agree to the CLA in CONTRIBUTING.md (legal name and email in this description). Trivial typo PRs may skip this.
|
|
@@ -54,6 +54,12 @@ jobs:
|
|
|
54
54
|
python -m pip install --upgrade pip
|
|
55
55
|
pip install -e ".[dev]"
|
|
56
56
|
|
|
57
|
+
- name: Open-core boundary
|
|
58
|
+
run: python scripts/check_open_core_boundary.py
|
|
59
|
+
env:
|
|
60
|
+
CONTEXTDB_REQUIRE_PR_CLASSIFICATION: ${{ github.event_name == 'pull_request' }}
|
|
61
|
+
CONTEXTDB_PR_BODY: ${{ github.event.pull_request.body }}
|
|
62
|
+
|
|
57
63
|
- name: Lint with ruff
|
|
58
64
|
run: ruff check .
|
|
59
65
|
|
|
@@ -62,3 +68,44 @@ jobs:
|
|
|
62
68
|
|
|
63
69
|
- name: Run tests
|
|
64
70
|
run: pytest
|
|
71
|
+
|
|
72
|
+
postgres:
|
|
73
|
+
name: Postgres integration
|
|
74
|
+
runs-on: ubuntu-latest
|
|
75
|
+
services:
|
|
76
|
+
postgres:
|
|
77
|
+
image: postgres:16
|
|
78
|
+
env:
|
|
79
|
+
POSTGRES_USER: postgres
|
|
80
|
+
POSTGRES_PASSWORD: postgres
|
|
81
|
+
POSTGRES_DB: postgres
|
|
82
|
+
ports:
|
|
83
|
+
- 5432:5432
|
|
84
|
+
options: >-
|
|
85
|
+
--health-cmd "pg_isready -U postgres"
|
|
86
|
+
--health-interval 5s
|
|
87
|
+
--health-timeout 5s
|
|
88
|
+
--health-retries 10
|
|
89
|
+
env:
|
|
90
|
+
CONTEXTDB_TEST_POSTGRES_URL: postgresql://postgres:postgres@127.0.0.1:5432/postgres
|
|
91
|
+
steps:
|
|
92
|
+
- uses: actions/checkout@v4
|
|
93
|
+
|
|
94
|
+
- uses: actions/setup-python@v5
|
|
95
|
+
with:
|
|
96
|
+
python-version: "3.12"
|
|
97
|
+
cache: pip
|
|
98
|
+
|
|
99
|
+
- name: Install package with Postgres support
|
|
100
|
+
run: |
|
|
101
|
+
python -m pip install --upgrade pip
|
|
102
|
+
pip install -e ".[dev,postgres]"
|
|
103
|
+
|
|
104
|
+
- name: Run real Postgres tests
|
|
105
|
+
run: |
|
|
106
|
+
pytest \
|
|
107
|
+
tests/unit/test_postgres_concurrency.py \
|
|
108
|
+
tests/unit/test_postgres_connector.py \
|
|
109
|
+
tests/unit/test_postgres_memory_evolution.py \
|
|
110
|
+
tests/unit/test_scoped_id_access.py \
|
|
111
|
+
tests/unit/test_vector_scope.py
|
|
@@ -2,6 +2,57 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.4.0 — 2026-08-23
|
|
6
|
+
|
|
7
|
+
- Explicit deterministic `add` / `update` / `delete` / `noop` memory
|
|
8
|
+
evolution with public result and error contracts, lineage, scoped hard
|
|
9
|
+
deletion, content-free NOOP audit, and post-commit consistency tokens.
|
|
10
|
+
Postgres applies memory rows, revisions, and audit in one transaction;
|
|
11
|
+
ordinary `factual.add()` remains compatible and same-speaker duplicates
|
|
12
|
+
are now true no-ops.
|
|
13
|
+
- Public connector contracts plus a minimal local PostgreSQL/Supabase reader
|
|
14
|
+
with stable timestamp-plus-key cursors and soft-delete mapping. Hosts retain
|
|
15
|
+
control of credentials, scheduling, retries, and memory writes.
|
|
16
|
+
|
|
17
|
+
## 0.3.2 — 2026-08-20
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- Host-owned asyncpg pools and embedding providers can be shared safely across
|
|
22
|
+
project runtimes without being closed on runtime eviction.
|
|
23
|
+
- Mutations return project-scoped memory versions and Postgres WAL positions;
|
|
24
|
+
reads can require those floors and fail closed when unavailable.
|
|
25
|
+
- Embeddings carry model identity and distinct query/document roles, including
|
|
26
|
+
role-aware OpenAI-compatible transport.
|
|
27
|
+
- Project-scoped vector and immutable item caches remove redundant warm recall
|
|
28
|
+
queries while preserving user isolation and cross-worker coherence.
|
|
29
|
+
- A durable read-audit hook lets hosted runtimes persist exact PII-processed
|
|
30
|
+
recall evidence outside the synchronous SDK audit chain.
|
|
31
|
+
- The open-core constitution, PR classification, CI source scanner, and release
|
|
32
|
+
gate prevent operated Cloud capabilities from entering the Apache package.
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- Memory mutation, project/global revision changes, and write audit now commit
|
|
37
|
+
in one Postgres transaction.
|
|
38
|
+
- Advisory locks execute their protected work on the same transaction-bound
|
|
39
|
+
connection instead of accidentally hopping pool connections.
|
|
40
|
+
- Public commercial-use guidance now matches Apache-2.0 while preserving
|
|
41
|
+
ContextDB trademark controls.
|
|
42
|
+
|
|
43
|
+
`contextdb.init`, `factual.add`, `factual.recall`, and `search` remain
|
|
44
|
+
backward-compatible. All new host-sharing and consistency arguments are
|
|
45
|
+
optional.
|
|
46
|
+
|
|
47
|
+
## 0.3.1 — 2026-08-18
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- README links to docs/COMMERCIAL.md/CONTRIBUTING.md are absolute GitHub
|
|
52
|
+
URLs — relative targets 404 on the PyPI project page.
|
|
53
|
+
- `scripts/check_release.py` now scans the built package description for
|
|
54
|
+
relative Markdown links so this fails in CI before it reaches PyPI.
|
|
55
|
+
|
|
5
56
|
## 0.3.0 — 2026-08-18
|
|
6
57
|
|
|
7
58
|
Host API scope hardening:
|
|
@@ -26,9 +26,13 @@ You may not, without a commercial agreement with Atoms AI:
|
|
|
26
26
|
|
|
27
27
|
## Resale and commercial agreements
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
Apache-2.0 permits commercial use, modification, redistribution, embedding,
|
|
30
|
+
and hosted use of the code, subject to its terms. No separate copyright
|
|
31
|
+
license is required for those uses.
|
|
32
|
+
|
|
33
|
+
If your company wants to use the ContextDB name or logo for a hosted offering,
|
|
34
|
+
or wants a supported OEM arrangement, Cloud service, support, or a trademark
|
|
35
|
+
agreement, contact **contextdb@atomsai.com**.
|
|
32
36
|
|
|
33
37
|
## Attribution (optional)
|
|
34
38
|
|
|
@@ -7,7 +7,10 @@ gates.
|
|
|
7
7
|
## What we accept here
|
|
8
8
|
|
|
9
9
|
Trust and safety correctness, local runtime fixes, adapters, docs, and
|
|
10
|
-
evals.
|
|
10
|
+
evals. Portable contracts and minimal single-node reference implementations
|
|
11
|
+
also belong here. Classify every substantial change under
|
|
12
|
+
[OPEN_CORE.md](OPEN_CORE.md). Evals win over prose:
|
|
13
|
+
`pytest tests/evals/ -v`.
|
|
11
14
|
|
|
12
15
|
We do **not** accept:
|
|
13
16
|
|
|
@@ -15,6 +18,9 @@ We do **not** accept:
|
|
|
15
18
|
no flags that only work against a hosted service
|
|
16
19
|
- Imports of packages outside the declared dependencies
|
|
17
20
|
- Changes that loosen PII-before-embed or the hash-chained audit log
|
|
21
|
+
- Hosted auth, tenancy, entitlements, billing, organization control-plane,
|
|
22
|
+
enterprise governance, managed-service, deployment, migration-orchestration,
|
|
23
|
+
or fleet code
|
|
18
24
|
|
|
19
25
|
## Contributor License Agreement
|
|
20
26
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# ContextDB open-core constitution
|
|
2
|
+
|
|
3
|
+
**Status: binding for all future work.** Changes require an explicit
|
|
4
|
+
architecture decision and maintainer approval.
|
|
5
|
+
|
|
6
|
+
> Open the single-node semantics and reference engine. Keep multi-tenant coordination, operated guarantees, governance, and proof private.
|
|
7
|
+
|
|
8
|
+
This repository is the public Apache-2.0 engine. It must remain complete,
|
|
9
|
+
useful offline, inspectable, and safe without a hosted account, license key,
|
|
10
|
+
paid flag, time bomb, or phone-home.
|
|
11
|
+
|
|
12
|
+
Existing Apache grants are permanent. New code is reviewed prospectively
|
|
13
|
+
against this constitution before merge and again before package publication.
|
|
14
|
+
|
|
15
|
+
## Four change classes
|
|
16
|
+
|
|
17
|
+
Every capability-changing contribution is classified as exactly one:
|
|
18
|
+
|
|
19
|
+
1. **Semantic** — portable correctness required offline: open implementation.
|
|
20
|
+
2. **Contract** — interface, schema, protocol, or compatibility test: open.
|
|
21
|
+
3. **Reference** — minimal single-node implementation proving a contract: open.
|
|
22
|
+
4. **Operated** — coordinates tenants, processes, regions, people, or an SLA:
|
|
23
|
+
private Cloud implementation, not this repository.
|
|
24
|
+
|
|
25
|
+
Docs, tests, and maintenance with no capability change declare that explicitly.
|
|
26
|
+
Mixed features are split. This repository may contain the contract and minimal
|
|
27
|
+
reference implementation. Distributed schedulers, controllers, managed
|
|
28
|
+
workers, deployment topology, and operations stay private.
|
|
29
|
+
|
|
30
|
+
## What belongs here
|
|
31
|
+
|
|
32
|
+
- Memory and epistemic data models.
|
|
33
|
+
- `TrustPolicy`, act/ask/abstain, confirmation, and local explanation.
|
|
34
|
+
- PII-before-embed, injection defenses, and public adversarial evals.
|
|
35
|
+
- Local CRUD, SQLite, and a basic Postgres reference adapter.
|
|
36
|
+
- Atomic mutation/version/audit behavior required for correct storage.
|
|
37
|
+
- Deletion semantics and local verification.
|
|
38
|
+
- Portable consistency-token, embedding-provider, and connector contracts.
|
|
39
|
+
- Minimal reference implementations and compatibility tests.
|
|
40
|
+
|
|
41
|
+
Safety and correctness are never commercially gated or intentionally weaker
|
|
42
|
+
than the hosted service.
|
|
43
|
+
|
|
44
|
+
## What does not belong here
|
|
45
|
+
|
|
46
|
+
- Hosted gateway, tenancy, API-key auth, entitlements, quotas, billing, or
|
|
47
|
+
abuse controls.
|
|
48
|
+
- Organization/project/team control plane or governance console.
|
|
49
|
+
- Multi-worker routing, replica orchestration, failover, autoscaling, backups,
|
|
50
|
+
incidents, or availability guarantees.
|
|
51
|
+
- Managed model fleet, batching service, backfill control, or deployment code.
|
|
52
|
+
- Managed connector sync, checkpoints, retries, observability, or support SLAs.
|
|
53
|
+
- Organization Action Ledger, signed compliance exports, or retention service.
|
|
54
|
+
- Policy rollout/canary/approval controllers.
|
|
55
|
+
- SSO, SCIM, KMS/BYOK, private networking, residency, or contractual controls.
|
|
56
|
+
|
|
57
|
+
Thin generated Cloud clients, public API schemas, connector interfaces, and
|
|
58
|
+
common community adapters are public distribution artifacts because they grow
|
|
59
|
+
the ecosystem; they may live in separate public packages and contain no hosted
|
|
60
|
+
implementation.
|
|
61
|
+
|
|
62
|
+
## Contribution and release gate
|
|
63
|
+
|
|
64
|
+
- Pull requests declare one change class and justify repository placement.
|
|
65
|
+
- Ambiguous changes stop for boundary review; publication is never the default.
|
|
66
|
+
- Contract tests may be shared; private implementations are not copied here.
|
|
67
|
+
- Every PyPI release receives an open-core diff review.
|
|
68
|
+
- `scripts/check_open_core_boundary.py` and CI enforce mechanical invariants.
|
|
69
|
+
|
|
70
|
+
Private code can be opened later. An Apache grant cannot be clawed back.
|
|
71
|
+
|
|
72
|
+
## Commercial model
|
|
73
|
+
|
|
74
|
+
ContextDB Cloud sells operation, coordination, governance, and proof of this
|
|
75
|
+
open correctness model. The SDK is not a crippled free tier. If Cloud cannot
|
|
76
|
+
win while this engine is useful, Cloud must become stronger rather than making
|
|
77
|
+
the SDK weaker.
|
|
78
|
+
|
|
79
|
+
See [COMMERCIAL.md](COMMERCIAL.md) for trademark rules. Apache-2.0 permits
|
|
80
|
+
commercial use of the code; it does not grant rights to ContextDB trademarks.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pycontextdb
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: The unified context layer for AI agents — memory you can act on without treating wishes as facts
|
|
5
5
|
Project-URL: Homepage, https://github.com/atomsai/contextdb
|
|
6
6
|
Project-URL: Documentation, https://contextdb.dev
|
|
@@ -74,7 +74,7 @@ Description-Content-Type: text/markdown
|
|
|
74
74
|
<p align="center">
|
|
75
75
|
<a href="https://pypi.org/project/pycontextdb/"><img src="https://img.shields.io/pypi/v/pycontextdb.svg" alt="PyPI version"></a>
|
|
76
76
|
<a href="https://github.com/atomsai/contextdb/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License: Apache 2.0"></a>
|
|
77
|
-
<a href="https://github.com/atomsai/contextdb/blob/main/tests/"><img src="https://img.shields.io/badge/tests-
|
|
77
|
+
<a href="https://github.com/atomsai/contextdb/blob/main/tests/"><img src="https://img.shields.io/badge/tests-195%20passing-brightgreen.svg" alt="Tests"></a>
|
|
78
78
|
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.10%2B-blue.svg" alt="Python 3.10+"></a>
|
|
79
79
|
<a href="https://github.com/atomsai/contextdb/blob/main/pyproject.toml"><img src="https://img.shields.io/badge/mypy-strict-blue.svg" alt="Type Checked"></a>
|
|
80
80
|
<a href="https://github.com/atomsai/contextdb/blob/main/benchmarks/run_benchmarks.py"><img src="https://img.shields.io/badge/search_p95-%3C5ms_%40_5K-brightgreen.svg" alt="Search p95"></a>
|
|
@@ -102,7 +102,7 @@ Description-Content-Type: text/markdown
|
|
|
102
102
|
| **Search latency (5K memories)** | p50 **3.9ms** · p95 **5.0ms** |
|
|
103
103
|
| **Vector search (10K × 1,536d)** | p50 **0.8ms** · p95 **1.0ms** |
|
|
104
104
|
| **PII detection** | 100,000+ texts/sec |
|
|
105
|
-
| **Tests** |
|
|
105
|
+
| **Tests** | 195 passing (incl. 34 trust-model acceptance evals) · ruff clean · mypy `--strict` clean |
|
|
106
106
|
| **Dependencies** | SQLite + NumPy (FAISS / Postgres optional) |
|
|
107
107
|
|
|
108
108
|
Those search numbers are **SQLite + the in-repo mock embedder**. A recall
|
|
@@ -155,7 +155,7 @@ Databricks Lakebase gives agents a hard drive. ContextDB gives agents a brain.
|
|
|
155
155
|
| PostgreSQL / MongoDB | Static rows; no lifecycle; no graph links | `FactualMemory` with formation, evolution, and consolidation |
|
|
156
156
|
| S3 / flat files | Write-only archive; not queryable by meaning or time | `ExperientialMemory` for trajectories, reflections, and workflows |
|
|
157
157
|
| Custom glue code | Brittle; rebuilt at every company; 2-4 engineering months | One `init()` call, one async SDK, one dependency |
|
|
158
|
-
|
|
|
158
|
+
| Ad hoc update/delete glue | Corrections overwrite history; deletion leaves vector residue | Deterministic `evolve()` operations with lineage, audit, and consistency results |
|
|
159
159
|
| *(nothing today)* | Raw PII stored indefinitely; compliance risk | PII detection, typed TTLs, hash-chained audit log |
|
|
160
160
|
|
|
161
161
|
---
|
|
@@ -217,6 +217,43 @@ async def main() -> None:
|
|
|
217
217
|
asyncio.run(main())
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
+
### Explicit memory evolution
|
|
221
|
+
|
|
222
|
+
When the caller already knows the operation, apply it directly:
|
|
223
|
+
|
|
224
|
+
```python
|
|
225
|
+
current = await db.factual.evolve(
|
|
226
|
+
"add",
|
|
227
|
+
"Customer prefers email.",
|
|
228
|
+
source="user_stated",
|
|
229
|
+
entity="user",
|
|
230
|
+
attribute="contact_preference",
|
|
231
|
+
)
|
|
232
|
+
assert current.memory is not None
|
|
233
|
+
result = await db.factual.evolve(
|
|
234
|
+
"update",
|
|
235
|
+
"Customer prefers SMS, not email.",
|
|
236
|
+
source="user_stated",
|
|
237
|
+
target_memory_id=current.memory.id,
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
print(result.previous_memory_ids)
|
|
241
|
+
print(result.memory.id)
|
|
242
|
+
print(result.consistency_token.memory_version)
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
`evolve()` supports `add`, `update`, `delete`, and `noop`. Corrections create a
|
|
246
|
+
successor and close the predecessor; they do not overwrite corrected content
|
|
247
|
+
in place. Delete hard-removes the selected row and vector. Same-speaker
|
|
248
|
+
duplicates are true no-ops and do not advance the memory version. The caller
|
|
249
|
+
selects the operation; this path does not use an LLM planner or the optional RL
|
|
250
|
+
manager.
|
|
251
|
+
|
|
252
|
+
See the
|
|
253
|
+
[explicit evolution contract](https://github.com/atomsai/contextdb/blob/main/docs/memory_evolution.md)
|
|
254
|
+
for conflict, contested-slot, audit, scoping, and Postgres transaction
|
|
255
|
+
semantics.
|
|
256
|
+
|
|
220
257
|
---
|
|
221
258
|
|
|
222
259
|
## Experiential memory
|
|
@@ -618,8 +655,8 @@ pip install 'pycontextdb[postgres]'
|
|
|
618
655
|
db = contextdb.init(storage_url="postgresql://...")
|
|
619
656
|
```
|
|
620
657
|
|
|
621
|
-
See [docs/serve.md](docs/serve.md), [docs/multi_tenant.md](docs/multi_tenant.md),
|
|
622
|
-
and [docs/trust_policy.md](docs/trust_policy.md).
|
|
658
|
+
See [docs/serve.md](https://github.com/atomsai/contextdb/blob/main/docs/serve.md), [docs/multi_tenant.md](https://github.com/atomsai/contextdb/blob/main/docs/multi_tenant.md),
|
|
659
|
+
and [docs/trust_policy.md](https://github.com/atomsai/contextdb/blob/main/docs/trust_policy.md).
|
|
623
660
|
|
|
624
661
|
## License and attribution
|
|
625
662
|
|
|
@@ -628,14 +665,16 @@ this README ships in this tree, with no feature gates. **ContextDB** is a
|
|
|
628
665
|
trademark; the Apache license is not a trademark license. Reselling
|
|
629
666
|
ContextDB as a service, or as part of one, under the ContextDB name or
|
|
630
667
|
branding requires a commercial agreement with Atoms AI — contact
|
|
631
|
-
contextdb@atomsai.com (see [COMMERCIAL.md](COMMERCIAL.md)).
|
|
668
|
+
contextdb@atomsai.com (see [COMMERCIAL.md](https://github.com/atomsai/contextdb/blob/main/COMMERCIAL.md)).
|
|
669
|
+
The binding product boundary is documented in
|
|
670
|
+
[OPEN_CORE.md](https://github.com/atomsai/contextdb/blob/main/OPEN_CORE.md). A public
|
|
632
671
|
credit line is optional — if you want one, use **Built with ContextDB**
|
|
633
672
|
linking to this repository.
|
|
634
673
|
|
|
635
674
|
## Contributing
|
|
636
675
|
|
|
637
676
|
Apache 2.0 — see [LICENSE](https://github.com/atomsai/contextdb/blob/main/LICENSE).
|
|
638
|
-
Substantial PRs need a CLA ([CONTRIBUTING.md](CONTRIBUTING.md)).
|
|
677
|
+
Substantial PRs need a CLA ([CONTRIBUTING.md](https://github.com/atomsai/contextdb/blob/main/CONTRIBUTING.md)).
|
|
639
678
|
See [`docs/architecture.md`](https://github.com/atomsai/contextdb/blob/main/docs/architecture.md) for the design rationale. Issues and pull requests welcome on [GitHub](https://github.com/atomsai/contextdb).
|
|
640
679
|
|
|
641
680
|
**Local setup:**
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<p align="center">
|
|
9
9
|
<a href="https://pypi.org/project/pycontextdb/"><img src="https://img.shields.io/pypi/v/pycontextdb.svg" alt="PyPI version"></a>
|
|
10
10
|
<a href="https://github.com/atomsai/contextdb/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License: Apache 2.0"></a>
|
|
11
|
-
<a href="https://github.com/atomsai/contextdb/blob/main/tests/"><img src="https://img.shields.io/badge/tests-
|
|
11
|
+
<a href="https://github.com/atomsai/contextdb/blob/main/tests/"><img src="https://img.shields.io/badge/tests-195%20passing-brightgreen.svg" alt="Tests"></a>
|
|
12
12
|
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.10%2B-blue.svg" alt="Python 3.10+"></a>
|
|
13
13
|
<a href="https://github.com/atomsai/contextdb/blob/main/pyproject.toml"><img src="https://img.shields.io/badge/mypy-strict-blue.svg" alt="Type Checked"></a>
|
|
14
14
|
<a href="https://github.com/atomsai/contextdb/blob/main/benchmarks/run_benchmarks.py"><img src="https://img.shields.io/badge/search_p95-%3C5ms_%40_5K-brightgreen.svg" alt="Search p95"></a>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
| **Search latency (5K memories)** | p50 **3.9ms** · p95 **5.0ms** |
|
|
37
37
|
| **Vector search (10K × 1,536d)** | p50 **0.8ms** · p95 **1.0ms** |
|
|
38
38
|
| **PII detection** | 100,000+ texts/sec |
|
|
39
|
-
| **Tests** |
|
|
39
|
+
| **Tests** | 195 passing (incl. 34 trust-model acceptance evals) · ruff clean · mypy `--strict` clean |
|
|
40
40
|
| **Dependencies** | SQLite + NumPy (FAISS / Postgres optional) |
|
|
41
41
|
|
|
42
42
|
Those search numbers are **SQLite + the in-repo mock embedder**. A recall
|
|
@@ -89,7 +89,7 @@ Databricks Lakebase gives agents a hard drive. ContextDB gives agents a brain.
|
|
|
89
89
|
| PostgreSQL / MongoDB | Static rows; no lifecycle; no graph links | `FactualMemory` with formation, evolution, and consolidation |
|
|
90
90
|
| S3 / flat files | Write-only archive; not queryable by meaning or time | `ExperientialMemory` for trajectories, reflections, and workflows |
|
|
91
91
|
| Custom glue code | Brittle; rebuilt at every company; 2-4 engineering months | One `init()` call, one async SDK, one dependency |
|
|
92
|
-
|
|
|
92
|
+
| Ad hoc update/delete glue | Corrections overwrite history; deletion leaves vector residue | Deterministic `evolve()` operations with lineage, audit, and consistency results |
|
|
93
93
|
| *(nothing today)* | Raw PII stored indefinitely; compliance risk | PII detection, typed TTLs, hash-chained audit log |
|
|
94
94
|
|
|
95
95
|
---
|
|
@@ -151,6 +151,43 @@ async def main() -> None:
|
|
|
151
151
|
asyncio.run(main())
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
+
### Explicit memory evolution
|
|
155
|
+
|
|
156
|
+
When the caller already knows the operation, apply it directly:
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
current = await db.factual.evolve(
|
|
160
|
+
"add",
|
|
161
|
+
"Customer prefers email.",
|
|
162
|
+
source="user_stated",
|
|
163
|
+
entity="user",
|
|
164
|
+
attribute="contact_preference",
|
|
165
|
+
)
|
|
166
|
+
assert current.memory is not None
|
|
167
|
+
result = await db.factual.evolve(
|
|
168
|
+
"update",
|
|
169
|
+
"Customer prefers SMS, not email.",
|
|
170
|
+
source="user_stated",
|
|
171
|
+
target_memory_id=current.memory.id,
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
print(result.previous_memory_ids)
|
|
175
|
+
print(result.memory.id)
|
|
176
|
+
print(result.consistency_token.memory_version)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
`evolve()` supports `add`, `update`, `delete`, and `noop`. Corrections create a
|
|
180
|
+
successor and close the predecessor; they do not overwrite corrected content
|
|
181
|
+
in place. Delete hard-removes the selected row and vector. Same-speaker
|
|
182
|
+
duplicates are true no-ops and do not advance the memory version. The caller
|
|
183
|
+
selects the operation; this path does not use an LLM planner or the optional RL
|
|
184
|
+
manager.
|
|
185
|
+
|
|
186
|
+
See the
|
|
187
|
+
[explicit evolution contract](https://github.com/atomsai/contextdb/blob/main/docs/memory_evolution.md)
|
|
188
|
+
for conflict, contested-slot, audit, scoping, and Postgres transaction
|
|
189
|
+
semantics.
|
|
190
|
+
|
|
154
191
|
---
|
|
155
192
|
|
|
156
193
|
## Experiential memory
|
|
@@ -552,8 +589,8 @@ pip install 'pycontextdb[postgres]'
|
|
|
552
589
|
db = contextdb.init(storage_url="postgresql://...")
|
|
553
590
|
```
|
|
554
591
|
|
|
555
|
-
See [docs/serve.md](docs/serve.md), [docs/multi_tenant.md](docs/multi_tenant.md),
|
|
556
|
-
and [docs/trust_policy.md](docs/trust_policy.md).
|
|
592
|
+
See [docs/serve.md](https://github.com/atomsai/contextdb/blob/main/docs/serve.md), [docs/multi_tenant.md](https://github.com/atomsai/contextdb/blob/main/docs/multi_tenant.md),
|
|
593
|
+
and [docs/trust_policy.md](https://github.com/atomsai/contextdb/blob/main/docs/trust_policy.md).
|
|
557
594
|
|
|
558
595
|
## License and attribution
|
|
559
596
|
|
|
@@ -562,14 +599,16 @@ this README ships in this tree, with no feature gates. **ContextDB** is a
|
|
|
562
599
|
trademark; the Apache license is not a trademark license. Reselling
|
|
563
600
|
ContextDB as a service, or as part of one, under the ContextDB name or
|
|
564
601
|
branding requires a commercial agreement with Atoms AI — contact
|
|
565
|
-
contextdb@atomsai.com (see [COMMERCIAL.md](COMMERCIAL.md)).
|
|
602
|
+
contextdb@atomsai.com (see [COMMERCIAL.md](https://github.com/atomsai/contextdb/blob/main/COMMERCIAL.md)).
|
|
603
|
+
The binding product boundary is documented in
|
|
604
|
+
[OPEN_CORE.md](https://github.com/atomsai/contextdb/blob/main/OPEN_CORE.md). A public
|
|
566
605
|
credit line is optional — if you want one, use **Built with ContextDB**
|
|
567
606
|
linking to this repository.
|
|
568
607
|
|
|
569
608
|
## Contributing
|
|
570
609
|
|
|
571
610
|
Apache 2.0 — see [LICENSE](https://github.com/atomsai/contextdb/blob/main/LICENSE).
|
|
572
|
-
Substantial PRs need a CLA ([CONTRIBUTING.md](CONTRIBUTING.md)).
|
|
611
|
+
Substantial PRs need a CLA ([CONTRIBUTING.md](https://github.com/atomsai/contextdb/blob/main/CONTRIBUTING.md)).
|
|
573
612
|
See [`docs/architecture.md`](https://github.com/atomsai/contextdb/blob/main/docs/architecture.md) for the design rationale. Issues and pull requests welcome on [GitHub](https://github.com/atomsai/contextdb).
|
|
574
613
|
|
|
575
614
|
**Local setup:**
|
|
@@ -10,16 +10,26 @@ from contextdb.core.config import ContextDBConfig
|
|
|
10
10
|
from contextdb.core.exceptions import (
|
|
11
11
|
ConfigError,
|
|
12
12
|
ContextDBError,
|
|
13
|
+
EvolutionConflictError,
|
|
14
|
+
EvolutionOperationConflictError,
|
|
15
|
+
EvolutionTargetNotFoundError,
|
|
16
|
+
EvolutionTargetRequiredError,
|
|
17
|
+
MemoryEvolutionError,
|
|
13
18
|
MemoryNotFoundError,
|
|
14
19
|
PrivacyError,
|
|
15
20
|
ScopeConflictError,
|
|
16
21
|
SourceRequiredError,
|
|
22
|
+
StaleReadError,
|
|
17
23
|
StorageError,
|
|
18
24
|
UnauthorizedError,
|
|
19
25
|
)
|
|
20
26
|
from contextdb.core.models import (
|
|
21
27
|
Edge,
|
|
22
28
|
Entity,
|
|
29
|
+
EvolutionOperation,
|
|
30
|
+
EvolutionOutcome,
|
|
31
|
+
MemoryConsistencyToken,
|
|
32
|
+
MemoryEvolutionResult,
|
|
23
33
|
MemoryItem,
|
|
24
34
|
MemoryStatus,
|
|
25
35
|
MemoryType,
|
|
@@ -29,8 +39,9 @@ from contextdb.core.models import (
|
|
|
29
39
|
)
|
|
30
40
|
from contextdb.core.policy import TrustPolicy
|
|
31
41
|
from contextdb.pool import ContextDBPool
|
|
42
|
+
from contextdb.utils.embeddings import EmbeddingProvider
|
|
32
43
|
|
|
33
|
-
__version__ = "0.
|
|
44
|
+
__version__ = "0.4.0"
|
|
34
45
|
|
|
35
46
|
__all__ = [
|
|
36
47
|
"Clock",
|
|
@@ -40,9 +51,19 @@ __all__ = [
|
|
|
40
51
|
"ContextDBError",
|
|
41
52
|
"ContextDBPool",
|
|
42
53
|
"Edge",
|
|
54
|
+
"EmbeddingProvider",
|
|
43
55
|
"Entity",
|
|
56
|
+
"EvolutionConflictError",
|
|
57
|
+
"EvolutionOperationConflictError",
|
|
58
|
+
"EvolutionOperation",
|
|
59
|
+
"EvolutionOutcome",
|
|
60
|
+
"EvolutionTargetNotFoundError",
|
|
61
|
+
"EvolutionTargetRequiredError",
|
|
44
62
|
"FrozenClock",
|
|
63
|
+
"MemoryEvolutionError",
|
|
64
|
+
"MemoryEvolutionResult",
|
|
45
65
|
"MemoryItem",
|
|
66
|
+
"MemoryConsistencyToken",
|
|
46
67
|
"MemoryNotFoundError",
|
|
47
68
|
"MemoryStatus",
|
|
48
69
|
"MemoryType",
|
|
@@ -52,6 +73,7 @@ __all__ = [
|
|
|
52
73
|
"RetentionPolicy",
|
|
53
74
|
"ScopeConflictError",
|
|
54
75
|
"SourceRequiredError",
|
|
76
|
+
"StaleReadError",
|
|
55
77
|
"StorageError",
|
|
56
78
|
"TrustPolicy",
|
|
57
79
|
"UnauthorizedError",
|
|
@@ -70,6 +92,8 @@ def init(
|
|
|
70
92
|
session_id: str | None = None,
|
|
71
93
|
clock: Clock | None = None,
|
|
72
94
|
trust_policy: TrustPolicy | None = None,
|
|
95
|
+
postgres_pool: Any | None = None,
|
|
96
|
+
embedding_provider: EmbeddingProvider | None = None,
|
|
73
97
|
**kwargs: Any,
|
|
74
98
|
) -> ContextDB:
|
|
75
99
|
"""Create a :class:`ContextDB` client.
|
|
@@ -84,6 +108,10 @@ def init(
|
|
|
84
108
|
config: Pre-built configuration. When ``None`` one is constructed
|
|
85
109
|
from ``kwargs`` and environment variables prefixed with
|
|
86
110
|
``CONTEXTDB_``.
|
|
111
|
+
postgres_pool: Optional externally owned asyncpg pool. Valid only with
|
|
112
|
+
a PostgreSQL ``storage_url``. ContextDB never closes this pool.
|
|
113
|
+
embedding_provider: Optional externally owned provider shared by the
|
|
114
|
+
host. ContextDB uses but never closes this provider.
|
|
87
115
|
**kwargs: Forwarded to :class:`ContextDBConfig` if ``config`` is
|
|
88
116
|
not provided.
|
|
89
117
|
|
|
@@ -99,4 +127,6 @@ def init(
|
|
|
99
127
|
session_id=session_id,
|
|
100
128
|
clock=clock,
|
|
101
129
|
trust_policy=trust_policy,
|
|
130
|
+
postgres_pool=postgres_pool,
|
|
131
|
+
embedding_provider=embedding_provider,
|
|
102
132
|
)
|