axio-context-sqlite 0.11.2__tar.gz → 0.12.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.
@@ -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.2
3
+ Version: 0.12.0
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
@@ -70,6 +70,7 @@ from axio_context_sqlite import connect, SQLiteContextStore
70
70
  from axio.messages import Message
71
71
  from axio.blocks import TextBlock
72
72
 
73
+
73
74
  async def main() -> None:
74
75
  conn = await connect(pathlib.Path(tempfile.mkdtemp()) / "chat.db")
75
76
  try:
@@ -80,6 +81,7 @@ async def main() -> None:
80
81
  finally:
81
82
  await conn.close()
82
83
 
84
+
83
85
  asyncio.run(main())
84
86
  ```
85
87
 
@@ -109,6 +111,7 @@ Every connection opened by `connect()` is configured with:
109
111
  name: test_readme_agent
110
112
  ```python
111
113
  from axio.testing import StubTransport, make_text_response
114
+
112
115
  transport = StubTransport([make_text_response("Hi!")])
113
116
  ```
114
117
  -->
@@ -120,6 +123,7 @@ import pathlib
120
123
  from axio.agent import Agent
121
124
  from axio_context_sqlite import connect, SQLiteContextStore
122
125
 
126
+
123
127
  async def main() -> None:
124
128
  conn = await connect(pathlib.Path(tempfile.mkdtemp()) / "chat.db")
125
129
  try:
@@ -130,6 +134,7 @@ async def main() -> None:
130
134
  finally:
131
135
  await conn.close()
132
136
 
137
+
133
138
  asyncio.run(main())
134
139
  ```
135
140
 
@@ -144,6 +149,7 @@ from axio_context_sqlite import connect, SQLiteContextStore
144
149
  from axio.messages import Message
145
150
  from axio.blocks import TextBlock
146
151
 
152
+
147
153
  async def main() -> None:
148
154
  conn = await connect(pathlib.Path(tempfile.mkdtemp()) / "chat.db")
149
155
  try:
@@ -156,6 +162,7 @@ async def main() -> None:
156
162
  finally:
157
163
  await conn.close()
158
164
 
165
+
159
166
  asyncio.run(main())
160
167
  ```
161
168
 
@@ -183,6 +190,7 @@ from axio_context_sqlite import connect, SQLiteContextStore
183
190
  from axio.messages import Message
184
191
  from axio.blocks import TextBlock
185
192
 
193
+
186
194
  async def main() -> None:
187
195
  conn = await connect(pathlib.Path(tempfile.mkdtemp()) / "chat.db")
188
196
  try:
@@ -194,6 +202,7 @@ async def main() -> None:
194
202
  finally:
195
203
  await conn.close()
196
204
 
205
+
197
206
  asyncio.run(main())
198
207
  ```
199
208
 
@@ -52,6 +52,7 @@ from axio_context_sqlite import connect, SQLiteContextStore
52
52
  from axio.messages import Message
53
53
  from axio.blocks import TextBlock
54
54
 
55
+
55
56
  async def main() -> None:
56
57
  conn = await connect(pathlib.Path(tempfile.mkdtemp()) / "chat.db")
57
58
  try:
@@ -62,6 +63,7 @@ async def main() -> None:
62
63
  finally:
63
64
  await conn.close()
64
65
 
66
+
65
67
  asyncio.run(main())
66
68
  ```
67
69
 
@@ -91,6 +93,7 @@ Every connection opened by `connect()` is configured with:
91
93
  name: test_readme_agent
92
94
  ```python
93
95
  from axio.testing import StubTransport, make_text_response
96
+
94
97
  transport = StubTransport([make_text_response("Hi!")])
95
98
  ```
96
99
  -->
@@ -102,6 +105,7 @@ import pathlib
102
105
  from axio.agent import Agent
103
106
  from axio_context_sqlite import connect, SQLiteContextStore
104
107
 
108
+
105
109
  async def main() -> None:
106
110
  conn = await connect(pathlib.Path(tempfile.mkdtemp()) / "chat.db")
107
111
  try:
@@ -112,6 +116,7 @@ async def main() -> None:
112
116
  finally:
113
117
  await conn.close()
114
118
 
119
+
115
120
  asyncio.run(main())
116
121
  ```
117
122
 
@@ -126,6 +131,7 @@ from axio_context_sqlite import connect, SQLiteContextStore
126
131
  from axio.messages import Message
127
132
  from axio.blocks import TextBlock
128
133
 
134
+
129
135
  async def main() -> None:
130
136
  conn = await connect(pathlib.Path(tempfile.mkdtemp()) / "chat.db")
131
137
  try:
@@ -138,6 +144,7 @@ async def main() -> None:
138
144
  finally:
139
145
  await conn.close()
140
146
 
147
+
141
148
  asyncio.run(main())
142
149
  ```
143
150
 
@@ -165,6 +172,7 @@ from axio_context_sqlite import connect, SQLiteContextStore
165
172
  from axio.messages import Message
166
173
  from axio.blocks import TextBlock
167
174
 
175
+
168
176
  async def main() -> None:
169
177
  conn = await connect(pathlib.Path(tempfile.mkdtemp()) / "chat.db")
170
178
  try:
@@ -176,6 +184,7 @@ async def main() -> None:
176
184
  finally:
177
185
  await conn.close()
178
186
 
187
+
179
188
  asyncio.run(main())
180
189
  ```
181
190
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "axio-context-sqlite"
3
- version = "0.11.2"
3
+ version = "0.12.0"
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