ltcai 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +140 -589
  2. package/auto_setup.py +17 -17
  3. package/docs/CHANGELOG.md +99 -0
  4. package/docs/MULTI_AGENT_RUNTIME.md +23 -5
  5. package/docs/PLUGIN_SDK.md +21 -8
  6. package/docs/REALTIME_COLLABORATION.md +19 -6
  7. package/docs/V2_ARCHITECTURE.md +65 -33
  8. package/docs/WORKFLOW_DESIGNER.md +18 -8
  9. package/docs/architecture.md +127 -135
  10. package/docs/kg-schema.md +3 -3
  11. package/docs/public-deploy.md +2 -3
  12. package/knowledge_graph.py +2 -2
  13. package/latticeai/__init__.py +1 -1
  14. package/latticeai/api/agents.py +57 -1
  15. package/latticeai/api/marketplace.py +81 -0
  16. package/latticeai/api/models.py +8 -0
  17. package/latticeai/api/plugins.py +1 -1
  18. package/latticeai/api/realtime.py +1 -1
  19. package/latticeai/api/workflow_designer.py +10 -1
  20. package/latticeai/core/config.py +1 -1
  21. package/latticeai/core/graph_curator.py +2 -2
  22. package/latticeai/core/marketplace.py +178 -0
  23. package/latticeai/core/model_compat.py +7 -63
  24. package/latticeai/core/model_resolution.py +1 -1
  25. package/latticeai/core/multi_agent.py +359 -68
  26. package/latticeai/core/plugins.py +29 -13
  27. package/latticeai/core/realtime.py +1 -1
  28. package/latticeai/core/workflow_engine.py +1 -1
  29. package/latticeai/core/workspace_os.py +257 -10
  30. package/latticeai/server_app.py +17 -5
  31. package/latticeai/services/model_catalog.py +105 -153
  32. package/latticeai/services/model_recommendation.py +28 -17
  33. package/latticeai/services/model_runtime.py +2 -2
  34. package/latticeai/services/platform_runtime.py +9 -5
  35. package/llm_router.py +80 -92
  36. package/ltcai_cli.py +2 -3
  37. package/package.json +2 -2
  38. package/static/agents.html +47 -3
  39. package/static/chat.html +5 -6
  40. package/static/plugins.html +51 -0
  41. package/static/scripts/chat.js +34 -36
  42. package/static/workflows.html +22 -0
  43. package/static/workspace.html +1 -1
  44. package/telegram_bot.py +1 -1
package/llm_router.py CHANGED
@@ -29,16 +29,14 @@ executor = ThreadPoolExecutor(max_workers=1)
29
29
 
30
30
  try:
31
31
  import mlx.core as mx
32
- from mlx_lm import load as lm_load
33
32
  from mlx_vlm import load as vlm_load
34
33
  VLM_AVAILABLE = True
35
- print("✅ MLX-VLM and MLX-LM are ready for Gemma 4.")
34
+ print("✅ MLX-VLM is ready for multimodal models.")
36
35
  except Exception as e:
37
36
  mx = None
38
- lm_load = None
39
37
  vlm_load = None
40
38
  VLM_AVAILABLE = False
41
- print(f"⚠️ MLX libraries unavailable: {e}")
39
+ print(f"⚠️ MLX-VLM unavailable: {e}")
42
40
 
43
41
  BRAND_NAME = "Lattice AI"
44
42
  LEGACY_BRAND_PATTERNS = [
@@ -77,12 +75,12 @@ OPENAI_COMPATIBLE_PROVIDERS = {
77
75
  "groq": {
78
76
  "env_key": "GROQ_API_KEY",
79
77
  "base_url": "https://api.groq.com/openai/v1",
80
- "default_model": "llama-3.1-8b-instant",
78
+ "default_model": "meta-llama/llama-4-scout-17b-16e-instruct",
81
79
  },
82
80
  "together": {
83
81
  "env_key": "TOGETHER_API_KEY",
84
82
  "base_url": "https://api.together.xyz/v1",
85
- "default_model": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
83
+ "default_model": "Qwen/Qwen3-VL-32B-Instruct",
86
84
  },
87
85
  "xai": {
88
86
  "env_key": "XAI_API_KEY",
@@ -93,14 +91,14 @@ OPENAI_COMPATIBLE_PROVIDERS = {
93
91
  "env_key": "OLLAMA_API_KEY",
94
92
  "base_url_env": "OLLAMA_BASE_URL",
95
93
  "base_url": "http://localhost:11434/v1",
96
- "default_model": "llama3.1",
94
+ "default_model": "hf.co/ggml-org/gemma-4-12B-it-GGUF:Q4_K_M",
97
95
  "api_key_fallback": "ollama",
98
96
  },
99
97
  "vllm": {
100
98
  "env_key": "VLLM_API_KEY",
101
99
  "base_url_env": "VLLM_BASE_URL",
102
100
  "base_url": "http://localhost:8000/v1",
103
- "default_model": "meta-llama/Llama-3.1-8B-Instruct",
101
+ "default_model": "Qwen/Qwen3-VL-8B-Instruct",
104
102
  "api_key_fallback": "vllm",
105
103
  },
106
104
  "lmstudio": {
@@ -137,20 +135,18 @@ PROVIDER_MODEL_CATALOG = {
137
135
  {"id": "anthropic/claude-sonnet-4.6", "name": "Claude Sonnet 4.6 via OpenRouter", "family": "Claude"},
138
136
  {"id": "anthropic/claude-haiku-4.5", "name": "Claude Haiku 4.5 via OpenRouter", "family": "Claude"},
139
137
  {"id": "qwen/qwen3-vl-235b-a22b-instruct", "name": "Qwen3-VL 235B A22B via OpenRouter", "family": "Qwen"},
140
- {"id": "qwen/qwen3-coder", "name": "Qwen3 Coder via OpenRouter", "family": "Qwen"},
138
+ {"id": "google/gemma-4-12b-it", "name": "Gemma 4 12B via OpenRouter", "family": "Gemma"},
141
139
  {"id": "x-ai/grok-2", "name": "Grok 2 via OpenRouter", "family": "Grok"},
142
- {"id": "meta-llama/llama-3.3-70b-instruct", "name": "Llama 3.3 70B via OpenRouter", "family": "Llama"},
140
+ {"id": "meta-llama/llama-4-scout-17b-16e-instruct", "name": "Llama 4 Scout via OpenRouter", "family": "Llama"},
143
141
  {"id": "google/gemini-2.5-flash", "name": "Gemini 2.5 Flash via OpenRouter", "family": "Gemini"},
144
142
  ],
145
143
  "groq": [
146
- {"id": "qwen/qwen3-32b", "name": "Qwen3 32B", "family": "Qwen"},
147
- {"id": "llama-3.1-8b-instant", "name": "Llama 3.1 8B Instant", "family": "Llama"},
148
- {"id": "llama-3.3-70b-versatile", "name": "Llama 3.3 70B Versatile", "family": "Llama"},
144
+ {"id": "meta-llama/llama-4-scout-17b-16e-instruct", "name": "Llama 4 Scout", "family": "Llama"},
149
145
  ],
150
146
  "together": [
151
147
  {"id": "Qwen/Qwen3-VL-32B-Instruct", "name": "Qwen3-VL 32B", "family": "Qwen"},
152
- {"id": "meta-llama/Llama-3.3-70B-Instruct-Turbo", "name": "Llama 3.3 70B Turbo", "family": "Llama"},
153
- {"id": "mistralai/Mixtral-8x22B-Instruct-v0.1", "name": "Mixtral 8x22B", "family": "Mistral"},
148
+ {"id": "google/gemma-4-12b-it", "name": "Gemma 4 12B", "family": "Gemma"},
149
+ {"id": "meta-llama/Llama-4-Scout-17B-16E-Instruct", "name": "Llama 4 Scout", "family": "Llama"},
154
150
  ],
155
151
  "xai": [
156
152
  {"id": "grok-beta", "name": "Grok Beta", "family": "Grok"},
@@ -158,6 +154,40 @@ PROVIDER_MODEL_CATALOG = {
158
154
  ],
159
155
  }
160
156
 
157
+ MODEL_SOURCE_BY_FAMILY = {
158
+ "GPT": ("미국", "OpenAI"),
159
+ "Claude": ("미국", "Anthropic"),
160
+ "Qwen": ("중국", "Alibaba"),
161
+ "Llama": ("미국", "Meta"),
162
+ "Gemini": ("미국", "Google"),
163
+ "Grok": ("미국", "xAI"),
164
+ }
165
+
166
+
167
+ def source_metadata_for_model(provider: str, model: Dict[str, str], *, local_server: bool) -> Dict[str, str]:
168
+ family = str(model.get("family") or "")
169
+ country, company = MODEL_SOURCE_BY_FAMILY.get(family, ("미상", provider.title()))
170
+ if local_server:
171
+ execution_method = "내 컴퓨터에서만 실행"
172
+ internet_requirement = "모델을 다운로드할 때만 인터넷 필요; 실행 중에는 필요 없음"
173
+ else:
174
+ execution_method = "인터넷 연결 후 사용"
175
+ internet_requirement = "내 파일이 인터넷으로 전송될 수 있음"
176
+ return {
177
+ "source_country": country,
178
+ "source_company": company,
179
+ "execution_method": execution_method,
180
+ "internet_requirement": internet_requirement,
181
+ "model_name": model.get("name") or model.get("id") or "",
182
+ "source_display_order": [
183
+ "source_country",
184
+ "source_company",
185
+ "execution_method",
186
+ "internet_requirement",
187
+ "model_name",
188
+ ],
189
+ }
190
+
161
191
  @dataclass
162
192
  class CloudModel:
163
193
  provider: str
@@ -207,37 +237,29 @@ def _resolve_local_hf_model(model_id: str) -> str:
207
237
  return model_id
208
238
 
209
239
  def ensure_mlx_runtime() -> None:
210
- global mx, lm_load, vlm_load, VLM_AVAILABLE
211
- if mx is not None and lm_load is not None:
240
+ global mx, vlm_load, VLM_AVAILABLE
241
+ if mx is not None and vlm_load is not None:
212
242
  return
213
243
  try:
214
244
  import mlx.core as mlx_core
215
- from mlx_lm import load as mlx_lm_load
245
+ from mlx_vlm import load as mlx_vlm_load
216
246
 
217
247
  mx = mlx_core
218
- lm_load = mlx_lm_load
219
- try:
220
- from mlx_vlm import load as mlx_vlm_load
221
- vlm_load = mlx_vlm_load
222
- VLM_AVAILABLE = True
223
- except Exception:
224
- vlm_load = None
225
- VLM_AVAILABLE = False
248
+ vlm_load = mlx_vlm_load
249
+ VLM_AVAILABLE = True
226
250
  mx.set_default_device(mx.gpu)
227
251
  except Exception as e:
228
- raise RuntimeError(f"MLX runtime is not available after install: {e}") from e
252
+ raise RuntimeError(f"MLX-VLM runtime is not available after install: {e}") from e
229
253
 
230
254
  def _mlx_sampler(temperature: float):
231
255
  """Build an MLX sampler callable for the given temperature.
232
256
 
233
- mlx_lm >= 0.20 removed the ``temp`` keyword from generate_step in favour of a
234
- ``sampler`` callable, and mlx_vlm follows the same convention. Passing
235
- ``temp=`` to generate/stream_generate now raises
236
- ``generate_step() got an unexpected keyword argument 'temp'``. Both libraries
237
- accept ``sampler=`` and share make_sampler from mlx_lm.sample_utils.
257
+ Lattice v2.2 keeps local execution on MLX-VLM only. Returning ``None`` lets
258
+ MLX-VLM use its bundled default sampler without pulling another generation
259
+ package into the runtime contract.
238
260
  """
239
- from mlx_lm.sample_utils import make_sampler
240
- return make_sampler(temp=temperature)
261
+ _ = temperature
262
+ return None
241
263
 
242
264
  class LLMRouter:
243
265
  def __init__(self):
@@ -331,8 +353,8 @@ class LLMRouter:
331
353
  return self._load_cloud_model(provider, provider_model, api_key_override=api_key_override, owner=owner)
332
354
 
333
355
  ensure_mlx_runtime()
334
- if mx is None or lm_load is None:
335
- raise RuntimeError("MLX is not available in this process. Run on Apple Silicon with Metal access.")
356
+ if mx is None or vlm_load is None:
357
+ raise RuntimeError("MLX-VLM is not available in this process. Run on Apple Silicon with Metal access.")
336
358
 
337
359
  cache_key = f"{model_id}_{draft_model_id}" if draft_model_id else model_id
338
360
  if cache_key in self._cache:
@@ -348,24 +370,13 @@ class LLMRouter:
348
370
 
349
371
  def _load():
350
372
  mx.set_default_device(mx.gpu)
351
- is_gemma4 = "gemma-4" in model_id.lower() or "gemma4" in model_id.lower()
352
-
353
- # 1. Target 로드 (Gemma 4는 항상 vlm_load 사용)
354
- if is_gemma4 and VLM_AVAILABLE:
355
- print(f"🔄 Loading Target (VLM Mode): {target_model_id}...")
356
- model, tokenizer = vlm_load(target_model_id)
357
- else:
358
- print(f"🔄 Loading Target (LM Mode): {target_model_id}...")
359
- model, tokenizer = lm_load(target_model_id)
360
-
361
- # 2. Draft 로드 (Gemma 4는 항상 vlm_load 사용)
373
+ print(f"🔄 Loading Target (VLM Mode): {target_model_id}...")
374
+ model, tokenizer = vlm_load(target_model_id)
375
+
362
376
  draft_model = None
363
377
  if target_draft_model_id:
364
378
  print(f"🔄 Loading Assistant (VLM Mode): {target_draft_model_id}...")
365
- if is_gemma4 and VLM_AVAILABLE:
366
- draft_model, _ = vlm_load(target_draft_model_id)
367
- else:
368
- draft_model, _ = lm_load(target_draft_model_id)
379
+ draft_model, _ = vlm_load(target_draft_model_id)
369
380
  print(f"✅ Assistant Ready.")
370
381
 
371
382
  return model, tokenizer, draft_model
@@ -418,14 +429,16 @@ class LLMRouter:
418
429
  }]
419
430
  for model in provider_models:
420
431
  model_id = model["id"]
432
+ local_server = provider in local_server_providers
421
433
  items.append({
422
434
  "id": f"{provider}:{model_id}",
423
435
  "name": model.get("name") or f"{provider.title()} · {model_id}",
424
436
  "provider": provider,
425
437
  "family": model.get("family"),
426
- "tag": "local-server" if provider in local_server_providers else "cloud",
438
+ "tag": "local-server" if local_server else "cloud",
427
439
  "available": has_key,
428
440
  "requires": config["env_key"] if not has_key else None,
441
+ **source_metadata_for_model(provider, model, local_server=local_server),
429
442
  })
430
443
  custom = os.getenv("LATTICEAI_CLOUD_MODELS") or ""
431
444
  for raw in [item.strip() for item in custom.split(",") if item.strip()]:
@@ -439,6 +452,11 @@ class LLMRouter:
439
452
  "tag": "cloud",
440
453
  "available": bool(os.getenv(config["env_key"]) or config.get("api_key_fallback")),
441
454
  "requires": None,
455
+ **source_metadata_for_model(
456
+ provider,
457
+ {"id": model, "name": f"{provider.title()} · {model}", "family": provider.title()},
458
+ local_server=provider in local_server_providers,
459
+ ),
442
460
  })
443
461
  return items
444
462
 
@@ -511,25 +529,15 @@ class LLMRouter:
511
529
  return await self._cloud_generate(cached, message, context, max_tokens, temperature)
512
530
 
513
531
  model, tokenizer, draft_model = self._cache[self._current]
514
- is_gemma4 = "gemma-4" in self._current.lower() or "gemma4" in self._current.lower()
515
- prompt = (
516
- self._build_vlm_prompt(model, tokenizer, message, context, 1)
517
- if image_data and is_gemma4 and VLM_AVAILABLE
518
- else self._build_prompt(message, context, tokenizer)
519
- )
532
+ prompt = self._build_vlm_prompt(model, tokenizer, message, context, 1 if image_data else 0)
520
533
 
521
534
  loop = asyncio.get_event_loop()
522
535
 
523
536
  def _gen():
524
537
  import mlx.core as mx
525
538
  mx.set_default_device(mx.gpu)
526
- is_gemma4 = "gemma-4" in self._current.lower() or "gemma4" in self._current.lower()
527
- if is_gemma4 and VLM_AVAILABLE:
528
- from mlx_vlm import generate as vlm_gen
529
- return vlm_gen(model, tokenizer, prompt=prompt, image=self._prep_image(image_data), max_tokens=max_tokens, sampler=_mlx_sampler(temperature), draft_model=draft_model, draft_kind="mtp")
530
- else:
531
- from mlx_lm import generate as lm_gen
532
- return lm_gen(model, tokenizer, prompt=prompt, max_tokens=max_tokens, sampler=_mlx_sampler(temperature), draft_model=draft_model)
539
+ from mlx_vlm import generate as vlm_gen
540
+ return vlm_gen(model, tokenizer, prompt=prompt, image=self._prep_image(image_data) if image_data else None, max_tokens=max_tokens, sampler=_mlx_sampler(temperature), draft_model=draft_model, draft_kind="mtp")
533
541
  result = await loop.run_in_executor(executor, _gen)
534
542
  # mlx-vlm might return a GenerationResult object; extract the text
535
543
  if hasattr(result, "text"):
@@ -567,12 +575,7 @@ class LLMRouter:
567
575
  return
568
576
 
569
577
  model, tokenizer, draft_model = self._cache[self._current]
570
- is_gemma4 = "gemma-4" in self._current.lower() or "gemma4" in self._current.lower()
571
- prompt = (
572
- self._build_vlm_prompt(model, tokenizer, message, context, 1)
573
- if image_data and is_gemma4 and VLM_AVAILABLE
574
- else self._build_prompt(message, context, tokenizer)
575
- )
578
+ prompt = self._build_vlm_prompt(model, tokenizer, message, context, 1 if image_data else 0)
576
579
  loop = asyncio.get_event_loop()
577
580
  queue = asyncio.Queue()
578
581
 
@@ -580,13 +583,8 @@ class LLMRouter:
580
583
  import mlx.core as mx
581
584
  mx.set_default_device(mx.gpu)
582
585
  try:
583
- is_gemma4 = "gemma-4" in self._current.lower() or "gemma4" in self._current.lower()
584
- if is_gemma4 and VLM_AVAILABLE:
585
- from mlx_vlm import stream_generate as vlm_stream
586
- gen = vlm_stream(model, tokenizer, prompt=prompt, image=self._prep_image(image_data), max_tokens=max_tokens, sampler=_mlx_sampler(temperature), draft_model=draft_model, draft_kind="mtp")
587
- else:
588
- from mlx_lm import stream_generate as lm_stream
589
- gen = lm_stream(model, tokenizer, prompt=prompt, max_tokens=max_tokens, sampler=_mlx_sampler(temperature), draft_model=draft_model)
586
+ from mlx_vlm import stream_generate as vlm_stream
587
+ gen = vlm_stream(model, tokenizer, prompt=prompt, image=self._prep_image(image_data) if image_data else None, max_tokens=max_tokens, sampler=_mlx_sampler(temperature), draft_model=draft_model, draft_kind="mtp")
590
588
 
591
589
  for chunk in gen:
592
590
  text = chunk.text if hasattr(chunk, "text") else (chunk[0] if isinstance(chunk, tuple) else str(chunk))
@@ -675,13 +673,8 @@ class LLMRouter:
675
673
  def _gen():
676
674
  import mlx.core as mx
677
675
  mx.set_default_device(mx.gpu)
678
- is_gemma4 = "gemma-4" in self._current.lower() or "gemma4" in self._current.lower()
679
- if is_gemma4 and VLM_AVAILABLE:
680
- from mlx_vlm import generate as vlm_gen
681
- return vlm_gen(model, tokenizer, prompt=prompt, image=None, max_tokens=max_tokens, sampler=_mlx_sampler(temperature), draft_model=draft_model, draft_kind="mtp")
682
- else:
683
- from mlx_lm import generate as lm_gen
684
- return lm_gen(model, tokenizer, prompt=prompt, max_tokens=max_tokens, sampler=_mlx_sampler(temperature), draft_model=draft_model)
676
+ from mlx_vlm import generate as vlm_gen
677
+ return vlm_gen(model, tokenizer, prompt=prompt, image=None, max_tokens=max_tokens, sampler=_mlx_sampler(temperature), draft_model=draft_model, draft_kind="mtp")
685
678
  result = await loop.run_in_executor(executor, _gen)
686
679
  if hasattr(result, "text"):
687
680
  return normalize_branding(result.text)
@@ -742,13 +735,8 @@ class LLMRouter:
742
735
  import mlx.core as mx
743
736
  mx.set_default_device(mx.gpu)
744
737
  try:
745
- is_gemma4 = "gemma-4" in self._current.lower() or "gemma4" in self._current.lower()
746
- if is_gemma4 and VLM_AVAILABLE:
747
- from mlx_vlm import stream_generate as vlm_stream
748
- gen = vlm_stream(model, tokenizer, prompt=prompt, image=None, max_tokens=max_tokens, sampler=_mlx_sampler(temperature), draft_model=draft_model, draft_kind="mtp")
749
- else:
750
- from mlx_lm import stream_generate as lm_stream
751
- gen = lm_stream(model, tokenizer, prompt=prompt, max_tokens=max_tokens, sampler=_mlx_sampler(temperature), draft_model=draft_model)
738
+ from mlx_vlm import stream_generate as vlm_stream
739
+ gen = vlm_stream(model, tokenizer, prompt=prompt, image=None, max_tokens=max_tokens, sampler=_mlx_sampler(temperature), draft_model=draft_model, draft_kind="mtp")
752
740
  for chunk in gen:
753
741
  text = chunk.text if hasattr(chunk, "text") else (chunk[0] if isinstance(chunk, tuple) else str(chunk))
754
742
  loop.call_soon_threadsafe(queue.put_nowait, text)
package/ltcai_cli.py CHANGED
@@ -97,9 +97,8 @@ def doctor() -> int:
97
97
  ("FastAPI", _has_module("fastapi"), "required server dependency", True),
98
98
  ("Uvicorn", _has_module("uvicorn"), "required server dependency", True),
99
99
  ("OpenAI SDK", _has_module("openai"), "required for cloud providers", False),
100
- ("MLX", _has_module("mlx"), "required for Apple Silicon local models", False),
101
- ("MLX-LM", _has_module("mlx_lm"), "required for local text models", False),
102
- ("MLX-VLM", _has_module("mlx_vlm"), "required for Gemma/VLM models", False),
100
+ ("MLX", _has_module("mlx"), "required for Apple Silicon multimodal models", False),
101
+ ("MLX-VLM", _has_module("mlx_vlm"), "required for Gemma-4/VLM models", False),
103
102
  ("Ollama binary", shutil.which("ollama") is not None, "optional local-server engine", False),
104
103
  ]
105
104
  data_dir = Path(os.getenv("LATTICEAI_DATA_DIR") or Path.home() / ".ltcai")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ltcai",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "Lattice AI Workspace OS for local-first graph, memory, agent, workflow, and skill operations",
5
5
  "homepage": "https://github.com/TaeSooPark-PTS/LatticeAI#readme",
6
6
  "repository": {
@@ -19,7 +19,7 @@
19
19
  "dev": "python3 ltcai_cli.py --reload",
20
20
  "build": "npm run build:python",
21
21
  "build:python": "python3 -m build",
22
- "check:python": "python3 -m py_compile ltcai_cli.py server.py latticeai/server_app.py latticeai/api/chat.py latticeai/api/computer_use.py latticeai/api/deps.py latticeai/api/garden.py latticeai/api/local_files.py latticeai/api/permissions.py latticeai/api/setup.py latticeai/api/static_routes.py latticeai/api/tools.py latticeai/api/plugins.py latticeai/api/workflow_designer.py latticeai/api/agents.py latticeai/api/realtime.py latticeai/services/app_context.py latticeai/services/model_runtime.py latticeai/services/model_catalog.py latticeai/services/model_recommendation.py latticeai/services/tool_dispatch.py latticeai/services/upload_service.py latticeai/core/tool_registry.py latticeai/core/enterprise.py latticeai/core/enterprise_admin.py latticeai/core/agent_prompts.py latticeai/core/workspace_os.py latticeai/core/plugins.py latticeai/core/workflow_engine.py latticeai/core/multi_agent.py latticeai/core/realtime.py knowledge_graph.py knowledge_graph_api.py local_knowledge_api.py llm_router.py p_reinforce.py telegram_bot.py tools.py codex_telegram_bot.py",
22
+ "check:python": "python3 -m py_compile ltcai_cli.py server.py latticeai/server_app.py latticeai/api/chat.py latticeai/api/computer_use.py latticeai/api/deps.py latticeai/api/garden.py latticeai/api/local_files.py latticeai/api/permissions.py latticeai/api/setup.py latticeai/api/static_routes.py latticeai/api/tools.py latticeai/api/plugins.py latticeai/api/workflow_designer.py latticeai/api/agents.py latticeai/api/realtime.py latticeai/api/marketplace.py latticeai/services/app_context.py latticeai/services/model_runtime.py latticeai/services/model_catalog.py latticeai/services/model_recommendation.py latticeai/services/tool_dispatch.py latticeai/services/upload_service.py latticeai/core/tool_registry.py latticeai/core/enterprise.py latticeai/core/enterprise_admin.py latticeai/core/agent_prompts.py latticeai/core/workspace_os.py latticeai/core/plugins.py latticeai/core/marketplace.py latticeai/core/workflow_engine.py latticeai/core/multi_agent.py latticeai/core/realtime.py knowledge_graph.py knowledge_graph_api.py local_knowledge_api.py llm_router.py p_reinforce.py telegram_bot.py tools.py codex_telegram_bot.py",
23
23
  "test": "python3 -m pytest tests/ -v",
24
24
  "test:unit": "python3 -m pytest tests/unit/ -v",
25
25
  "test:integration": "python3 -m pytest tests/integration/ -v",
@@ -9,7 +9,7 @@
9
9
  <body>
10
10
  <main>
11
11
  <h1>Multi-Agent Runtime</h1>
12
- <p class="sub">Planner · Executor · Reviewer · Researcher · Release — with handoff, retry, and an observable timeline.</p>
12
+ <p class="sub">Planner · Executor · Reviewer · Researcher · Release — with handoff, context packets, memory, retry, and replay.</p>
13
13
 
14
14
  <div class="section">
15
15
  <label>Goal</label>
@@ -28,6 +28,11 @@
28
28
  <h3>Recent agent runs</h3>
29
29
  <div id="runs"><div class="empty">Loading…</div></div>
30
30
  </div>
31
+
32
+ <div class="section">
33
+ <h3>Replay viewer</h3>
34
+ <div id="replay"><div class="empty">Select a recent run.</div></div>
35
+ </div>
31
36
  </main>
32
37
 
33
38
  <script type="module">
@@ -47,13 +52,33 @@
47
52
 
48
53
  function renderTimeline(timeline) {
49
54
  return (timeline || []).map((t) => {
50
- const label = t.event === "handoff" ? `↪ handoff ${escapeHtml(t.from)} → ${escapeHtml(t.to)}`
55
+ const label = (t.event || "").startsWith("handoff_") ? `↪ ${escapeHtml(t.event)} ${escapeHtml(t.from||"")} → ${escapeHtml(t.to||"")}`
56
+ : t.event === "handoff" ? `↪ handoff ${escapeHtml(t.from)} → ${escapeHtml(t.to)}`
51
57
  : t.event === "role" ? `● ${escapeHtml(t.role)} ${badge(t.status)}`
58
+ : t.event === "retry_requested" ? `↻ retry ${escapeHtml(t.reason||"")}`
59
+ : t.event === "review_approved" ? `✓ review approved`
52
60
  : `· ${escapeHtml(t.event)}`;
53
61
  return `<div class="timeline-item">${label}<div class="t-meta">${escapeHtml(t.note||t.timestamp||"")}</div></div>`;
54
62
  }).join("");
55
63
  }
56
64
 
65
+ function renderHandoffs(handoffs) {
66
+ if (!handoffs?.length) return `<div class="empty">No handoffs recorded.</div>`;
67
+ return handoffs.map((h) => `<div class="timeline-item">
68
+ <strong>${escapeHtml(h.handoff_id)}</strong> ${badge(h.status)}
69
+ <div class="t-meta">${escapeHtml(h.source_agent)} → ${escapeHtml(h.target_agent)} · ${escapeHtml(h.reason||"")}</div>
70
+ </div>`).join("");
71
+ }
72
+
73
+ function renderReview(result) {
74
+ const reviews = result.review_history || [];
75
+ const retries = result.retry_history || [];
76
+ return `<div class="grid two">
77
+ <div>${reviews.length ? reviews.map((r) => `<div class="timeline-item">${badge(r.outcome)} ${escapeHtml(r.reason||"")}<div class="t-meta">retry ${r.retry_count}</div></div>`).join("") : `<div class="empty">No review history.</div>`}</div>
78
+ <div>${retries.length ? retries.map((r) => `<div class="timeline-item">${badge("retry " + r.retry)} ${escapeHtml(r.reason||"")}<div class="t-meta">limit ${r.limit}</div></div>`).join("") : `<div class="empty">No retries.</div>`}</div>
79
+ </div>`;
80
+ }
81
+
57
82
  document.getElementById("runBtn").addEventListener("click", async () => {
58
83
  const btn = document.getElementById("runBtn");
59
84
  btn.disabled = true;
@@ -66,7 +91,9 @@
66
91
  <div class="card">
67
92
  <div class="row"><h3>${escapeHtml(r.output)}</h3><div class="spacer"></div>${badge(r.status)}</div>
68
93
  <div class="meta">retries: ${r.retries} · roles: ${(r.roles_run||[]).join(" → ")}</div>
69
- <div class="section">${renderTimeline(r.timeline)}</div>
94
+ <div class="section"><h3>Handoff chain</h3>${renderHandoffs(r.handoffs)}</div>
95
+ <div class="section"><h3>Review panel</h3>${renderReview(r)}</div>
96
+ <div class="section"><h3>Timeline</h3>${renderTimeline(r.timeline)}</div>
70
97
  </div>`;
71
98
  toast(`Agent run: ${r.status}`);
72
99
  await loadRuns();
@@ -82,9 +109,26 @@
82
109
  <div class="card" style="margin-bottom:10px">
83
110
  <div class="row"><h3>${escapeHtml((r.input||"").slice(0,80))}</h3><div class="spacer"></div>${badge(r.status)}</div>
84
111
  <div class="meta">${escapeHtml(r.agent_id)} · ${escapeHtml(r.created_at)} · ${(r.timeline||[]).length} timeline events</div>
112
+ <div class="row" style="margin-top:10px"><button class="ghost" data-replay="${r.id}">Replay</button></div>
85
113
  </div>`).join("");
86
114
  }
87
115
 
116
+ document.getElementById("runs").addEventListener("click", async (e) => {
117
+ const btn = e.target.closest("button[data-replay]");
118
+ if (!btn) return;
119
+ const out = document.getElementById("replay");
120
+ out.innerHTML = `<div class="empty">Loading replay…</div>`;
121
+ try {
122
+ const data = await api(`/agents/api/runs/${btn.dataset.replay}/replay`);
123
+ const frames = data.replay.frames || [];
124
+ out.innerHTML = frames.map((f) => `<div class="timeline-item">
125
+ <div class="row"><strong>${escapeHtml(f.event)}</strong><div class="spacer"></div>${badge(f.decision || "event")}</div>
126
+ <div class="t-meta">${escapeHtml(String(f.actor||""))} · ${escapeHtml(f.when||"")}</div>
127
+ <pre>${escapeHtml(JSON.stringify({ why: f.why, input: f.input, output: f.output }, null, 2))}</pre>
128
+ </div>`).join("") || `<div class="empty">No replay frames.</div>`;
129
+ } catch (err) { out.innerHTML = `<div class="empty">${escapeHtml(err.message)}</div>`; }
130
+ });
131
+
88
132
  loadRoles().catch((e) => toast(e.message));
89
133
  loadRuns().catch(() => {});
90
134
  </script>
package/static/chat.html CHANGED
@@ -237,8 +237,7 @@
237
237
  <button class="hdc-btn" onclick="openDataGraph()"><i class="ti ti-arrow-right"></i> 그래프 보기</button>
238
238
  </div>
239
239
 
240
- <!-- 자동 설정 (고급/관리자 모드만) -->
241
- <div class="hdc-card hdc-setup" id="home-setup-card" style="display:none">
240
+ <div class="hdc-card hdc-setup" id="home-setup-card">
242
241
  <div class="hdc-title"><i class="ti ti-settings-automation"></i> 자동 설정</div>
243
242
  <div class="hdc-setup-count">
244
243
  <span id="home-setup-num">—</span>
@@ -279,7 +278,7 @@
279
278
  <div class="chat-capability-row" id="chat-capability-row">
280
279
  <span>파일 생성</span>
281
280
  <span>지식 정리</span>
282
- <span>로컬 런타임</span>
281
+ <span>내 컴퓨터에서 실행</span>
283
282
  </div>
284
283
  </div>
285
284
  </section>
@@ -359,12 +358,12 @@
359
358
  <button class="mode-card" id="mode-card-advanced" onclick="selectMode('advanced')">
360
359
  <div class="mode-icon"><i class="ti ti-terminal-2"></i></div>
361
360
  <h3 data-i18n="mode_advanced">고급 모드</h3>
362
- <span data-i18n="mode_advanced_sub">모델 상태, 런타임 설정, 고급 도구 관리</span>
361
+ <span data-i18n="mode_advanced_sub">같은 기능을 자세한 설명으로 표시</span>
363
362
  </button>
364
363
  <button class="mode-card" id="mode-card-admin" onclick="selectMode('admin')">
365
364
  <div class="mode-icon"><i class="ti ti-shield-lock"></i></div>
366
365
  <h3 data-i18n="mode_admin">관리자 모드</h3>
367
- <span data-i18n="mode_admin_sub">운영자용 관리자 대시보드</span>
366
+ <span data-i18n="mode_admin_sub">사용자, 정책, 감사 로그 관리</span>
368
367
  </button>
369
368
  </div>
370
369
  </section>
@@ -375,7 +374,7 @@
375
374
  <div class="model-panel-header">
376
375
  <div>
377
376
  <h2 data-i18n="model_switcher">모델 스위처</h2>
378
- <p style="color: var(--muted); font-size: 12px; margin-top: 4px;" data-i18n="model_switcher_sub">실행 엔진을 설치하고, 엔진에 맞는 local/cloud LLM을 선택합니다.</p>
377
+ <p style="color: var(--muted); font-size: 12px; margin-top: 4px;" data-i18n="model_switcher_sub">제작 국가, 제작 회사, 실행 방식, 인터넷 사용 여부를 확인하고 모델을 선택합니다.</p>
379
378
  </div>
380
379
  <button class="admin-close" onclick="closeModelPanel()"><i class="ti ti-x"></i></button>
381
380
  </div>
@@ -12,6 +12,16 @@
12
12
  <p class="sub" id="sub">Versioned, permissioned plugins that extend skills, tools, and workflows.</p>
13
13
  <div id="list" class="grid"><div class="empty">Loading plugins…</div></div>
14
14
 
15
+ <div class="section">
16
+ <h3>Template foundation</h3>
17
+ <div id="templates" class="grid"><div class="empty">Loading templates…</div></div>
18
+ </div>
19
+
20
+ <div class="section">
21
+ <h3>Plugin execution viewer</h3>
22
+ <div id="pluginEvents"><div class="empty">Loading plugin events…</div></div>
23
+ </div>
24
+
15
25
  <div class="section">
16
26
  <h3>Validate a manifest</h3>
17
27
  <p class="sub">Paste a <code>plugin.json</code> to check it against the SDK schema and permission allow-list.</p>
@@ -55,6 +65,45 @@
55
65
  </div>`).join("");
56
66
  }
57
67
 
68
+ async function loadTemplates() {
69
+ const data = await api("/marketplace/templates");
70
+ const box = document.getElementById("templates");
71
+ if (!data.templates.length) { box.innerHTML = `<div class="empty">No templates available.</div>`; return; }
72
+ box.innerHTML = data.templates.map((t) => `
73
+ <div class="card">
74
+ <div class="row"><h3>${escapeHtml(t.name)}</h3><div class="spacer"></div>${badge(t.kind)}</div>
75
+ <div class="meta">v${escapeHtml(t.version)} · ${escapeHtml((t.metadata||{}).category || "foundation")}</div>
76
+ <p style="font-size:13px;color:#cbd5e1">${escapeHtml(t.description || "")}</p>
77
+ <div class="row" style="margin-top:12px">
78
+ <a class="btn ghost" target="_blank" href="/marketplace/templates/${t.kind}/${t.id}/export">Export</a>
79
+ <button data-template="${t.kind}:${t.id}">Install</button>
80
+ </div>
81
+ </div>`).join("");
82
+ }
83
+
84
+ async function loadPluginEvents() {
85
+ const data = await api("/realtime/feed?limit=80");
86
+ const events = (data.events || []).filter((e) => e.area === "plugins" || e.event_type?.startsWith("plugin_"));
87
+ const box = document.getElementById("pluginEvents");
88
+ if (!events.length) { box.innerHTML = `<div class="empty">No plugin executions yet.</div>`; return; }
89
+ box.innerHTML = events.slice(0, 20).map((ev) => `<div class="timeline-item">
90
+ <div class="row"><strong>${escapeHtml(ev.event_type)}</strong><div class="spacer"></div>${badge((ev.payload||{}).status || ev.area)}</div>
91
+ <div class="t-meta">${escapeHtml((ev.payload||{}).plugin_id || (ev.payload||{}).plugin || "")} · ${escapeHtml(ev.received_at || ev.timestamp || "")}</div>
92
+ </div>`).join("");
93
+ }
94
+
95
+ document.getElementById("templates").addEventListener("click", async (e) => {
96
+ const btn = e.target.closest("button[data-template]");
97
+ if (!btn) return;
98
+ btn.disabled = true;
99
+ const [kind, id] = btn.dataset.template.split(":");
100
+ try {
101
+ const exported = await api(`/marketplace/templates/${kind}/${id}/export`);
102
+ await api("/marketplace/templates/install", { method: "POST", body: JSON.stringify({ data: exported }) });
103
+ toast(`Installed template: ${id}`);
104
+ } catch (err) { toast(err.message); } finally { btn.disabled = false; }
105
+ });
106
+
58
107
  document.getElementById("list").addEventListener("click", async (e) => {
59
108
  const btn = e.target.closest("button[data-act]");
60
109
  if (!btn) return;
@@ -77,6 +126,8 @@
77
126
  });
78
127
 
79
128
  load().catch((e) => toast(e.message));
129
+ loadTemplates().catch((e) => toast(e.message));
130
+ loadPluginEvents().catch(() => {});
80
131
  </script>
81
132
  </body>
82
133
  </html>