ltcai 11.2.0 → 11.4.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 +46 -53
- package/docs/CHANGELOG.md +61 -0
- package/docs/COMMUNITY_AND_PLUGINS.md +1 -1
- package/docs/DEVELOPMENT.md +1 -1
- package/docs/MULTI_AGENT_RUNTIME.md +1 -1
- package/docs/ONBOARDING.md +1 -1
- package/docs/OPERATIONS.md +6 -2
- package/docs/PERMISSION_MODE.md +1 -1
- package/docs/TRUST_MODEL.md +1 -1
- package/docs/WHY_LATTICE.md +1 -1
- package/docs/kg-schema.md +2 -2
- package/docs/v11.3.0_PLAN.md +202 -0
- package/docs/v11.4.0_RUST_FOUNDATION_PLAN.md +176 -0
- package/lattice_brain/__init__.py +1 -1
- package/lattice_brain/graph/_kg_common/__init__.py +287 -0
- package/lattice_brain/graph/_kg_common/extraction.py +516 -0
- package/lattice_brain/graph/_kg_common/relations.py +161 -0
- package/lattice_brain/graph/_kg_common/text.py +479 -0
- package/lattice_brain/graph/discovery_index/__init__.py +35 -0
- package/lattice_brain/graph/discovery_index/cleanup.py +182 -0
- package/lattice_brain/graph/discovery_index/extract.py +137 -0
- package/lattice_brain/graph/discovery_index/scan.py +411 -0
- package/lattice_brain/graph/discovery_index/upsert.py +495 -0
- package/lattice_brain/graph/projection/__init__.py +42 -0
- package/lattice_brain/graph/projection/curation.py +500 -0
- package/lattice_brain/graph/{projection.py → projection/v2_schema.py} +15 -477
- package/lattice_brain/graph/retrieval/__init__.py +54 -0
- package/lattice_brain/graph/retrieval/context.py +197 -0
- package/lattice_brain/graph/retrieval/graph_view.py +319 -0
- package/lattice_brain/graph/retrieval/hybrid.py +488 -0
- package/lattice_brain/graph/retrieval/maintenance.py +121 -0
- package/lattice_brain/graph/retrieval/signals.py +95 -0
- package/lattice_brain/graph/retrieval_vector/__init__.py +42 -0
- package/lattice_brain/graph/retrieval_vector/fingerprint.py +97 -0
- package/lattice_brain/graph/retrieval_vector/indexing.py +347 -0
- package/lattice_brain/graph/retrieval_vector/search.py +560 -0
- package/lattice_brain/graph/retrieval_vector/status.py +374 -0
- package/lattice_brain/ingestion/__init__.py +130 -0
- package/lattice_brain/ingestion/_contract.py +90 -0
- package/lattice_brain/ingestion/constants.py +127 -0
- package/lattice_brain/ingestion/folder_scan.py +57 -0
- package/lattice_brain/ingestion/folders.py +258 -0
- package/lattice_brain/ingestion/hashing.py +26 -0
- package/lattice_brain/ingestion/jobs_api.py +107 -0
- package/lattice_brain/ingestion/models.py +80 -0
- package/lattice_brain/ingestion/pipeline.py +486 -0
- package/lattice_brain/ingestion/quality.py +209 -0
- package/lattice_brain/ingestion/routing.py +295 -0
- package/lattice_brain/multimodal/__init__.py +164 -0
- package/lattice_brain/multimodal/audio.py +77 -0
- package/lattice_brain/multimodal/common.py +118 -0
- package/lattice_brain/multimodal/images.py +498 -0
- package/lattice_brain/multimodal/ports.py +169 -0
- package/lattice_brain/multimodal/video.py +410 -0
- package/lattice_brain/portability/__init__.py +90 -0
- package/lattice_brain/portability/_contract.py +42 -0
- package/lattice_brain/portability/backups.py +338 -0
- package/lattice_brain/portability/bundles.py +136 -0
- package/lattice_brain/portability/constants.py +93 -0
- package/lattice_brain/portability/fsops.py +138 -0
- package/lattice_brain/portability/service.py +41 -0
- package/lattice_brain/{portability.py → portability/sharing.py} +44 -677
- package/lattice_brain/runtime/__init__.py +1 -1
- package/lattice_brain/runtime/multi_agent.py +1 -1
- package/latticeai/__init__.py +1 -1
- package/latticeai/api/chronicle.py +63 -0
- package/latticeai/core/agent/__init__.py +93 -0
- package/latticeai/core/agent/_contract.py +79 -0
- package/latticeai/core/agent/context.py +57 -0
- package/latticeai/core/agent/deps.py +125 -0
- package/latticeai/core/agent/execution.py +622 -0
- package/latticeai/core/agent/planning.py +145 -0
- package/latticeai/core/agent/recovery.py +157 -0
- package/latticeai/core/agent/runtime.py +210 -0
- package/latticeai/core/agent/verification.py +231 -0
- package/latticeai/core/embedding_providers/__init__.py +151 -0
- package/latticeai/core/embedding_providers/base.py +199 -0
- package/latticeai/core/embedding_providers/captions.py +162 -0
- package/latticeai/core/embedding_providers/profiles.py +126 -0
- package/latticeai/core/embedding_providers/text.py +350 -0
- package/latticeai/core/embedding_providers/vision.py +352 -0
- package/latticeai/core/file_generation/__init__.py +115 -0
- package/latticeai/core/file_generation/bundles.py +76 -0
- package/latticeai/core/file_generation/extraction.py +154 -0
- package/latticeai/core/file_generation/inference.py +235 -0
- package/latticeai/core/file_generation/orchestration.py +152 -0
- package/latticeai/core/file_generation/prompting.py +117 -0
- package/latticeai/core/file_generation/repair.py +114 -0
- package/latticeai/core/file_generation/sanitize.py +61 -0
- package/latticeai/core/file_generation/validation.py +201 -0
- package/latticeai/core/legacy_compatibility.py +1 -1
- package/latticeai/core/marketplace.py +1 -1
- package/latticeai/core/messages.py +9 -0
- package/latticeai/core/workspace_os_constants.py +1 -1
- package/latticeai/integrations/telegram_bot/__init__.py +123 -0
- package/latticeai/integrations/telegram_bot/__main__.py +17 -0
- package/latticeai/integrations/telegram_bot/config.py +86 -0
- package/latticeai/integrations/telegram_bot/dispatch.py +311 -0
- package/latticeai/integrations/telegram_bot/flows.py +478 -0
- package/latticeai/integrations/telegram_bot/helpers.py +322 -0
- package/latticeai/integrations/telegram_bot/screens.py +394 -0
- package/latticeai/models/router/__init__.py +88 -0
- package/latticeai/models/router/_contract.py +66 -0
- package/latticeai/models/router/branding.py +56 -0
- package/latticeai/models/router/catalog.py +69 -0
- package/latticeai/models/router/documents.py +199 -0
- package/latticeai/models/router/errors.py +37 -0
- package/latticeai/models/router/generation.py +258 -0
- package/latticeai/models/router/loading.py +291 -0
- package/latticeai/models/router/local_models.py +85 -0
- package/latticeai/models/router/registry.py +147 -0
- package/latticeai/runtime/build_phases/__init__.py +82 -0
- package/latticeai/runtime/build_phases/features.py +407 -0
- package/latticeai/runtime/build_phases/foundation.py +555 -0
- package/latticeai/runtime/build_phases/web.py +492 -0
- package/latticeai/runtime/runtime_context.py +1 -0
- package/latticeai/services/architecture_readiness.py +48 -19
- package/latticeai/services/brain_intelligence/__init__.py +58 -0
- package/latticeai/services/brain_intelligence/_contract.py +71 -0
- package/latticeai/services/brain_intelligence/consistency.py +193 -0
- package/latticeai/services/brain_intelligence/constants.py +47 -0
- package/latticeai/services/brain_intelligence/digest.py +258 -0
- package/latticeai/services/brain_intelligence/health.py +331 -0
- package/latticeai/services/brain_intelligence/proposals.py +264 -0
- package/latticeai/services/brain_intelligence/sampling.py +84 -0
- package/latticeai/services/brain_intelligence/service.py +48 -0
- package/latticeai/services/chronicle.py +557 -0
- package/latticeai/services/memory_service/__init__.py +52 -0
- package/latticeai/services/memory_service/_contract.py +100 -0
- package/latticeai/services/memory_service/brief.py +431 -0
- package/latticeai/services/memory_service/constants.py +57 -0
- package/latticeai/services/memory_service/maintenance.py +138 -0
- package/latticeai/services/memory_service/manager.py +186 -0
- package/latticeai/services/memory_service/proof.py +136 -0
- package/latticeai/services/memory_service/recall.py +225 -0
- package/latticeai/services/memory_service/service.py +48 -0
- package/latticeai/services/memory_service/stores.py +110 -0
- package/latticeai/services/model_runtime/__init__.py +322 -0
- package/latticeai/services/model_runtime/cloud.py +87 -0
- package/latticeai/services/model_runtime/download.py +282 -0
- package/latticeai/services/model_runtime/engines.py +341 -0
- package/latticeai/services/model_runtime/loading.py +178 -0
- package/latticeai/services/model_runtime/service.py +129 -0
- package/latticeai/services/model_runtime/state.py +131 -0
- package/latticeai/services/model_runtime/status.py +255 -0
- package/latticeai/services/product_readiness.py +15 -7
- package/latticeai/setup/wizard/__init__.py +126 -0
- package/latticeai/setup/wizard/catalog.py +172 -0
- package/latticeai/setup/wizard/detect.py +323 -0
- package/latticeai/setup/wizard/install.py +348 -0
- package/latticeai/setup/wizard/paths.py +168 -0
- package/latticeai/setup/wizard/plans.py +74 -0
- package/latticeai/setup/wizard/recommend.py +320 -0
- package/package.json +6 -2
- package/scripts/bump_version.py +14 -0
- package/scripts/capture_release_evidence.mjs +33 -21
- package/scripts/check_current_release_docs.mjs +1 -1
- package/scripts/check_i18n_namespace_coverage.mjs +41 -4
- package/scripts/check_max_file_lines.mjs +102 -0
- package/scripts/check_release_evidence_bound.mjs +30 -15
- package/scripts/check_screenshot_pixel_delta.py +34 -4
- package/scripts/check_server_i18n.mjs +1 -0
- package/scripts/generate_rust_parity_fixtures.py +562 -0
- package/scripts/lib/mock_server_fingerprint.mjs +94 -0
- package/scripts/release_screen_claims.json +31 -2
- package/src-tauri/Cargo.lock +361 -3
- package/src-tauri/Cargo.toml +6 -1
- package/src-tauri/src/backend.rs +349 -0
- package/src-tauri/src/folder.rs +33 -0
- package/src-tauri/src/main.rs +97 -399
- package/src-tauri/tauri.conf.json +1 -1
- package/static/app/asset-manifest.json +41 -37
- package/static/app/assets/Act-yYpYnn0v.js +1 -0
- package/static/app/assets/AdminConsole-DL3Cr5pL.js +1 -0
- package/static/app/assets/{Brain-tuhI4sOC.js → Brain-C1HBN0Wf.js} +2 -2
- package/static/app/assets/BrainHome-DoXRhUUC.js +2 -0
- package/static/app/assets/BrainSignals-6yR6ir5t.js +1 -0
- package/static/app/assets/Capture-CFIRsFNE.js +1 -0
- package/static/app/assets/Chronicle-BZbEgiwN.js +1 -0
- package/static/app/assets/CommandPalette-D2pMxC2I.js +1 -0
- package/static/app/assets/Library-DwO3yZST.js +1 -0
- package/static/app/assets/{LivingBrain-DBwhto14.js → LivingBrain-Jn1GK0-S.js} +1 -1
- package/static/app/assets/ProductFlow-B-w1R4Oo.js +1 -0
- package/static/app/assets/ReviewCard-6B27X8Vg.js +3 -0
- package/static/app/assets/System-DW8F-2xL.js +1 -0
- package/static/app/assets/arrow-left-DXvKg9U6.js +1 -0
- package/static/app/assets/{bot-Cia42c2h.js → bot-IM_E_Y12.js} +1 -1
- package/static/app/assets/brain-Ci1CkWjM.js +1 -0
- package/static/app/assets/{button-2j2Ijzgq.js → button-COwyqfHM.js} +1 -1
- package/static/app/assets/circle-check-DfInj-qD.js +1 -0
- package/static/app/assets/{circle-pause-BEFeWpVW.js → circle-pause-DEM4A1Y5.js} +1 -1
- package/static/app/assets/{circle-play-ujXMcHxl.js → circle-play-C9djDuLd.js} +1 -1
- package/static/app/assets/{cpu-k4awryFq.js → cpu-DFdo1gw-.js} +1 -1
- package/static/app/assets/{download-DFbLJ_ig.js → download-SnJL6oqk.js} +1 -1
- package/static/app/assets/{folder-open-7y_b6xkM.js → folder-open-CqZeDkjE.js} +1 -1
- package/static/app/assets/{hard-drive-Bidh02Kr.js → hard-drive-j1jJXYYf.js} +1 -1
- package/static/app/assets/{index-DwDl9-8Y.css → index-BLPb5lmE.css} +1 -1
- package/static/app/assets/index-_u5iUHDr.js +10 -0
- package/static/app/assets/input-B0lPdRQZ.js +1 -0
- package/static/app/assets/link-2-CoFbooHS.js +1 -0
- package/static/app/assets/{permissionCopy-Bpb83Hx9.js → permissionCopy-BsyLxtao.js} +1 -1
- package/static/app/assets/primitives-DEbN-d6p.js +1 -0
- package/static/app/assets/search-BybIWPNd.js +1 -0
- package/static/app/assets/{share-2-BH1M-WNi.js → share-2-CVtZ_ewX.js} +1 -1
- package/static/app/assets/{shield-alert-BlKdBXcG.js → shield-alert-CBi2GNWM.js} +1 -1
- package/static/app/assets/{textarea-CCWbUfFB.js → textarea-DNMpB5ih.js} +1 -1
- package/static/app/assets/{useFocusTrap-YdHQ7pJ1.js → useFocusTrap-C83t3GXF.js} +1 -1
- package/static/app/assets/useMutation-DtbJDoyz.js +1 -0
- package/static/app/assets/{useQuery-CXQiwbVT.js → useQuery-Dcp1OChy.js} +1 -1
- package/static/app/assets/utils-BlZr7Pd4.js +4 -0
- package/static/app/assets/workspace-jJY4RuAV.js +1 -0
- package/static/app/index.html +4 -4
- package/static/sw.js +1 -1
- package/lattice_brain/graph/_kg_common.py +0 -1331
- package/lattice_brain/graph/discovery_index.py +0 -1141
- package/lattice_brain/graph/retrieval.py +0 -1120
- package/lattice_brain/graph/retrieval_vector.py +0 -1293
- package/lattice_brain/ingestion.py +0 -1525
- package/lattice_brain/multimodal.py +0 -1258
- package/latticeai/core/agent.py +0 -1465
- package/latticeai/core/embedding_providers.py +0 -1196
- package/latticeai/core/file_generation.py +0 -1047
- package/latticeai/integrations/telegram_bot.py +0 -1390
- package/latticeai/models/router.py +0 -1007
- package/latticeai/runtime/build_phases.py +0 -1450
- package/latticeai/services/brain_intelligence.py +0 -1083
- package/latticeai/services/memory_service.py +0 -1177
- package/latticeai/services/model_runtime.py +0 -1281
- package/latticeai/setup/wizard.py +0 -1310
- package/static/app/assets/Act-AWf0SAKp.js +0 -1
- package/static/app/assets/AdminConsole-D0u8Tiyj.js +0 -1
- package/static/app/assets/BrainHome-Ts7G_Ila.js +0 -2
- package/static/app/assets/BrainSignals-jMYgQ2Ar.js +0 -1
- package/static/app/assets/Capture-CqOSzyPr.js +0 -1
- package/static/app/assets/CommandPalette-DC0Bzh-I.js +0 -1
- package/static/app/assets/Library-CX-bbhmK.js +0 -1
- package/static/app/assets/ProductFlow-BHA2cfKI.js +0 -1
- package/static/app/assets/ReviewCard-BUhCKRNM.js +0 -3
- package/static/app/assets/System-Bu2t5hn1.js +0 -1
- package/static/app/assets/arrow-left-Dzwa5zRb.js +0 -1
- package/static/app/assets/brain-DJMoqrwx.js +0 -1
- package/static/app/assets/index-BpYkzcVm.js +0 -10
- package/static/app/assets/input-DSlJJxRs.js +0 -1
- package/static/app/assets/primitives-BCx6TvfG.js +0 -1
- package/static/app/assets/search-Cgy8cCFJ.js +0 -1
- package/static/app/assets/utils-zqPZJxdx.js +0 -4
- package/static/app/assets/workspace-DXTihhfU.js +0 -1
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
"""Phases 9-10: platform features and the interaction routers.
|
|
2
|
+
|
|
3
|
+
The tail of the build order — everything that mounts routers on the finished
|
|
4
|
+
application. Split out of the single ``build_phases`` module in v11.3.0.
|
|
5
|
+
|
|
6
|
+
Every heavy import lives *inside* a phase, never at module scope.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from latticeai.runtime.runtime_context import RuntimeContext
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# ── phase 7: platform features ───────────────────────────────────────────────
|
|
15
|
+
def phase_platform_features(ctx: RuntimeContext) -> None:
|
|
16
|
+
"""Workspace platform, automation, review queue, command centre, proposals."""
|
|
17
|
+
ctx.enter("platform_features")
|
|
18
|
+
|
|
19
|
+
from latticeai.api.agents import create_agents_router
|
|
20
|
+
from latticeai.api.automation_intelligence import (
|
|
21
|
+
create_automation_intelligence_router,
|
|
22
|
+
)
|
|
23
|
+
from latticeai.api.change_proposals import create_change_proposals_router
|
|
24
|
+
from latticeai.api.chronicle import create_chronicle_router
|
|
25
|
+
from latticeai.api.command_center import create_command_center_router
|
|
26
|
+
from latticeai.api.evidence_actions import create_evidence_actions_router
|
|
27
|
+
from latticeai.api.funnel_metrics import create_funnel_metrics_router
|
|
28
|
+
from latticeai.api.marketplace import create_marketplace_router
|
|
29
|
+
from latticeai.api.plugins import create_plugins_router
|
|
30
|
+
from latticeai.api.project_sessions import create_project_sessions_router
|
|
31
|
+
from latticeai.api.realtime import create_realtime_router
|
|
32
|
+
from latticeai.api.voice_capture import create_voice_capture_router
|
|
33
|
+
from latticeai.api.workflow_designer import create_workflow_designer_router
|
|
34
|
+
from latticeai.api.workspace import _workspace_scope_from_request
|
|
35
|
+
from latticeai.core.project_sessions import ProjectSessionStore
|
|
36
|
+
from latticeai.runtime.hooks_runtime import (
|
|
37
|
+
bind_builtin_hook_runners,
|
|
38
|
+
bind_trigger_hook_runner,
|
|
39
|
+
)
|
|
40
|
+
from latticeai.runtime.platform_runtime_wiring import (
|
|
41
|
+
build_platform_automation_runtime,
|
|
42
|
+
)
|
|
43
|
+
from latticeai.runtime.router_registration import (
|
|
44
|
+
register_platform_feature_routers,
|
|
45
|
+
)
|
|
46
|
+
from latticeai.services.change_proposals import ChangeProposalService
|
|
47
|
+
from latticeai.services.chronicle import ChronicleService
|
|
48
|
+
from latticeai.services.command_center import CommandCenterService
|
|
49
|
+
from latticeai.services.evidence_actions import EvidenceActionService
|
|
50
|
+
from latticeai.services.tool_dispatch import get_tool_permission
|
|
51
|
+
from latticeai.services.voice_capture import VoiceCaptureService
|
|
52
|
+
from latticeai.tools import resolve_workspace_path
|
|
53
|
+
|
|
54
|
+
# v2 Agentic Workspace Platform: cross-system wiring.
|
|
55
|
+
platform_automation_runtime = build_platform_automation_runtime(
|
|
56
|
+
model_router=ctx.model_router,
|
|
57
|
+
workspace_store=ctx.WORKSPACE_OS,
|
|
58
|
+
workspace_service=ctx.WORKSPACE_SERVICE,
|
|
59
|
+
plugin_registry=ctx.PLUGIN_REGISTRY,
|
|
60
|
+
get_current_user=ctx.get_current_user,
|
|
61
|
+
workspace_graph=ctx._workspace_graph,
|
|
62
|
+
workspace_scope_from_request=_workspace_scope_from_request,
|
|
63
|
+
get_tool_permission=get_tool_permission,
|
|
64
|
+
hooks=ctx.HOOKS_REGISTRY,
|
|
65
|
+
agent_registry=ctx.AGENT_REGISTRY,
|
|
66
|
+
data_dir=ctx.DATA_DIR,
|
|
67
|
+
append_audit_event=ctx.append_audit_event,
|
|
68
|
+
memory_service=ctx.MEMORY_SERVICE,
|
|
69
|
+
tz_name=getattr(ctx.CONFIG, "timezone", None),
|
|
70
|
+
)
|
|
71
|
+
ctx.adopt(
|
|
72
|
+
platform_automation_runtime,
|
|
73
|
+
"_llm_generate_sync",
|
|
74
|
+
"PLATFORM",
|
|
75
|
+
"_automation_runtime",
|
|
76
|
+
"REVIEW_QUEUE",
|
|
77
|
+
"TRIGGER_SERVICE",
|
|
78
|
+
"AGENT_RUNTIME",
|
|
79
|
+
"RUN_EXECUTOR",
|
|
80
|
+
)
|
|
81
|
+
bind_trigger_hook_runner(
|
|
82
|
+
registry=ctx.HOOKS_REGISTRY, trigger_service=ctx.TRIGGER_SERVICE
|
|
83
|
+
)
|
|
84
|
+
ctx.app.state.run_executor = ctx.RUN_EXECUTOR
|
|
85
|
+
ctx.app.state.run_reconciliation = ctx.RUN_EXECUTOR.reconcile_startup()
|
|
86
|
+
ctx.TRIGGER_SERVICE.start()
|
|
87
|
+
|
|
88
|
+
bind_builtin_hook_runners(
|
|
89
|
+
registry=ctx.HOOKS_REGISTRY,
|
|
90
|
+
append_audit_event=ctx.append_audit_event,
|
|
91
|
+
get_tool_permission=get_tool_permission,
|
|
92
|
+
classify_sensitive_message=ctx.classify_sensitive_message,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
register_platform_feature_routers(
|
|
96
|
+
ctx.app,
|
|
97
|
+
create_plugins_router=create_plugins_router,
|
|
98
|
+
plugin_registry=ctx.PLUGIN_REGISTRY,
|
|
99
|
+
require_user=ctx.require_user,
|
|
100
|
+
require_admin=ctx.require_admin,
|
|
101
|
+
append_audit_event=ctx.append_audit_event,
|
|
102
|
+
platform=ctx.PLATFORM,
|
|
103
|
+
ui_file_response=ctx.ui_file_response,
|
|
104
|
+
static_dir=ctx.STATIC_DIR,
|
|
105
|
+
create_workflow_designer_router=create_workflow_designer_router,
|
|
106
|
+
store=ctx.WORKSPACE_OS,
|
|
107
|
+
get_current_user=ctx.get_current_user,
|
|
108
|
+
workspace_graph=ctx._workspace_graph,
|
|
109
|
+
hooks=ctx.HOOKS_REGISTRY,
|
|
110
|
+
run_executor=ctx.RUN_EXECUTOR,
|
|
111
|
+
trigger_service=ctx.TRIGGER_SERVICE,
|
|
112
|
+
create_agents_router=create_agents_router,
|
|
113
|
+
agent_runtime=ctx.AGENT_RUNTIME,
|
|
114
|
+
create_marketplace_router=create_marketplace_router,
|
|
115
|
+
template_catalog=ctx.TEMPLATE_CATALOG,
|
|
116
|
+
create_realtime_router=create_realtime_router,
|
|
117
|
+
realtime_bus=ctx.REALTIME_BUS,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
ctx.app.include_router(
|
|
121
|
+
create_automation_intelligence_router(
|
|
122
|
+
service=ctx.AUTOMATION_INTELLIGENCE,
|
|
123
|
+
store=ctx.WORKSPACE_OS,
|
|
124
|
+
require_user=ctx.require_user,
|
|
125
|
+
gate_read=ctx.PLATFORM.gate_read,
|
|
126
|
+
gate_write=ctx.PLATFORM.gate_write,
|
|
127
|
+
append_audit_event=ctx.append_audit_event,
|
|
128
|
+
workspace_graph=ctx._workspace_graph,
|
|
129
|
+
run_executor=ctx.RUN_EXECUTOR,
|
|
130
|
+
review_queue=ctx.REVIEW_QUEUE,
|
|
131
|
+
)
|
|
132
|
+
)
|
|
133
|
+
# UX funnel metrics (backlog #16): admin-only runtime counters.
|
|
134
|
+
ctx.app.include_router(
|
|
135
|
+
create_funnel_metrics_router(
|
|
136
|
+
service=ctx.FUNNEL_METRICS,
|
|
137
|
+
require_admin=ctx.require_admin,
|
|
138
|
+
)
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
ctx.set(
|
|
142
|
+
COMMAND_CENTER=CommandCenterService(
|
|
143
|
+
conversation_store=ctx.CONVERSATIONS,
|
|
144
|
+
knowledge_graph=ctx.KNOWLEDGE_GRAPH,
|
|
145
|
+
store=ctx.WORKSPACE_OS,
|
|
146
|
+
search_service=ctx.SEARCH_SERVICE,
|
|
147
|
+
brain_intelligence=ctx.BRAIN_INTELLIGENCE,
|
|
148
|
+
automation_intelligence=ctx.AUTOMATION_INTELLIGENCE,
|
|
149
|
+
review_queue=ctx.REVIEW_QUEUE,
|
|
150
|
+
enable_graph=ctx.ENABLE_GRAPH,
|
|
151
|
+
)
|
|
152
|
+
)
|
|
153
|
+
ctx.app.include_router(
|
|
154
|
+
create_command_center_router(
|
|
155
|
+
service=ctx.COMMAND_CENTER,
|
|
156
|
+
require_user=ctx.require_user,
|
|
157
|
+
gate_read=ctx.PLATFORM.gate_read,
|
|
158
|
+
)
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
# Brain Chronicle (v11.3.0): the bitemporal columns v11.1.0 started
|
|
162
|
+
# writing, read back as a timeline. Pure reads over the Brain's own
|
|
163
|
+
# storage — no schema of its own, nothing to write, nothing to migrate.
|
|
164
|
+
ctx.set(
|
|
165
|
+
CHRONICLE=ChronicleService(
|
|
166
|
+
knowledge_graph=ctx.KNOWLEDGE_GRAPH,
|
|
167
|
+
conversations=ctx.CONVERSATIONS,
|
|
168
|
+
enable_graph=ctx.ENABLE_GRAPH,
|
|
169
|
+
)
|
|
170
|
+
)
|
|
171
|
+
ctx.app.include_router(
|
|
172
|
+
create_chronicle_router(
|
|
173
|
+
service=ctx.CHRONICLE,
|
|
174
|
+
require_user=ctx.require_user,
|
|
175
|
+
gate_read=ctx.PLATFORM.gate_read,
|
|
176
|
+
)
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
ctx.set(
|
|
180
|
+
CHANGE_PROPOSALS=ChangeProposalService(
|
|
181
|
+
review_queue=ctx.REVIEW_QUEUE,
|
|
182
|
+
resolve_path=resolve_workspace_path,
|
|
183
|
+
audit=ctx.append_audit_event,
|
|
184
|
+
)
|
|
185
|
+
)
|
|
186
|
+
# Proposal-first mutations: the agent loop consults the governor so
|
|
187
|
+
# additive creates run with minimal friction while changes and deletions
|
|
188
|
+
# of existing files are staged for review instead of applied.
|
|
189
|
+
ctx.CHAT_AGENT_RUNTIME.deps.change_governor = ctx.CHANGE_PROPOSALS
|
|
190
|
+
ctx.app.include_router(
|
|
191
|
+
create_change_proposals_router(
|
|
192
|
+
service=ctx.CHANGE_PROPOSALS,
|
|
193
|
+
require_user=ctx.require_user,
|
|
194
|
+
gate_read=ctx.PLATFORM.gate_read,
|
|
195
|
+
gate_write=ctx.PLATFORM.gate_write,
|
|
196
|
+
)
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
# Evidence → action (v9.9.6): an answer's citations become ready-to-send,
|
|
200
|
+
# evidence-scoped follow-ups. Deterministic composition only — execution
|
|
201
|
+
# stays on the chat/file-generation path.
|
|
202
|
+
ctx.set(
|
|
203
|
+
EVIDENCE_ACTIONS_SERVICE=EvidenceActionService(
|
|
204
|
+
node_reader=getattr(ctx.KNOWLEDGE_GRAPH, "get_node", None)
|
|
205
|
+
)
|
|
206
|
+
)
|
|
207
|
+
ctx.app.include_router(
|
|
208
|
+
create_evidence_actions_router(
|
|
209
|
+
service=ctx.EVIDENCE_ACTIONS_SERVICE,
|
|
210
|
+
require_user=ctx.require_user,
|
|
211
|
+
allowed_workspaces_for=ctx._allowed_workspaces_for,
|
|
212
|
+
)
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
# Voice memo capture (v9.9.7): the shortest path from a thought to the
|
|
216
|
+
# Brain. Transcription is an optional local port — absent, the memo is
|
|
217
|
+
# still stored and the response says it is not searchable. v11.1.0 shares
|
|
218
|
+
# that one port with multi-modal ingestion, so a memo and a scanned
|
|
219
|
+
# recording can never disagree about whether this machine can hear.
|
|
220
|
+
ctx.set(
|
|
221
|
+
VOICE_CAPTURE=VoiceCaptureService(
|
|
222
|
+
pipeline=ctx.INGESTION_PIPELINE if ctx.ENABLE_GRAPH else None,
|
|
223
|
+
transcriber=ctx.MULTIMODAL_PORTS.transcriber,
|
|
224
|
+
)
|
|
225
|
+
)
|
|
226
|
+
ctx.app.include_router(
|
|
227
|
+
create_voice_capture_router(
|
|
228
|
+
service=ctx.VOICE_CAPTURE,
|
|
229
|
+
require_user=ctx.require_user,
|
|
230
|
+
gate_write=ctx.PLATFORM.gate_write,
|
|
231
|
+
append_audit_event=ctx.append_audit_event,
|
|
232
|
+
)
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
# Multi-turn project loop (v9.9.6): work spanning several runs keeps its
|
|
236
|
+
# files, open TODOs, and last honest verification in one project session.
|
|
237
|
+
ctx.set(PROJECT_SESSIONS=ProjectSessionStore(ctx.DATA_DIR / "project_sessions"))
|
|
238
|
+
ctx.app.include_router(
|
|
239
|
+
create_project_sessions_router(
|
|
240
|
+
store=ctx.PROJECT_SESSIONS,
|
|
241
|
+
require_user=ctx.require_user,
|
|
242
|
+
gate_read=ctx.PLATFORM.gate_read,
|
|
243
|
+
gate_write=ctx.PLATFORM.gate_write,
|
|
244
|
+
)
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
# ── phase 8: interaction routers ─────────────────────────────────────────────
|
|
249
|
+
def phase_interaction(ctx: RuntimeContext) -> None:
|
|
250
|
+
"""Model, chat, search, tools, hooks, memory and brain tail routers."""
|
|
251
|
+
ctx.enter("interaction")
|
|
252
|
+
|
|
253
|
+
from fastapi import HTTPException
|
|
254
|
+
|
|
255
|
+
from latticeai.api.agent_registry import create_agent_registry_router
|
|
256
|
+
from latticeai.api.brain_intelligence import create_brain_intelligence_router
|
|
257
|
+
from latticeai.api.browser import create_browser_router
|
|
258
|
+
from latticeai.api.chat import create_chat_router
|
|
259
|
+
from latticeai.api.garden import create_garden_router
|
|
260
|
+
from latticeai.api.health import create_health_router
|
|
261
|
+
from latticeai.api.hooks import create_hooks_router
|
|
262
|
+
from latticeai.api.memory import create_memory_router
|
|
263
|
+
from latticeai.api.models import create_models_router
|
|
264
|
+
from latticeai.api.network import create_network_router
|
|
265
|
+
from latticeai.api.portability import create_portability_router
|
|
266
|
+
from latticeai.api.review_queue import create_review_queue_router
|
|
267
|
+
from latticeai.api.search import create_search_router
|
|
268
|
+
from latticeai.api.setup import create_setup_router
|
|
269
|
+
from latticeai.api.tools import create_tools_router
|
|
270
|
+
from latticeai.core.model_compat import (
|
|
271
|
+
list_cached_profiles as _list_compat_profiles,
|
|
272
|
+
)
|
|
273
|
+
from latticeai.runtime.chat_wiring import build_interaction_contexts
|
|
274
|
+
from latticeai.runtime.model_wiring import register_model_runtime_routers
|
|
275
|
+
from latticeai.runtime.platform_services_runtime import build_brain_network
|
|
276
|
+
from latticeai.runtime.review_wiring import build_review_run_now_runner
|
|
277
|
+
from latticeai.runtime.router_registration import (
|
|
278
|
+
register_health_and_model_routers,
|
|
279
|
+
register_interaction_routers,
|
|
280
|
+
register_review_and_brain_tail_routers,
|
|
281
|
+
)
|
|
282
|
+
from latticeai.services.model_runtime import (
|
|
283
|
+
CLOUD_VERIFY_TTL_SECONDS,
|
|
284
|
+
ENGINE_MODEL_CATALOG,
|
|
285
|
+
MODEL_ENGINE_ALIASES,
|
|
286
|
+
download_hf_model,
|
|
287
|
+
ensure_ollama_server,
|
|
288
|
+
filter_lower_family_versions,
|
|
289
|
+
local_binary,
|
|
290
|
+
normalize_local_model_request,
|
|
291
|
+
sse_event,
|
|
292
|
+
)
|
|
293
|
+
|
|
294
|
+
service = ctx.model_runtime_service
|
|
295
|
+
ctx.set(
|
|
296
|
+
model_runtime=register_model_runtime_routers(
|
|
297
|
+
app=ctx.app,
|
|
298
|
+
create_health_router=create_health_router,
|
|
299
|
+
create_models_router=create_models_router,
|
|
300
|
+
register_health_and_model_routers=register_health_and_model_routers,
|
|
301
|
+
model_router=ctx.model_router,
|
|
302
|
+
runtime_service=service,
|
|
303
|
+
runtime_features=service.runtime_features,
|
|
304
|
+
is_public_mode=ctx.IS_PUBLIC_MODE,
|
|
305
|
+
engine_status=service.engine_status,
|
|
306
|
+
get_current_user=ctx.get_current_user,
|
|
307
|
+
require_auth=ctx.REQUIRE_AUTH,
|
|
308
|
+
app_version=ctx.APP_VERSION,
|
|
309
|
+
app_mode=ctx.APP_MODE,
|
|
310
|
+
require_user=ctx.require_user,
|
|
311
|
+
require_admin=ctx.require_admin,
|
|
312
|
+
load_users=ctx.load_users,
|
|
313
|
+
get_user_role=ctx.get_user_role,
|
|
314
|
+
install_engine=service.install_engine,
|
|
315
|
+
verify_cloud_models=service.verify_cloud_models,
|
|
316
|
+
normalize_local_model_request=normalize_local_model_request,
|
|
317
|
+
download_hf_model=download_hf_model,
|
|
318
|
+
prepare_and_load_model=service.prepare_and_load_model,
|
|
319
|
+
prepare_and_load_model_stream=service.prepare_and_load_model_stream,
|
|
320
|
+
sse_event=sse_event,
|
|
321
|
+
ensure_ollama_server=ensure_ollama_server,
|
|
322
|
+
local_binary=local_binary,
|
|
323
|
+
filter_lower_family_versions=filter_lower_family_versions,
|
|
324
|
+
list_compat_profiles=_list_compat_profiles,
|
|
325
|
+
set_user_api_key=ctx.set_user_api_key,
|
|
326
|
+
engine_model_catalog=ENGINE_MODEL_CATALOG,
|
|
327
|
+
model_engine_aliases=MODEL_ENGINE_ALIASES,
|
|
328
|
+
cloud_verify_ttl_seconds=CLOUD_VERIFY_TTL_SECONDS,
|
|
329
|
+
allow_local_models=ctx.ALLOW_LOCAL_MODELS,
|
|
330
|
+
)
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
_tool_router_context, interaction_router_context = build_interaction_contexts(
|
|
334
|
+
config=ctx.CONFIG,
|
|
335
|
+
ingestion_pipeline=ctx.INGESTION_PIPELINE,
|
|
336
|
+
data_dir=ctx.DATA_DIR,
|
|
337
|
+
static_dir=ctx.STATIC_DIR,
|
|
338
|
+
model_router=ctx.model_router,
|
|
339
|
+
require_user=ctx.require_user,
|
|
340
|
+
require_admin=ctx.require_admin,
|
|
341
|
+
get_current_user=ctx.get_current_user,
|
|
342
|
+
clear_history=ctx.clear_history,
|
|
343
|
+
append_audit_event=ctx.append_audit_event,
|
|
344
|
+
enforce_rate_limit=ctx.enforce_rate_limit,
|
|
345
|
+
bytes_match_extension=ctx._bytes_match_extension,
|
|
346
|
+
classify_sensitive_message=ctx.classify_sensitive_message,
|
|
347
|
+
save_to_history=ctx.save_to_history,
|
|
348
|
+
enable_graph=ctx.ENABLE_GRAPH,
|
|
349
|
+
knowledge_graph=ctx.KNOWLEDGE_GRAPH,
|
|
350
|
+
require_graph=ctx._require_graph,
|
|
351
|
+
local_kg_watcher=ctx.LOCAL_KG_WATCHER,
|
|
352
|
+
load_mcp_installs=ctx.load_mcp_installs,
|
|
353
|
+
recommend_mcps=ctx.recommend_mcps,
|
|
354
|
+
install_mcp=ctx.install_mcp,
|
|
355
|
+
mcp_public_item=ctx.mcp_public_item,
|
|
356
|
+
hooks=ctx.HOOKS_REGISTRY,
|
|
357
|
+
workspace_service=ctx.WORKSPACE_SERVICE,
|
|
358
|
+
chat_context=ctx.app_context,
|
|
359
|
+
search_service=ctx.SEARCH_SERVICE,
|
|
360
|
+
allowed_workspaces_for=ctx._allowed_workspaces_for,
|
|
361
|
+
embedding_info=ctx._embedding_info,
|
|
362
|
+
agent_registry=ctx.AGENT_REGISTRY,
|
|
363
|
+
memory_service=ctx.MEMORY_SERVICE,
|
|
364
|
+
platform=ctx.PLATFORM,
|
|
365
|
+
active_model_getter=lambda: ctx.model_router.current_model_id or "",
|
|
366
|
+
brain_intelligence=ctx.BRAIN_INTELLIGENCE,
|
|
367
|
+
)
|
|
368
|
+
register_interaction_routers(
|
|
369
|
+
ctx.app,
|
|
370
|
+
interaction_context=interaction_router_context,
|
|
371
|
+
create_chat_router=create_chat_router,
|
|
372
|
+
create_search_router=create_search_router,
|
|
373
|
+
create_tools_router=create_tools_router,
|
|
374
|
+
create_hooks_router=create_hooks_router,
|
|
375
|
+
create_agent_registry_router=create_agent_registry_router,
|
|
376
|
+
create_memory_router=create_memory_router,
|
|
377
|
+
create_brain_intelligence_router=create_brain_intelligence_router,
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
register_review_and_brain_tail_routers(
|
|
381
|
+
ctx.app,
|
|
382
|
+
create_review_queue_router=create_review_queue_router,
|
|
383
|
+
review_queue=ctx.REVIEW_QUEUE,
|
|
384
|
+
require_user=ctx.require_user,
|
|
385
|
+
gate_read=ctx.PLATFORM.gate_read,
|
|
386
|
+
gate_write=ctx.PLATFORM.gate_write,
|
|
387
|
+
run_review_item=build_review_run_now_runner(ctx.PLATFORM, HTTPException),
|
|
388
|
+
append_audit_event=ctx.append_audit_event,
|
|
389
|
+
# Approving a change_proposal from the Review Center applies the
|
|
390
|
+
# staged content through the same service the agent governor uses.
|
|
391
|
+
change_proposals=ctx.CHANGE_PROPOSALS,
|
|
392
|
+
create_browser_router=create_browser_router,
|
|
393
|
+
ingestion_pipeline=ctx.INGESTION_PIPELINE,
|
|
394
|
+
workspace_service=ctx.WORKSPACE_SERVICE,
|
|
395
|
+
create_portability_router=create_portability_router,
|
|
396
|
+
kg_portability=ctx.KG_PORTABILITY,
|
|
397
|
+
require_admin=ctx.require_admin,
|
|
398
|
+
build_brain_network=build_brain_network,
|
|
399
|
+
device_identity=ctx.DEVICE_IDENTITY,
|
|
400
|
+
data_dir=ctx.DATA_DIR,
|
|
401
|
+
create_network_router=create_network_router,
|
|
402
|
+
create_garden_router=create_garden_router,
|
|
403
|
+
gardener=ctx.gardener,
|
|
404
|
+
create_setup_router=create_setup_router,
|
|
405
|
+
model_router=ctx.model_router,
|
|
406
|
+
knowledge_graph=ctx.KNOWLEDGE_GRAPH,
|
|
407
|
+
)
|