axio-context-sqlite 0.11.3__tar.gz → 0.12.1__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.
@@ -12,3 +12,4 @@ _build/
12
12
  .DS_Store
13
13
  *.sqlite
14
14
  *.db
15
+ .axio/mcp.local.json
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: axio-context-sqlite
3
- Version: 0.11.3
3
+ Version: 0.12.1
4
4
  Summary: SQLite-backed context store for Axio
5
5
  Project-URL: Documentation, https://docs.axio-agent.com
6
6
  Project-URL: Homepage, https://github.com/mosquito/axio-agent
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "axio-context-sqlite"
3
- version = "0.11.3"
3
+ version = "0.12.1"
4
4
  description = "SQLite-backed context store for Axio"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -14,6 +14,9 @@ classifiers = [
14
14
  keywords = ["llm", "agent", "ai", "sqlite", "context", "storage"]
15
15
  dependencies = ["axio", "aiosqlite>=0.20"]
16
16
 
17
+ [project.entry-points."axio.context"]
18
+ sqlite = "axio_context_sqlite.plugin:SQLiteContextBackend"
19
+
17
20
  [project.urls]
18
21
  Documentation = "https://docs.axio-agent.com"
19
22
  Homepage = "https://github.com/mosquito/axio-agent"
@@ -0,0 +1,28 @@
1
+ """Application context backend with one shared SQLite connection."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+ from uuid import uuid4
7
+
8
+ import aiosqlite
9
+
10
+ from .store import SQLiteContextStore, connect
11
+
12
+
13
+ class SQLiteContextBackend:
14
+ def __init__(self) -> None:
15
+ self.connection: aiosqlite.Connection | None = None
16
+
17
+ async def init(self, path: Path) -> None:
18
+ self.connection = await connect(path)
19
+
20
+ def create(self, session_id: str | None = None) -> SQLiteContextStore:
21
+ if self.connection is None:
22
+ raise RuntimeError("SQLite context backend is not initialized")
23
+ return SQLiteContextStore(self.connection, session_id or uuid4().hex)
24
+
25
+ async def close(self) -> None:
26
+ if self.connection is not None:
27
+ await self.connection.close()
28
+ self.connection = None