ltcai 9.1.0 → 9.3.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 +55 -41
- package/docs/CHANGELOG.md +58 -0
- package/docs/COMMUNITY_AND_PLUGINS.md +4 -3
- package/docs/DEVELOPMENT.md +8 -8
- package/docs/LEGACY_COMPATIBILITY.md +1 -1
- package/docs/ONBOARDING.md +2 -2
- package/docs/OPERATIONS.md +1 -1
- package/docs/TRUST_MODEL.md +1 -1
- package/docs/WHY_LATTICE.md +1 -1
- package/docs/kg-schema.md +1 -1
- package/docs/mcp-tools.md +1 -1
- package/lattice_brain/__init__.py +1 -1
- package/lattice_brain/runtime/multi_agent.py +1 -1
- package/latticeai/__init__.py +1 -1
- package/latticeai/api/brain_intelligence.py +68 -0
- package/latticeai/api/chat_helpers.py +4 -0
- package/latticeai/api/chat_intents.py +30 -16
- package/latticeai/app_factory.py +4 -0
- package/latticeai/core/agent.py +31 -4
- package/latticeai/core/agent_prompts.py +5 -0
- package/latticeai/core/file_generation.py +451 -0
- package/latticeai/core/legacy_compatibility.py +1 -1
- package/latticeai/core/marketplace.py +1 -1
- package/latticeai/core/workspace_os.py +1 -1
- package/latticeai/runtime/chat_wiring.py +2 -0
- package/latticeai/runtime/persistence_runtime.py +7 -0
- package/latticeai/runtime/router_registration.py +16 -0
- package/latticeai/services/architecture_readiness.py +1 -1
- package/latticeai/services/brain_intelligence.py +439 -0
- package/latticeai/services/memory_service.py +65 -5
- package/latticeai/services/product_readiness.py +1 -1
- package/latticeai/services/router_context.py +1 -0
- package/package.json +1 -1
- package/scripts/check_current_release_docs.mjs +1 -1
- package/src-tauri/Cargo.lock +1 -1
- package/src-tauri/Cargo.toml +1 -1
- package/src-tauri/tauri.conf.json +1 -1
- package/static/app/asset-manifest.json +11 -11
- package/static/app/assets/{Act-Bzz0bUyW.js → Act-ls57ctKH.js} +1 -1
- package/static/app/assets/{Brain-Dj2J20YA.js → Brain-Jd3V4Obm.js} +1 -1
- package/static/app/assets/{Capture-CqlEl1Ga.js → Capture-DLj9Uzed.js} +1 -1
- package/static/app/assets/{Library-B03FP1Yx.js → Library-dPbez7Tc.js} +1 -1
- package/static/app/assets/{System-80lHW0Ux.js → System-CkROWBuq.js} +1 -1
- package/static/app/assets/index-BRUqy2zk.css +2 -0
- package/static/app/assets/index-CAlo2Lm-.js +17 -0
- package/static/app/assets/{primitives-Q1A96_7v.js → primitives-DrwaJ7dy.js} +1 -1
- package/static/app/assets/{textarea-D13RtnTo.js → textarea-DNvCwmmK.js} +1 -1
- package/static/app/index.html +2 -2
- package/static/sw.js +1 -1
- package/static/app/assets/index-BiMofBTM.js +0 -17
- package/static/app/assets/index-Bmx9rzTc.css +0 -2
package/README.md
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
# Lattice AI
|
|
2
2
|
|
|
3
|
-
**Lattice AI 9.
|
|
3
|
+
**Lattice AI 9.3.0 is the local-first Digital Brain platform. Proactive Brain Intelligence turns the Brain from a passive store into an active steward of its own knowledge: it scores its health across freshness, connectivity, search readiness, and consistency, surfaces contradictions and stale knowledge, proposes consent-first duplicate consolidation, and upgrades recall to hybrid lexical+semantic evidence.**
|
|
4
4
|
|
|
5
5
|
**Lattice AI는 모델이 바뀌어도 내 지식과 맥락을 보존하는 로컬 우선 AI 브레인입니다.**
|
|
6
6
|
|
|
7
|
-
> The 9.
|
|
7
|
+
> The 9.3.0 release wires the previously dormant Brain quality layer into
|
|
8
|
+
> the product: /api/brain health diagnosis with recommended care actions, a
|
|
9
|
+
> proactive insights digest, contradiction surfacing across memories and the
|
|
10
|
+
> graph, dry-run-first duplicate consolidation, and hybrid recall that blends
|
|
11
|
+
> vector similarity with lexical evidence behind an honest quality gate.
|
|
12
|
+
> The 9.2.0 release hardened file creation end to end: chat file requests are
|
|
13
|
+
> routed to a deterministic direct-write path (including type-only requests
|
|
14
|
+
> like "html 파일 만들어줘"), model replies are treated as untrusted content
|
|
15
|
+
> and cleaned of fences, reasoning blocks, and chat framing, and the agent
|
|
16
|
+
> JSON loop tolerates small-model formatting slips instead of aborting.
|
|
17
|
+
> The 9.1.0 release added request-scoped model routing,
|
|
8
18
|
> workspace-isolated graph identities and frontend caches, fail-closed admin
|
|
9
19
|
> gates, SSRF-safe web capture, private local state permissions, and reproducible
|
|
10
|
-
> release/test isolation. The same release
|
|
20
|
+
> release/test isolation. The same release introduced a human-first UI:
|
|
11
21
|
> a visible knowledge journey from conversation or source capture into the
|
|
12
22
|
> living Brain, its real relationship graph, and memory-grounded automation;
|
|
13
23
|
> the empty Brain home now keeps that complete loop inside one viewport, with
|
|
@@ -87,10 +97,11 @@ You need Lattice AI when:
|
|
|
87
97
|
The screenshots below are the latest checked-in visual evidence captures. They
|
|
88
98
|
keep the first-run Brain flow, memory graph, source capture, model library,
|
|
89
99
|
system view, admin console, and review center visible as release gates while
|
|
90
|
-
9.
|
|
91
|
-
|
|
92
|
-
and
|
|
93
|
-
checked-in 9.
|
|
100
|
+
9.3.0 makes the Brain proactively intelligent: it diagnoses its own health,
|
|
101
|
+
surfaces contradictions and stale knowledge, proposes consent-first
|
|
102
|
+
consolidation, and recalls with hybrid lexical+semantic evidence. The
|
|
103
|
+
captures below are the checked-in 9.3.0 visual release evidence for that
|
|
104
|
+
product flow.
|
|
94
105
|
|
|
95
106
|
### 1. Wake Brain
|
|
96
107
|
|
|
@@ -102,21 +113,21 @@ confirm owner, check the computer, choose the Brain voice.
|
|
|
102
113
|
Choose the owner of the Brain. The profile is not a SaaS account by default; it
|
|
103
114
|
is the local identity for the knowledge you keep.
|
|
104
115
|
|
|
105
|
-

|
|
106
117
|
|
|
107
118
|
### 3. Recommended Models
|
|
108
119
|
|
|
109
120
|
Start with a short list: safest recommendation, faster model, stronger model.
|
|
110
121
|
Advanced details stay available without overwhelming first-time users.
|
|
111
122
|
|
|
112
|
-

|
|
113
124
|
|
|
114
125
|
### 4. Install And Load
|
|
115
126
|
|
|
116
127
|
Download and load only after consent. Lattice explains model size, local
|
|
117
128
|
execution, and network use before work starts.
|
|
118
129
|
|
|
119
|
-

|
|
120
131
|
|
|
121
132
|
### 5. Brain Chat
|
|
122
133
|
|
|
@@ -128,14 +139,14 @@ and its visible life signal follow real listening, recall, synthesis, and action
|
|
|
128
139
|
state. Detailed memory rings, provenance, conversation history, and
|
|
129
140
|
model/runtime proof open as overlays only when requested.
|
|
130
141
|
|
|
131
|
-

|
|
132
143
|
|
|
133
144
|
### 6. Review Center
|
|
134
145
|
|
|
135
146
|
Automation results are staged for review before they become durable decisions.
|
|
136
147
|
Snooze, unsnooze, run now, approve, and dismiss actions stay explicit.
|
|
137
148
|
|
|
138
|
-

|
|
139
150
|
|
|
140
151
|
## Brain Depths
|
|
141
152
|
|
|
@@ -151,10 +162,10 @@ The user travels inward from everyday memory to deeper structure:
|
|
|
151
162
|
|
|
152
163
|
Walkthrough:
|
|
153
164
|
|
|
154
|
-

|
|
155
166
|
|
|
156
167
|
Screenshot index and capture notes:
|
|
157
|
-
[output/release/v9.
|
|
168
|
+
[output/release/v9.3.0/SCREENSHOT_INDEX.md](output/release/v9.3.0/SCREENSHOT_INDEX.md)
|
|
158
169
|
|
|
159
170
|
## Install
|
|
160
171
|
|
|
@@ -239,42 +250,43 @@ See [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) for developer workflow details.
|
|
|
239
250
|
|
|
240
251
|
## Current Release
|
|
241
252
|
|
|
242
|
-
The current release is **9.
|
|
243
|
-
|
|
244
|
-
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
- The
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
- `dist/ltcai-9.
|
|
264
|
-
- `ltcai-9.
|
|
265
|
-
- `
|
|
266
|
-
- `
|
|
253
|
+
The current release is **9.3.0 — Proactive Brain Intelligence**:
|
|
254
|
+
|
|
255
|
+
- A new `latticeai.core.file_generation` pipeline treats every model reply as
|
|
256
|
+
untrusted content: extension-aware strict prompting, extraction of the real
|
|
257
|
+
payload from fences/`<think>` blocks/chat framing, per-type structural
|
|
258
|
+
validation (complete HTML documents, parseable JSON, CSS rule blocks), one
|
|
259
|
+
corrective retry that tells the model what was wrong, and a deterministic
|
|
260
|
+
repair fallback that guarantees a valid file.
|
|
261
|
+
- Type-only requests without an explicit filename ("html 파일 만들어줘",
|
|
262
|
+
"웹페이지 만들어줘") now resolve to an inferred target and use the
|
|
263
|
+
deterministic direct-write path instead of the model-driven agent loop.
|
|
264
|
+
- The agent executor tolerates small-model formatting slips: `<think>` blocks
|
|
265
|
+
and trailing commas are stripped from action JSON, and parse failures feed a
|
|
266
|
+
corrective format reminder back to the model instead of aborting the run.
|
|
267
|
+
- The executor prompt pins exact file-content rules for `write_file` so
|
|
268
|
+
agent-created files are complete and fence-free.
|
|
269
|
+
- File writes report whether content was generated cleanly, retried, or
|
|
270
|
+
auto-repaired in the response payload (`generation` metadata).
|
|
271
|
+
|
|
272
|
+
Expected artifacts for 9.3.0 release must use exact filenames:
|
|
273
|
+
|
|
274
|
+
- `dist/ltcai-9.3.0-py3-none-any.whl`
|
|
275
|
+
- `dist/ltcai-9.3.0.tar.gz`
|
|
276
|
+
- `ltcai-9.3.0.tgz`
|
|
277
|
+
- `dist/ltcai-9.3.0.vsix`
|
|
278
|
+
- `src-tauri/target/release/bundle/dmg/Lattice AI_9.3.0_aarch64.dmg`
|
|
267
279
|
|
|
268
280
|
Do not use wildcard artifact uploads. Package registry publishing remains owner-run.
|
|
269
281
|
|
|
270
282
|
See [docs/ROADMAP_RECOMMENDATIONS.md](docs/ROADMAP_RECOMMENDATIONS.md) for the
|
|
271
|
-
strategic roadmap slices applied through 9.
|
|
283
|
+
strategic roadmap slices applied through 9.3.0 and the follow-up tracks.
|
|
272
284
|
|
|
273
285
|
## Known Limitations
|
|
274
286
|
|
|
275
287
|
- External package registries are owner-published and can lag behind GitHub.
|
|
276
288
|
- PostgreSQL/pgvector is optional scale/migration tooling. SQLite remains the
|
|
277
|
-
live local Brain store in 9.
|
|
289
|
+
live local Brain store in 9.3.0.
|
|
278
290
|
- Docker, model downloads, cloud model calls, Telegram, Brain Network, and update
|
|
279
291
|
checks require explicit user action.
|
|
280
292
|
- Conversation does not fabricate answers when no model is loaded.
|
|
@@ -286,6 +298,8 @@ strategic roadmap slices applied through 9.1.0 and the follow-up tracks.
|
|
|
286
298
|
|
|
287
299
|
| Version | Theme |
|
|
288
300
|
| --- | --- |
|
|
301
|
+
| 9.3.0 | Proactive Brain Intelligence: the Brain diagnoses its own health, surfaces contradictions and stale knowledge, proposes consent-first duplicate consolidation, and recalls with hybrid lexical+semantic evidence behind an honest quality gate |
|
|
302
|
+
| 9.2.0 | Model-Agnostic File Generation: chat file requests always produce structurally valid files with any LLM via extraction, per-type validation, corrective retry, deterministic repair, inferred file targets, and a fault-tolerant agent JSON loop |
|
|
289
303
|
| 9.1.0 | Code Review Completion & Fail-Closed Runtime: all July 11 review findings closed across fail-closed security, typed runtime/model/chat boundaries, honest frontend failures and tests, and repository hygiene |
|
|
290
304
|
| 9.0.0 | Code Review Closure & Runtime Cleanup: July 8 code-review follow-ups fixed, chat/runtime reliability improved, duplicated utility surfaces consolidated, runtime audit append paths moved to JSONL, and release metadata/artifacts synchronized |
|
|
291
305
|
| 8.9.0 | Scoped Memory & Tool Policy Hardening: authenticated history/KG reads are workspace-scoped, direct Tool API paths enforce registry policy, local approvals hash tokens at rest, AgentRuntime approval semantics are explicit, and frontend/runtime seams are split |
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,64 @@ The top entry is either the current unreleased main-branch work or the current
|
|
|
4
4
|
release line. Older entries are historical and may describe behavior as it
|
|
5
5
|
existed at that release.
|
|
6
6
|
|
|
7
|
+
## [9.3.0] - 2026-07-20
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- Added `latticeai/services/brain_intelligence.py` and the `/api/brain/*`
|
|
11
|
+
router: health diagnosis (freshness/connectivity/search-readiness/
|
|
12
|
+
consistency scores with recommended care actions), proactive insights
|
|
13
|
+
digest, contradiction surfacing (memory pairs, temporal, CONTRADICTS
|
|
14
|
+
edges), and consent-first duplicate consolidation (dry-run default,
|
|
15
|
+
audited memory prune on apply, graph never mutated).
|
|
16
|
+
- Wired the previously dormant `lattice_brain.quality` layer
|
|
17
|
+
(MemoryQualityManager, GraphEdgeQualityManager) into the product.
|
|
18
|
+
- Added the "Brain intelligence check" panel to the Brain surface with full
|
|
19
|
+
ko/en localization, plus `latticeApi` client methods for the new endpoints.
|
|
20
|
+
- Added `tests/unit/test_brain_intelligence.py` (14 tests).
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- `/api/memory/recall` is now hybrid: vector similarity blends with lexical
|
|
24
|
+
term evidence behind a `hybrid-evidence/v2` quality gate; results carry
|
|
25
|
+
`vector_score` and `evidence_kinds`; vector matches are workspace-scoped
|
|
26
|
+
via `filter_scoped_nodes` before they can influence rankings.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
- Recall no longer misses knowledge phrased differently from the query when
|
|
30
|
+
the vector index is available; vector-tier failures degrade recall to
|
|
31
|
+
lexical with the error surfaced instead of breaking the endpoint.
|
|
32
|
+
|
|
33
|
+
## [9.2.0] - 2026-07-20
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
- Added `latticeai/core/file_generation.py`, a model-agnostic file content
|
|
37
|
+
pipeline: extension-aware strict prompting with pinned first lines, payload
|
|
38
|
+
extraction from fences/`<think>` blocks/chat framing, per-type structural
|
|
39
|
+
validation, one corrective retry, and a deterministic repair fallback that
|
|
40
|
+
guarantees a structurally valid file from any loaded LLM.
|
|
41
|
+
- Added filename inference for chat file requests that name a type but no path
|
|
42
|
+
("html 파일 만들어줘" → `generated_page.html`), keeping such requests on the
|
|
43
|
+
deterministic direct-write path instead of the model-driven agent loop.
|
|
44
|
+
- Added `generation` metadata (attempts, validation reasons, auto-repair flag)
|
|
45
|
+
to `/chat` direct file-action responses, and a user-facing notice when the
|
|
46
|
+
saved file was produced by auto-repair.
|
|
47
|
+
- Added `tests/unit/test_file_generation.py` covering extraction, validation,
|
|
48
|
+
repair, inference, prompting, and retry/repair orchestration (22 tests).
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
- Chat file-action routing counts explicit artifact types (html, 웹페이지,
|
|
52
|
+
webpage) as file words, so "html 페이지 만들어줘" creates a real file.
|
|
53
|
+
- Direct file generation clamps temperature to ≤0.3 and raises the token
|
|
54
|
+
budget to ≥4096 so generated documents complete.
|
|
55
|
+
- The agent executor prompt pins `write_file` content rules: complete raw
|
|
56
|
+
content, no Markdown fences, extension-valid documents.
|
|
57
|
+
|
|
58
|
+
### Fixed
|
|
59
|
+
- Small local models (gemma/qwen class) no longer save chat wrappers, fenced
|
|
60
|
+
code blocks, reasoning traces, or truncated documents as file bytes.
|
|
61
|
+
- The agent JSON loop no longer aborts on the first malformed action reply:
|
|
62
|
+
`extract_action` strips `<think>` blocks and tolerates trailing commas, and
|
|
63
|
+
up to two corrective format reminders are fed back before halting.
|
|
64
|
+
|
|
7
65
|
## [9.1.0] - 2026-07-11
|
|
8
66
|
|
|
9
67
|
### Added
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# Community And Plugins
|
|
2
2
|
|
|
3
|
-
Current release: **9.
|
|
3
|
+
Current release: **9.3.0 — Proactive Brain Intelligence**.
|
|
4
4
|
|
|
5
5
|
LatticeAI defines the path from a strong local-first framework (8.4.0
|
|
6
6
|
action-aware baseline, 8.5.0 registry+DI hardening, 8.6.0 capture/navigation
|
|
7
7
|
reliability, 8.7.0 runtime-state hygiene, 8.8.0 Brain Core extraction
|
|
8
|
-
readiness, 8.9.0 scoped Tool API hardening, 9.0.0 cleanup closure,
|
|
9
|
-
fail-closed review completion
|
|
8
|
+
readiness, 8.9.0 scoped Tool API hardening, 9.0.0 cleanup closure, 9.1.0
|
|
9
|
+
fail-closed review completion, 9.2.0 model-agnostic file generation, and
|
|
10
|
+
9.3.0 proactive Brain intelligence) to a product ecosystem. The
|
|
10
11
|
immediate goal is small and practical: make it clear how
|
|
11
12
|
contributors can extend the Brain without weakening local-first trust,
|
|
12
13
|
workspace scoping, or release quality.
|
package/docs/DEVELOPMENT.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Lattice AI Development
|
|
2
2
|
|
|
3
|
-
Current release: **9.
|
|
3
|
+
Current release: **9.3.0 — Proactive Brain Intelligence**.
|
|
4
4
|
|
|
5
5
|
This document is for contributors working on the local-first Digital Brain
|
|
6
6
|
codebase. Product positioning and quick start stay in `README.md`; release
|
|
7
|
-
history is intentionally limited to 8.0.0-9.
|
|
7
|
+
history is intentionally limited to 8.0.0-9.3.0 in `docs/CHANGELOG.md` and
|
|
8
8
|
`RELEASE.md`.
|
|
9
9
|
|
|
10
10
|
## Product Contract
|
|
@@ -153,10 +153,10 @@ For user-facing, API, runtime, release, or packaging changes, check:
|
|
|
153
153
|
Release/publish examples must use exact target-version filenames. Do not
|
|
154
154
|
document wildcard artifact upload commands.
|
|
155
155
|
|
|
156
|
-
For 9.
|
|
156
|
+
For 9.3.0 release work, exact artifacts are:
|
|
157
157
|
|
|
158
|
-
- `dist/ltcai-9.
|
|
159
|
-
- `dist/ltcai-9.
|
|
160
|
-
- `ltcai-9.
|
|
161
|
-
- `dist/ltcai-9.
|
|
162
|
-
- `src-tauri/target/release/bundle/dmg/Lattice AI_9.
|
|
158
|
+
- `dist/ltcai-9.3.0-py3-none-any.whl`
|
|
159
|
+
- `dist/ltcai-9.3.0.tar.gz`
|
|
160
|
+
- `ltcai-9.3.0.tgz`
|
|
161
|
+
- `dist/ltcai-9.3.0.vsix`
|
|
162
|
+
- `src-tauri/target/release/bundle/dmg/Lattice AI_9.3.0_aarch64.dmg`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Legacy Compatibility Map
|
|
2
2
|
|
|
3
|
-
Current target: **9.
|
|
3
|
+
Current target: **9.3.0 — Proactive Brain Intelligence**.
|
|
4
4
|
|
|
5
5
|
Lattice AI is moving toward a smaller, modular architecture centered on
|
|
6
6
|
`lattice_brain`, `latticeai.services`, `latticeai.api`, and `latticeai.runtime`.
|
package/docs/ONBOARDING.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Lattice AI Onboarding
|
|
2
2
|
|
|
3
|
-
Current release: **9.
|
|
3
|
+
Current release: **9.3.0 — Proactive Brain Intelligence**.
|
|
4
4
|
|
|
5
5
|
The first-run goal is a five-minute path from "I opened the app" to "my Brain
|
|
6
6
|
has a source, a question, and proof." This page is the product contract behind
|
|
@@ -40,7 +40,7 @@ read the docs first.
|
|
|
40
40
|
|
|
41
41
|
## Release Gate
|
|
42
42
|
|
|
43
|
-
9.
|
|
43
|
+
9.3.0 treats onboarding as a release gate, not marketing copy. The current
|
|
44
44
|
machine-checkable product readiness report requires this five-minute contract,
|
|
45
45
|
the Brain Home surface, setup helpers, graph ingestion tests, and exact release
|
|
46
46
|
artifact documentation before the release can be called complete.
|
package/docs/OPERATIONS.md
CHANGED
package/docs/TRUST_MODEL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Lattice AI Trust Model
|
|
2
2
|
|
|
3
|
-
Current release: **9.
|
|
3
|
+
Current release: **9.3.0 — Proactive Brain Intelligence**.
|
|
4
4
|
|
|
5
5
|
Lattice AI is local-first, explicit about external communication, and honest
|
|
6
6
|
when a capability is unavailable.
|
package/docs/WHY_LATTICE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Why Lattice AI Exists
|
|
2
2
|
|
|
3
|
-
Current release: **9.
|
|
3
|
+
Current release: **9.3.0 — Proactive Brain Intelligence**.
|
|
4
4
|
|
|
5
5
|
**Lattice AI is a local-first Digital Brain that keeps your knowledge durable
|
|
6
6
|
across any AI model.**
|
package/docs/kg-schema.md
CHANGED
package/docs/mcp-tools.md
CHANGED
|
@@ -21,7 +21,7 @@ from .contracts import multi_agent_contract
|
|
|
21
21
|
from ..utils import now_iso as _now
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
MULTI_AGENT_VERSION = "9.
|
|
24
|
+
MULTI_AGENT_VERSION = "9.3.0"
|
|
25
25
|
|
|
26
26
|
AGENT_ROLES = ("researcher", "planner", "executor", "reviewer", "release")
|
|
27
27
|
CORE_PIPELINE = ("planner", "executor", "reviewer")
|
package/latticeai/__init__.py
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Proactive Brain Intelligence API router (v9.3.0).
|
|
2
|
+
|
|
3
|
+
Exposes :class:`~latticeai.services.brain_intelligence.BrainIntelligenceService`:
|
|
4
|
+
health diagnosis, proactive insights, contradiction surfacing, and consent-first
|
|
5
|
+
consolidation. Read endpoints use the workspace read gate; consolidation with
|
|
6
|
+
``apply=true`` is a write and is audited.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from typing import Callable, Optional
|
|
12
|
+
|
|
13
|
+
from fastapi import APIRouter, Request
|
|
14
|
+
from pydantic import BaseModel
|
|
15
|
+
|
|
16
|
+
from latticeai.services.brain_intelligence import BrainIntelligenceService
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ConsolidateRequest(BaseModel):
|
|
20
|
+
apply: bool = False
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def create_brain_intelligence_router(
|
|
24
|
+
*,
|
|
25
|
+
service: BrainIntelligenceService,
|
|
26
|
+
require_user: Callable[[Request], str],
|
|
27
|
+
gate_read: Callable[[Request], Optional[str]],
|
|
28
|
+
gate_write: Callable[[Request], Optional[str]],
|
|
29
|
+
append_audit_event: Callable[..., None],
|
|
30
|
+
) -> APIRouter:
|
|
31
|
+
router = APIRouter()
|
|
32
|
+
|
|
33
|
+
@router.get("/api/brain/health")
|
|
34
|
+
async def brain_health(request: Request):
|
|
35
|
+
user = require_user(request)
|
|
36
|
+
scope = gate_read(request)
|
|
37
|
+
return service.health_report(user_email=user, workspace_id=scope)
|
|
38
|
+
|
|
39
|
+
@router.get("/api/brain/insights")
|
|
40
|
+
async def brain_insights(request: Request):
|
|
41
|
+
user = require_user(request)
|
|
42
|
+
scope = gate_read(request)
|
|
43
|
+
return service.insights(user_email=user, workspace_id=scope)
|
|
44
|
+
|
|
45
|
+
@router.get("/api/brain/contradictions")
|
|
46
|
+
async def brain_contradictions(request: Request):
|
|
47
|
+
user = require_user(request)
|
|
48
|
+
scope = gate_read(request)
|
|
49
|
+
return service.contradictions(user_email=user, workspace_id=scope)
|
|
50
|
+
|
|
51
|
+
@router.post("/api/brain/consolidate")
|
|
52
|
+
async def brain_consolidate(req: ConsolidateRequest, request: Request):
|
|
53
|
+
user = require_user(request)
|
|
54
|
+
scope = gate_write(request) if req.apply else gate_read(request)
|
|
55
|
+
result = service.consolidate(apply=req.apply, user_email=user, workspace_id=scope)
|
|
56
|
+
append_audit_event(
|
|
57
|
+
"brain_consolidate",
|
|
58
|
+
user_email=user,
|
|
59
|
+
mode=result.get("mode"),
|
|
60
|
+
duplicate_memories=result.get("duplicate_memory_count", 0),
|
|
61
|
+
pruned=result.get("pruned", 0),
|
|
62
|
+
)
|
|
63
|
+
return result
|
|
64
|
+
|
|
65
|
+
return router
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
__all__ = ["create_brain_intelligence_router"]
|
|
@@ -128,6 +128,10 @@ def is_file_action_request(text: str) -> bool:
|
|
|
128
128
|
has_target = bool(_FILE_TARGET_RE.search(raw))
|
|
129
129
|
has_file_word = any(word in lower for word in (
|
|
130
130
|
"file", "파일", "문서", "artifact", "아티팩트", "save as", "저장",
|
|
131
|
+
# Explicit artifact types: users asking for "an html page" expect a
|
|
132
|
+
# real file, not a code block in chat — route them to the file path
|
|
133
|
+
# where the model-agnostic generation pipeline guarantees validity.
|
|
134
|
+
"html", "웹페이지", "웹 페이지", "홈페이지", "webpage", "web page",
|
|
131
135
|
))
|
|
132
136
|
has_action = any(word in lower for word in (
|
|
133
137
|
"create", "make", "write", "save", "generate", "edit", "update",
|
|
@@ -14,10 +14,10 @@ from latticeai.api.chat_helpers import (
|
|
|
14
14
|
file_action_target,
|
|
15
15
|
format_network_status,
|
|
16
16
|
inline_file_action_content,
|
|
17
|
-
strip_generated_file_content,
|
|
18
17
|
)
|
|
19
18
|
from latticeai.api.chat_stream import agent_payload_stream, single_answer_response
|
|
20
19
|
from latticeai.core.agent import AgentState
|
|
20
|
+
from latticeai.core.file_generation import generate_file_content, infer_file_target
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class ChatIntentController:
|
|
@@ -185,28 +185,36 @@ class ChatIntentController:
|
|
|
185
185
|
return single_answer_response(req, answer, model="client_url")
|
|
186
186
|
|
|
187
187
|
async def direct_file_action(self, req: Any, *, model_id: Optional[str]):
|
|
188
|
-
|
|
188
|
+
# An explicit path ("report.txt") wins; otherwise infer one from an
|
|
189
|
+
# explicit type keyword ("html 파일 만들어줘") so weak models never
|
|
190
|
+
# have to drive the JSON tool loop just to create a file.
|
|
191
|
+
target_path = file_action_target(req.message) or infer_file_target(req.message)
|
|
189
192
|
if not target_path:
|
|
190
193
|
return None
|
|
191
194
|
content = inline_file_action_content(req.message)
|
|
195
|
+
generation_meta: Optional[Dict[str, Any]] = None
|
|
192
196
|
if content is None and not model_id:
|
|
193
197
|
return self.no_model_response()
|
|
194
198
|
if content is None and model_id:
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
199
|
+
# Model-agnostic pipeline: strict extension-aware prompt →
|
|
200
|
+
# extraction → validation → one corrective retry → deterministic
|
|
201
|
+
# repair. Guarantees a structurally valid file from any LLM.
|
|
202
|
+
async def _generate(context: str) -> str:
|
|
203
|
+
return str(
|
|
204
|
+
await self.router.generate_as(
|
|
205
|
+
model_id,
|
|
206
|
+
message="Return only the requested file content.",
|
|
207
|
+
context=context,
|
|
208
|
+
max_tokens=max(int(req.max_tokens or 0), 4096),
|
|
209
|
+
temperature=min(req.temperature, 0.3),
|
|
210
|
+
)
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
content, generation_meta = await generate_file_content(
|
|
214
|
+
_generate,
|
|
215
|
+
target_path=target_path,
|
|
216
|
+
user_request=req.message,
|
|
208
217
|
)
|
|
209
|
-
content = strip_generated_file_content(str(raw_content))
|
|
210
218
|
if content is None:
|
|
211
219
|
raise HTTPException(
|
|
212
220
|
status_code=400,
|
|
@@ -220,6 +228,10 @@ class ChatIntentController:
|
|
|
220
228
|
except self.tool_error as exc:
|
|
221
229
|
raise HTTPException(status_code=400, detail=str(exc)) from exc
|
|
222
230
|
answer = f"{result.get('path') or target_path} 파일을 만들었습니다."
|
|
231
|
+
if generation_meta and generation_meta.get("repaired"):
|
|
232
|
+
answer += (
|
|
233
|
+
" (모델 출력이 불완전해 자동 보정을 거쳐 유효한 파일로 저장했습니다.)"
|
|
234
|
+
)
|
|
223
235
|
created_files = [
|
|
224
236
|
{
|
|
225
237
|
"path": result.get("path") or target_path,
|
|
@@ -248,6 +260,8 @@ class ChatIntentController:
|
|
|
248
260
|
"routed_to_agent": True,
|
|
249
261
|
"action_route": "direct_write_file",
|
|
250
262
|
}
|
|
263
|
+
if generation_meta is not None:
|
|
264
|
+
payload["generation"] = generation_meta
|
|
251
265
|
if req.stream:
|
|
252
266
|
return StreamingResponse(
|
|
253
267
|
agent_payload_stream(
|
package/latticeai/app_factory.py
CHANGED
|
@@ -165,6 +165,7 @@ def _build(config: "Optional[Config]" = None) -> Dict[str, Any]:
|
|
|
165
165
|
from latticeai.api.hooks import create_hooks_router
|
|
166
166
|
from latticeai.core.product_hardening import build_product_hardening_status
|
|
167
167
|
from latticeai.api.agent_registry import create_agent_registry_router
|
|
168
|
+
from latticeai.api.brain_intelligence import create_brain_intelligence_router
|
|
168
169
|
from latticeai.api.memory import create_memory_router
|
|
169
170
|
from latticeai.api.browser import create_browser_router
|
|
170
171
|
from latticeai.api.portability import create_portability_router
|
|
@@ -383,6 +384,7 @@ def _build(config: "Optional[Config]" = None) -> Dict[str, Any]:
|
|
|
383
384
|
TEMPLATE_CATALOG = _persistence_runtime["TEMPLATE_CATALOG"]
|
|
384
385
|
AGENT_REGISTRY = _persistence_runtime["AGENT_REGISTRY"]
|
|
385
386
|
MEMORY_SERVICE = _persistence_runtime["MEMORY_SERVICE"]
|
|
387
|
+
BRAIN_INTELLIGENCE = _persistence_runtime["BRAIN_INTELLIGENCE"]
|
|
386
388
|
INGESTION_PIPELINE = _persistence_runtime["INGESTION_PIPELINE"]
|
|
387
389
|
DEVICE_IDENTITY = _persistence_runtime["DEVICE_IDENTITY"]
|
|
388
390
|
KG_PORTABILITY = _persistence_runtime["KG_PORTABILITY"]
|
|
@@ -1114,6 +1116,7 @@ def _build(config: "Optional[Config]" = None) -> Dict[str, Any]:
|
|
|
1114
1116
|
memory_service=MEMORY_SERVICE,
|
|
1115
1117
|
platform=PLATFORM,
|
|
1116
1118
|
active_model_getter=lambda: router.current_model_id or "",
|
|
1119
|
+
brain_intelligence=BRAIN_INTELLIGENCE,
|
|
1117
1120
|
)
|
|
1118
1121
|
register_interaction_routers(
|
|
1119
1122
|
app,
|
|
@@ -1124,6 +1127,7 @@ def _build(config: "Optional[Config]" = None) -> Dict[str, Any]:
|
|
|
1124
1127
|
create_hooks_router=create_hooks_router,
|
|
1125
1128
|
create_agent_registry_router=create_agent_registry_router,
|
|
1126
1129
|
create_memory_router=create_memory_router,
|
|
1130
|
+
create_brain_intelligence_router=create_brain_intelligence_router,
|
|
1127
1131
|
)
|
|
1128
1132
|
|
|
1129
1133
|
from latticeai.api.review_queue import create_review_queue_router
|