ltcai 3.4.1 → 3.5.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.
package/README.md CHANGED
@@ -3,11 +3,10 @@
3
3
 
4
4
  # Lattice AI
5
5
 
6
- **Lattice AI v3 Local-First AI Workspace Platform.**
6
+ **Local-first AI workspace for your files, chats, knowledge, models, and agents.**
7
7
 
8
- Work across Personal and Organization workspaces with Knowledge Graph,
9
- Vector Index, Hybrid Search, Native Chat, agents, files, models, and
10
- Basic / Advanced / Admin modes.
8
+ Keep your work context on your own machine. Connect documents, conversations,
9
+ local models, graph memory, and agent workflows in one self-hosted workspace.
11
10
  </div>
12
11
 
13
12
  <div align="center">
@@ -23,7 +22,96 @@
23
22
 
24
23
  </div>
25
24
 
26
- ![Lattice AI — local-first AI workspace](docs/assets/v3.4.0/home.png)
25
+ ![Lattice AI — local-first AI workspace home](docs/assets/v3.4.0/home.png)
26
+
27
+ > **Lattice AI is a self-hosted AI workspace that keeps your files, chats, knowledge, local models, and agents together on your own machine.**
28
+
29
+ It isn't another chat window. It's a workspace built around your work — local-first
30
+ by default, cloud only when you choose.
31
+
32
+ ## Why install Lattice AI?
33
+
34
+ Most AI tools only answer questions in a chat window. Lattice AI gives you a
35
+ workspace around the work itself:
36
+
37
+ - **Keep everything in one place** — files, notes, chats, and decisions live
38
+ together instead of scattered across tabs and apps.
39
+ - **Turn documents into knowledge** — uploads and connected folders become
40
+ searchable, linked context you can reuse.
41
+ - **Search the way you think** — fuse keyword, vector, and knowledge-graph
42
+ signals in a single query.
43
+ - **Stay private and offline-capable** — run local models through MLX, Ollama, or
44
+ LM Studio; nothing leaves your machine unless you opt in.
45
+ - **Use cloud models only when you choose** — bring an API key for cloud LLMs
46
+ when you want them, not by default.
47
+ - **Automate with agents you can inspect** — workflows leave behind plans,
48
+ reviews, retries, and results you can replay.
49
+
50
+ Lattice AI is not a clone of ChatGPT, Claude, Cursor, Obsidian, or Notion. It
51
+ sits in a different place: a **workspace** that ties local/self-hosted AI, your
52
+ files, project knowledge, hybrid search, local and optional cloud models, agents,
53
+ and workflows together — and runs on your own hardware.
54
+
55
+ ## What can you do with it?
56
+
57
+ - Build a private AI workspace for a project, scoped to your machine.
58
+ - Chat with your local files, images, and workspace memory.
59
+ - Upload documents — or connect a folder — and turn them into searchable knowledge.
60
+ - Explore how files, decisions, conversations, and entities connect in a
61
+ Knowledge Graph.
62
+ - Run local models through MLX, Ollama, or LM Studio, and use cloud LLMs only when
63
+ you want to.
64
+ - Create repeatable agent workflows for research, coding, analysis, and
65
+ documentation.
66
+ - Separate personal work from organization work.
67
+ - Switch between Basic, Advanced, and Admin modes depending on your role.
68
+
69
+ ## Product Tour
70
+
71
+ ### Start from the workspace home
72
+
73
+ ![Lattice AI workspace home — readiness, model state, and retrieval status](docs/assets/v3.4.0/home.png)
74
+
75
+ The home view shows workspace readiness, model state, retrieval status, and the
76
+ main entry points — derived from real local state, never placeholder counters.
77
+
78
+ ### Chat with files, images, and workspace context
79
+
80
+ ![Lattice AI chat connected to files, graph context, and vision input](docs/assets/v3.4.0/chat.png)
81
+
82
+ Chat is wired to your files, graph context, memory, and model routing — including
83
+ vision-capable image input by attach, drag-and-drop, or paste.
84
+
85
+ ### Bring documents into the workspace
86
+
87
+ ![Lattice AI files view — uploaded documents and connected folders](docs/assets/v3.4.0/files.png)
88
+
89
+ Uploads and connected folders become indexed workspace context, searchable from
90
+ chat and hybrid search.
91
+
92
+ ### Understand knowledge visually
93
+
94
+ ![Lattice AI knowledge graph of files, decisions, conversations, and entities](docs/assets/v3.4.0/knowledge-graph.png)
95
+
96
+ The Knowledge Graph shows how files, decisions, conversations, and entities
97
+ connect — context that stays useful even when you switch models.
98
+
99
+ ### Run agent workflows
100
+
101
+ ![Lattice AI agent run with roles, logs, review, and retry](docs/assets/v3.4.0/agent-run.png)
102
+
103
+ Agents turn a goal into an inspectable run — roles, logs, review, and retry — that
104
+ you can read back step by step.
105
+
106
+ ### Extend with hooks and the local runtime
107
+
108
+ ![Lattice AI hooks dispatch with a recent-execution log](docs/assets/v3.4.0/hooks-dispatch.png)
109
+
110
+ ![Lattice AI local agent status, handshake, and folder watching](docs/assets/v3.4.0/local-agent.png)
111
+
112
+ Advanced users wire lifecycle hooks into runs, tools, workflows, uploads, and
113
+ indexing — and see the on-device local runtime's real status, handshake, and
114
+ folder-watch activity.
27
115
 
28
116
  ## Install
29
117
 
@@ -65,279 +153,116 @@ Then open:
65
153
  http://127.0.0.1:4825/app
66
154
  ```
67
155
 
68
- Development checkout:
156
+ Working from a development checkout:
69
157
 
70
158
  ```bash
71
159
  npm install
72
160
  npm run dev
73
161
  ```
74
162
 
75
- Useful validation commands:
76
-
77
- ```bash
78
- npm run check:python
79
- npm run test:unit
80
- npm run build
81
- ```
82
-
83
- ## What Is Lattice AI?
84
-
85
- Lattice AI v3 is a local-first AI workspace platform for people and teams who
86
- want their files, models, graph context, retrieval, and agent workflows in one
87
- place.
88
-
89
- - **Primary app shell**: `/app` is the default product experience with Chat,
90
- Files, Hybrid Search, Knowledge Graph, Memory, Models, Settings, Advanced
91
- agent/workflow tooling, and Admin areas. Classic pages remain compatibility
92
- routes only; normal workflows stay in `/app`.
93
- - **Local-first AI Workspace**: work starts on your machine, with local data and
94
- workspace state by default.
95
- - **AI Pipeline Platform**: plan, execute, review, retry, and replay work across
96
- local models, cloud models, tools, files, and generated artifacts.
97
- - **Knowledge Graph Platform**: documents, images, screenshots, notes,
98
- conversations, and decisions become linked entities, relationships, evidence,
99
- and reusable context.
100
- - **Multi-Agent Workflow Platform**: agents hand off structured context, review
101
- work, retry with reasons, and keep timelines inspectable.
102
- - **Personal / Organization Workspace**: move between personal work and team
103
- workspaces with role-aware views and Basic / Advanced / Admin modes.
104
- - **Vector Index and Hybrid Search**: local vector rows are derived from the
105
- Knowledge Graph and fused with keyword and graph signals.
106
- - **Local Model Management**: choose current multimodal local models with source
107
- disclosure, hardware-aware recommendations, and cloud fallback options.
108
- - **Community-first workspaces**: Personal and Organization workspaces ship in
109
- the local product; enterprise SSO/SCIM/governance remain future extensions.
110
-
111
- ## Why Lattice AI?
112
-
113
- Most AI tools split your work across a chat window, a model picker, loose files,
114
- and disconnected automations. Lattice AI keeps those parts together:
115
-
116
- - files and conversations become graph context;
117
- - graph context feeds pipelines and coding actions;
118
- - model cards disclose country, company, run mode, internet usage, and model
119
- identity;
120
- - personal and organization workspaces keep team workflows separate from local
121
- work;
122
- - multi-agent workflows leave behind replayable plans, reviews, retries, and
123
- outcomes.
124
-
125
- ## v3.4.1 Highlights
126
-
127
- Lattice AI v3.4.1 is the **runtime completion** release: it makes the v3.4.0
128
- runtime systems verifiably complete and corrects the v3.4.0 overclaims an
129
- implementation audit found. Every item is verified by a **live end-to-end run**
130
- against a booted server (see `docs/assets/v3.4.1/e2e_runtime_log.txt`).
131
-
132
- - **Hooks — full lifecycle.** One shared tool-dispatch path fires `pre_tool`/
133
- `post_tool` across the HTTP, agent, and workflow tool paths (v3.4.0 only fired
134
- on the HTTP path); workflow hooks fire from both the designer and platform
135
- paths; the upload pipeline fires granular upload + index hooks; **all 7
136
- built-in hooks have real runners**, and non-executable hooks are flagged
137
- `advisory`.
138
- - **Local Agent — real probes.** `online`/`handshake`/`health`/
139
- `filesystem_access` are no longer hardcoded — they are probed (real filesystem
140
- write, live graph reachability, derived `mode`, `pid`, handshake latency).
141
- - **Connect Folder — proven end-to-end.** A real local folder is connected,
142
- indexed, and visible in the Files table, retrieval, and hybrid search.
143
- - **Folder Watch — proven end-to-end + restore.** Creating a file triggers a
144
- debounced reindex (`watchdog` installed); the watch is restored after restart.
145
-
146
- See [RELEASE_NOTES_v3.4.1.md](RELEASE_NOTES_v3.4.1.md) and the evidence-traced
163
+ ## Core Features
164
+
165
+ - **Local-first workspace** — your data, models, and workspace state live on your
166
+ machine by default; cloud is opt-in.
167
+ - **Files and connected folders** — upload documents or connect a local folder;
168
+ Lattice indexes them and watches connected folders for changes.
169
+ - **Chat with workspace context** — conversations are grounded in your files,
170
+ knowledge graph, and memory, with vision-capable image input.
171
+ - **Knowledge Graph** files, images, notes, conversations, and decisions become
172
+ linked entities and relationships you can explore.
173
+ - **Hybrid Search** keyword, vector, and graph signals are fused into one ranked
174
+ result set.
175
+ - **Local model support** — run multimodal models locally via MLX, Ollama, or LM
176
+ Studio, with hardware-aware recommendations and source disclosure.
177
+ - **Optional cloud model routing** add OpenAI-compatible or other cloud models
178
+ when you choose; model cards disclose origin, run mode, and internet use.
179
+ - **Multi-agent workflows** turn goals into runs with roles, handoffs, review,
180
+ retries, and replayable timelines.
181
+ - **Skills, hooks, tools, and MCP** extend the workspace with skills, lifecycle
182
+ hooks, a governed tool registry, and Model Context Protocol servers.
183
+ - **Personal / Organization workspaces** keep personal work separate from team
184
+ work with role-aware views.
185
+ - **Basic / Advanced / Admin modes** — show only what each role needs, from core
186
+ workflows to agent tooling to administration.
187
+
188
+ ## Latest Release
189
+
190
+ ### v3.4.1 Runtime Completion
191
+
192
+ - Full hooks lifecycle across HTTP, agent, workflow, upload, and indexing paths.
193
+ - Real Local Agent probes instead of hardcoded readiness.
194
+ - Connect Folder verified end-to-end.
195
+ - Folder Watch verified, including restore after restart.
196
+
197
+ See [RELEASE_NOTES_v3.4.1.md](RELEASE_NOTES_v3.4.1.md) and
147
198
  [FEATURE_STATUS.md](FEATURE_STATUS.md).
148
199
 
149
- ## v3.4.0 Highlights
150
-
151
- Lattice AI v3.4.0 is the **platform completion** release: it closes the remaining
152
- non-enterprise functionality gaps the v3.3.0 honesty audit flagged, so the
153
- local-first workspace is complete and demonstrable end-to-end. Each item below is
154
- runtime-verified on a live server, not only wired in source.
155
-
156
- - **Hooks now execute.** A real dispatch engine (`run_hook` / `run_hooks` /
157
- `fire_hook` + `HookContext` / `HookResult`) runs hooks at genuine lifecycle
158
- points — agents (pre/post-run), workflows (start/end), tools (pre/post-tool),
159
- and the upload pipeline. `pre_*` hooks can gate (block) an action; every
160
- dispatch is recorded to a persisted run log surfaced in the Hooks view.
161
- - **Uploads appear in Files.** Uploaded documents are listed with live ingest →
162
- index state (`/knowledge-graph/documents`), completing upload → Files →
163
- Knowledge Graph → Hybrid Search → Chat.
164
- - **Vision (VLM) image input.** The Chat composer accepts images by attach,
165
- drag-and-drop, or paste, with a preview and a **Vision Enabled / Disabled**
166
- badge driven by the active model's capability.
167
- - **Run agents from the Agents view.** A Run console (goal + roles → Run / Stop /
168
- Status / Queue / Logs) executes the multi-agent pipeline locally; it runs
169
- without a model and fires its pre/post-run hooks.
170
- - **On-device Local Agent + Connect Folder + Folder Watch.** My Computer reports
171
- the real local-runtime agent status and handshake; folders can be connected and
172
- watched (debounced reindex on change) through the existing on-device endpoints.
173
- - **Enterprise stays honestly disabled.** SSO, SCIM, DLP, Private VPC, SIEM, and
174
- enterprise RBAC remain off with honest "not available in this build" states.
175
-
176
- See [RELEASE_NOTES_v3.4.0.md](RELEASE_NOTES_v3.4.0.md),
177
- [PLATFORM_COMPLETION_REPORT_v3.4.0.md](PLATFORM_COMPLETION_REPORT_v3.4.0.md), and
178
- the evidence-traced [FEATURE_STATUS.md](FEATURE_STATUS.md).
179
-
180
- ## v3.3.1 Highlights
181
-
182
- Lattice AI v3.3.1 rebuilds the visible `/app` product experience while
183
- preserving the existing local-first runtime. The app now presents Chat, Files,
184
- Search, Knowledge, Memory, Models, Settings, Advanced tooling, and Admin
185
- workflows with clearer navigation and honest live/unavailable states.
186
-
187
- - **Visual product rebuild** — compact rail navigation, quieter topbar,
188
- command-palette search, retrieval readiness footer, and denser controls.
189
- - **Truthful Home dashboard** — backend, model, retrieval, memory, source, and
190
- trace readiness are derived from real endpoints instead of fabricated counts.
191
- - **Basic / Advanced / Admin navigation** — Basic focuses on core workspace
192
- workflows; Advanced exposes agents, workflows, skills, hooks, and MCP; Admin
193
- keeps organization controls separate.
194
- - **Files and Settings clarity** — manual upload is available immediately,
195
- folder watching is explicitly tied to the desktop local agent, and Settings
196
- shows backend, agent, model, telemetry, and embedding readiness.
197
- - **Design system refresh** — cooler neutral light/dark tokens, tighter 8px
198
- radius discipline, compact cards/tables/stats/buttons, and regenerated
199
- hashed v3 assets.
200
-
201
- The v3.2.0 platform remains the feature-complete foundation: multi-agent
202
- collaboration, Agent Registry, Marketplace templates, Workflow Agents,
203
- Autonomous Planning, Long-Term Memory, Skills, Hooks, Tool Registry, MCP
204
- Manager, production embedding profiles, and hash-manifested `/app` assets.
205
- Release audit: [docs/V3_2_AUDIT.md](docs/V3_2_AUDIT.md).
206
-
207
- ## Screenshots
208
-
209
- All screenshots are the v3.4.0 `/app` shell. Live model output (VLM inference,
210
- agent-generated text) requires a loaded local model and is not depicted.
211
-
212
- ### Home
213
-
214
- ![Home — local-first workspace at a glance](docs/assets/v3.4.0/home.png)
215
-
216
- ### Chat with Vision (VLM) image input
217
-
218
- ![Chat — image attach + Vision Enabled badge](docs/assets/v3.4.0/chat.png)
219
-
220
- ### Files — uploaded documents + Connect Folder
221
-
222
- ![Files — uploaded documents with index state](docs/assets/v3.4.0/files.png)
223
-
224
- ### Run agents from the Agents view
225
-
226
- ![Agent run — goal, roles, and live timeline logs](docs/assets/v3.4.0/agent-run.png)
227
-
228
- ### Hooks dispatch + run log
229
-
230
- ![Hooks — per-hook Run and recent executions](docs/assets/v3.4.0/hooks-dispatch.png)
231
-
232
- ### Local Agent (on-device runtime)
233
-
234
- ![My Computer — Local Agent status and handshake](docs/assets/v3.4.0/local-agent.png)
235
-
236
- ### Knowledge Graph
237
-
238
- ![Knowledge Graph](docs/assets/v3.4.0/knowledge-graph.png)
239
-
240
- ## Knowledge Graph Flow
200
+ ## How it works
241
201
 
242
202
  ```text
243
- files / documents / images / screenshots / conversations / decisions
244
- -> multimodal understanding
245
- -> entity and relationship extraction
246
- -> evidence and artifact storage
247
- -> Knowledge Graph update
248
- -> AI pipeline context
249
- -> coding actions / analysis / documents / team workflows
203
+ files / chats / notes / images / decisions
204
+ -> workspace memory
205
+ -> knowledge graph
206
+ -> hybrid search
207
+ -> chat / agents / workflows
208
+ -> reusable outputs
250
209
  ```
251
210
 
252
- The graph keeps useful workspace context available even when you change models.
253
-
254
- ## v3 Backend Retrieval
211
+ - Your content stays on your machine and becomes durable workspace memory.
212
+ - Memory is organized into a knowledge graph of entities and relationships.
213
+ - Hybrid search fuses keyword, vector, and graph signals over that context.
214
+ - Chat, agents, and workflows draw on the same grounded context.
215
+ - Outputs — documents, analysis, and decisions — feed back into the workspace.
255
216
 
256
- The v3 backend adds a local-first retrieval stack that combines the Knowledge
257
- Graph, a SQLite vector index, and hybrid result fusion. It preserves existing
258
- graph data while adding derived vector rows that can be rebuilt at any time.
217
+ For the deeper design, see [ARCHITECTURE.md](ARCHITECTURE.md) and
218
+ [docs/architecture.md](docs/architecture.md).
259
219
 
260
- Embedding status: production profiles are exposed through
261
- `GET /api/embeddings/providers`, while `lattice-local-hash-v1` remains a
262
- deterministic fallback for offline indexing and tests. It is never presented as
263
- a production semantic embedding model.
264
-
265
- Core API contracts:
220
+ ## Documentation
266
221
 
267
- - `POST /api/search/hybrid`
268
- - `GET /api/search/keyword?q=...`
269
- - `GET /api/search/vector?q=...`
270
- - `GET /api/graph`
271
- - `GET /api/graph/node?node_id=...`
272
- - `GET /api/graph/relationship`
273
- - `GET /api/index/status`
274
- - `POST /api/index/rebuild`
222
+ ### Product and principles
275
223
 
276
- See [docs/V3_BACKEND_ARCHITECTURE.md](docs/V3_BACKEND_ARCHITECTURE.md) for the
277
- storage model, search model, migration behavior, and API response shape.
224
+ - [PROJECT_PRINCIPLES.md](PROJECT_PRINCIPLES.md) product principles
225
+ - [AI_PHILOSOPHY.md](AI_PHILOSOPHY.md) how AI is used in the workspace
226
+ - [MODEL_POLICY.md](MODEL_POLICY.md) — local model recommendation policy
278
227
 
279
- ## Local Model Policy
228
+ ### Architecture
280
229
 
281
- Lattice AI recommends current-generation multimodal models for local use and
282
- keeps local model choices explicit.
230
+ - [ARCHITECTURE.md](ARCHITECTURE.md) workspace, graph, pipeline, and model overview
231
+ - [docs/architecture.md](docs/architecture.md) full architecture reference
232
+ - [docs/V3_BACKEND_ARCHITECTURE.md](docs/V3_BACKEND_ARCHITECTURE.md) — backend storage, search, and retrieval
283
233
 
284
- | Family | Default role | Example recommendation |
285
- | --- | --- | --- |
286
- | Gemma 4 | Default Google multimodal family | `mlx-community/gemma-4-12b-it-4bit` |
287
- | Gemma 4 large | Higher-quality local multimodal work | `mlx-community/gemma-4-31b-it-4bit` |
288
- | Qwen3-VL | Smaller, balanced multimodal options | `mlx-community/Qwen3-VL-4B-Instruct-4bit` |
289
- | Llama 4 | Meta multimodal option | `mlx-community/Llama-4-Scout-17B-16E-Instruct-4bit` |
234
+ ### Knowledge and retrieval
290
235
 
291
- Every recommended model card shows maker country, maker company, run mode,
292
- internet requirement, and model name. See [MODEL_POLICY.md](MODEL_POLICY.md).
236
+ - [KNOWLEDGE_GRAPH.md](KNOWLEDGE_GRAPH.md) graph model and behavior
293
237
 
294
- ## Architecture
238
+ ### Agents and workflows
295
239
 
296
- ```text
297
- Personal / Organization Workspace
298
- -> files, chats, screenshots, model choices, workflow events
299
- -> Knowledge Graph
300
- -> AI Pipeline
301
- -> Multi-Agent Workflow
302
- -> coding actions, documents, analysis, team handoffs
303
- ```
240
+ - [docs/MULTI_AGENT_RUNTIME.md](docs/MULTI_AGENT_RUNTIME.md) — multi-agent workflow runtime
241
+ - [docs/WORKFLOW_DESIGNER.md](docs/WORKFLOW_DESIGNER.md) AI pipeline designer
304
242
 
305
- Core areas:
243
+ ### Extensions
306
244
 
307
- - FastAPI local workspace app
308
- - Knowledge Graph storage and graph APIs
309
- - AI pipeline and workflow designer
310
- - Multi-agent handoff, review, retry, and replay records
311
- - Local model management and model recommendation catalog
312
- - VS Code / Cursor / VSCodium extension surface
313
- - Personal and organization workspace boundaries
245
+ - [docs/PLUGIN_SDK.md](docs/PLUGIN_SDK.md) plugin SDK
314
246
 
315
- ## Documentation
247
+ ### Releases
316
248
 
317
- - [ARCHITECTURE.md](ARCHITECTURE.md) — workspace, graph, pipeline, and model-management overview
318
- - [docs/architecture.md](docs/architecture.md) — full architecture reference
319
- - [PROJECT_PRINCIPLES.md](PROJECT_PRINCIPLES.md) — product principles
320
- - [AI_PHILOSOPHY.md](AI_PHILOSOPHY.md) — how AI is used in the workspace
321
- - [MODEL_POLICY.md](MODEL_POLICY.md) local model recommendation policy
322
- - [KNOWLEDGE_GRAPH.md](KNOWLEDGE_GRAPH.md) — graph model and behavior
323
- - [docs/MULTI_AGENT_RUNTIME.md](docs/MULTI_AGENT_RUNTIME.md) — multi-agent workflow runtime
324
- - [docs/WORKFLOW_DESIGNER.md](docs/WORKFLOW_DESIGNER.md) — AI pipeline designer
325
- - [docs/REALTIME_COLLABORATION.md](docs/REALTIME_COLLABORATION.md) — realtime workspace events
326
- - [docs/ENTERPRISE.md](docs/ENTERPRISE.md) — organization workspaces and SSO
327
- - [docs/PLUGIN_SDK.md](docs/PLUGIN_SDK.md) — plugin SDK
328
- - [RELEASE_NOTES.md](RELEASE_NOTES.md) and [docs/CHANGELOG.md](docs/CHANGELOG.md)
249
+ - [RELEASE_NOTES.md](RELEASE_NOTES.md) — current release notes
250
+ - [RELEASE_NOTES_v3.4.1.md](RELEASE_NOTES_v3.4.1.md)
251
+ - [RELEASE_NOTES_v3.4.0.md](RELEASE_NOTES_v3.4.0.md)
252
+ - [RELEASE_NOTES_v3.3.0.md](RELEASE_NOTES_v3.3.0.md)
253
+ - [CHANGELOG.md](CHANGELOG.md) and [docs/CHANGELOG.md](docs/CHANGELOG.md)
329
254
 
330
- ## Release history
255
+ ## Release History
331
256
 
332
257
  | Version | Theme |
333
258
  | --- | --- |
334
- | **3.4.1** | Runtime completion — hooks full lifecycle (shared tool dispatch across HTTP/agent/workflow, all built-ins real), Local Agent real probes (no hardcoded readiness), Connect Folder + Folder Watch proven live end-to-end + restore-on-restart; corrects v3.4.0 overclaims |
335
- | 3.4.0 | Platform completion — hooks execution engine, uploads visible in Files, VLM image input, agent run trigger, on-device Local Agent / Connect Folder / Folder Watch; Enterprise stays honestly disabled; refreshed v3.4.0 public assets |
336
- | 3.3.1 | Visual product rebuild — rebuilt `/app` shell, Basic/Advanced/Admin navigation, cooler token palette, compact component system, Home readiness dashboard, Files local-agent truthfulness, Settings runtime status, and v3.3.1 design notes |
337
- | **3.3.0** | Product quality & honesty release — evidence-based feature audit (`FEATURE_STATUS.md`), single-source version truth, working manual document upload in Files, fixed document-generation streaming, truthful Home retrieval status, documented design system (`STYLE_SYSTEM.md`) |
338
- | 3.2.0 | Feature-complete platform — multi-agent collaboration, agent registry, marketplace + templates, workflow agents, autonomous planning, long-term memory + manager, skills/hooks/tool registries, MCP manager, all operable from `/app` |
339
- | 3.1.0 | Mainline platform completion — native `/app` workflows, Classic retired from normal paths, production embedding profiles, AgentRuntime/registries, hashed v3 assets |
340
- | 3.0.1 | Release-blocker remediation — provider-backed embeddings (Hash/MLX/Ollama/OpenAI/Custom), unified AgentRuntime boundary, every v3 surface connected or clearly unavailable |
259
+ | **3.4.1** | Runtime completion — full hooks lifecycle, real Local Agent probes, Connect Folder and Folder Watch verified end-to-end |
260
+ | 3.4.0 | Platform completion — hooks execution, uploads in Files, vision image input, agent run trigger, on-device Local Agent / Connect Folder / Folder Watch |
261
+ | 3.3.1 | Visual product rebuild — rebuilt `/app` shell, Basic/Advanced/Admin navigation, refreshed design system |
262
+ | **3.3.0** | Product quality & honesty release — evidence-based feature audit, single-source version truth, working document upload, documented design system |
263
+ | 3.2.0 | Feature-complete platform — multi-agent collaboration, agent registry, marketplace + templates, workflow agents, long-term memory, skills/hooks/tool registries, MCP manager |
264
+ | 3.1.0 | Mainline platform completion — native `/app` workflows, production embedding profiles, AgentRuntime/registries, hashed v3 assets |
265
+ | 3.0.1 | Release-blocker remediation — provider-backed embeddings, unified AgentRuntime boundary, every v3 surface connected or clearly unavailable |
341
266
  | 3.0.0 | v3 local-first AI workspace platform — `/app`, Native Chat, Knowledge Graph, Vector Index, Hybrid Search, workspace modes |
342
267
  | 2.2.7 | Visual system stabilization — cohesive dark/light screens, crisp chat composer, dark graph canvas, Workspace OS polish |
343
268
  | 2.2.6 | Token-native CSS foundation |
@@ -0,0 +1,56 @@
1
+ # Runtime Hook Coverage — v3.5.0
2
+
3
+ Every place Lattice AI executes a real tool or agent action, and whether it runs
4
+ through the unified lifecycle. The single tool path is
5
+ `dispatch_tool(hooks, name, args, run_fn)` in `latticeai/core/hooks.py`
6
+ (`pre_tool → execute → post_tool`); the HTTP helper `_tool_response`
7
+ (`latticeai/api/tools.py`) wraps it; uploads use the parallel
8
+ `pre_upload/post_upload/pre_index/post_index` lifecycle
9
+ (`latticeai/services/upload_service.py`); agent runs use `pre_run/post_run`.
10
+
11
+ **Method.** Routers/services were enumerated by a 6-way parallel audit and then
12
+ each genuine execution path was verified by reading the call site. A path is a
13
+ *bypass* only if a real tool/agent action skips its lifecycle. Read-only metadata
14
+ endpoints (status, list-permissions, config) execute no tool and are not bypasses.
15
+
16
+ **Result.** All discovered tool/agent execution paths are covered. The four
17
+ remaining "uncovered" rows are deliberate, documented design decisions (service
18
+ maintenance ops + an action already inside the upload lifecycle), not gaps.
19
+
20
+ ## Tool / agent execution paths
21
+
22
+ | Entrypoint | Execution | Lifecycle path | pre fired | post fired | Test |
23
+ |---|---|---|---|---|---|
24
+ | `POST /tools/list_dir`, `workspace_tree`, `write_file`, `search_files`, `todo_*`, `inspect_html`, `preview_url`, `create_*`, `read_document`, `knowledge_*`, `obsidian_*`, `network_status` | tool fn | `_tool_response`→`dispatch_tool` | yes (`pre_tool`) | yes (`post_tool`) | `test_hooks_dispatch`, `test_runtime_coverage` |
25
+ | `POST /tools/read_file` | `read_file` (kwargs) | `_tool_response` (kwargs-aware) ✅v3.5.0 | yes | yes | `test_runtime_coverage` |
26
+ | `POST /tools/edit_file` | `edit_file` (kwargs) | `_tool_response` ✅v3.5.0 | yes | yes | `test_runtime_coverage` |
27
+ | `POST /tools/grep` | `grep` (kwargs) | `_tool_response` ✅v3.5.0 | yes | yes | `test_runtime_coverage` |
28
+ | `POST /tools/clear_history` | `clear_history` | `_dispatch`→`dispatch_tool` ✅v3.5.0 | yes | yes | `test_runtime_coverage` |
29
+ | `POST /tools/git_*`, `run_command`, `build_project`, `deploy_project` | tool fn | `_tool_response` | yes | yes | `test_route_compatibility` |
30
+ | `POST /local/*` (list/read/write) | `local_*` | `tool_response` | yes | yes | `test_route_compatibility` |
31
+ | `GET/POST /cu/*` (open_app/url/click/type/key/scroll/move/drag) | `computer_*` | `tool_response` | yes | yes | `test_runtime_coverage` |
32
+ | `GET /cu/status`, `/cu/screenshot` | `computer_status/screenshot` | `_dispatch` ✅v3.5.0 | yes | yes | `test_runtime_coverage` |
33
+ | `POST /cu/agent` (agent loop) | `execute_tool(name,args)` per step + Chrome shortcut | `_dispatch`→`dispatch_tool` ✅v3.5.0 | yes | yes | `test_runtime_coverage` |
34
+ | `POST /agent/eval` | `execute_tool` per eval case | `dispatch_tool` ✅v3.5.0 | yes | yes | (covered via dispatch_tool) |
35
+ | Single-agent runtime tool calls | `execute_tool` via `AgentDeps` | `core/agent.py`→`dispatch_tool` | yes | yes | `test_hooks_dispatch` |
36
+ | Agent run (start→finish) | orchestrator run | `agent_runtime` `pre_run`/`post_run` | yes (`pre_run`) | yes (`post_run`) | `test_hooks_dispatch` |
37
+ | Workflow tool node | `dispatch_tool` | `platform_runtime` | yes | yes | `test_hooks_dispatch` |
38
+ | Workflow run (start→end) | engine run | `WorkflowEngine` `pre_workflow`/`post_workflow` | yes | yes | `test_hooks_dispatch` |
39
+ | `POST /upload/document` | `process_uploaded_document` | upload lifecycle | `pre_upload` | `post_upload` | existing upload tests |
40
+ | Document indexing (upload + folder watch) | embed/graph build | `pre_index`/`post_index` | yes | yes | existing |
41
+
42
+ ## Intentionally outside the tool lifecycle (documented, not gaps)
43
+
44
+ | Entrypoint | Why not `pre_tool`/`post_tool` |
45
+ |---|---|
46
+ | `read_document` inside `process_uploaded_document` (`upload_service.py`) | Already inside the upload lifecycle (`pre_upload`→`post_upload`); wrapping it again would double-dispatch the same user action. |
47
+ | `POST /api/memory/{prune,compact,rebuild,clear}` | Knowledge/memory **service** maintenance operations, not registry tools; they have their own audit events. Not part of the agent tool vocabulary. |
48
+ | `clear_history` inside `core/agent.py` executor | Runs inside an agent run already bracketed by `pre_run`/`post_run`; not re-wrapped to avoid nested dispatch. |
49
+ | Read-only status/config endpoints (`/tools/permissions`, `/obsidian/status`, model/catalog reads) | Execute no tool — nothing to gate. |
50
+
51
+ ## Summary
52
+
53
+ - Genuine tool/agent execution paths discovered: **all enumerated routers + services**.
54
+ - Bypasses found and closed in v3.5.0: **read_file, edit_file, grep, clear_history, computer-use agent loop (+ /cu/status, /cu/screenshot), skill-eval**.
55
+ - Bypasses remaining: **none** (the four rows above are deliberate, documented design decisions).
56
+ - Coverage of discovered tool/agent execution paths: **100%**.
@@ -1,3 +1,3 @@
1
1
  """Lattice AI - modular server package."""
2
2
 
3
- __version__ = "3.4.1"
3
+ __version__ = "3.5.0"
@@ -1,17 +1,21 @@
1
1
  """Authentication API router: register, login, logout, SSO, profile."""
2
2
 
3
- import base64
4
- import json
5
3
  import logging
6
4
  import secrets
7
5
  import time
8
- from typing import Any, Callable, Dict, Optional
6
+ from typing import Any, Awaitable, Callable, Dict, Optional, Tuple
9
7
  from urllib.parse import urlencode
10
8
 
11
9
  from fastapi import APIRouter, HTTPException, Request
12
10
  from fastapi.responses import JSONResponse, RedirectResponse
13
11
  from pydantic import BaseModel
14
12
 
13
+ from latticeai.core.oidc import (
14
+ OIDCValidationError,
15
+ fetch_jwks as _default_fetch_jwks,
16
+ verify_id_token as _default_verify_id_token,
17
+ )
18
+
15
19
 
16
20
  class UserRegister(BaseModel):
17
21
  email: str
@@ -35,7 +39,9 @@ class UpdateProfileRequest(BaseModel):
35
39
  nickname: Optional[str] = None
36
40
 
37
41
 
38
- _sso_states: Dict[str, float] = {}
42
+ # state → (issued_at, nonce). The nonce binds the eventual ID token to *this*
43
+ # login attempt (replay / token-injection defence); the timestamp expires it.
44
+ _sso_states: Dict[str, Tuple[float, str]] = {}
39
45
 
40
46
 
41
47
  def create_auth_router(
@@ -58,6 +64,8 @@ def create_auth_router(
58
64
  open_registration: bool,
59
65
  session_ttl: int,
60
66
  require_auth: bool = True,
67
+ verify_id_token: Callable[..., Dict] = _default_verify_id_token,
68
+ fetch_jwks: Callable[[str], Awaitable[Dict]] = _default_fetch_jwks,
61
69
  ) -> APIRouter:
62
70
  router = APIRouter()
63
71
 
@@ -114,13 +122,15 @@ def create_auth_router(
114
122
  if not settings.get("enabled") or not discovery:
115
123
  raise HTTPException(status_code=503, detail="SSO가 설정되지 않았습니다.")
116
124
  state = secrets.token_urlsafe(16)
117
- _sso_states[state] = time.time()
125
+ nonce = secrets.token_urlsafe(16)
126
+ _sso_states[state] = (time.time(), nonce)
118
127
  params = urlencode({
119
128
  "client_id": settings["client_id"],
120
129
  "response_type": "code",
121
130
  "redirect_uri": settings["redirect_uri"],
122
131
  "scope": settings.get("scopes") or "openid email profile",
123
132
  "state": state,
133
+ "nonce": nonce,
124
134
  })
125
135
  return RedirectResponse(f"{discovery['authorization_endpoint']}?{params}")
126
136
 
@@ -128,9 +138,10 @@ def create_auth_router(
128
138
  async def sso_callback(code: str = "", state: str = "", error: str = ""):
129
139
  if error:
130
140
  return RedirectResponse(f"/?sso_error={error}")
131
- ts = _sso_states.pop(state, None)
132
- if ts is None or time.time() - ts > 300:
141
+ entry = _sso_states.pop(state, None)
142
+ if entry is None or time.time() - entry[0] > 300:
133
143
  raise HTTPException(status_code=400, detail="유효하지 않은 SSO 상태입니다.")
144
+ _, nonce = entry
134
145
  settings = get_sso_settings()
135
146
  discovery = await get_sso_discovery()
136
147
  if not settings.get("enabled") or not discovery:
@@ -148,8 +159,25 @@ def create_auth_router(
148
159
  id_token = tokens.get("id_token")
149
160
  if not id_token:
150
161
  raise HTTPException(status_code=400, detail="ID 토큰을 받지 못했습니다.")
151
- padded = id_token.split(".")[1] + "=="
152
- payload = json.loads(base64.urlsafe_b64decode(padded))
162
+ # Never trust a decoded JWT payload: verify signature (against the
163
+ # provider JWKS), issuer, audience, expiry and the login nonce before
164
+ # using any claim. Any failure is fail-closed (401).
165
+ issuer = discovery.get("issuer") or ""
166
+ try:
167
+ jwks = await fetch_jwks(discovery.get("jwks_uri", ""))
168
+ payload = verify_id_token(
169
+ id_token,
170
+ jwks=jwks,
171
+ issuer=issuer,
172
+ audience=settings["client_id"],
173
+ nonce=nonce,
174
+ )
175
+ except OIDCValidationError as exc:
176
+ logging.warning("SSO ID token rejected: %s", exc)
177
+ raise HTTPException(status_code=401, detail="SSO 토큰 검증에 실패했습니다.")
178
+ except Exception as exc: # discovery/JWKS fetch failure → fail closed
179
+ logging.warning("SSO token validation error: %s", exc)
180
+ raise HTTPException(status_code=502, detail="SSO 공급자 검증에 실패했습니다.")
153
181
  email = payload.get("email") or payload.get("preferred_username") or payload.get("upn") or ""
154
182
  if not email:
155
183
  raise HTTPException(status_code=400, detail="이메일을 확인할 수 없습니다.")