ltcai 8.9.0 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +28 -39
  2. package/auto_setup.py +11 -62
  3. package/docs/CHANGELOG.md +76 -237
  4. package/docs/COMMUNITY_AND_PLUGINS.md +2 -2
  5. package/docs/DEVELOPMENT.md +8 -8
  6. package/docs/LEGACY_COMPATIBILITY.md +1 -1
  7. package/docs/ONBOARDING.md +2 -2
  8. package/docs/ROADMAP_RECOMMENDATIONS.md +61 -36
  9. package/docs/TRUST_MODEL.md +1 -1
  10. package/docs/WHY_LATTICE.md +2 -2
  11. package/docs/kg-schema.md +1 -1
  12. package/lattice_brain/__init__.py +1 -1
  13. package/lattice_brain/archive.py +4 -9
  14. package/lattice_brain/embeddings.py +38 -2
  15. package/lattice_brain/graph/_kg_common.py +27 -462
  16. package/lattice_brain/graph/_kg_constants.py +243 -0
  17. package/lattice_brain/graph/_kg_fsutil.py +297 -0
  18. package/lattice_brain/graph/discovery.py +0 -948
  19. package/lattice_brain/graph/discovery_index.py +972 -0
  20. package/lattice_brain/graph/retrieval.py +0 -570
  21. package/lattice_brain/graph/retrieval_docgen.py +210 -0
  22. package/lattice_brain/graph/retrieval_vector.py +460 -0
  23. package/lattice_brain/graph/store.py +6 -0
  24. package/lattice_brain/ingestion.py +68 -0
  25. package/lattice_brain/portability.py +1 -9
  26. package/lattice_brain/quality.py +98 -4
  27. package/lattice_brain/runtime/agent_runtime.py +166 -0
  28. package/lattice_brain/runtime/multi_agent.py +1 -1
  29. package/lattice_brain/utils.py +28 -0
  30. package/latticeai/__init__.py +1 -1
  31. package/latticeai/api/chat.py +340 -407
  32. package/latticeai/api/chat_helpers.py +227 -0
  33. package/latticeai/api/computer_use.py +149 -31
  34. package/latticeai/api/marketplace.py +11 -0
  35. package/latticeai/api/permissions.py +3 -3
  36. package/latticeai/api/tools.py +1 -0
  37. package/latticeai/app_factory.py +82 -360
  38. package/latticeai/core/io_utils.py +37 -0
  39. package/latticeai/core/legacy_compatibility.py +1 -1
  40. package/latticeai/core/local_embeddings.py +2 -4
  41. package/latticeai/core/marketplace.py +33 -2
  42. package/latticeai/core/mcp_catalog.py +450 -0
  43. package/latticeai/core/mcp_registry.py +2 -441
  44. package/latticeai/core/users.py +4 -9
  45. package/latticeai/core/workspace_os.py +1 -1
  46. package/latticeai/core/workspace_os_utils.py +3 -17
  47. package/latticeai/integrations/telegram_bot.py +7 -2
  48. package/latticeai/models/model_providers.py +111 -0
  49. package/latticeai/models/router.py +58 -136
  50. package/latticeai/runtime/audit_runtime.py +27 -16
  51. package/latticeai/runtime/automation_runtime.py +9 -0
  52. package/latticeai/runtime/history_runtime.py +163 -0
  53. package/latticeai/runtime/namespace_runtime.py +173 -0
  54. package/latticeai/runtime/network_config_runtime.py +56 -0
  55. package/latticeai/runtime/sso_config_runtime.py +128 -0
  56. package/latticeai/runtime/user_key_runtime.py +106 -0
  57. package/latticeai/services/architecture_readiness.py +2 -2
  58. package/latticeai/services/memory_service.py +213 -0
  59. package/latticeai/services/platform_runtime.py +9 -1
  60. package/latticeai/services/product_readiness.py +11 -11
  61. package/latticeai/services/review_queue.py +64 -11
  62. package/latticeai/services/run_executor.py +21 -0
  63. package/latticeai/services/setup_detection.py +80 -0
  64. package/latticeai/services/tool_dispatch.py +1 -1
  65. package/package.json +1 -1
  66. package/setup_wizard.py +11 -55
  67. package/src-tauri/Cargo.lock +1 -1
  68. package/src-tauri/Cargo.toml +1 -1
  69. package/src-tauri/tauri.conf.json +1 -1
  70. package/static/app/asset-manifest.json +11 -11
  71. package/static/app/assets/{Act-fZokUnC0.js → Act-21lIXx2E.js} +1 -1
  72. package/static/app/assets/Brain-BqUd5UJJ.js +321 -0
  73. package/static/app/assets/{Capture-D5KV3Cu7.js → Capture-BA7Z2Q1u.js} +1 -1
  74. package/static/app/assets/{Library-C9kyFkSt.js → Library-bFMtyni3.js} +1 -1
  75. package/static/app/assets/System-K6krGCqn.js +1 -0
  76. package/static/app/assets/index-C4R3ws30.js +17 -0
  77. package/static/app/assets/index-ChSeOB02.css +2 -0
  78. package/static/app/assets/primitives-sQU3it5I.js +1 -0
  79. package/static/app/assets/{textarea-CD8UNKIy.js → textarea-DK3Fd_lR.js} +1 -1
  80. package/static/app/index.html +2 -2
  81. package/static/css/tokens.css +4 -2
  82. package/static/sw.js +1 -1
  83. package/tools/local_files.py +6 -0
  84. package/latticeai/runtime/sso_runtime.py +0 -52
  85. package/static/app/assets/Brain-DtyuWubr.js +0 -321
  86. package/static/app/assets/System-VbChmX7r.js +0 -1
  87. package/static/app/assets/index-DCh5AoXt.css +0 -2
  88. package/static/app/assets/index-DPdcPoF0.js +0 -17
  89. package/static/app/assets/primitives-DFeanEV6.js +0 -1
@@ -5,43 +5,12 @@ small release-sized work. The operating principle stays unchanged:
5
5
 
6
6
  > Models are temporary. Knowledge is durable. The Brain is the product.
7
7
 
8
- ## 7.3.0 Applied Slice
8
+ ## Applied Release History
9
9
 
10
- 7.3.0 implements the first narrow slice of the roadmap:
11
-
12
- - Runtime evolution: single-agent and multi-agent execution share
13
- `agent-run-contract/v1`, making mode/status/timeline evidence inspectable.
14
- - Hybrid search optimization: the Brain quality gate now includes deterministic
15
- recall and ranking regression thresholds.
16
- - Security and trust: run contracts distinguish runtime type and execution mode
17
- so simulated output is not presented as real execution.
18
-
19
- ## 7.4.0 Applied Slice
20
-
21
- 7.4.0 completes the next roadmap slice without deferring it:
22
-
23
- - Runtime convergence: agent runs, workflow runs, audit events, and realtime
24
- events all expose the `agent-run-contract/v1` family envelope while keeping
25
- legacy top-level fields for compatibility.
26
- - Trust and operations: persisted run rows refresh their contract through
27
- queued, running, terminal, cancelled, and interrupted states; audit events are
28
- contracted only after secret redaction.
29
- - Retrieval quality and scale: the CI quality gate now seeds a real local
30
- Knowledge Graph corpus and scores SearchService hybrid retrieval with judged
31
- queries, recall, precision, NDCG, and must-include hit-rate thresholds.
32
-
33
- ## 7.5.0 Applied Slice
34
-
35
- 7.5.0 burns down the remaining 7.4.0 risk instead of deferring it:
36
-
37
- - Contract consumption: AgentRuntime and realtime feed APIs now emit compact
38
- `contracts` views so UI, replay, admin, and export consumers can depend on the
39
- shared family envelope directly.
40
- - Retrieval scale: the corpus fixture now runs against 250+ local records while
41
- keeping judged queries, graded relevance, and must-include expectations.
42
- - Release trust: stale artifact mixing is handled through clean exact-version
43
- artifact generation, npm audit findings are cleared, and the Tauri 2 stack is
44
- updated past the old `block v0.1.6` future-incompatibility warning.
10
+ Release-specific applied-slice history is now kept only for 8.0.0 and newer in
11
+ [docs/CHANGELOG.md](CHANGELOG.md) and [RELEASE.md](../RELEASE.md). Pre-8.0.0
12
+ release-history notes were removed from the tracked documentation surface during
13
+ the 9.0.0 documentation cleanup.
45
14
 
46
15
  ## Near-Term Tracks
47
16
 
@@ -79,3 +48,59 @@ small release-sized work. The operating principle stays unchanged:
79
48
  - Interoperability with Obsidian, Notion, Email, Calendar, Git, Slack, and Teams.
80
49
  - Encrypted Brain Network sharing.
81
50
  - Plugin marketplace and public benchmarks.
51
+
52
+ ## Large-Scale Work Feasibility Assessment (2026-07-07)
53
+
54
+ 2026-07-07 코드베이스 검사 + 테스트 실행 결과 기반. (app_factory 1214줄, workspace_os 1391줄, 최근 AgentRuntime facade + KG mixin 분해 완료, 833 unit tests passed)
55
+
56
+ ### 1. Knowledge Graph / Retrieval at Large Corpus Scale (가장 추천, 기반 탄탄)
57
+ - Incremental/background ingestion + advanced dedup(콘텐츠해시 이상), conflict resolution, merge.
58
+ - Larger corpus benchmarks (현재 250+ → 수천~수만 아이템), latency budget, channel별 진단.
59
+ - pgvector 풀 프로덕션 경로 + 마이그레이션.
60
+ - **실행 가능성**: IngestionPipeline + provenance + vector mixin + benchmark fixtures 이미 존재. discovery/retrieval 분해 완료. hooks lifecycle 통합됨. 대형 작업으로 적합. 테스트: test_ingestion_pipeline.py 14/14 green.
61
+
62
+ ### 2. Multi-Modal Brain (스키마 준비됨, 구현 공백 큼)
63
+ - 이미지: vision LLM describe + 임베딩, IMAGE/IMAGE_TEXT 노드 + CONTAINS_IMAGE 엣지 완성, UI 증거 표시.
64
+ - 오디오(전사), 비디오(키프레임).
65
+ - **실행 가능성**: schema.py에 IMAGE/IMAGE_TEXT/CONTAINS_IMAGE 정의됨. discovery_index.py에 PIL + pytesseract OCR (include_ocr) 부분 구현. embeddings.py / LLMRouter에 vision 지원 부재. retrieval도 이미지 노드 미처리. ingestion 라우팅 확장 필요. 대형 + 차별화 포인트.
66
+
67
+ ### 3. Server / Runtime Composition 완전화 (구조 부채 해소)
68
+ - app_factory.py 잔여 로직 추가 추출 (더 많은 wiring → runtime/* 전용 모듈).
69
+ - dict(locals()) 레거시 제거, 강력한 RuntimeContext / DI.
70
+ - Config 중앙화 감사 및 강제 (core/config.py 이미 중앙).
71
+ - **실행 가능성**: 최근 review0707 + decomp (1214줄로 감소, runtime/ 디렉토리 풍부) 후에도 여전히 1.2k 라인. AGENTS.md 우선순위 #3,4 정확히 매치. AgentRuntime은 lattice_brain/runtime/agent_runtime.py 로 facade 추출 완료. ToolRegistry도 core/ + services 분리 진행.
72
+
73
+ ### 4. Proactive Synthesis + Temporal / Contradiction (최근 작업 연장)
74
+ - 백그라운드 합성 잡, 그래프 이력 기반 모순 검출, temporal 쿼리.
75
+ - 최근 커밋(Brain synthesis memories, follow-up) 을 스케줄 + 자동화로 확장.
76
+ - **실행 가능성**: MultiAgentOrchestrator + workflow_engine + IngestionPipeline + Brain Brief 이미 wired. hooks/audit 있음. agent synthesis UI 표면 최근 추가. 대형 기능으로 자연스러운 확장.
77
+
78
+ ### 5. Ecosystem / Interop + Plugin Marketplace (외부 연동 대형)
79
+ - Obsidian/Notion/Email/Calendar import bridge (MCP 또는 전용 ingestion).
80
+ - 서명된 플러그인, 원격 카탈로그, marketplace UI.
81
+ - Brain Network (암호화 공유).
82
+ - **실행 가능성**: plugins/ (hello-world, git-insights), mcp_registry, marketplace.py, core/plugins.py 존재. ingestion이 단일 관문. 하지만 실제 외부 브릿지/마켓플레이스 UI/보안 스캔은 대형.
83
+
84
+ 기타: Tauri auto-update + native scale, Workflow Designer 프론트엔드 완성, VSCode 확장 심화 통합 등.
85
+
86
+ **검증 결과 (2026-07-07)**:
87
+ - Core imports (Config, IngestionPipeline, AgentRuntime, ToolRegistry): OK
88
+ - Unit tests: 833 passed (tests/unit/)
89
+ - Ingestion specific: 14 passed
90
+ - Agent runtime tests: 29 passed
91
+ - Frontend lint: typecheck + privacy + OpenAPI 335 paths + lint all pass
92
+ - Git: clean (inspection 시점)
93
+
94
+ **2026-07-07 pts_grok 대형 후보 1~5 슬라이스 실행 결과 (자율 진행)**:
95
+ - 1. KG/Retrieval: background ingestion queue seam, schedule_background, vector index scale diagnostics, backlog reasons/samples, coverage ratio, and rebuild latency budget.
96
+ - 2. Multimodal: offline VisionStub describe/embed path and discovery_index vision_caption fallback so image files have searchable evidence without remote calls.
97
+ - 3. Server decomp: explicit _RUNTIME_BUNDLE in app_factory as the migration contract toward DI while dict(locals()) compatibility remains.
98
+ - 3a. Server decomp follow-up: filtered app_factory runtime namespace so internal scratch imports/runtime dicts no longer leak through lazy server_app compatibility; namespace reduced from 300 to 253 keys while legacy helpers remain, with typed RuntimeBundle added behind legacy _RUNTIME_BUNDLE.
99
+ - 4. Proactive/Temporal: stronger MemoryQualityManager conflict detection, including pairwise opposite-preference and temporal-negation flags.
100
+ - 4a. Proactive UX follow-up: Brain Brief now emits proactive_actions, and BrainHome renders one-click ask/delegate/review/graph action cards.
101
+ - 4b. Proactive UX completion: BrainHome now keeps a local activity trail for suggested actions, showing whether Brain ask, Agent delegation, Review draft, or graph navigation actions are running, completed, or failed.
102
+ - 5. Interop/Marketplace: ingestion_bridge marketplace templates and /marketplace/interop/bridges exposure for future Obsidian/Calendar-style connector imports through unified-ingestion.
103
+ - 총 affected tests: 45 passed in the first targeted gate. Broader lint/static/doc checks are run before commit.
104
+ - 남은: 각 슬라이스는 기반 확장. full background workers, real local VLM/image embeddings, full locals() removal, graph-level temporal queries, and production connector installs remain follow-up work.
105
+
106
+ 이 항목들은 "대형사이즈" 에도 할 만하며, mission (local-first, KG, AgentRuntime, security) 과 AGENTS 우선 리팩토링 순서에 부합. 작은 슬라이스로 시작 추천.
@@ -1,6 +1,6 @@
1
1
  # Lattice AI Trust Model
2
2
 
3
- Current release: **8.9.0 — Scoped Memory & Tool Policy Hardening**.
3
+ Current release: **9.0.0Code Review Closure & Runtime Cleanup**.
4
4
 
5
5
  Lattice AI is local-first, explicit about external communication, and honest
6
6
  when a capability is unavailable.
@@ -1,6 +1,6 @@
1
1
  # Why Lattice AI Exists
2
2
 
3
- Current release: **8.9.0 — Scoped Memory & Tool Policy Hardening**.
3
+ Current release: **9.0.0Code Review Closure & Runtime Cleanup**.
4
4
 
5
5
  **Lattice AI is a local-first Digital Brain that keeps your knowledge durable
6
6
  across any AI model.**
@@ -32,7 +32,7 @@ The graph matters, but it is not the product identity. The product identity is a
32
32
  local-first Digital Brain: a place where the user can talk, add sources, watch
33
33
  memory grow, and inspect the Knowledge Graph when they need proof.
34
34
 
35
- In 8.9.0 the first screen is intentionally not a dashboard. The living Brain,
35
+ In 9.0.0 the first screen is intentionally not a dashboard. The living Brain,
36
36
  conversation composer, evidence-backed Brain Brief, scoped memory isolation,
37
37
  and five-minute onboarding
38
38
  path appear together so the user immediately knows what matters, what to add,
package/docs/kg-schema.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Knowledge Graph Schema
2
2
 
3
- Current release: **8.9.0 — Scoped Memory & Tool Policy Hardening**.
3
+ Current release: **9.0.0Code Review Closure & Runtime Cleanup**.
4
4
 
5
5
  명세 출처: `lattice_ai_full_spec.pptx` 슬라이드 20·21·22
6
6
  구현: `kg_schema.py`
@@ -26,7 +26,7 @@ from .storage import (
26
26
  storage_from_env,
27
27
  )
28
28
 
29
- __version__ = "8.9.0"
29
+ __version__ = "9.0.0"
30
30
 
31
31
  __all__ = [
32
32
  "AgentRuntime",
@@ -9,7 +9,6 @@ restore on another machine without contacting a service.
9
9
  from __future__ import annotations
10
10
 
11
11
  import base64
12
- import hashlib
13
12
  import io
14
13
  import json
15
14
  import os
@@ -27,6 +26,8 @@ from cryptography.hazmat.primitives.ciphers.aead import AESGCM
27
26
  from cryptography.exceptions import InvalidTag
28
27
  from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
29
28
 
29
+ from .utils import sha256_file as _sha256_file
30
+
30
31
 
31
32
  ARCHIVE_FORMAT = "latticebrain.encrypted"
32
33
  ARCHIVE_VERSION = 2
@@ -68,15 +69,9 @@ def _derive_key(passphrase: str, salt: bytes) -> bytes:
68
69
 
69
70
 
70
71
  def _sha256_bytes(data: bytes) -> str:
71
- return hashlib.sha256(data).hexdigest()
72
+ import hashlib
72
73
 
73
-
74
- def _sha256_file(path: Path) -> str:
75
- h = hashlib.sha256()
76
- with open(path, "rb") as fh:
77
- for block in iter(lambda: fh.read(65536), b""):
78
- h.update(block)
79
- return h.hexdigest()
74
+ return hashlib.sha256(data).hexdigest()
80
75
 
81
76
 
82
77
  def _safe_json(value: Any) -> Any:
@@ -8,7 +8,7 @@ import os
8
8
  import re
9
9
  import struct
10
10
  from dataclasses import dataclass
11
- from typing import Iterable, List
11
+ from typing import Any, Dict, Iterable, List, Optional
12
12
 
13
13
 
14
14
  DEFAULT_EMBEDDING_DIM = int(os.getenv("LATTICEAI_VECTOR_DIM", "384"))
@@ -87,4 +87,40 @@ class LocalEmbeddingModel:
87
87
  return list(struct.unpack(f"<{count}f", payload[: count * 4]))
88
88
 
89
89
 
90
- __all__ = ["DEFAULT_EMBEDDING_DIM", "EMBEDDING_MODEL_ID", "LocalEmbeddingModel", "embedding_model_id"]
90
+ # --- Large candidate #2 slice: multimodal (vision) stubs ---
91
+ # Schema already defines IMAGE / IMAGE_TEXT / CONTAINS_IMAGE.
92
+ # These stubs allow ingestion + retrieval paths to carry image signals without
93
+ # requiring heavy deps at core. Real impl can swap in local vision (e.g. via
94
+ # ollama vision or onnx CLIP) behind the same interface.
95
+ @dataclass(frozen=True)
96
+ class VisionStub:
97
+ """Offline vision describe + embed stubs for multimodal Brain.
98
+
99
+ describe: returns a short textual caption derived from metadata/filename.
100
+ embed: produces a vector from image meta (size+format) + optional caption hash.
101
+ Later: replace with real embedding model that accepts image bytes/path.
102
+ """
103
+ dim: int = DEFAULT_EMBEDDING_DIM
104
+
105
+ def describe(self, path: str | None = None, meta: Optional[Dict[str, Any]] = None) -> str:
106
+ meta = meta or {}
107
+ w = meta.get("width") or meta.get("w") or "?"
108
+ h = meta.get("height") or meta.get("h") or "?"
109
+ fmt = meta.get("format") or meta.get("ext") or "img"
110
+ name = (path or "").split("/")[-1] or "image"
111
+ # deterministic caption stub (no external call)
112
+ return f"Image {name} ({fmt} {w}x{h})"
113
+
114
+ def embed_image(self, path: str | None = None, meta: Optional[Dict[str, Any]] = None, caption: str = "") -> List[float]:
115
+ meta = meta or {}
116
+ basis = f"{path or ''}|{meta.get('width',0)}x{meta.get('height',0)}|{meta.get('format','')}|{caption[:120]}"
117
+ # reuse text embedder for determinism (image content hash would be better with real vision)
118
+ model = LocalEmbeddingModel(dim=self.dim)
119
+ return model.embed(basis)
120
+
121
+
122
+ def get_vision_embedder(dim: int | None = None) -> VisionStub:
123
+ return VisionStub(dim=dim or DEFAULT_EMBEDDING_DIM)
124
+
125
+
126
+ __all__ = ["DEFAULT_EMBEDDING_DIM", "EMBEDDING_MODEL_ID", "LocalEmbeddingModel", "embedding_model_id", "VisionStub", "get_vision_embedder"]