hivemind-sqlite-database 0.4.0a1__tar.gz → 0.4.0a2__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.
- {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a2}/PKG-INFO +1 -1
- hivemind_sqlite_database-0.4.0a2/README.md +122 -0
- {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a2}/hivemind_sqlite_database/version.py +1 -1
- {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a2}/hivemind_sqlite_database.egg-info/PKG-INFO +1 -1
- hivemind_sqlite_database-0.4.0a1/README.md +0 -76
- {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a2}/LICENSE.md +0 -0
- {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a2}/hivemind_sqlite_database/__init__.py +0 -0
- {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a2}/hivemind_sqlite_database.egg-info/SOURCES.txt +0 -0
- {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a2}/hivemind_sqlite_database.egg-info/dependency_links.txt +0 -0
- {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a2}/hivemind_sqlite_database.egg-info/entry_points.txt +0 -0
- {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a2}/hivemind_sqlite_database.egg-info/requires.txt +0 -0
- {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a2}/hivemind_sqlite_database.egg-info/top_level.txt +0 -0
- {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a2}/pyproject.toml +0 -0
- {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a2}/setup.cfg +0 -0
- {hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a2}/tests/test_sqlitedb.py +0 -0
|
@@ -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
|
|
@@ -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.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hivemind_sqlite_database-0.4.0a1 → hivemind_sqlite_database-0.4.0a2}/tests/test_sqlitedb.py
RENAMED
|
File without changes
|