vexor 0.21.0__py3-none-any.whl → 0.21.1__py3-none-any.whl
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.
- vexor/__init__.py +1 -1
- vexor/cache.py +57 -14
- {vexor-0.21.0.dist-info → vexor-0.21.1.dist-info}/METADATA +1 -1
- {vexor-0.21.0.dist-info → vexor-0.21.1.dist-info}/RECORD +7 -7
- {vexor-0.21.0.dist-info → vexor-0.21.1.dist-info}/WHEEL +0 -0
- {vexor-0.21.0.dist-info → vexor-0.21.1.dist-info}/entry_points.txt +0 -0
- {vexor-0.21.0.dist-info → vexor-0.21.1.dist-info}/licenses/LICENSE +0 -0
vexor/__init__.py
CHANGED
vexor/cache.py
CHANGED
|
@@ -143,8 +143,17 @@ def cache_file(root: Path, model: str, include_hidden: bool) -> Path: # pragma:
|
|
|
143
143
|
return cache_db_path()
|
|
144
144
|
|
|
145
145
|
|
|
146
|
-
def _connect(
|
|
147
|
-
|
|
146
|
+
def _connect(
|
|
147
|
+
db_path: Path,
|
|
148
|
+
*,
|
|
149
|
+
readonly: bool = False,
|
|
150
|
+
query_only: bool = False,
|
|
151
|
+
) -> sqlite3.Connection:
|
|
152
|
+
if readonly:
|
|
153
|
+
db_uri = f"file:{db_path.as_posix()}?mode=ro"
|
|
154
|
+
conn = sqlite3.connect(db_uri, uri=True)
|
|
155
|
+
else:
|
|
156
|
+
conn = sqlite3.connect(db_path)
|
|
148
157
|
conn.row_factory = sqlite3.Row
|
|
149
158
|
try:
|
|
150
159
|
conn.execute("PRAGMA journal_mode = WAL;")
|
|
@@ -155,9 +164,23 @@ def _connect(db_path: Path) -> sqlite3.Connection:
|
|
|
155
164
|
conn.execute("PRAGMA temp_store = MEMORY;")
|
|
156
165
|
conn.execute("PRAGMA busy_timeout = 5000;")
|
|
157
166
|
conn.execute("PRAGMA foreign_keys = ON;")
|
|
167
|
+
if readonly or query_only:
|
|
168
|
+
conn.execute("PRAGMA query_only = ON;")
|
|
158
169
|
return conn
|
|
159
170
|
|
|
160
171
|
|
|
172
|
+
def _ensure_schema_readonly(
|
|
173
|
+
conn: sqlite3.Connection,
|
|
174
|
+
*,
|
|
175
|
+
tables: Sequence[str],
|
|
176
|
+
) -> None:
|
|
177
|
+
if _schema_needs_reset(conn):
|
|
178
|
+
raise sqlite3.OperationalError("Schema reset required")
|
|
179
|
+
for table in tables:
|
|
180
|
+
if not _table_exists(conn, table):
|
|
181
|
+
raise sqlite3.OperationalError(f"Missing table: {table}")
|
|
182
|
+
|
|
183
|
+
|
|
161
184
|
def _table_exists(conn: sqlite3.Connection, table: str) -> bool:
|
|
162
185
|
row = conn.execute(
|
|
163
186
|
"SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",
|
|
@@ -883,9 +906,15 @@ def load_index(
|
|
|
883
906
|
if not db_path.exists():
|
|
884
907
|
raise FileNotFoundError(db_path)
|
|
885
908
|
|
|
886
|
-
conn = _connect(db_path)
|
|
909
|
+
conn = _connect(db_path, readonly=True)
|
|
887
910
|
try:
|
|
888
|
-
|
|
911
|
+
try:
|
|
912
|
+
_ensure_schema_readonly(
|
|
913
|
+
conn,
|
|
914
|
+
tables=("index_metadata", "indexed_file", "indexed_chunk", "chunk_meta"),
|
|
915
|
+
)
|
|
916
|
+
except sqlite3.OperationalError:
|
|
917
|
+
raise FileNotFoundError(db_path)
|
|
889
918
|
key = _cache_key(
|
|
890
919
|
root,
|
|
891
920
|
include_hidden,
|
|
@@ -993,9 +1022,20 @@ def load_index_vectors(
|
|
|
993
1022
|
if not db_path.exists():
|
|
994
1023
|
raise FileNotFoundError(db_path)
|
|
995
1024
|
|
|
996
|
-
conn = _connect(db_path)
|
|
1025
|
+
conn = _connect(db_path, readonly=True)
|
|
997
1026
|
try:
|
|
998
|
-
|
|
1027
|
+
try:
|
|
1028
|
+
_ensure_schema_readonly(
|
|
1029
|
+
conn,
|
|
1030
|
+
tables=(
|
|
1031
|
+
"index_metadata",
|
|
1032
|
+
"indexed_file",
|
|
1033
|
+
"indexed_chunk",
|
|
1034
|
+
"chunk_embedding",
|
|
1035
|
+
),
|
|
1036
|
+
)
|
|
1037
|
+
except sqlite3.OperationalError:
|
|
1038
|
+
raise FileNotFoundError(db_path)
|
|
999
1039
|
key = _cache_key(
|
|
1000
1040
|
root,
|
|
1001
1041
|
include_hidden,
|
|
@@ -1149,12 +1189,15 @@ def load_chunk_metadata(
|
|
|
1149
1189
|
db_path = cache_db_path()
|
|
1150
1190
|
owns_connection = conn is None
|
|
1151
1191
|
try:
|
|
1152
|
-
connection = conn or _connect(db_path)
|
|
1192
|
+
connection = conn or _connect(db_path, readonly=True)
|
|
1153
1193
|
except sqlite3.OperationalError:
|
|
1154
1194
|
return {}
|
|
1155
1195
|
try:
|
|
1156
1196
|
try:
|
|
1157
|
-
|
|
1197
|
+
_ensure_schema_readonly(
|
|
1198
|
+
connection,
|
|
1199
|
+
tables=("indexed_chunk", "chunk_meta"),
|
|
1200
|
+
)
|
|
1158
1201
|
except sqlite3.OperationalError:
|
|
1159
1202
|
return {}
|
|
1160
1203
|
results: dict[int, dict] = {}
|
|
@@ -1193,12 +1236,12 @@ def load_query_vector(
|
|
|
1193
1236
|
db_path = cache_db_path()
|
|
1194
1237
|
owns_connection = conn is None
|
|
1195
1238
|
try:
|
|
1196
|
-
connection = conn or _connect(db_path)
|
|
1239
|
+
connection = conn or _connect(db_path, readonly=True)
|
|
1197
1240
|
except sqlite3.OperationalError:
|
|
1198
1241
|
return None
|
|
1199
1242
|
try:
|
|
1200
1243
|
try:
|
|
1201
|
-
|
|
1244
|
+
_ensure_schema_readonly(connection, tables=("query_cache",))
|
|
1202
1245
|
except sqlite3.OperationalError:
|
|
1203
1246
|
return None
|
|
1204
1247
|
row = connection.execute(
|
|
@@ -1270,12 +1313,12 @@ def load_embedding_cache(
|
|
|
1270
1313
|
db_path = cache_db_path()
|
|
1271
1314
|
owns_connection = conn is None
|
|
1272
1315
|
try:
|
|
1273
|
-
connection = conn or _connect(db_path)
|
|
1316
|
+
connection = conn or _connect(db_path, readonly=True)
|
|
1274
1317
|
except sqlite3.OperationalError:
|
|
1275
1318
|
return {}
|
|
1276
1319
|
try:
|
|
1277
1320
|
try:
|
|
1278
|
-
|
|
1321
|
+
_ensure_schema_readonly(connection, tables=("embedding_cache",))
|
|
1279
1322
|
except sqlite3.OperationalError:
|
|
1280
1323
|
return {}
|
|
1281
1324
|
results: dict[str, np.ndarray] = {}
|
|
@@ -1433,12 +1476,12 @@ def list_cache_entries() -> list[dict[str, object]]:
|
|
|
1433
1476
|
return []
|
|
1434
1477
|
|
|
1435
1478
|
try:
|
|
1436
|
-
conn = _connect(db_path)
|
|
1479
|
+
conn = _connect(db_path, readonly=True)
|
|
1437
1480
|
except sqlite3.OperationalError:
|
|
1438
1481
|
return []
|
|
1439
1482
|
try:
|
|
1440
1483
|
try:
|
|
1441
|
-
|
|
1484
|
+
_ensure_schema_readonly(conn, tables=("index_metadata", "indexed_file"))
|
|
1442
1485
|
except sqlite3.OperationalError:
|
|
1443
1486
|
return []
|
|
1444
1487
|
rows = conn.execute(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
vexor/__init__.py,sha256=
|
|
1
|
+
vexor/__init__.py,sha256=Ab63nROf2nbDW-xY4wuNU_DS0K8hsqfPa1KjvCaKJzA,441
|
|
2
2
|
vexor/__main__.py,sha256=ZFzom1wCfP6TPXe3aoDFpNcUgjbCZ7Quy_vfzNsH5Fw,426
|
|
3
3
|
vexor/api.py,sha256=YCHpiydbPbRJUqdQYrpwe1JrRI-w_7LRuyZDGBP1_d4,11506
|
|
4
|
-
vexor/cache.py,sha256=
|
|
4
|
+
vexor/cache.py,sha256=20SaiBKkPJIDXHtflX6uHiQXI4DtD6wx7RtWbz2l6LU,54339
|
|
5
5
|
vexor/cli.py,sha256=M9GKdD_mJ068Zpm62znTp0KhhKp1dkh_WHmfJHR9hwU,68094
|
|
6
6
|
vexor/config.py,sha256=CiPfEH7Ilt6XepEx4p02qfW5HfkpNDBjhEMyckbSWaA,17413
|
|
7
7
|
vexor/modes.py,sha256=N_wAWoqbxmCfko-v520p59tpAYvUwraCSSQRtMaF4ac,11549
|
|
@@ -26,8 +26,8 @@ vexor/services/skill_service.py,sha256=Rrgt3OMsKPPiXOiRhSNAWjBM9UNz9qmSWQe3uYGzq
|
|
|
26
26
|
vexor/services/system_service.py,sha256=KPlv83v3rTvBiNiH7vrp6tDmt_AqHxuUd-5RI0TfvWs,24638
|
|
27
27
|
vexor/_bundled_skills/vexor-cli/SKILL.md,sha256=m3FlyqgHBdRwyGPEp8PrUS21K0G2jEl88tRvhSPta08,2798
|
|
28
28
|
vexor/_bundled_skills/vexor-cli/references/install-vexor.md,sha256=IUBShLI1mAxugwUIMAJQ5_j6KcaPWfobe0gSd6MWU7w,1245
|
|
29
|
-
vexor-0.21.
|
|
30
|
-
vexor-0.21.
|
|
31
|
-
vexor-0.21.
|
|
32
|
-
vexor-0.21.
|
|
33
|
-
vexor-0.21.
|
|
29
|
+
vexor-0.21.1.dist-info/METADATA,sha256=jS_xdqPXD8WsDNKd684w5eHmj_f1CHvNMR-DY-MvBQg,13494
|
|
30
|
+
vexor-0.21.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
31
|
+
vexor-0.21.1.dist-info/entry_points.txt,sha256=dvxp6Q1R1d6bozR7TwmpdJ0X_v83MkzsLPagGY_lfr0,40
|
|
32
|
+
vexor-0.21.1.dist-info/licenses/LICENSE,sha256=wP7TAKRll1t9LoYGxWS9NikPM_0hCc00LmlLyvQBsL8,1066
|
|
33
|
+
vexor-0.21.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|