ltcai 4.0.1 → 4.2.0

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 (192) hide show
  1. package/README.md +33 -24
  2. package/desktop/electron/main.cjs +44 -0
  3. package/docs/CHANGELOG.md +84 -0
  4. package/docs/V4_1_FRONTEND_ARCHITECTURE_REVIEW.md +65 -0
  5. package/docs/V4_1_FRONTEND_MIGRATION_REPORT.md +70 -0
  6. package/docs/V4_1_VALIDATION_REPORT.md +47 -0
  7. package/docs/V4_2_BRAIN_CORE_ARCHITECTURE.md +97 -0
  8. package/docs/V4_2_STORAGE_MIGRATION_REPORT.md +91 -0
  9. package/docs/V4_2_VALIDATION_REPORT.md +89 -0
  10. package/docs/V4_DIGITAL_BRAIN_RECOVERY.md +31 -26
  11. package/frontend/index.html +24 -0
  12. package/frontend/openapi.json +14436 -0
  13. package/frontend/src/App.tsx +184 -0
  14. package/frontend/src/api/client.ts +320 -0
  15. package/frontend/src/api/openapi.ts +16921 -0
  16. package/frontend/src/components/primitives.tsx +204 -0
  17. package/frontend/src/components/ui/badge.tsx +27 -0
  18. package/frontend/src/components/ui/button.tsx +37 -0
  19. package/frontend/src/components/ui/card.tsx +22 -0
  20. package/frontend/src/components/ui/input.tsx +16 -0
  21. package/frontend/src/components/ui/textarea.tsx +16 -0
  22. package/frontend/src/lib/utils.ts +33 -0
  23. package/frontend/src/main.tsx +23 -0
  24. package/frontend/src/pages/Act.tsx +245 -0
  25. package/frontend/src/pages/Ask.tsx +200 -0
  26. package/frontend/src/pages/Brain.tsx +267 -0
  27. package/frontend/src/pages/Capture.tsx +158 -0
  28. package/frontend/src/pages/Library.tsx +187 -0
  29. package/frontend/src/pages/System.tsx +378 -0
  30. package/frontend/src/routes.ts +85 -0
  31. package/frontend/src/store/appStore.ts +54 -0
  32. package/frontend/src/styles.css +107 -0
  33. package/kg_schema.py +1 -1
  34. package/knowledge_graph.py +4 -4
  35. package/lattice_brain/__init__.py +70 -0
  36. package/lattice_brain/_kg_common.py +1 -0
  37. package/lattice_brain/archive.py +133 -0
  38. package/lattice_brain/context.py +3 -0
  39. package/lattice_brain/conversations.py +3 -0
  40. package/lattice_brain/core.py +82 -0
  41. package/lattice_brain/discovery.py +1 -0
  42. package/lattice_brain/documents.py +1 -0
  43. package/lattice_brain/embeddings.py +82 -0
  44. package/lattice_brain/identity.py +13 -0
  45. package/lattice_brain/ingest.py +1 -0
  46. package/lattice_brain/memory.py +3 -0
  47. package/lattice_brain/network.py +1 -0
  48. package/lattice_brain/projection.py +1 -0
  49. package/lattice_brain/provenance.py +1 -0
  50. package/lattice_brain/retrieval.py +1 -0
  51. package/lattice_brain/schema.py +1 -0
  52. package/lattice_brain/storage/__init__.py +22 -0
  53. package/lattice_brain/storage/base.py +72 -0
  54. package/lattice_brain/storage/docker.py +105 -0
  55. package/lattice_brain/storage/factory.py +31 -0
  56. package/lattice_brain/storage/migration.py +190 -0
  57. package/lattice_brain/storage/postgres.py +123 -0
  58. package/lattice_brain/storage/sqlite.py +128 -0
  59. package/lattice_brain/store.py +3 -0
  60. package/lattice_brain/write_master.py +1 -0
  61. package/latticeai/__init__.py +1 -1
  62. package/latticeai/api/portability.py +69 -0
  63. package/latticeai/api/setup.py +5 -4
  64. package/latticeai/api/static_routes.py +4 -4
  65. package/latticeai/app_factory.py +17 -10
  66. package/latticeai/brain/__init__.py +6 -6
  67. package/latticeai/brain/_kg_common.py +1 -1
  68. package/latticeai/brain/network.py +1 -1
  69. package/latticeai/brain/retrieval.py +15 -0
  70. package/latticeai/brain/store.py +22 -6
  71. package/latticeai/core/config.py +8 -0
  72. package/latticeai/core/marketplace.py +1 -1
  73. package/latticeai/core/multi_agent.py +1 -1
  74. package/latticeai/core/workspace_os.py +1 -1
  75. package/latticeai/services/kg_portability.py +82 -1
  76. package/package.json +55 -15
  77. package/scripts/build_frontend_assets.mjs +38 -0
  78. package/scripts/bump_version.py +4 -1
  79. package/scripts/export_openapi.py +31 -0
  80. package/scripts/lint_frontend.mjs +91 -0
  81. package/scripts/migrate_brain_storage.py +53 -0
  82. package/scripts/run_python.mjs +47 -0
  83. package/scripts/wheel_smoke.py +3 -0
  84. package/src-tauri/Cargo.lock +4833 -0
  85. package/src-tauri/Cargo.toml +19 -0
  86. package/src-tauri/build.rs +3 -0
  87. package/src-tauri/capabilities/default.json +7 -0
  88. package/src-tauri/src/main.rs +78 -0
  89. package/src-tauri/tauri.conf.json +39 -0
  90. package/static/app/asset-manifest.json +32 -0
  91. package/static/app/assets/core-CwxXejkd.js +2 -0
  92. package/static/app/assets/core-CwxXejkd.js.map +1 -0
  93. package/static/app/assets/index-CDjiH_se.css +2 -0
  94. package/static/app/assets/index-C_HAkbAg.js +333 -0
  95. package/static/app/assets/index-C_HAkbAg.js.map +1 -0
  96. package/static/app/index.html +25 -0
  97. package/static/manifest.json +2 -2
  98. package/static/sw.js +4 -4
  99. package/scripts/build_v3_assets.mjs +0 -170
  100. package/scripts/lint_v3.mjs +0 -120
  101. package/static/v3/asset-manifest.json +0 -63
  102. package/static/v3/css/lattice.base.49deefb5.css +0 -128
  103. package/static/v3/css/lattice.base.css +0 -128
  104. package/static/v3/css/lattice.components.cde18231.css +0 -472
  105. package/static/v3/css/lattice.components.css +0 -472
  106. package/static/v3/css/lattice.shell.29d36d85.css +0 -452
  107. package/static/v3/css/lattice.shell.css +0 -452
  108. package/static/v3/css/lattice.tokens.304cbc40.css +0 -135
  109. package/static/v3/css/lattice.tokens.css +0 -135
  110. package/static/v3/css/lattice.views.0a18b6c5.css +0 -360
  111. package/static/v3/css/lattice.views.css +0 -360
  112. package/static/v3/index.html +0 -68
  113. package/static/v3/js/app.c5c80c46.js +0 -26
  114. package/static/v3/js/app.js +0 -26
  115. package/static/v3/js/core/api.ba0fbf14.js +0 -625
  116. package/static/v3/js/core/api.js +0 -625
  117. package/static/v3/js/core/components.f25b3b93.js +0 -230
  118. package/static/v3/js/core/components.js +0 -230
  119. package/static/v3/js/core/dom.a2773eb0.js +0 -148
  120. package/static/v3/js/core/dom.js +0 -148
  121. package/static/v3/js/core/i18n.880e1fec.js +0 -575
  122. package/static/v3/js/core/i18n.js +0 -575
  123. package/static/v3/js/core/router.584570f2.js +0 -37
  124. package/static/v3/js/core/router.js +0 -37
  125. package/static/v3/js/core/routes.37522821.js +0 -101
  126. package/static/v3/js/core/routes.js +0 -101
  127. package/static/v3/js/core/shell.e3f6bbfa.js +0 -420
  128. package/static/v3/js/core/shell.js +0 -420
  129. package/static/v3/js/core/store.7b2aa044.js +0 -123
  130. package/static/v3/js/core/store.js +0 -123
  131. package/static/v3/js/views/account.eff40715.js +0 -143
  132. package/static/v3/js/views/account.js +0 -143
  133. package/static/v3/js/views/activity.0d271ef9.js +0 -67
  134. package/static/v3/js/views/activity.js +0 -67
  135. package/static/v3/js/views/admin-audit.660a1fb1.js +0 -185
  136. package/static/v3/js/views/admin-audit.js +0 -185
  137. package/static/v3/js/views/admin-permissions.a7ae5f09.js +0 -177
  138. package/static/v3/js/views/admin-permissions.js +0 -177
  139. package/static/v3/js/views/admin-policies.3658fd86.js +0 -102
  140. package/static/v3/js/views/admin-policies.js +0 -102
  141. package/static/v3/js/views/admin-private-vpc.7d342d36.js +0 -135
  142. package/static/v3/js/views/admin-private-vpc.js +0 -135
  143. package/static/v3/js/views/admin-security.07c66b72.js +0 -180
  144. package/static/v3/js/views/admin-security.js +0 -180
  145. package/static/v3/js/views/admin-users.f7ac7b43.js +0 -166
  146. package/static/v3/js/views/admin-users.js +0 -166
  147. package/static/v3/js/views/agents.17c5288d.js +0 -564
  148. package/static/v3/js/views/agents.js +0 -564
  149. package/static/v3/js/views/chat.e250e2cc.js +0 -624
  150. package/static/v3/js/views/chat.js +0 -624
  151. package/static/v3/js/views/files.adad14c1.js +0 -365
  152. package/static/v3/js/views/files.js +0 -365
  153. package/static/v3/js/views/graph-canvas.17c15d65.js +0 -509
  154. package/static/v3/js/views/graph-canvas.js +0 -509
  155. package/static/v3/js/views/home.24f8b8ae.js +0 -200
  156. package/static/v3/js/views/home.js +0 -200
  157. package/static/v3/js/views/hooks.37895880.js +0 -220
  158. package/static/v3/js/views/hooks.js +0 -220
  159. package/static/v3/js/views/hybrid-search.2fb63ed9.js +0 -194
  160. package/static/v3/js/views/hybrid-search.js +0 -194
  161. package/static/v3/js/views/knowledge-graph.4d09c537.js +0 -529
  162. package/static/v3/js/views/knowledge-graph.js +0 -529
  163. package/static/v3/js/views/marketplace.ab0583d4.js +0 -141
  164. package/static/v3/js/views/marketplace.js +0 -141
  165. package/static/v3/js/views/mcp.99b5c6a7.js +0 -114
  166. package/static/v3/js/views/mcp.js +0 -114
  167. package/static/v3/js/views/memory.4ebdf474.js +0 -147
  168. package/static/v3/js/views/memory.js +0 -147
  169. package/static/v3/js/views/models.a1ffa147.js +0 -256
  170. package/static/v3/js/views/models.js +0 -256
  171. package/static/v3/js/views/my-computer.d9d9ae1c.js +0 -463
  172. package/static/v3/js/views/my-computer.js +0 -463
  173. package/static/v3/js/views/network.52a4f181.js +0 -97
  174. package/static/v3/js/views/network.js +0 -97
  175. package/static/v3/js/views/pipeline.c522f1ce.js +0 -157
  176. package/static/v3/js/views/pipeline.js +0 -157
  177. package/static/v3/js/views/planning.4876fd77.js +0 -174
  178. package/static/v3/js/views/planning.js +0 -174
  179. package/static/v3/js/views/runs.b63b2afa.js +0 -144
  180. package/static/v3/js/views/runs.js +0 -144
  181. package/static/v3/js/views/settings.b7140634.js +0 -317
  182. package/static/v3/js/views/settings.js +0 -317
  183. package/static/v3/js/views/skills.c6c2f965.js +0 -109
  184. package/static/v3/js/views/skills.js +0 -109
  185. package/static/v3/js/views/snapshots.6f5db095.js +0 -135
  186. package/static/v3/js/views/snapshots.js +0 -135
  187. package/static/v3/js/views/tools.e4f11276.js +0 -108
  188. package/static/v3/js/views/tools.js +0 -108
  189. package/static/v3/js/views/workflows.7752225a.js +0 -213
  190. package/static/v3/js/views/workflows.js +0 -213
  191. package/static/v3/js/views/workspace-admin.c466029b.js +0 -156
  192. package/static/v3/js/views/workspace-admin.js +0 -156
package/README.md CHANGED
@@ -203,34 +203,32 @@ npm run dev
203
203
 
204
204
  ## Latest Release
205
205
 
206
- ### v4.0.1Digital Brain Platform Maintenance
207
-
208
- - **Brain store architecture** — `knowledge_graph.py` is now a compatibility
209
- shim over focused `latticeai/brain/` modules.
210
- - **v2 write-mastered graph** `nodes_v2` / `edges_v2` are authoritative;
211
- legacy tables stay as a compatibility projection, with pre-flip backup and
212
- DB-format guard.
213
- - **Durable memory and context** — conversations, decisions, experiences, and
214
- context traces live in the brain database family.
215
- - **Real act/runtime foundation** workflows execute governed tools, pause for
216
- approval, run asynchronously with SSE progress/cancellation, and LLM-backed
217
- agent runs fail closed instead of fabricating output.
218
- - **Durable workspace governance** stable user UUIDs, enforced policy,
219
- invitations, and SQLite-backed Workspace OS state preserve identity and
220
- workspace history without destructive migration.
221
- - **Local sovereignty** signed exports, device identity, scoped graph export,
222
- and Brain Network peer exchange are implemented at the API layer.
223
- - **Post-v4 parity closure** durable async runs, stable identity/workspace
224
- state, and the complete `/app` SPA parity/legacy-retirement work are included
225
- in this maintenance release.
226
-
227
- See [RELEASE_NOTES_v4.0.1.md](RELEASE_NOTES_v4.0.1.md),
206
+ ### v4.2.0 — Brain Core & Storage Rebuild
207
+
208
+ - **Independent Brain Core package** — `lattice_brain` exposes the Knowledge
209
+ Graph, durable conversations, memory/context, signed exchange, archives, and
210
+ storage tools for FastAPI, CLI, tests, and future tools.
211
+ - **Pluggable storage layer** `StorageEngine`, `SQLiteEngine`, and
212
+ `PostgresEngine` give the backend an explicit storage boundary. SQLite stays
213
+ the default.
214
+ - **Honest vector search** sqlite-vec is detected when available; otherwise
215
+ the real local hash-embedding cosine path remains active and reported.
216
+ - **Postgres scale mode** pgvector setup and SQLite-to-Postgres migration are
217
+ opt-in. Live Docker validation covers migration integrity, idempotence, and
218
+ pgvector distance search. Explicit Postgres selection fails loudly when
219
+ DSN/dependencies are missing; it never hides failure with a SQLite fallback.
220
+ - **Consent-gated Docker setup** — Docker Compose setup is generated locally
221
+ and only starts Docker after explicit user consent.
222
+ - **Encrypted `.latticebrain` archives** local encrypted backup/restore over
223
+ the brain DB and blobs, with bad passphrases failing closed.
224
+
225
+ See [RELEASE_NOTES_v4.2.0.md](RELEASE_NOTES_v4.2.0.md),
228
226
  [docs/kg-schema.md](docs/kg-schema.md),
229
227
  [FEATURE_STATUS.md](FEATURE_STATUS.md).
230
228
 
231
229
  ## How it works — every source converges into the graph
232
230
 
233
- As of v4.0.1, data sources flow through the brain ingestion pipeline into
231
+ As of v4.2.0, data sources flow through the brain ingestion pipeline into
234
232
  the Knowledge Graph — no source bypasses it, none becomes an isolated silo:
235
233
 
236
234
  ```text
@@ -246,7 +244,8 @@ source (file · folder · PDF · web URL · browser tab · text)
246
244
  - **The graph is the asset.** Memory, search, and agents are views over it; models
247
245
  read it. Swap a model and your knowledge is unchanged.
248
246
  - **Portable, no cloud.** Export/import the graph as JSON, or take a full local
249
- binary backup (DB + blobs) and restore it.
247
+ binary backup (DB + blobs), encrypted `.latticebrain` archive, or explicit
248
+ SQLite-to-Postgres migration plan and restore it.
250
249
  - **Local-first protects the graph.** It lives in local SQLite on your machine.
251
250
 
252
251
  For the deeper design, see [ARCHITECTURE.md](ARCHITECTURE.md) and
@@ -264,6 +263,12 @@ For the deeper design, see [ARCHITECTURE.md](ARCHITECTURE.md) and
264
263
 
265
264
  - [ARCHITECTURE.md](ARCHITECTURE.md) — workspace, graph, pipeline, and model overview
266
265
  - [docs/architecture.md](docs/architecture.md) — full architecture reference
266
+ - [docs/V4_2_BRAIN_CORE_ARCHITECTURE.md](docs/V4_2_BRAIN_CORE_ARCHITECTURE.md) — v4.2.0 Brain Core package and storage architecture
267
+ - [docs/V4_2_STORAGE_MIGRATION_REPORT.md](docs/V4_2_STORAGE_MIGRATION_REPORT.md) — v4.2.0 storage migration and archive report
268
+ - [docs/V4_2_VALIDATION_REPORT.md](docs/V4_2_VALIDATION_REPORT.md) — v4.2.0 validation report
269
+ - [docs/V4_1_FRONTEND_ARCHITECTURE_REVIEW.md](docs/V4_1_FRONTEND_ARCHITECTURE_REVIEW.md) — v4.1.0 frontend and desktop architecture review
270
+ - [docs/V4_1_FRONTEND_MIGRATION_REPORT.md](docs/V4_1_FRONTEND_MIGRATION_REPORT.md) — v4.1.0 capability migration report
271
+ - [docs/V4_1_VALIDATION_REPORT.md](docs/V4_1_VALIDATION_REPORT.md) — v4.1.0 validation report
267
272
  - [docs/V3_BACKEND_ARCHITECTURE.md](docs/V3_BACKEND_ARCHITECTURE.md) — backend storage, search, and retrieval
268
273
 
269
274
  ### Knowledge and retrieval
@@ -282,6 +287,8 @@ For the deeper design, see [ARCHITECTURE.md](ARCHITECTURE.md) and
282
287
  ### Releases
283
288
 
284
289
  - [RELEASE_NOTES.md](RELEASE_NOTES.md) — current release notes
290
+ - [RELEASE_NOTES_v4.2.0.md](RELEASE_NOTES_v4.2.0.md)
291
+ - [RELEASE_NOTES_v4.1.0.md](RELEASE_NOTES_v4.1.0.md)
285
292
  - [RELEASE_NOTES_v4.0.1.md](RELEASE_NOTES_v4.0.1.md)
286
293
  - [RELEASE_NOTES_v4.0.0.md](RELEASE_NOTES_v4.0.0.md)
287
294
  - [RELEASE_NOTES_v3.6.0.md](RELEASE_NOTES_v3.6.0.md)
@@ -294,6 +301,8 @@ For the deeper design, see [ARCHITECTURE.md](ARCHITECTURE.md) and
294
301
 
295
302
  | Version | Theme |
296
303
  | --- | --- |
304
+ | **4.2.0** | Brain Core & Storage Rebuild — independent `lattice_brain` package, pluggable storage layer, sqlite-vec/pgvector capability reporting, explicit Postgres migration, consent-gated Docker setup, encrypted `.latticebrain` archives |
305
+ | **4.1.0** | Frontend & Desktop Rebuild RC — React/Vite/OpenAPI desktop SPA, Tauri 2.0 primary shell, graph-first navigation, and legacy static frontend removal |
297
306
  | **4.0.1** | Digital Brain Platform maintenance — closes post-tag v4 gaps with durable async runs, stable identity/workspace state, full `/app` parity, and legacy UI retirement |
298
307
  | **4.0.0** | Digital Brain Platform — decomposed brain store, v2 write-mastered Knowledge Graph, durable memory/context, real workflow/agent foundations, signed brain exchange |
299
308
  | 3.6.0 | Knowledge Graph First — unified ingestion pipeline, formalized entity/relationship model, browser/web ingestion, local export/import/backup, provenance, KG as the primary surface |
@@ -0,0 +1,44 @@
1
+ const { app, BrowserWindow } = require("electron");
2
+ const { spawn } = require("node:child_process");
3
+ const path = require("node:path");
4
+
5
+ const origin = process.env.LATTICEAI_DESKTOP_BACKEND_ORIGIN || "http://127.0.0.1:8765";
6
+ let backend = null;
7
+
8
+ function startBackend() {
9
+ if (process.env.LATTICEAI_DESKTOP_NO_BACKEND) return;
10
+ const command = process.env.LATTICEAI_DESKTOP_BACKEND_CMD || "python3 ltcai_cli.py --host 127.0.0.1 --port 8765";
11
+ const [bin, ...args] = command.split(/\s+/).filter(Boolean);
12
+ if (!bin) return;
13
+ backend = spawn(bin, args, {
14
+ cwd: process.env.LATTICEAI_DESKTOP_BACKEND_CWD || path.resolve(__dirname, "../.."),
15
+ env: { ...process.env, LATTICEAI_HOST: "127.0.0.1", LATTICEAI_PORT: "8765", LATTICEAI_TUNNEL: "false" },
16
+ stdio: "ignore",
17
+ });
18
+ }
19
+
20
+ function createWindow() {
21
+ const win = new BrowserWindow({
22
+ width: 1440,
23
+ height: 920,
24
+ minWidth: 1024,
25
+ minHeight: 720,
26
+ title: "Lattice AI",
27
+ webPreferences: {
28
+ contextIsolation: true,
29
+ nodeIntegration: false,
30
+ sandbox: true,
31
+ },
32
+ });
33
+ win.loadURL(`${origin}/app`);
34
+ }
35
+
36
+ app.whenReady().then(() => {
37
+ startBackend();
38
+ createWindow();
39
+ });
40
+
41
+ app.on("window-all-closed", () => {
42
+ if (backend) backend.kill();
43
+ if (process.platform !== "darwin") app.quit();
44
+ });
package/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,89 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.2.0] - 2026-06-12
4
+
5
+ > Brain Core & Storage Rebuild release. The backend Digital Brain boundary is
6
+ > available through the independent `lattice_brain` package, while the v4.1.0
7
+ > frontend, FastAPI contracts, and SQLite user data remain compatible.
8
+
9
+ ### Added
10
+
11
+ - `lattice_brain` import package with `BrainCore`, Knowledge Graph,
12
+ conversation, memory/context, identity/network, archive, and storage facades.
13
+ - Pluggable storage layer: `StorageEngine`, `SQLiteEngine`, `PostgresEngine`,
14
+ `DockerPostgresWizard`, and `SQLiteToPostgresMigrator`.
15
+ - sqlite-vec capability detection with honest `bruteforce-cosine` local vector
16
+ search fallback.
17
+ - Opt-in Postgres/pgvector scale setup and non-destructive SQLite-to-Postgres
18
+ migration planning/copy tooling.
19
+ - Live Docker-backed pgvector migration validation, including rowid-less FTS5
20
+ shadow tables, row-count integrity, idempotent reruns, and fail-closed
21
+ Postgres behavior.
22
+ - Encrypted `.latticebrain` archive create/restore support for the SQLite brain
23
+ database and blob directory.
24
+ - FastAPI routes for storage status, consent-gated Docker setup,
25
+ SQLite-to-Postgres migration, and encrypted archive create/restore.
26
+
27
+ ### Changed
28
+
29
+ - FastAPI constructs the graph/conversation runtime through
30
+ `lattice_brain.BrainCore`; root and `latticeai.brain.*` imports remain
31
+ compatibility shims.
32
+ - OpenAPI client regenerated with 313 paths.
33
+ - System settings exposes API-backed storage status, Docker setup consent, and
34
+ migration planning controls.
35
+ - Synchronized package/runtime versions to `4.2.0`, including Tauri config and
36
+ `lattice_brain.__version__`.
37
+
38
+ ### Expected Artifacts
39
+
40
+ - `dist/ltcai-4.2.0-py3-none-any.whl`
41
+ - `dist/ltcai-4.2.0.tar.gz`
42
+ - `dist/ltcai-4.2.0.vsix`
43
+ - `ltcai-4.2.0.tgz`
44
+
45
+ ## [4.1.0] - 2026-06-12
46
+
47
+ > Frontend & Desktop Rebuild release candidate. The existing FastAPI backend,
48
+ > Brain Core, storage architecture, and agent/workflow runtime remain the
49
+ > source of truth; the frontend and desktop shell are replaced by a React/Vite
50
+ > desktop architecture.
51
+
52
+ ### Added
53
+
54
+ - React + TypeScript + Vite SPA under `frontend/`, using TanStack Query,
55
+ Zustand, React Flow, Cytoscape.js, Tailwind CSS, local shadcn-style
56
+ primitives, and a generated OpenAPI TypeScript client.
57
+ - Tauri 2.0 desktop shell under `src-tauri/` that launches the local backend
58
+ and exposes the backend origin to the SPA; Electron fallback shell retained
59
+ under `desktop/electron/`.
60
+ - Primary graph-first navigation: Brain, Ask, Capture, Act, Library, System.
61
+ - OpenAPI export/generation script and frontend lint guard for generated-client
62
+ usage, no-CDN static assets, and stale frontend references.
63
+
64
+ ### Changed
65
+
66
+ - `/app` now serves the built React/Vite bundle from `static/app`.
67
+ - Legacy static v3 frontend assets and v3 build/lint scripts are removed after
68
+ capability parity was migrated into the new React surfaces.
69
+ - Release/build scripts now build Vite app assets and preserve Python, npm, and
70
+ VSIX packaging flows at version `4.1.0`.
71
+ - npm Python-backed scripts use `scripts/run_python.mjs` to prefer
72
+ `LTCAI_PYTHON` or the repo virtualenv before falling back to system Python.
73
+
74
+ ### Validation Scope
75
+
76
+ - Python compile check, ruff, unit tests, live integration tests, frontend lint,
77
+ TypeScript build, Playwright visual tests, desktop shell checks, no-CDN
78
+ verification, release artifact validation, wheel smoke, and npm pack dry-run.
79
+
80
+ ### Expected Artifacts
81
+
82
+ - `dist/ltcai-4.1.0-py3-none-any.whl`
83
+ - `dist/ltcai-4.1.0.tar.gz`
84
+ - `dist/ltcai-4.1.0.vsix`
85
+ - `ltcai-4.1.0.tgz`
86
+
3
87
  ## [4.0.1] - 2026-06-12
4
88
 
5
89
  > Digital Brain Platform maintenance release for commits on `main` after tag
@@ -0,0 +1,65 @@
1
+ # v4.1.0 Frontend Architecture Review
2
+
3
+ ## Scope
4
+
5
+ This review covers the v4.1.0 replacement of the `/app` frontend and desktop
6
+ shell. It does not redesign Brain Core, storage, backend API contracts, or the
7
+ agent/workflow runtime.
8
+
9
+ ## Baseline
10
+
11
+ v4.0.1 served a static frontend assembled under `static/v3` with bespoke build
12
+ and lint scripts. Capability parity existed, but the implementation duplicated
13
+ view systems, carried legacy static route assumptions, and could not cleanly
14
+ share typed API contracts with the FastAPI backend.
15
+
16
+ ## Target Architecture
17
+
18
+ - Desktop shell: Tauri 2.0 primary, Electron fallback only.
19
+ - Frontend: React, TypeScript, Vite, TanStack Query, Zustand, React Flow,
20
+ Cytoscape.js, Tailwind CSS, local shadcn-style primitives.
21
+ - API: generated OpenAPI TypeScript client from the existing FastAPI app.
22
+ - Runtime: single client-side SPA, no SSR, no CDN.
23
+ - Backend: existing FastAPI app remains the source of truth.
24
+
25
+ ## Implemented Architecture
26
+
27
+ - `frontend/` owns the React/Vite source.
28
+ - `frontend/src/api/openapi.ts` is generated from `frontend/openapi.json`.
29
+ - `frontend/src/api/client.ts` wraps generated-client JSON calls and keeps
30
+ streaming chat plus multipart upload as explicit fetch special cases.
31
+ - `frontend/src/routes.ts` defines Brain, Ask, Capture, Act, Library, System and
32
+ maps legacy hash routes into those groups.
33
+ - `static/app` is the shipped build output and is served by `/app`.
34
+ - `src-tauri/` contains the Tauri 2.0 shell and backend-origin bridge.
35
+ - `desktop/electron/` contains the fallback shell.
36
+ - `static/sw.js` precaches the React app manifest/assets for offline-capable
37
+ local startup.
38
+
39
+ ## Boundary Decisions
40
+
41
+ - The backend contract was preserved; only the frontend consumer changed.
42
+ - Brain Core and storage modules were not modified for UI convenience.
43
+ - No CDN fallback was introduced; all visual/runtime dependencies are bundled.
44
+ - No demo-only controls were added. Unavailable capabilities render explicit
45
+ unavailable/error states based on API responses.
46
+ - npm runtime installs are kept lean: React/Vite/Tauri/Electron toolchains are
47
+ development dependencies because the distributable app ships built assets.
48
+
49
+ ## Capability Mapping
50
+
51
+ | v4.0.1 capability | v4.1.0 surface |
52
+ | --- | --- |
53
+ | Knowledge Graph, hybrid search, memory, provenance, portability | Brain |
54
+ | Chat, conversations, context trace, attachments | Ask |
55
+ | Uploads, connected folders, local runtime, URL capture, index pipeline | Capture |
56
+ | Agents, runs, approvals, workflows, triggers, hooks, tools | Act |
57
+ | Models, embeddings, skills, MCP, templates/plugins | Library |
58
+ | Account, auth, workspaces, snapshots, activity, network, settings, admin/security | System |
59
+
60
+ ## Residual Risk
61
+
62
+ - The first Vite bundle is larger than 500 kB after minification because graph,
63
+ workflow, and app shell libraries are included in the initial desktop SPA
64
+ bundle. This is a performance optimization target, not a capability blocker,
65
+ and the build remains fully local/offline.
@@ -0,0 +1,70 @@
1
+ # v4.1.0 Frontend Migration Report
2
+
3
+ ## Objective
4
+
5
+ Replace the v4.0.1 static frontend implementation with the Digital Brain
6
+ desktop architecture while preserving capabilities, user data, backend API
7
+ contracts, and local-first/offline operation.
8
+
9
+ ## Migration Summary
10
+
11
+ - Added React + TypeScript + Vite source under `frontend/`.
12
+ - Added generated OpenAPI schema/client files under `frontend/openapi.json` and
13
+ `frontend/src/api/openapi.ts`.
14
+ - Added React capability pages for Brain, Ask, Capture, Act, Library, System.
15
+ - Added Tauri 2.0 desktop shell under `src-tauri/`.
16
+ - Added Electron fallback shell under `desktop/electron/`.
17
+ - Replaced `/app` static serving with `static/app/index.html`.
18
+ - Replaced v3 asset build/lint scripts with Vite build and frontend lint guards.
19
+ - Removed `static/v3` and retired `scripts/build_v3_assets.mjs` /
20
+ `scripts/lint_v3.mjs`.
21
+ - Updated package metadata so Python wheel/sdist, npm tgz, and VSIX builds ship
22
+ the new `static/app` assets.
23
+
24
+ ## Compatibility
25
+
26
+ - Existing FastAPI routes are preserved.
27
+ - The generated OpenAPI client is produced from the live app schema.
28
+ - Legacy app hash routes are mapped into the new primary navigation groups.
29
+ - Service worker caching now targets the Vite app manifest instead of v3 assets.
30
+ - User data formats, Brain database files, Workspace OS state, snapshots,
31
+ conversations, memories, and graph data are not migrated or destructively
32
+ changed by the frontend rebuild.
33
+
34
+ ## Capability Parity
35
+
36
+ | Capability | Migration result |
37
+ | --- | --- |
38
+ | Brain graph exploration | Cytoscape.js graph view in Brain |
39
+ | Hybrid search | Brain search tab backed by `/api/search/hybrid` |
40
+ | Memory recall | Brain memory tab backed by memory APIs |
41
+ | Provenance and portability | Brain provenance/portability actions |
42
+ | Chat and context trace | Ask surface with streaming chat and context panel |
43
+ | Conversation management | Ask history backed by conversation APIs |
44
+ | Document upload | Capture upload using multipart backend endpoint |
45
+ | Connected folders/local runtime | Capture desktop/local runtime APIs |
46
+ | Index pipeline and URL capture | Capture pipeline/browser ingestion APIs |
47
+ | Agents and run records | Act agents/runs/approvals backed by runtime APIs |
48
+ | Workflow graph | Act React Flow visualization and workflow APIs |
49
+ | Triggers, hooks, tools | Act surfaces backed by trigger/hook/tool APIs |
50
+ | Models and embeddings | Library model/embedding APIs |
51
+ | Skills, MCP, templates/plugins | Library registry APIs |
52
+ | Account/auth/profile/password | System account APIs |
53
+ | Workspaces/invitations | System workspace APIs |
54
+ | Snapshots/time-machine | System snapshot APIs |
55
+ | Activity/presence/network | System activity and network APIs |
56
+ | Admin/security/settings | System admin and settings APIs |
57
+
58
+ ## Removed Frontend Debt
59
+
60
+ - Duplicate static v3 view modules.
61
+ - Legacy frontend build pipeline.
62
+ - Legacy v3 frontend lint script.
63
+ - Static v3 asset tree in release packages.
64
+ - Direct current-release references to v4.0.1 in latest docs.
65
+
66
+ ## Data Preservation
67
+
68
+ No user data migration is required for v4.1.0. All persisted state remains owned
69
+ by the existing backend stores. The frontend rebuild only changes the client and
70
+ desktop shell used to access those stores.
@@ -0,0 +1,47 @@
1
+ # v4.1.0 Validation Report
2
+
3
+ ## Summary
4
+
5
+ v4.1.0 RC validation passed for the React/Vite frontend, Tauri desktop shell,
6
+ FastAPI backend compatibility, release artifacts, and installed-wheel smoke.
7
+
8
+ ## Commands Run
9
+
10
+ | Area | Command | Result |
11
+ | --- | --- | --- |
12
+ | OpenAPI generation | `npm run frontend:openapi` | Pass; generated 308 paths |
13
+ | Static app build | `npm run build:assets` | Pass; wrote `static/app/asset-manifest.json` |
14
+ | Frontend lint / no CDN / API compatibility | `npm run lint` | Pass; scanned 28 frontend/static files; OpenAPI exposes 308 paths |
15
+ | TypeScript build | `npm run typecheck` | Pass; frontend TS + VS Code extension build |
16
+ | Python compile | `npm run check:python` | Pass; compiled 206 modules |
17
+ | Ruff | `node scripts/run_python.mjs -m ruff check .` | Pass |
18
+ | Unit tests | `npm run test:unit -- --tb=short` | Pass; 585 passed, 2 warnings |
19
+ | Live integration tests | `LTCAI_TEST_BASE_URL=http://127.0.0.1:8899 npm run test:integration -- --tb=short` | Pass; 9 passed |
20
+ | Playwright visual/offline tests | `npx playwright test tests/visual/v3.spec.js` | Pass; 12 passed |
21
+ | Tauri cargo check | `npm run desktop:tauri:check` | Pass |
22
+ | Tauri desktop build | `LATTICEAI_DESKTOP_NO_BACKEND=1 npm run desktop:tauri:build` | Pass; built `.app` and DMG |
23
+ | Electron fallback syntax/version | `node --check desktop/electron/main.cjs && npx electron --version` | Pass; Electron v42.4.0 |
24
+ | Release artifacts | `npm run release:artifacts` plus resumed `npm pack && npm run package:vsix` | Pass |
25
+ | Artifact validation | `npm run release:validate` | Pass; exact v4.1.0 wheel/sdist/VSIX/tgz found |
26
+ | Wheel smoke | `node scripts/run_python.mjs scripts/wheel_smoke.py --wheel dist/ltcai-4.1.0-py3-none-any.whl` | Pass; imports 19 modules and `/health` reports 4.1.0 |
27
+ | npm pack dry-run | `npm pack --dry-run` | Pass; `ltcai-4.1.0.tgz`, 259 files, 2.9 MB |
28
+
29
+ ## Generated Artifacts
30
+
31
+ - `dist/ltcai-4.1.0-py3-none-any.whl`
32
+ - `dist/ltcai-4.1.0.tar.gz`
33
+ - `dist/ltcai-4.1.0.vsix`
34
+ - `ltcai-4.1.0.tgz`
35
+ - `src-tauri/target/release/bundle/macos/Lattice AI.app`
36
+ - `src-tauri/target/release/bundle/dmg/Lattice AI_4.1.0_aarch64.dmg`
37
+
38
+ ## Notes
39
+
40
+ - Vite reports one large initial bundle warning after minification. The app
41
+ remains fully local/offline and passes visual/offline startup validation.
42
+ - `cargo check` reports a future-incompatibility warning in transitive
43
+ `block v0.1.6`; the current Tauri 2.0 build passes on Rust 1.96.
44
+ - Release artifact validation warns that historical artifacts remain in
45
+ `dist/`; this is expected and reinforces the rule to upload only exact
46
+ v4.1.0 filenames, never `dist/*`.
47
+ - No external registry publish was performed.
@@ -0,0 +1,97 @@
1
+ # Lattice AI v4.2.0 — Brain Core Architecture
2
+
3
+ Status: released validation complete
4
+
5
+ v4.2.0 extracts the Digital Brain backend boundary into the importable
6
+ `lattice_brain` package while preserving the existing FastAPI contracts and the
7
+ v4.1.0 user data layout. FastAPI, CLI, tests, and future tools can now import
8
+ Brain Core directly instead of reaching through root compatibility modules.
9
+
10
+ ## Package Boundary
11
+
12
+ - `lattice_brain` is the independent Brain Core package namespace.
13
+ - `latticeai.brain` remains as a compatibility namespace for existing callers.
14
+ - Root modules such as `knowledge_graph.py` and `kg_schema.py` remain
15
+ compatibility shims.
16
+ - FastAPI now constructs the graph and durable conversation store through
17
+ `lattice_brain.BrainCore`.
18
+
19
+ ## Brain Core Surfaces
20
+
21
+ The package exposes the implemented v4 brain modules:
22
+
23
+ - Knowledge system: `KnowledgeGraphStore`
24
+ - Memory system: `BrainMemory`
25
+ - Context assembler: `ContextAssembler`
26
+ - Durable conversations: `ConversationStore`
27
+ - Device identity and signed exchange helpers
28
+ - Brain Network compatibility exports
29
+ - Encrypted `.latticebrain` archives
30
+ - Storage abstraction and migration tools
31
+
32
+ The frontend still talks only to FastAPI localhost APIs. No frontend code calls
33
+ Python directly.
34
+
35
+ ## Storage Layer
36
+
37
+ `lattice_brain.storage` introduces:
38
+
39
+ - `StorageEngine` ABC
40
+ - `SQLiteEngine` default engine
41
+ - `PostgresEngine` opt-in engine with pgvector extension setup
42
+ - `DockerPostgresWizard` explicit-consent local Docker setup
43
+ - `SQLiteToPostgresMigrator` idempotent migration planner/runner, including
44
+ rowid-less FTS5 shadow table support through declared primary keys
45
+
46
+ SQLite remains the default. Postgres is never required. If
47
+ `LATTICEAI_STORAGE_ENGINE=postgres` is selected without a DSN or optional
48
+ dependency support, startup fails honestly instead of silently falling back to
49
+ SQLite.
50
+
51
+ ## Vector Search
52
+
53
+ SQLite vector search remains real and local:
54
+
55
+ - Existing vector rows stay in `vector_embeddings`.
56
+ - The active fallback is deterministic local hash embeddings with brute-force
57
+ cosine scoring.
58
+ - `sqlite-vec` is detected and loaded when available.
59
+ - Capability reports distinguish `sqlite-vec` from `bruteforce-cosine`; the
60
+ fallback is reported honestly and is still a real search path.
61
+
62
+ Postgres scale mode initializes a pgvector-backed `brain_vectors` table when
63
+ the `vector` extension is available.
64
+
65
+ ## Archive Model
66
+
67
+ v4.2.0 adds encrypted `.latticebrain` archives:
68
+
69
+ - AES-256-GCM payload encryption
70
+ - PBKDF2-HMAC-SHA256 key derivation
71
+ - Encrypted SQLite database and blob payload
72
+ - Restore replaces the target DB/WAL/SHM safely and restores blobs
73
+ - Wrong passphrase or tampered data fails closed
74
+
75
+ The existing JSON export/import and ZIP backup/restore paths remain compatible.
76
+
77
+ ## FastAPI APIs
78
+
79
+ New localhost APIs:
80
+
81
+ - `GET /api/brain/storage`
82
+ - `POST /api/brain/storage/postgres/docker`
83
+ - `POST /api/brain/storage/migrate-postgres`
84
+ - `POST /api/knowledge-graph/archive`
85
+ - `POST /api/knowledge-graph/archive/restore`
86
+
87
+ All mutating operations require admin authorization. Docker starts only when the
88
+ request explicitly carries consent.
89
+
90
+ ## Compatibility
91
+
92
+ - Existing v4.1.0 SQLite data remains in `knowledge_graph.sqlite`.
93
+ - Existing `knowledge_graph.py`, `kg_schema.py`, and `latticeai.brain.*`
94
+ imports continue to work.
95
+ - Existing FastAPI routes remain available.
96
+ - Existing release artifacts still build.
97
+ - No data-loss migration is performed automatically.
@@ -0,0 +1,91 @@
1
+ # Lattice AI v4.2.0 — Storage Migration Report
2
+
3
+ Status: released validation complete
4
+
5
+ v4.2.0 adds a pluggable storage layer without changing the default local-first
6
+ runtime. Existing users continue on SQLite. Postgres is an explicit opt-in
7
+ scale target, not a required dependency and not an automatic fallback.
8
+
9
+ ## Existing Data
10
+
11
+ - Existing v4.1.0 data remains in `~/.ltcai/knowledge_graph.sqlite`.
12
+ - Blob payloads remain in `~/.ltcai/knowledge_graph_blobs/`.
13
+ - Durable conversations continue to share the same SQLite DB family.
14
+ - No startup migration rewrites user data for v4.2.0.
15
+
16
+ ## SQLite Engine
17
+
18
+ `SQLiteEngine` owns SQLite connection setup:
19
+
20
+ - WAL mode
21
+ - foreign keys enabled
22
+ - local path creation
23
+ - backup and restore helpers
24
+ - sqlite-vec loading attempt when installed
25
+ - honest capability report when sqlite-vec is unavailable
26
+
27
+ The current graph store continues to use SQLite-specific SQL and is therefore
28
+ wired only to `SQLiteEngine` for the active FastAPI runtime.
29
+
30
+ ## Postgres Engine
31
+
32
+ `PostgresEngine` is opt-in and fail-closed:
33
+
34
+ - Requires `LATTICEAI_POSTGRES_DSN` when explicitly selected.
35
+ - Requires optional `psycopg` support.
36
+ - Creates `lattice_brain` schema by default.
37
+ - Runs `CREATE EXTENSION IF NOT EXISTS vector`.
38
+ - Creates a pgvector-backed `brain_vectors` table.
39
+
40
+ If Postgres is selected but unavailable, Lattice AI reports the error. It does
41
+ not hide the failure by falling back to SQLite.
42
+
43
+ ## Docker Setup
44
+
45
+ `DockerPostgresWizard` writes a local Docker Compose file for
46
+ `pgvector/pgvector:pg16`. It never runs Docker unless the caller explicitly
47
+ passes consent.
48
+
49
+ API behavior:
50
+
51
+ - `consent=false`: writes the compose file and returns `consent_required`.
52
+ - `dry_run=true`: returns the exact Docker command without starting anything.
53
+ - `consent=true` and `dry_run=false`: runs `docker compose up -d postgres`.
54
+
55
+ ## SQLite to Postgres Migration
56
+
57
+ `SQLiteToPostgresMigrator` plans and copies all user tables from a SQLite brain
58
+ database into Postgres:
59
+
60
+ - Introspects non-internal SQLite tables.
61
+ - Preserves every row.
62
+ - Uses table `id` as the idempotence key when present.
63
+ - Uses declared primary keys, including composite keys on rowid-less FTS5 shadow
64
+ tables.
65
+ - Uses preserved `__source_rowid` when no declared key exists and SQLite rowid
66
+ is available.
67
+ - Upserts rows on repeated runs.
68
+ - Leaves the source SQLite database untouched.
69
+
70
+ The API defaults to dry-run migration planning. Actual copy requires an
71
+ explicit DSN and `dry_run=false`.
72
+
73
+ Live v4.2.0 validation used explicit Docker consent to start
74
+ `pgvector/pgvector:pg16`, copy a seeded v4 SQLite brain database into
75
+ Postgres, verify source and destination row counts, rerun the migration
76
+ idempotently, query pgvector distance ordering, and tear down the test Compose
77
+ stack with volumes.
78
+
79
+ ## Encrypted Archives
80
+
81
+ `.latticebrain` archive support was added for local encrypted backup/restore:
82
+
83
+ - Database and blobs are zipped locally.
84
+ - Payload is encrypted with AES-256-GCM.
85
+ - Keys derive from the user passphrase via PBKDF2-HMAC-SHA256.
86
+ - Restore rejects bad passphrases or tampered payloads.
87
+
88
+ ## Compatibility Result
89
+
90
+ No v4.1.0 capability is removed. SQLite remains the default and does not depend
91
+ on Docker, Postgres, pgvector, or network access.