hivemind-sqlite-database 0.4.0a1__tar.gz → 0.4.0a3__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 (15) hide show
  1. {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a3}/PKG-INFO +5 -1
  2. hivemind_sqlite_database-0.4.0a3/README.md +122 -0
  3. {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a3}/hivemind_sqlite_database/version.py +1 -1
  4. {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a3}/hivemind_sqlite_database.egg-info/PKG-INFO +5 -1
  5. {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a3}/hivemind_sqlite_database.egg-info/requires.txt +5 -0
  6. {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a3}/pyproject.toml +5 -0
  7. hivemind_sqlite_database-0.4.0a1/README.md +0 -76
  8. {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a3}/LICENSE.md +0 -0
  9. {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a3}/hivemind_sqlite_database/__init__.py +0 -0
  10. {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a3}/hivemind_sqlite_database.egg-info/SOURCES.txt +0 -0
  11. {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a3}/hivemind_sqlite_database.egg-info/dependency_links.txt +0 -0
  12. {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a3}/hivemind_sqlite_database.egg-info/entry_points.txt +0 -0
  13. {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a3}/hivemind_sqlite_database.egg-info/top_level.txt +0 -0
  14. {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a3}/setup.cfg +0 -0
  15. {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a3}/tests/test_sqlitedb.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hivemind-sqlite-database
3
- Version: 0.4.0a1
3
+ Version: 0.4.0a3
4
4
  Summary: sqlite database plugin for hivemind-core
5
5
  Author-email: jarbasAi <jarbasai@mailfence.com>
6
6
  License: Apache-2.0
@@ -12,4 +12,8 @@ Requires-Dist: hivemind-bus-client
12
12
  Requires-Dist: ovos-utils
13
13
  Provides-Extra: cipher
14
14
  Requires-Dist: sqlcipher3; extra == "cipher"
15
+ Provides-Extra: test
16
+ Requires-Dist: pytest; extra == "test"
17
+ Requires-Dist: hivescope>=0.5.2a1; extra == "test"
18
+ Requires-Dist: hivemind-plugin-manager>=0.7.1a1; extra == "test"
15
19
  Dynamic: license-file
@@ -0,0 +1,122 @@
1
+ # hivemind-sqlite-database
2
+
3
+ SQLite database backend for [hivemind-core](https://github.com/JarbasHiveMind/HiveMind-core).
4
+
5
+ Implements the [`hivemind-plugin-manager`](https://github.com/JarbasHiveMind/hivemind-plugin-manager)
6
+ `AbstractDB` contract on top of Python's built-in `sqlite3` module (or `sqlcipher3` when
7
+ encryption is enabled). Client records (API keys, crypto keys, access-control lists) are stored in
8
+ a local `.db` file with WAL journal mode for safe multi-reader, single-writer access.
9
+
10
+ **This is the default database backend for fresh hivemind-core installations.**
11
+
12
+ ## Where it fits
13
+
14
+ ```
15
+ hivemind-core
16
+ └── hivemind-plugin-manager (DatabaseFactory loads plugins by entry-point)
17
+ └── hivemind-sqlite-database ← this repo
18
+ └── sqlite3 (stdlib) or sqlcipher3 (optional encryption)
19
+ ```
20
+
21
+ The plugin registers under the `hivemind.database` entry-point group as
22
+ `hivemind-sqlite-db-plugin`. `hivemind-core` loads it automatically when `server.json`
23
+ sets `database.module` to this name.
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ pip install hivemind-sqlite-database
29
+ ```
30
+
31
+ ### With encryption support (SQLCipher / AES-256)
32
+
33
+ ```bash
34
+ # Debian/Ubuntu — system library
35
+ sudo apt install libsqlcipher0
36
+
37
+ # Python binding
38
+ pip install "hivemind-sqlite-database[cipher]"
39
+ ```
40
+
41
+ > The `sqlcipher3` wheel on PyPI ships its own `libsqlcipher` for x86_64 Linux,
42
+ > so the `apt` step may be optional on that platform. On ARM or Alpine you must
43
+ > build from source and need the system library.
44
+
45
+ ## Quickstart
46
+
47
+ Add or update the `"database"` block in `~/.config/hivemind-core/server.json`:
48
+
49
+ ```json
50
+ {
51
+ "database": {
52
+ "module": "hivemind-sqlite-db-plugin",
53
+ "hivemind-sqlite-db-plugin": {
54
+ "name": "clients",
55
+ "subfolder": "hivemind-core"
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ Then start (or restart) hivemind-core:
62
+
63
+ ```bash
64
+ hivemind-core listen
65
+ ```
66
+
67
+ The database file is created automatically at
68
+ `$XDG_DATA_HOME/hivemind-core/clients.db` (typically `~/.local/share/hivemind-core/clients.db`).
69
+
70
+ ### Optional encryption (SQLCipher)
71
+
72
+ ```json
73
+ {
74
+ "database": {
75
+ "module": "hivemind-sqlite-db-plugin",
76
+ "hivemind-sqlite-db-plugin": {
77
+ "name": "clients",
78
+ "subfolder": "hivemind-core",
79
+ "password": "your-strong-passphrase"
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ > **Warning**: There is no password recovery. If you lose the passphrase the database
86
+ > is permanently unrecoverable. Back up the passphrase securely.
87
+
88
+ ## Configuration reference
89
+
90
+ | Key | Default | Description |
91
+ |---|---|---|
92
+ | `name` | `"clients"` | Base filename (without extension). The database is `<name>.db`. |
93
+ | `subfolder` | `"hivemind-core"` | XDG subfolder under `$XDG_DATA_HOME`. |
94
+ | `password` | `null` | When set (non-empty string), opens the database with SQLCipher AES-256 encryption. Requires the `[cipher]` extra. |
95
+
96
+ The full path resolves to `$XDG_DATA_HOME/<subfolder>/<name>.db`,
97
+ typically `~/.local/share/hivemind-core/clients.db`.
98
+
99
+ ## Schema migration
100
+
101
+ On first open after an upgrade, `SQLiteDB` runs an automatic schema migration.
102
+ Version tracking uses SQLite's built-in `PRAGMA user_version` — no sibling files.
103
+
104
+ The v1→v2 migration folds legacy `intent_blacklist` / `skill_blacklist` column
105
+ data into each row's `metadata` JSON field and NULLs the legacy columns.
106
+ `message_blacklist` is purged outright.
107
+
108
+ The migration is idempotent, crash-safe, and transactional — the row rewrites
109
+ and the `user_version` bump happen in one transaction.
110
+
111
+ To migrate an existing installation to this backend, use hivemind-core's built-in
112
+ command:
113
+
114
+ ```bash
115
+ hivemind-core migrate-db
116
+ ```
117
+
118
+ ## Docs
119
+
120
+ - [docs/architecture.md](docs/architecture.md) — internals, WAL mode, schema, migration
121
+ - [docs/configuration.md](docs/configuration.md) — full configuration reference
122
+ - [docs/operations.md](docs/operations.md) — file locations, backup, encryption, authoring a plugin
@@ -2,7 +2,7 @@
2
2
  VERSION_MAJOR = 0
3
3
  VERSION_MINOR = 4
4
4
  VERSION_BUILD = 0
5
- VERSION_ALPHA = 1
5
+ VERSION_ALPHA = 3
6
6
  # END_VERSION_BLOCK
7
7
 
8
8
  __version__ = f"{VERSION_MAJOR}.{VERSION_MINOR}.{VERSION_BUILD}" + (f"a{VERSION_ALPHA}" if VERSION_ALPHA else "")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hivemind-sqlite-database
3
- Version: 0.4.0a1
3
+ Version: 0.4.0a3
4
4
  Summary: sqlite database plugin for hivemind-core
5
5
  Author-email: jarbasAi <jarbasai@mailfence.com>
6
6
  License: Apache-2.0
@@ -12,4 +12,8 @@ Requires-Dist: hivemind-bus-client
12
12
  Requires-Dist: ovos-utils
13
13
  Provides-Extra: cipher
14
14
  Requires-Dist: sqlcipher3; extra == "cipher"
15
+ Provides-Extra: test
16
+ Requires-Dist: pytest; extra == "test"
17
+ Requires-Dist: hivescope>=0.5.2a1; extra == "test"
18
+ Requires-Dist: hivemind-plugin-manager>=0.7.1a1; extra == "test"
15
19
  Dynamic: license-file
@@ -4,3 +4,8 @@ ovos-utils
4
4
 
5
5
  [cipher]
6
6
  sqlcipher3
7
+
8
+ [test]
9
+ pytest
10
+ hivescope>=0.5.2a1
11
+ hivemind-plugin-manager>=0.7.1a1
@@ -18,6 +18,11 @@ dependencies = [
18
18
 
19
19
  [project.optional-dependencies]
20
20
  cipher = ["sqlcipher3"]
21
+ test = [
22
+ "pytest",
23
+ "hivescope>=0.5.2a1",
24
+ "hivemind-plugin-manager>=0.7.1a1",
25
+ ]
21
26
 
22
27
  [project.urls]
23
28
  Homepage = "https://github.com/JarbasHiveMind/hivemind-sqlite-database"
@@ -1,76 +0,0 @@
1
- # HiveMind SQLite Database
2
-
3
- SQLite database plugin for [hivemind-core](https://github.com/JarbasHiveMind/HiveMind-core).
4
-
5
- Implements the `AbstractDB` interface via `hivemind-plugin-manager` and stores HiveMind
6
- client records (API keys, crypto keys, access-control lists) in a local SQLite file.
7
-
8
- ## Installation
9
-
10
- ```bash
11
- pip install hivemind-sqlite-database
12
- ```
13
-
14
- ### With encryption support (SQLCipher)
15
-
16
- ```bash
17
- # 1. Install the SQLCipher system library
18
- # Debian/Ubuntu:
19
- sudo apt install libsqlcipher0
20
-
21
- # 2. Install the Python binding via the optional extra
22
- pip install "hivemind-sqlite-database[cipher]"
23
- ```
24
-
25
- > The `sqlcipher3` wheel on PyPI ships its own libsqlcipher for x86_64 Linux, so the
26
- > `apt` step may be optional on that platform. On ARM or Alpine you must build from
27
- > source and will need the system library.
28
-
29
- ## Usage
30
-
31
- ### Plain (unencrypted) database — default
32
-
33
- ```python
34
- from hivemind_sqlite_database import SQLiteDB
35
-
36
- db = SQLiteDB() # stores data in XDG_DATA_HOME/hivemind-core/clients.db
37
- ```
38
-
39
- ### Encrypted database (SQLCipher / AES-256)
40
-
41
- ```python
42
- from hivemind_sqlite_database import SQLiteDB
43
-
44
- db = SQLiteDB(password="your-strong-passphrase")
45
- ```
46
-
47
- Pass the same `password` every time you open the database. The encryption is
48
- transparent — all existing methods (`add_item`, `search_by_value`, etc.) work
49
- identically.
50
-
51
- > **Data-loss warning**: There is no password recovery. If you lose the passphrase
52
- > the database is permanently unrecoverable. Back up your passphrase securely.
53
-
54
- ### hivemind-core configuration
55
-
56
- ```json
57
- {
58
- "database": {
59
- "module": "hivemind-sqlite-db-plugin",
60
- "hivemind-sqlite-db-plugin": {
61
- "name": "clients",
62
- "subfolder": "hivemind-core",
63
- "password": "your-strong-passphrase"
64
- }
65
- }
66
- }
67
- ```
68
-
69
- Leave `"password"` out (or set it to `null`) to use an unencrypted database.
70
-
71
- ## Notes
72
-
73
- - An encrypted database cannot be opened by the plain `sqlite3` CLI or stdlib module.
74
- - A plaintext database cannot be opened as encrypted. There is no automatic migration.
75
- - The `password` field maps directly to SQLCipher's `PRAGMA key`.
76
- - WAL journal mode is enabled for both encrypted and unencrypted databases.