ltcai 4.0.0 → 4.0.1

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 (108) hide show
  1. package/README.md +37 -33
  2. package/docs/CHANGELOG.md +64 -0
  3. package/docs/REALTIME_COLLABORATION.md +3 -3
  4. package/docs/V3_FRONTEND.md +9 -8
  5. package/docs/V4_DIGITAL_BRAIN_RECOVERY.md +86 -43
  6. package/docs/kg-schema.md +6 -2
  7. package/docs/spec-vs-impl.md +10 -10
  8. package/kg_schema.py +2 -603
  9. package/knowledge_graph.py +37 -4958
  10. package/latticeai/__init__.py +1 -1
  11. package/latticeai/api/admin.py +15 -16
  12. package/latticeai/api/agents.py +13 -6
  13. package/latticeai/api/auth.py +19 -11
  14. package/latticeai/api/invitations.py +100 -0
  15. package/latticeai/api/knowledge_graph.py +4 -11
  16. package/latticeai/api/plugins.py +3 -6
  17. package/latticeai/api/realtime.py +4 -7
  18. package/latticeai/api/static_routes.py +9 -12
  19. package/latticeai/api/ui_redirects.py +26 -0
  20. package/latticeai/api/workflow_designer.py +39 -6
  21. package/latticeai/api/workspace.py +24 -10
  22. package/latticeai/app_factory.py +88 -17
  23. package/latticeai/brain/_kg_common.py +1123 -0
  24. package/latticeai/brain/discovery.py +1455 -0
  25. package/latticeai/brain/documents.py +218 -0
  26. package/latticeai/brain/ingest.py +644 -0
  27. package/latticeai/brain/projection.py +561 -0
  28. package/latticeai/brain/provenance.py +401 -0
  29. package/latticeai/brain/retrieval.py +1316 -0
  30. package/latticeai/brain/schema.py +640 -0
  31. package/latticeai/brain/store.py +216 -0
  32. package/latticeai/brain/write_master.py +225 -0
  33. package/latticeai/core/invitations.py +131 -0
  34. package/latticeai/core/marketplace.py +1 -1
  35. package/latticeai/core/multi_agent.py +1 -1
  36. package/latticeai/core/policy.py +54 -0
  37. package/latticeai/core/realtime.py +65 -44
  38. package/latticeai/core/sessions.py +31 -5
  39. package/latticeai/core/users.py +147 -0
  40. package/latticeai/core/workspace_os.py +420 -20
  41. package/latticeai/services/agent_runtime.py +242 -4
  42. package/latticeai/services/run_executor.py +328 -0
  43. package/latticeai/services/workspace_service.py +27 -19
  44. package/package.json +2 -14
  45. package/scripts/lint_v3.mjs +23 -0
  46. package/static/v3/asset-manifest.json +21 -14
  47. package/static/v3/js/{app.356e6452.js → app.c5c80c46.js} +1 -1
  48. package/static/v3/js/core/{api.7a308b89.js → api.ba0fbf14.js} +58 -1
  49. package/static/v3/js/core/api.js +57 -0
  50. package/static/v3/js/core/i18n.880e1fec.js +575 -0
  51. package/static/v3/js/core/i18n.js +575 -0
  52. package/static/v3/js/core/routes.37522821.js +101 -0
  53. package/static/v3/js/core/routes.js +71 -63
  54. package/static/v3/js/core/{shell.a1657f20.js → shell.e3f6bbfa.js} +67 -38
  55. package/static/v3/js/core/shell.js +65 -36
  56. package/static/v3/js/core/{store.204a08b2.js → store.7b2aa044.js} +10 -0
  57. package/static/v3/js/core/store.js +10 -0
  58. package/static/v3/js/views/account.eff40715.js +143 -0
  59. package/static/v3/js/views/account.js +143 -0
  60. package/static/v3/js/views/activity.0d271ef9.js +67 -0
  61. package/static/v3/js/views/activity.js +67 -0
  62. package/static/v3/js/views/{admin-users.03bac88c.js → admin-users.f7ac7b43.js} +4 -6
  63. package/static/v3/js/views/admin-users.js +4 -6
  64. package/static/v3/js/views/{agents.014d0b74.js → agents.17c5288d.js} +35 -12
  65. package/static/v3/js/views/agents.js +35 -12
  66. package/static/v3/js/views/{chat.e6dd7dd0.js → chat.e250e2cc.js} +23 -0
  67. package/static/v3/js/views/chat.js +23 -0
  68. package/static/v3/js/views/{knowledge-graph.5e40cbeb.js → knowledge-graph.4d09c537.js} +27 -7
  69. package/static/v3/js/views/knowledge-graph.js +27 -7
  70. package/static/v3/js/views/network.52a4f181.js +97 -0
  71. package/static/v3/js/views/network.js +97 -0
  72. package/static/v3/js/views/{planning.9ac3e313.js → planning.4876fd77.js} +26 -5
  73. package/static/v3/js/views/planning.js +26 -5
  74. package/static/v3/js/views/runs.b63b2afa.js +144 -0
  75. package/static/v3/js/views/runs.js +144 -0
  76. package/static/v3/js/views/{settings.8631fa5e.js → settings.b7140634.js} +7 -8
  77. package/static/v3/js/views/settings.js +7 -8
  78. package/static/v3/js/views/snapshots.6f5db095.js +135 -0
  79. package/static/v3/js/views/snapshots.js +135 -0
  80. package/static/v3/js/views/{workflows.26c57290.js → workflows.7752225a.js} +87 -2
  81. package/static/v3/js/views/workflows.js +87 -2
  82. package/static/v3/js/views/workspace-admin.c466029b.js +156 -0
  83. package/static/v3/js/views/workspace-admin.js +156 -0
  84. package/static/account.html +0 -113
  85. package/static/activity.html +0 -73
  86. package/static/admin.html +0 -486
  87. package/static/agents.html +0 -139
  88. package/static/chat.html +0 -841
  89. package/static/css/reference/account.css +0 -439
  90. package/static/css/reference/admin.css +0 -610
  91. package/static/css/reference/base.css +0 -1661
  92. package/static/css/reference/chat.css +0 -4623
  93. package/static/css/reference/graph.css +0 -1016
  94. package/static/css/responsive.css +0 -861
  95. package/static/graph.html +0 -122
  96. package/static/platform.css +0 -104
  97. package/static/plugins.html +0 -136
  98. package/static/scripts/account.js +0 -238
  99. package/static/scripts/admin.js +0 -1614
  100. package/static/scripts/chat.js +0 -5081
  101. package/static/scripts/graph.js +0 -1804
  102. package/static/scripts/platform.js +0 -64
  103. package/static/scripts/ux.js +0 -167
  104. package/static/scripts/workspace.js +0 -948
  105. package/static/v3/js/core/routes.7222343d.js +0 -93
  106. package/static/workflows.html +0 -146
  107. package/static/workspace.css +0 -1121
  108. package/static/workspace.html +0 -357
package/README.md CHANGED
@@ -56,10 +56,10 @@ workspace around the work itself:
56
56
  LM Studio; nothing leaves your machine unless you opt in.
57
57
  - **Use cloud models only when you choose** — bring an API key for cloud LLMs
58
58
  when you want them, not by default.
59
- - **Inspect every agent run** — the built-in runner persists plans, reviews,
60
- retries, and results as replayable run records. Today that runner is
61
- deterministic and does not call a model; LLM-driven execution is the v4
62
- runtime, in progress.
59
+ - **Inspect every agent run** — runs persist queued/running/final state, plans,
60
+ reviews, retries, cancellation, and replayable logs. With a loaded model the
61
+ v4 runner uses it; without one, deterministic simulation mode is explicitly
62
+ labeled and does not call a model.
63
63
 
64
64
  Lattice AI is not a clone of ChatGPT, Claude, Cursor, Obsidian, or Notion. It
65
65
  sits in a different place: a **workspace** that ties local/self-hosted AI, your
@@ -75,8 +75,8 @@ and workflows together — and runs on your own hardware.
75
75
  Knowledge Graph.
76
76
  - Run local models through MLX, Ollama, or LM Studio, and use cloud LLMs only when
77
77
  you want to.
78
- - Define agent workflows and replay their run records step by step (execution
79
- is deterministic scaffolding today it does not yet call a model).
78
+ - Define agent workflows and replay their run records step by step, including
79
+ live tool execution, approval pauses, and cooperative cancellation.
80
80
  - Separate personal work from organization work.
81
81
  - Switch between Basic, Advanced, and Admin modes depending on your role.
82
82
 
@@ -115,9 +115,9 @@ connect — context that stays useful even when you switch models.
115
115
  ![Lattice AI agent run with roles, logs, review, and retry](docs/assets/v3.4.0/agent-run.png)
116
116
 
117
117
  The agent runner turns a goal into an inspectable, replayable run record — roles,
118
- logs, review, and retry — that you can read back step by step. The runner shown
119
- here is deterministic and LLM-free; real model-driven execution is the v4
120
- runtime, currently in progress.
118
+ logs, review, retry, and cancellation state — that you can read back step by
119
+ step. Runs execute asynchronously and use the loaded model when one is available;
120
+ otherwise they are labeled as simulation.
121
121
 
122
122
  ### Extend with hooks and the local runtime
123
123
 
@@ -203,34 +203,34 @@ npm run dev
203
203
 
204
204
  ## Latest Release
205
205
 
206
- ### v3.6.0Knowledge Graph First
207
-
208
- - **Unified ingestion pipeline** — one entrypoint normalizes every source
209
- (file, folder, web URL, browser tab, text/markdown/code) into the graph,
210
- idempotent by content hash and bracketed by the `pre_tool`/`post_tool` hook
211
- lifecycle.
212
- - **Formalized entity/relationship model** — first-class `Source`, `Repository`,
213
- `Meeting`, `Organization`, `Workflow`, `Agent` entities and `indexed_from`,
214
- `modified_by`, `belongs_to_project`, `part_of`, `discussed_in`, `decided_by`,
215
- `generated_by`, `used_by_agent` relationships.
216
- - **Browser & web ingestion** `POST /api/browser/read-url` and
217
- `/ingest-current-tab`, plus a local Manifest V3 extension that posts only to
218
- `127.0.0.1`.
219
- - **Portability** local Knowledge Graph export/import (versioned JSON) and
220
- binary backup/restore (DB + blobs, integrity-checked). No cloud required.
221
- - **Provenance** — every node records where it came from; a queryable audit trail
222
- makes the graph explainable.
223
- - **Knowledge Graph as the primary surface** — the view becomes your digital brain
224
- with Status, Sources, Capture, and Backup tabs.
225
-
226
- See [RELEASE_NOTES_v3.6.0.md](RELEASE_NOTES_v3.6.0.md),
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),
227
228
  [docs/kg-schema.md](docs/kg-schema.md),
228
- [docs/RUNTIME_HOOK_COVERAGE_v3.6.0.md](docs/RUNTIME_HOOK_COVERAGE_v3.6.0.md), and
229
229
  [FEATURE_STATUS.md](FEATURE_STATUS.md).
230
230
 
231
231
  ## How it works — every source converges into the graph
232
232
 
233
- As of v3.6.0, all data sources flow through **one unified ingestion pipeline** into
233
+ As of v4.0.1, data sources flow through the brain ingestion pipeline into
234
234
  the Knowledge Graph — no source bypasses it, none becomes an isolated silo:
235
235
 
236
236
  ```text
@@ -282,6 +282,8 @@ For the deeper design, see [ARCHITECTURE.md](ARCHITECTURE.md) and
282
282
  ### Releases
283
283
 
284
284
  - [RELEASE_NOTES.md](RELEASE_NOTES.md) — current release notes
285
+ - [RELEASE_NOTES_v4.0.1.md](RELEASE_NOTES_v4.0.1.md)
286
+ - [RELEASE_NOTES_v4.0.0.md](RELEASE_NOTES_v4.0.0.md)
285
287
  - [RELEASE_NOTES_v3.6.0.md](RELEASE_NOTES_v3.6.0.md)
286
288
  - [RELEASE_NOTES_v3.5.0.md](RELEASE_NOTES_v3.5.0.md)
287
289
  - [RELEASE_NOTES_v3.4.1.md](RELEASE_NOTES_v3.4.1.md)
@@ -292,7 +294,9 @@ For the deeper design, see [ARCHITECTURE.md](ARCHITECTURE.md) and
292
294
 
293
295
  | Version | Theme |
294
296
  | --- | --- |
295
- | **3.6.0** | Knowledge Graph Firstunified ingestion pipeline, formalized entity/relationship model, browser/web ingestion, local export/import/backup, provenance, KG as the primary surface |
297
+ | **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
+ | **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
+ | 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 |
296
300
  | 3.5.0 | Foundation stabilization & verification — OIDC verifier, trusted-proxy gating, runtime hook coverage, `tools/` package, reproducible artifacts |
297
301
  | 3.4.1 | Runtime completion — full hooks lifecycle, real Local Agent probes, Connect Folder and Folder Watch verified end-to-end |
298
302
  | 3.4.0 | Platform completion — hooks execution, uploads in Files, vision image input, agent run trigger, on-device Local Agent / Connect Folder / Folder Watch |
package/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,69 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.0.1] - 2026-06-12
4
+
5
+ > Digital Brain Platform maintenance release for commits on `main` after tag
6
+ > `v4.0.0`. This release does not publish to PyPI, npm, the VS Code
7
+ > Marketplace, or Open VSX; artifacts are built and attached to GitHub Release
8
+ > `v4.0.1` only.
9
+
10
+ ### Added
11
+
12
+ - Durable async run executor for agent/workflow runs, including persisted
13
+ queued/running/final states, realtime SSE progress, cooperative cancellation,
14
+ and startup reconciliation of orphaned active runs.
15
+ - Stable user UUID migration, centralized policy enforcement, local invitation
16
+ tokens, and SQLite-backed Workspace OS state with JSON compatibility
17
+ mirroring.
18
+ - Complete `/app` SPA parity surfaces for account/profile/password, workspace
19
+ and organization administration, invitations, snapshots/time-machine with
20
+ merge-restore, activity/presence, run approvals/cancellation, workflow
21
+ triggers, Brain Network pairing/push, chat context trace, and Knowledge Graph
22
+ provenance coverage.
23
+
24
+ ### Changed
25
+
26
+ - Retired legacy static HTML/CSS/JS UI pages and legacy visual specs. Legacy GET
27
+ routes now redirect into the matching `/app` surface.
28
+ - Added en/ko i18n runtime coverage for the shell, routes, and new parity views,
29
+ guarded by `scripts/lint_v3.mjs`.
30
+ - Bumped synchronized package/runtime versions to `4.0.1`.
31
+
32
+ ### Expected Artifacts
33
+
34
+ - `dist/ltcai-4.0.1-py3-none-any.whl`
35
+ - `dist/ltcai-4.0.1.tar.gz`
36
+ - `dist/ltcai-4.0.1.vsix`
37
+ - `ltcai-4.0.1.tgz`
38
+
39
+ ## [4.0.0] - 2026-06-12
40
+
41
+ > Digital Brain Platform. The Knowledge Graph is now the durable brain store
42
+ > spine: focused `latticeai/brain/` modules own graph storage, schema, ingestion,
43
+ > provenance, retrieval, and document structure, while root modules remain
44
+ > compatibility shims.
45
+
46
+ ### Changed
47
+
48
+ - Decomposed the monolithic Knowledge Graph implementation into focused
49
+ `latticeai/brain/` modules, with every new module kept below 1,500 lines.
50
+ - Flipped graph writes to `nodes_v2` / `edges_v2` as the authoritative write
51
+ path; legacy tables are maintained as a compatibility projection.
52
+ - Added one-time pre-flip SQLite backup, `PRAGMA user_version=4`, schema-version
53
+ reporting, and fail-closed protection for newer DB formats.
54
+ - Added the durable async run executor for agent/workflow runs: persisted
55
+ queued/running/final states, realtime SSE progress, cooperative cancellation,
56
+ and startup reconciliation of orphaned active runs.
57
+ - Added stable user UUID migration, centralized RBAC policy enforcement, local
58
+ invitation tokens, and SQLite-backed Workspace OS state with JSON compatibility
59
+ mirroring and no durable-history truncation.
60
+ - Retired the legacy static UI pages in favor of the v4 `/app` SPA. Legacy GET
61
+ routes redirect into `/app`; new parity views cover token-native account,
62
+ workspace/org management, invitations, snapshots/time-machine with
63
+ merge-restore, activity/presence, run approvals/cancellation, workflow
64
+ triggers, Brain Network peer pairing/push, chat context trace, and Knowledge
65
+ Graph provenance coverage, with en/ko i18n gated by frontend lint.
66
+
3
67
  ## [3.6.0] - 2026-06-10
4
68
 
5
69
  > Knowledge Graph First. The Knowledge Graph becomes the primary architecture:
@@ -41,7 +41,7 @@ The bus is **in-process** (one server, local-first) and fans events out to
41
41
  in-memory subscriber queues.
42
42
 
43
43
  > **Compatibility.** This subsystem is purely additive. It introduces new
44
- > `/realtime/*` endpoints and an `/activity` page, and it attaches to the
44
+ > `/realtime/*` endpoints and an `/app#/activity` page, and it attaches to the
45
45
  > existing `WorkspaceOSStore` through an optional `event_sink` hook. No v1.x
46
46
  > data shape, API, or behavior changes. With zero subscribers the bus is a
47
47
  > no-op, so single-user local mode behaves exactly as before.
@@ -274,8 +274,8 @@ router is mounted in `server_app.py` with the live bus, the auth helpers, and
274
274
 
275
275
  ### `GET /activity`
276
276
 
277
- Serves the Activity UI page (`static/activity.html`). Returns `404` if the UI
278
- file or static directory is not available.
277
+ Compatibility redirect to `/app#/activity`. The Activity UI is part of the v4
278
+ SPA and reads `/realtime/feed`, `/realtime/presence`, and `/workspace/time-machine`.
279
279
 
280
280
  ### `GET /realtime/stream`
281
281
 
@@ -6,9 +6,9 @@
6
6
 
7
7
  Entry point: **`/app`** (served by `latticeai/api/static_routes.py` →
8
8
  `static/v3/index.html`). Login, auto-login after registration, SSO callback, and
9
- the PWA manifest land on `/app`. The legacy multi-page screens (`/workspace`,
10
- `/chat`, `/graph`, `/admin`, …) remain reachable only as compatibility/debug
11
- routes; normal user workflows stay in `/app`.
9
+ the PWA manifest land on `/app`. Legacy multi-page static screens have been
10
+ deleted; compatibility routes (`/workspace`, `/chat`, `/graph`, `/admin`, …)
11
+ redirect into their `/app#/...` views.
12
12
 
13
13
  ---
14
14
 
@@ -31,11 +31,12 @@ One declarative table (`static/v3/js/core/routes.js`) drives the nav rail, the
31
31
  command palette, the router, breadcrumbs, and lazy view loading.
32
32
 
33
33
  ```
34
- Workspace Home · Chat
35
- Retrieval Knowledge Graph · Hybrid Search
36
- Data Files · Pipeline*
37
- Compute Agents* · Models · My Computer*
38
- System Settings
34
+ Brain Knowledge Graph · Hybrid Search · Memory
35
+ Ask Chat
36
+ Capture Files · Pipeline*
37
+ Act Agents* · Runs* · Workflows* · Planning* · Hooks*
38
+ Library Models · Skills* · MCP* · Marketplace*
39
+ System Overview · Account · Workspaces · Snapshots · Activity · Network* · Settings · My Computer*
39
40
  Administration Users · Permissions · Audit Logs · Security · Policies · Private VPC (admin mode)
40
41
  ```
41
42
 
@@ -5,22 +5,36 @@
5
5
  > completed analysis. **Update this file before ending any phase and before any
6
6
  > likely session/context/usage limit.**
7
7
  >
8
- > Last updated: 2026-06-12 — RELEASE CANDIDATE PREPARED (Phase D complete; awaiting human review)
8
+ > Last updated: 2026-06-12 — v4.0.1 maintenance release prep; T9 remainder remains closed
9
9
 
10
10
  ---
11
11
 
12
12
  ## 0. RC STATUS (final)
13
13
 
14
- **v4.0.0 release candidate is on `origin/feat/v4-digital-brain`.**
15
- Validation: 571 unit tests pass · ruff clean · check:python 186 modules ·
16
- lint_v3 all checks · installed-wheel smoke (19 modules from clean venv) ·
17
- release artifacts validated (wheel + sdist + npm tgz, 2.0MB).
18
- NO merge, NO tag, NO publish — awaiting review.
19
- Remaining gaps (labeled in FEATURE_STATUS.md §v4.0.0 + RELEASE_NOTES_v4.0.0.md):
20
- T3d decomposition/v2-flip, T7c async engine, T6 remainder (UUIDs/policy/
21
- invitations/SQLite state), T9 remainder (legacy deletion + parity views,
22
- login, i18n, T9b surfaces), pptx history rewrite (owner), consent-gated
23
- embedder provisioning. All contracts live in docs/V4_IMPLEMENTATION_PLAN.md.
14
+ **v4.0.1 packages the `main` commits after tag `v4.0.0`; implementation gaps are empty.**
15
+ Latest verified implementation milestone: T9 remainder closed with full unit coverage
16
+ (`585 passed`), ruff, Python compile, `npm run lint`, `npm run build:assets`,
17
+ Playwright v3 visual coverage, Python sdist/wheel build, installed-wheel smoke,
18
+ and `npm pack --dry-run`.
19
+ The v4.0.1 release process builds and validates artifacts for GitHub Release
20
+ attachment only. It does not publish to PyPI, npm Registry, VS Code Marketplace,
21
+ Open VSX, or production deployment targets.
22
+ v4.0.1 validation completed: Python compile, ruff, 585 unit tests, 9 live
23
+ integration tests, frontend lint, VS Code typecheck, 16 Playwright visual tests,
24
+ Python wheel/sdist build, npm tgz build, VSIX build, release artifact
25
+ validation, wheel smoke, and npm pack dry-run all passed.
26
+ Remaining implementation gaps: **none**.
27
+ Owner-only blockers: pptx history rewrite (requires force-push/owner decision)
28
+ and consent-gated production embedder provisioning (silent default download is
29
+ not permitted).
30
+
31
+ ## Remaining Gaps
32
+
33
+ None. The T9 remainder was closed on main with legacy page deletion, `/app`
34
+ parity views, token-native account UI, en/ko i18n, approval/run inbox,
35
+ workflow-trigger controls, Brain Network UI, chat context-trace panel, and
36
+ Knowledge Graph provenance coverage surfaced in the SPA. Owner-only blockers
37
+ above are intentionally not implementation gaps.
24
38
 
25
39
  ## 1. Program Charter (from the user's v4.0.0 directive)
26
40
 
@@ -55,7 +69,7 @@ chat-history import added; garden = watched source; T9b UI track added;
55
69
  T7 owns workflow_engine.py + realtime.py with suspension/reconciliation
56
70
  specs; tracks run strictly serially). Review record:
57
71
  `docs/v4-audit/v4_design_review.json`.
58
- **Phase C (Implementation) — T1 COMPLETE; next: T2 (Packaging & app factory).**
72
+ **Phase C (Implementation) — COMPLETE on main. Remaining implementation gaps are empty.**
59
73
 
60
74
  Track log (update at every track boundary):
61
75
  - **T2 DONE** (commit `5e8aa1b`, 74 files). Agent did ~90% then died on a
@@ -98,10 +112,15 @@ Track log (update at every track boundary):
98
112
  mark_superseded(). Suite 507.
99
113
  - **T3e DONE**: docs/kg-schema.md rewritten to match code (false API
100
114
  claims removed; FTS5/scope/temporal documented).
101
- - RESEQUENCING DECISION: T3d (decomposition + write-mastering flip) is
102
- agent-scale and limit-blocked until ~17:30 KST; T4 sub-units proceed
103
- inline meanwhile safe because T4 rewires *callers* onto public store
104
- APIs which T3d preserves (suite-green gate).
115
+ - **T3d DONE**: `knowledge_graph.py` is now a root compatibility shim;
116
+ implementation moved under `latticeai/brain/` (`store`, `schema`,
117
+ `projection`, `write_master`, `discovery`, `ingest`, `provenance`,
118
+ `documents`, `retrieval`), with every module under 1,500 lines. v2 is
119
+ the authoritative write door; legacy tables are maintained as the
120
+ compatibility projection. Startup creates a one-time pre-flip SQLite
121
+ backup for existing graph data, stamps `PRAGMA user_version=4`, refuses
122
+ newer DB formats, and preserves legacy read/import compatibility.
123
+ Focused KG validation: 43 passed.
105
124
  - **T4.1 DONE** (commits `427d6a3` + `a2a1445`): chat (app_factory
106
125
  save_to_history), MCP (/mcp/call knowledge_graph_ingest), and uploads
107
126
  (upload_service) all route through IngestionPipeline — new
@@ -164,6 +183,16 @@ Track log (update at every track boundary):
164
183
  accept allowed_workspaces; search router scopes via _ScopedSearchService
165
184
  proxy + PLATFORM.allowed_scopes; ContextAssembler hybrid seam scoped per
166
185
  user. Legacy NULL rows machine-visible (documented). Suite 564.
186
+ - **T6-remainder DONE**: users now carry stable `user:<uuid>` identities
187
+ with non-destructive `users.json` migration; sessions store UUID subjects
188
+ while preserving email compatibility; workspace memberships/owners and KG
189
+ identity columns migrate from email strings to UUIDs. `core/policy.py` is the
190
+ enforced role/capability map behind admin dependencies and `/admin/roles`.
191
+ Invitations are real local tokens (create/list/accept/expire) and accepted
192
+ workspace invites add UUID-keyed members. Workspace OS state imports once from
193
+ JSON into the same `knowledge_graph.sqlite`, mirrors JSON for compatibility,
194
+ writes transactionally, and no longer truncates durable history collections.
195
+ Suite: 583.
167
196
  - **T7d DONE** (commit 235f9b6): latticeai/services/triggers.py —
168
197
  interval scheduler (missed-while-down → recorded skip events, no
169
198
  catch-up) + brain_event triggers via visible post_tool hook on
@@ -171,29 +200,31 @@ Track log (update at every track boundary):
171
200
  status; started in app factory w/ idempotent hook registration. Suite 569.
172
201
  - **T7e DONE** (commit 014ca91): custom registry agents executable
173
202
  (config actually loaded; honest skip in simulation).
203
+ - **T7c DONE**: `latticeai/services/run_executor.py` owns durable asyncio
204
+ server-loop tasks for agent/workflow runs. `/agents/api/run` and workflow
205
+ definition runs now persist queued rows, execute sync orchestrator/tool work
206
+ via `asyncio.to_thread`, update the same run row through running/final states,
207
+ publish progress through the existing realtime SSE feed, support cooperative
208
+ cancellation, and reconcile orphaned active runs to `interrupted` at startup
209
+ while preserving `awaiting_approval` pause cursors. `RealtimeBus.publish` is
210
+ thread-safe via subscriber-loop `call_soon_threadsafe`. Suite: 579.
174
211
  - **T9-canvas DONE** (commit 2fee077): force-directed canvas explorer
175
212
  (graph-canvas.js + Explore rewire; visual spec updated).
176
213
  - **T9-IA DONE** (commit 972d34c): brain-first nav (Brain/Ask/Capture/
177
214
  Act/Library/System); knowledge-graph is the default landing route.
178
- - **PHASE D DECISION**: moving to T10 RC prep. REMAINING GAPS (honest,
179
- labeled, not faked): T3d brain decomposition + v2 write-mastering flip;
180
- T7c async run engine/cancellation/SSE/startup reconciliation; T6
181
- remainder (user UUIDs, enforced policy module, invitations, workspace
182
- SQLite state); T9 remainder (legacy page deletion + parity views, login
183
- rebuild, artifact ungitting, i18n, T9b approval/network/trace surfaces).
184
- All have full contracts in docs/V4_IMPLEMENTATION_PLAN.md + amendments.
215
+ - **T9 REMAINDER DONE**: legacy static pages and scripts deleted; legacy GET
216
+ routes redirect into `/app`; parity views added for account/profile,
217
+ workspaces/org members/invitations/activation, snapshots/time-machine with
218
+ merge-restore, activity/presence, run approvals/cancellation, workflow
219
+ trigger configuration/status, Brain Network pairing/push, chat context trace,
220
+ and KG provenance coverage. en/ko i18n runtime backs routes, shell, and new
221
+ parity views; `scripts/lint_v3.mjs` gates it. Visual coverage moved to the
222
+ v3 surface and legacy-page specs were retired.
185
223
  - T9-canvas agent left static/v3/js/views/graph-canvas.js (509 lines,
186
224
  node --check passes) but NEVER rewired knowledge-graph.js — file kept
187
225
  uncommitted in tree; integration outstanding.
188
- - NOTE: T3d + T9-canvas agents died instantly on session limits THREE times
189
- (latest reset 4:10am KST)
190
- (next reset 23:00 KST); both tasks remain queued with full contracts in
191
- this file + the plan.
192
- - **T3d** (agent task after limits reset 17:30 KST): latticeai/brain/
193
- decomposition (store/discovery/ingest/provenance/documents/extraction,
194
- ≤1,500 lines/module, no mixin god-object) + v2 write-mastering flip
195
- (backup-first, re-entrant migrator keyed on data state, downgrade
196
- marker via PRAGMA user_version, equivalence scoped to pre-flip data).
226
+ - NOTE: The old T3d queue is closed. T9 parity surfaces remain active with
227
+ full contracts in this file + the plan.
197
228
  - **T3e**: docs/kg-schema.md regenerated from enums.
198
229
  - graph_curator decision moved to T4.
199
230
  - **T9 PARTIAL — vendoring half DONE** (commit `aa613ae`, parallel-safe per
@@ -201,9 +232,7 @@ Track log (update at every track boundary):
201
232
  Tabler icons, chart.js, marked.js vendored under static/vendor);
202
233
  --lt3-on-accent token added; sw.js rebuilt around the v3 manifest;
203
234
  lint_v3.mjs now mechanically enforces token/inline-style/CDN rules;
204
- 6 guard tests. REMAINING T9: canvas graph port (item 2), IA regroup (1),
205
- legacy deletion + redirects (3, needs parity views), login rebuild,
206
- artifact ungitting, i18n, T9b surfaces (after T7/T8).
235
+ 6 guard tests. Closed later by T9-canvas, T9-IA, and T9 remainder.
207
236
  - **T1 DONE** (commits `1cddc67` frontend + `c574eb6` backend). All 7 items:
208
237
  by-id snapshot/memory authz via new WorkspaceService.authorize_record_read/
209
238
  authorize_memory_delete; /workspace/os leak removed (workspace_count
@@ -249,8 +278,9 @@ the canonical Phase A record.**
249
278
  services, 27 API routers + `server_app.py` at 1,554 lines). Legacy root
250
279
  modules ~6,720 lines incl. `knowledge_graph.py` **4,633 lines**,
251
280
  `kg_schema.py` 521, `llm_router.py` 775, `mcp_registry.py` 791.
252
- - Frontend: `/app` v3 SPA (`static/v3/`, 22 views, token-native) is primary;
253
- legacy static HTML pages (`static/*.html`) still shipped in parallel.
281
+ - Frontend: `/app` v3 SPA (`static/v3/`, token-native) is primary; legacy
282
+ static HTML pages were later removed and compatibility routes redirect
283
+ into `/app`.
254
284
  - Repo root clutter: ~30 `ltcai-*.tgz` tarballs, `ltcai-0.3.1/` extracted copy,
255
285
  logs, `chat_history.json`, 15MB pptx — most likely untracked; verify with
256
286
  `git ls-files` before cleaning.
@@ -495,15 +525,28 @@ retained for context only:
495
525
 
496
526
  ## 11. Branch Status
497
527
 
498
- - `feat/v4-digital-brain` exists locally, based on main @ 5889195 (v3.6.0).
499
- - Not yet pushed to origin. No implementation commits yet.
528
+ - `main` contains the v4 implementation through T9 remainder closure and is
529
+ pushed to `origin/main` at every verified milestone.
530
+ - No tag, package publish, release upload, production deployment, force-push, or
531
+ history rewrite has been performed.
500
532
 
501
533
  ## 12. Validation Status
502
534
 
503
- - main baseline: 455 unit pass / 9 pre-existing integration failures
504
- (ConnectError, need live server). Nothing run on the branch yet beyond this.
535
+ - Full unit suite: `.venv/bin/python -m pytest tests/unit -q` **585 passed,
536
+ 2 warnings**.
537
+ - Focused T9 tests: `tests/unit/test_workspace_os.py`,
538
+ `tests/unit/test_static_release_hygiene.py`, and `tests/visual/v3.spec.js`
539
+ passed after the parity/legacy-retirement changes.
540
+ - Static and code gates: `.venv/bin/python -m ruff check .`,
541
+ `.venv/bin/python scripts/check_python.py`, `npm run lint`,
542
+ `npm run build:assets`, and `node --check` on changed/new v3 JS passed.
543
+ - Build/package gates: `.venv/bin/python -m build`,
544
+ `.venv/bin/python scripts/wheel_smoke.py`, and `npm pack --dry-run` passed.
505
545
 
506
546
  ## 13. Files Modified (branch vs main)
507
547
 
508
- - `docs/V4_DIGITAL_BRAIN_RECOVERY.md` (this file) NEW.
509
- - (none else yet)
548
+ - T9 remainder changed backend compatibility redirects and SPA-facing APIs,
549
+ Workspace OS snapshot restore, v3 shell/routing/store/i18n/API modules, new
550
+ parity views, asset manifests, package/static inclusion rules, unit and visual
551
+ tests, mocks, release/status documentation, and removed retired legacy static
552
+ pages/scripts/CSS/tests.
package/docs/kg-schema.md CHANGED
@@ -205,8 +205,12 @@ provenance(source_type, source_uri, content_hash, captured_at, modified_at,
205
205
  `knowledge_graph.KnowledgeGraphStore` 가 열릴 때 v2 스키마를 생성/치유하고
206
206
  (`kg_schema.KGStoreV2.init_schema` — 추가 컬럼은 `ALTER` 로 in-place 치유,
207
207
  edges_v2 식별자 변경은 create→copy→swap 으로 재구축), legacy 데이터를
208
- v2 로 백필한다. 기존 `nodes` / `edges` 테이블은 건드리지 않는다 v4
209
- write-mastering 전환(T3d) 전까지 legacy 가 쓰기 마스터다.
208
+ v2 로 백필한다. 기존 `nodes` / `edges` 테이블은 삭제하지 않는다. v4 에서는
209
+ `nodes_v2` / `edges_v2` 가 쓰기 마스터이며, legacy 테이블은 이전 import/API
210
+ 소비자를 위한 compatibility projection 으로 같은 트랜잭션에서 갱신된다.
211
+ 기존 그래프 데이터가 있는 DB는 전환 전 `backups/*.pre-v2-write-master.*.sqlite`
212
+ 스냅샷을 한 번 생성하고, `PRAGMA user_version=4` 와 `kg_meta.db_format_version=4`
213
+ 를 기록한다. 더 높은 포맷의 DB는 fail-closed 로 열리지 않는다.
210
214
 
211
215
  ---
212
216
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  | 약속 | 목표 (PPT) | 현재 (repo) | 갭 |
11
11
  |------|-----------|-------------|----|
12
- | Cross-Platform Parity | Win·macOS·Linux·iOS·Android, 같은 디자인 토큰·컴포넌트 | Web(static) + VSCode ext + Telegram (브라우저 어디서나) | 네이티브 데스크탑/모바일 셸 없음 (PWA 부분 지원) |
12
+ | Cross-Platform Parity | Win·macOS·Linux·iOS·Android, 같은 디자인 토큰·컴포넌트 | `/app` SPA + VSCode ext + Telegram (브라우저 어디서나) | 네이티브 데스크탑/모바일 셸 없음 (PWA 부분 지원) |
13
13
  | Zero-Config Auto Setup | PROBE → RECOMMEND → INSTALL → VERIFY → PRESET, 90초 내 | `LTCAI doctor` (의존성만 체크 = PROBE의 일부) | GPU/RAM 프로빙, 추천, 설치, 벤치마크, 프리셋 미구현 |
14
14
  | Everything is a Graph | 10 노드 타입 / 12 엣지 타입 / 임베딩 / 신뢰도+증거 | nodes·edges·chunks 테이블 + 한글 동사 엣지(EDGE_VERB) | 명시 enum·embedding·confidence/evidence·owner 결손 |
15
15
 
@@ -20,7 +20,7 @@
20
20
  PPT 명세는 "한 코드·다섯 화면" — Shared Core(Design Tokens, UI Components, Business Logic, AI/Graph Core) 위에서 Tauri(데스크탑) / Capacitor·RN(모바일) 렌더러가 같은 결과를 낸다.
21
21
 
22
22
  **현재 구현**
23
- - `static/chat.html`, `static/graph.html`, `static/admin.html`, `static/account.html` 4개 HTML `static/css/tokens.css` 단일 토큰을 공유 (v2.2.1)
23
+ - `static/v3/` `/app` SPA 단일 토큰과 컴포넌트를 공유하며 legacy HTML 페이지는 v4에서 삭제됨
24
24
  - `vscode-extension/` — TypeScript VSCode 통합
25
25
  - `static/manifest.json` + `static/sw.js` — PWA 부분 지원 (iOS/Android 홈 화면 추가는 됨)
26
26
  - `telegram_bot.py` — Telegram 미러
@@ -28,11 +28,11 @@ PPT 명세는 "한 코드·다섯 화면" — Shared Core(Design Tokens, UI Comp
28
28
  **갭**
29
29
  - 데스크탑 네이티브 셸 (Tauri) 미구현
30
30
  - 모바일 네이티브 (Capacitor / RN) 미구현
31
- - 다국어(i18n) 시스템화 (HTML에 한글 하드코딩)
31
+ - `/app` SPA i18n(en/ko) 런타임은 구현됨; 네이티브 데스크탑/모바일 셸은 아직 없음
32
32
 
33
33
  **보강 결과물 (완료, v2.2.1)**
34
- - `static/css/tokens.css` — 4개 HTML이 공유하는 단일 진실 토큰 (`:root` = 라이트, `[data-lt-theme="dark"]` = 다크)
35
- - `static/css/responsive.css` + `static/scripts/ux.js` — 반응형 레이아웃 / 라이트·다크 토글 + OS 감지 + 지속화
34
+ - `static/css/tokens.css` + `static/v3/css/` `/app` SPA가 공유하는 단일 진실 토큰
35
+ - `static/v3/js/core/store.js` + `shell.js` — 반응형 레이아웃 / 라이트·다크 토글 + OS 감지 + 지속화
36
36
  - 로드맵: `apps/desktop/` (Tauri 셸) · `apps/mobile/` (Capacitor 셸) 차후 단계
37
37
 
38
38
  ---
@@ -103,9 +103,9 @@ chunks ( id, source_node, text, metadata_json, created_at )
103
103
  | **PPT 명세** | `#FFFFFF` 또는 `#0B0B16` | `#6E4AE6` Lattice 보라 |
104
104
 
105
105
  **보강 결과물 (완료, v2.2.1)**
106
- - `static/css/tokens.css` — 단일 토큰을 모든 화면이 공유. `:root` 가 라이트 값,
106
+ - `static/css/tokens.css` — 단일 토큰을 `/app` 화면이 공유. `:root` 가 라이트 값,
107
107
  `[data-lt-theme="dark"]` 가 다크 값을 정의하는 단일 진실 소스
108
- - 라이트/다크 토글 + OS 다크모드 감지 + 지속화는 `static/scripts/ux.js` 가 담당
108
+ - 라이트/다크 토글 + OS 다크모드 감지 + 지속화는 `static/v3/js/core/store.js` 와 `shell.js` 가 담당
109
109
 
110
110
  ---
111
111
 
@@ -115,10 +115,10 @@ PPT 화면 1, 13 (login, security) 에 한국어 / Microsoft Entra ID / Okta SSO
115
115
 
116
116
  **현재**
117
117
  - `server.py` 의 `/auth/sso` 엔드포인트 존재 (architecture.md 언급) — Entra/Okta 둘 다 명시되어 있는지 확인 필요
118
- - 다국어 — HTML 하드코딩 (`lang="ko"`)
118
+ - 다국어 — `/app` SPA en/ko 런타임(`static/v3/js/core/i18n.js`)과 언어 선택이 구현됨
119
119
 
120
120
  **갭 / 다음 단계**
121
- - i18n 사전 (`static/i18n/{ko,en,ja}.json`) 추출 PPT 명세 그대로 토큰화
121
+ - i18n 사전 런타임은 `static/v3/js/core/i18n.js` 구현됨; 추가 언어는 사전에 확장
122
122
 
123
123
  ---
124
124
 
@@ -127,7 +127,7 @@ PPT 화면 1, 13 (login, security) 에 한국어 / Microsoft Entra ID / Okta SSO
127
127
  | 순위 | 파일 | 무엇 |
128
128
  |------|------|------|
129
129
  | 1 | `docs/kg-schema.md`, `kg_schema.py` | KG 스키마 정식화 (10 노드 · 12 엣지 · embedding · confidence) |
130
- | 2 | `static/css/tokens.css` (+ `responsive.css`, `ux.js`) | 디자인 토큰 통합 + 라이트/다크 v2.2.1 완료 |
130
+ | 2 | `static/css/tokens.css` + `static/v3/` | 디자인 토큰 통합 + 라이트/다크 + en/ko i18n |
131
131
  | 3 | `auto_setup.py` | OS 프로빙 + 모델 추천 + 설치 어댑터 |
132
132
  | 4 | `docs/architecture.md` 보강 | 위 변경 반영 |
133
133
  | 5 | (차후) `apps/desktop`, `apps/mobile` 스캐폴딩 | Tauri/Capacitor |