ltcai 8.0.0 → 8.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.
- package/README.md +33 -72
- package/docs/CHANGELOG.md +52 -874
- package/docs/DEVELOPMENT.md +26 -3
- package/docs/LEGACY_COMPATIBILITY.md +3 -1
- package/docs/TRUST_MODEL.md +26 -26
- package/docs/WHY_LATTICE.md +28 -25
- package/docs/kg-schema.md +6 -4
- package/lattice_brain/__init__.py +1 -1
- package/lattice_brain/embeddings.py +9 -1
- package/lattice_brain/graph/schema.py +6 -0
- package/lattice_brain/runtime/multi_agent.py +1 -1
- package/latticeai/__init__.py +1 -1
- package/latticeai/api/computer_use.py +2 -0
- package/latticeai/api/memory.py +13 -0
- package/latticeai/app_factory.py +43 -162
- package/latticeai/brain/__init__.py +1 -1
- package/latticeai/core/config.py +10 -0
- package/latticeai/core/local_embeddings.py +8 -0
- package/latticeai/core/marketplace.py +1 -1
- package/latticeai/core/mcp_registry.py +140 -1
- package/latticeai/core/tool_registry.py +10 -0
- package/latticeai/core/workspace_graph_trace.py +132 -0
- package/latticeai/core/workspace_memory.py +75 -0
- package/latticeai/core/workspace_os.py +135 -1283
- package/latticeai/core/workspace_os_utils.py +132 -0
- package/latticeai/core/workspace_permissions.py +99 -0
- package/latticeai/core/workspace_plugins.py +97 -0
- package/latticeai/core/workspace_runs.py +612 -0
- package/latticeai/core/workspace_skills.py +114 -0
- package/latticeai/core/workspace_snapshots.py +195 -0
- package/latticeai/core/workspace_timeline.py +107 -0
- package/latticeai/runtime/audit_runtime.py +64 -0
- package/latticeai/runtime/config_runtime.py +4 -0
- package/latticeai/runtime/sso_runtime.py +52 -0
- package/latticeai/services/architecture_readiness.py +6 -5
- package/latticeai/services/memory_service.py +215 -7
- package/latticeai/services/model_capability_registry.py +68 -0
- package/latticeai/services/model_engines.py +603 -0
- package/latticeai/services/model_loading.py +482 -0
- package/latticeai/services/model_recommendation.py +5 -0
- package/latticeai/services/model_runtime.py +146 -837
- package/latticeai/services/product_readiness.py +19 -18
- package/package.json +2 -2
- package/scripts/build_frontend_assets.mjs +11 -2
- 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 -102
- package/static/app/assets/Act-D9jIknFd.js +1 -0
- package/static/app/assets/Brain-CFOtWbPN.js +321 -0
- package/static/app/assets/{Capture-B9Tlhzqr.js → Capture-Q4WYzwr5.js} +1 -2
- package/static/app/assets/Library-C5Q2yWee.js +1 -0
- package/static/app/assets/System-BLbjdr1_.js +1 -0
- package/static/app/assets/core-CwxXejkd.js +1 -2
- package/static/app/assets/index-BqammyNu.js +16 -0
- package/static/app/assets/index-ty1iGgZu.css +2 -0
- package/static/app/assets/primitives-Br8uSfZ4.js +1 -0
- package/static/app/assets/{textarea-BZk6ybp5.js → textarea-BnhNs1_X.js} +1 -2
- package/static/app/index.html +3 -10
- package/static/app/theme-boot.js +8 -0
- package/static/sw.js +1 -1
- package/tools/__init__.py +2 -1
- package/tools/computer.py +21 -0
- package/docs/CARRYOVER_AUDIT_v3.6.0.md +0 -61
- package/docs/HANDOVER_v3.6.0.md +0 -46
- package/docs/RUNTIME_HOOK_COVERAGE_v3.5.0.md +0 -56
- package/docs/RUNTIME_HOOK_COVERAGE_v3.6.0.md +0 -49
- package/docs/V2_ARCHITECTURE.md +0 -561
- package/docs/V3_2_AUDIT.md +0 -82
- package/docs/V3_BACKEND_ARCHITECTURE.md +0 -138
- package/docs/V3_FRONTEND.md +0 -140
- package/docs/V4_1_FRONTEND_ARCHITECTURE_REVIEW.md +0 -65
- package/docs/V4_1_FRONTEND_MIGRATION_REPORT.md +0 -70
- package/docs/V4_1_VALIDATION_REPORT.md +0 -47
- package/docs/V4_2_BRAIN_CORE_ARCHITECTURE.md +0 -97
- package/docs/V4_2_STORAGE_MIGRATION_REPORT.md +0 -91
- package/docs/V4_2_VALIDATION_REPORT.md +0 -89
- package/docs/V4_3_2_DEADCODE_AUDIT_REPORT.md +0 -174
- package/docs/V4_3_2_DOCUMENTATION_CLEANUP_REPORT.md +0 -81
- package/docs/V4_3_2_GITHUB_VERCEL_CHECK_REPORT.md +0 -75
- package/docs/V4_3_2_GRAPH_UX_REPORT.md +0 -48
- package/docs/V4_3_2_INDEPENDENT_AUDIT_PACKAGE.md +0 -209
- package/docs/V4_3_2_PRODUCT_POLISH_REPORT.md +0 -57
- package/docs/V4_3_2_SELF_AUDIT_REPORT.md +0 -63
- package/docs/V4_3_2_VALIDATION_REPORT.md +0 -97
- package/docs/V4_3_3_VALIDATION_REPORT.md +0 -46
- package/docs/V4_3_PORTABILITY_ARCHITECTURE.md +0 -69
- package/docs/V4_3_PRIVACY_AUDIT.md +0 -60
- package/docs/V4_3_PRODUCT_HARDENING_REPORT.md +0 -53
- package/docs/V4_3_VALIDATION_REPORT.md +0 -58
- package/docs/V4_4_0_EXTRACTION_REPORT.md +0 -239
- package/docs/V4_5_0_GEMMA_RUNTIME_COMPATIBILITY_REPORT.md +0 -49
- package/docs/V4_5_0_GRAPH_UX_REPORT.md +0 -34
- package/docs/V4_5_0_MODEL_RUNTIME_UX_REPORT.md +0 -40
- package/docs/V4_5_0_ONBOARDING_REPORT.md +0 -31
- package/docs/V4_5_0_PRODUCT_EXPERIENCE_RECOVERY_REPORT.md +0 -49
- package/docs/V4_5_0_VALIDATION_REPORT.md +0 -60
- package/docs/V4_5_1_GRAPH_EXPERIENCE_REPORT.md +0 -33
- package/docs/V4_5_1_MODEL_EXPERIENCE_REPORT.md +0 -37
- package/docs/V4_5_1_NAVIGATION_REPORT.md +0 -37
- package/docs/V4_5_1_ONBOARDING_REPORT.md +0 -29
- package/docs/V4_5_1_PRODUCT_REIMAGINING_REPORT.md +0 -61
- package/docs/V4_5_1_RC_ARTIFACTS.md +0 -44
- package/docs/V4_5_1_UX_REPORT.md +0 -45
- package/docs/V4_5_1_VALIDATION_REPORT.md +0 -55
- package/docs/V4_5_1_VISUAL_DESIGN_REPORT.md +0 -30
- package/docs/V4_6_0_LIVING_BRAIN_EXPERIENCE_REPORT.md +0 -72
- package/docs/V4_6_1_RELEASE_REFRESH_REPORT.md +0 -42
- package/docs/V4_7_0_ADMIN_SEPARATION_REPORT.md +0 -42
- package/docs/V4_7_1_ADMIN_OPERATIONS_REPORT.md +0 -49
- package/docs/V4_7_2_INTUITIVE_BRAIN_UX_REPORT.md +0 -62
- package/docs/V4_BRAIN_ARCHITECTURE.md +0 -322
- package/docs/V4_DIGITAL_BRAIN_RECOVERY.md +0 -555
- package/docs/V4_IMPLEMENTATION_PLAN.md +0 -470
- package/frontend/index.html +0 -24
- package/frontend/openapi.json +0 -15425
- package/frontend/src/App.tsx +0 -243
- package/frontend/src/api/client.ts +0 -580
- package/frontend/src/api/openapi.ts +0 -17892
- package/frontend/src/components/AdminAccessGate.tsx +0 -70
- package/frontend/src/components/FeedbackState.tsx +0 -45
- package/frontend/src/components/LanguageSwitcher.tsx +0 -23
- package/frontend/src/components/LivingBrain.tsx +0 -220
- package/frontend/src/components/ProductFlow.tsx +0 -171
- package/frontend/src/components/WorkspaceProfileSwitcher.tsx +0 -176
- package/frontend/src/components/onboarding/AnalysisScreen.tsx +0 -135
- package/frontend/src/components/onboarding/DownloadConsentPanel.tsx +0 -29
- package/frontend/src/components/onboarding/InstallScreen.tsx +0 -263
- package/frontend/src/components/onboarding/LanguageChooser.tsx +0 -23
- package/frontend/src/components/onboarding/LoginScreen.tsx +0 -131
- package/frontend/src/components/onboarding/ProductFlowScreens.tsx +0 -13
- package/frontend/src/components/onboarding/RecommendationScreen.tsx +0 -116
- package/frontend/src/components/onboarding/recommendationModel.ts +0 -189
- package/frontend/src/components/primitives.tsx +0 -392
- package/frontend/src/components/ui/badge.tsx +0 -27
- package/frontend/src/components/ui/button.tsx +0 -37
- package/frontend/src/components/ui/card.tsx +0 -22
- package/frontend/src/components/ui/input.tsx +0 -16
- package/frontend/src/components/ui/textarea.tsx +0 -16
- package/frontend/src/features/admin/AdminConsole.tsx +0 -334
- package/frontend/src/features/brain/BrainCarePanel.tsx +0 -254
- package/frontend/src/features/brain/BrainComposer.tsx +0 -85
- package/frontend/src/features/brain/BrainConversation.tsx +0 -688
- package/frontend/src/features/brain/BrainGraphLayer.tsx +0 -365
- package/frontend/src/features/brain/BrainHome.tsx +0 -624
- package/frontend/src/features/brain/BrainMemoryLayer.tsx +0 -45
- package/frontend/src/features/brain/BrainOverviewPanel.tsx +0 -149
- package/frontend/src/features/brain/BrainRelationshipLayer.tsx +0 -43
- package/frontend/src/features/brain/DepthEmergence.tsx +0 -53
- package/frontend/src/features/brain/brainData.ts +0 -246
- package/frontend/src/features/brain/graphLayout.ts +0 -37
- package/frontend/src/features/brain/types.ts +0 -150
- package/frontend/src/features/review/ReviewCard.tsx +0 -100
- package/frontend/src/features/review/ReviewInbox.tsx +0 -127
- package/frontend/src/features/review/reviewHelpers.ts +0 -69
- package/frontend/src/i18n.ts +0 -1303
- package/frontend/src/lib/utils.ts +0 -33
- package/frontend/src/main.tsx +0 -23
- package/frontend/src/pages/Act.tsx +0 -458
- package/frontend/src/pages/Ask.tsx +0 -14
- package/frontend/src/pages/Brain.tsx +0 -914
- package/frontend/src/pages/Capture.tsx +0 -258
- package/frontend/src/pages/Library.tsx +0 -486
- package/frontend/src/pages/System.tsx +0 -621
- package/frontend/src/routes.ts +0 -92
- package/frontend/src/store/appStore.ts +0 -94
- package/frontend/src/styles.css +0 -6579
- package/static/app/assets/Act-DOvf59ru.js +0 -2
- package/static/app/assets/Act-DOvf59ru.js.map +0 -1
- package/static/app/assets/Brain-C7_0mEiI.js +0 -322
- package/static/app/assets/Brain-C7_0mEiI.js.map +0 -1
- package/static/app/assets/Capture-B9Tlhzqr.js.map +0 -1
- package/static/app/assets/Library-BJPEEm5O.js +0 -2
- package/static/app/assets/Library-BJPEEm5O.js.map +0 -1
- package/static/app/assets/System-D6t9jo9V.js +0 -2
- package/static/app/assets/System-D6t9jo9V.js.map +0 -1
- package/static/app/assets/core-CwxXejkd.js.map +0 -1
- package/static/app/assets/index-C7g26IF6.css +0 -2
- package/static/app/assets/index-DbcEYJQ2.js +0 -17
- package/static/app/assets/index-DbcEYJQ2.js.map +0 -1
- package/static/app/assets/primitives-CD38lt4n.js +0 -2
- package/static/app/assets/primitives-CD38lt4n.js.map +0 -1
- package/static/app/assets/textarea-BZk6ybp5.js.map +0 -1
package/frontend/src/App.tsx
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { type BrainState } from "@/components/LivingBrain";
|
|
3
|
-
import { ProductFlow, readProductFlowComplete } from "@/components/ProductFlow";
|
|
4
|
-
import { useAppStore } from "@/store/appStore";
|
|
5
|
-
import { parseHash, productShellRoutes } from "@/routes";
|
|
6
|
-
import { BrainHome } from "@/features/brain/BrainHome";
|
|
7
|
-
import { AdminConsole } from "@/features/admin/AdminConsole";
|
|
8
|
-
import { WorkspaceProfileSwitcher } from "@/components/WorkspaceProfileSwitcher";
|
|
9
|
-
import { AdminAccessGate } from "@/components/AdminAccessGate";
|
|
10
|
-
import { t, type Language } from "@/i18n";
|
|
11
|
-
import { latticeApi } from "@/api/client";
|
|
12
|
-
import { useQuery } from "@tanstack/react-query";
|
|
13
|
-
import { FeedbackState } from "@/components/FeedbackState";
|
|
14
|
-
|
|
15
|
-
const ActPage = React.lazy(() => import("@/pages/Act").then((module) => ({ default: module.ActPage })));
|
|
16
|
-
const BrainPage = React.lazy(() => import("@/pages/Brain").then((module) => ({ default: module.BrainPage })));
|
|
17
|
-
const CapturePage = React.lazy(() => import("@/pages/Capture").then((module) => ({ default: module.CapturePage })));
|
|
18
|
-
const LibraryPage = React.lazy(() => import("@/pages/Library").then((module) => ({ default: module.LibraryPage })));
|
|
19
|
-
const SystemPage = React.lazy(() => import("@/pages/System").then((module) => ({ default: module.SystemPage })));
|
|
20
|
-
|
|
21
|
-
export default function App() {
|
|
22
|
-
const theme = useAppStore((state) => state.theme);
|
|
23
|
-
const language = useAppStore((state) => state.language);
|
|
24
|
-
const [flowComplete, setFlowComplete] = React.useState(readProductFlowComplete);
|
|
25
|
-
const rawRoute = useHashRoute();
|
|
26
|
-
const parsed = React.useMemo(() => parseHash(), [rawRoute]);
|
|
27
|
-
const { state: brainState, intensity, setBrain } = useBrainState();
|
|
28
|
-
|
|
29
|
-
React.useEffect(() => {
|
|
30
|
-
document.documentElement.dataset.theme = theme;
|
|
31
|
-
document.documentElement.lang = language === "ko" ? "ko" : "en";
|
|
32
|
-
}, [theme, language]);
|
|
33
|
-
|
|
34
|
-
React.useEffect(() => {
|
|
35
|
-
const onKey = (event: KeyboardEvent) => {
|
|
36
|
-
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k") {
|
|
37
|
-
event.preventDefault();
|
|
38
|
-
document.querySelector<HTMLTextAreaElement>(".brain-composer textarea")?.focus();
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
window.addEventListener("keydown", onKey);
|
|
42
|
-
return () => window.removeEventListener("keydown", onKey);
|
|
43
|
-
}, []);
|
|
44
|
-
|
|
45
|
-
if (!flowComplete) {
|
|
46
|
-
return <ProductFlow onComplete={() => setFlowComplete(true)} />;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<div className="brain-space">
|
|
51
|
-
<div className="brain-field" />
|
|
52
|
-
{rawRoute.startsWith("/admin") ? (
|
|
53
|
-
<AdminConsole onBack={() => navigateHash("/brain")} />
|
|
54
|
-
) : parsed.primary === "act" ? (
|
|
55
|
-
<BrainShell active={parsed.primary}>
|
|
56
|
-
<React.Suspense fallback={<PageLoader />}>
|
|
57
|
-
<ActPage initialTab={parsed.tab} />
|
|
58
|
-
</React.Suspense>
|
|
59
|
-
</BrainShell>
|
|
60
|
-
) : parsed.primary === "capture" ? (
|
|
61
|
-
<BrainShell active={parsed.primary}>
|
|
62
|
-
<React.Suspense fallback={<PageLoader />}>
|
|
63
|
-
<CapturePage initialTab={parsed.tab} />
|
|
64
|
-
</React.Suspense>
|
|
65
|
-
</BrainShell>
|
|
66
|
-
) : parsed.primary === "library" ? (
|
|
67
|
-
<BrainShell active={parsed.primary}>
|
|
68
|
-
<React.Suspense fallback={<PageLoader />}>
|
|
69
|
-
<LibraryPage initialTab={parsed.tab} />
|
|
70
|
-
</React.Suspense>
|
|
71
|
-
</BrainShell>
|
|
72
|
-
) : parsed.primary === "system" ? (
|
|
73
|
-
<BrainShell active={parsed.primary}>
|
|
74
|
-
<React.Suspense fallback={<PageLoader />}>
|
|
75
|
-
<SystemPage initialTab={parsed.tab} />
|
|
76
|
-
</React.Suspense>
|
|
77
|
-
</BrainShell>
|
|
78
|
-
) : parsed.primary === "memory" ? (
|
|
79
|
-
<BrainShell active="memory">
|
|
80
|
-
<React.Suspense fallback={<PageLoader />}>
|
|
81
|
-
<BrainPage initialTab="memory" />
|
|
82
|
-
</React.Suspense>
|
|
83
|
-
</BrainShell>
|
|
84
|
-
) : parsed.primary === "brain" && parsed.tab && parsed.tab !== "conversation" ? (
|
|
85
|
-
<BrainShell active="brain">
|
|
86
|
-
<React.Suspense fallback={<PageLoader />}>
|
|
87
|
-
<BrainPage initialTab={parsed.tab} />
|
|
88
|
-
</React.Suspense>
|
|
89
|
-
</BrainShell>
|
|
90
|
-
) : (
|
|
91
|
-
<BrainShell active="brain">
|
|
92
|
-
<BrainHome brainState={brainState} intensity={intensity} onBrainChange={setBrain} />
|
|
93
|
-
</BrainShell>
|
|
94
|
-
)}
|
|
95
|
-
</div>
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function BrainShell({
|
|
100
|
-
active,
|
|
101
|
-
children,
|
|
102
|
-
}: {
|
|
103
|
-
active: string;
|
|
104
|
-
children: React.ReactNode;
|
|
105
|
-
}) {
|
|
106
|
-
const language = useAppStore((state) => state.language);
|
|
107
|
-
return (
|
|
108
|
-
<main className="brain-shell-page" aria-label="Lattice workspace">
|
|
109
|
-
<nav className="brain-shell-nav" aria-label="Brain workspace navigation">
|
|
110
|
-
{productShellRoutes.map((item) => (
|
|
111
|
-
<button
|
|
112
|
-
key={item.id}
|
|
113
|
-
type="button"
|
|
114
|
-
className={item.id === active ? "is-active" : ""}
|
|
115
|
-
aria-current={item.id === active ? "page" : undefined}
|
|
116
|
-
onClick={() => navigateHash(`/${item.path}`)}
|
|
117
|
-
>
|
|
118
|
-
{t(language, item.labelKey)}
|
|
119
|
-
</button>
|
|
120
|
-
))}
|
|
121
|
-
<div className="brain-shell-switchers" aria-label={t(language, "shell.workspace.label")}>
|
|
122
|
-
<VsCodeSyncStatus language={language} />
|
|
123
|
-
<WorkspaceProfileSwitcher language={language} />
|
|
124
|
-
<AdminAccessGate language={language} />
|
|
125
|
-
</div>
|
|
126
|
-
</nav>
|
|
127
|
-
<section className="brain-shell-content">
|
|
128
|
-
<ExternalConsentStatus language={language} />
|
|
129
|
-
{children}
|
|
130
|
-
</section>
|
|
131
|
-
</main>
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function ExternalConsentStatus({ language }: { language: Language }) {
|
|
136
|
-
const externalConsent = useAppStore((state) => state.externalConsent);
|
|
137
|
-
const setExternalConsent = useAppStore((state) => state.setExternalConsent);
|
|
138
|
-
|
|
139
|
-
return (
|
|
140
|
-
<section className="external-consent-status" aria-label={t(language, "feedback.consent.aria")}>
|
|
141
|
-
<FeedbackState
|
|
142
|
-
tone={externalConsent ? "empty" : "error"}
|
|
143
|
-
language={language}
|
|
144
|
-
title={externalConsent ? t(language, "feedback.consent.activeTitle") : t(language, "feedback.consent.revokedTitle")}
|
|
145
|
-
body={externalConsent ? t(language, "feedback.consent.activeBody") : t(language, "feedback.consent.revokedBody")}
|
|
146
|
-
actionLabel={externalConsent ? t(language, "feedback.consent.revoke") : t(language, "feedback.consent.reenable")}
|
|
147
|
-
onAction={() => setExternalConsent(!externalConsent)}
|
|
148
|
-
/>
|
|
149
|
-
</section>
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function VsCodeSyncStatus({ language }: { language: Language }) {
|
|
154
|
-
const bridge = useQuery({
|
|
155
|
-
queryKey: ["workspaceVscodeStatus"],
|
|
156
|
-
queryFn: latticeApi.workspaceVscodeStatus,
|
|
157
|
-
refetchInterval: 15000,
|
|
158
|
-
});
|
|
159
|
-
const index = useQuery({
|
|
160
|
-
queryKey: ["index"],
|
|
161
|
-
queryFn: latticeApi.indexStatus,
|
|
162
|
-
refetchInterval: 15000,
|
|
163
|
-
});
|
|
164
|
-
const data = bridge.data?.data as Record<string, unknown> | undefined;
|
|
165
|
-
const lastSeen = Number(data?.last_seen_ms || 0);
|
|
166
|
-
const connected = Boolean(data?.connected) || (lastSeen > 0 && Date.now() - lastSeen < 60000);
|
|
167
|
-
const indexData = index.data?.data as Record<string, unknown> | undefined;
|
|
168
|
-
const indexStatus = String(indexData?.status || indexData?.state || "");
|
|
169
|
-
const indexing = /index|build|running|pending/i.test(indexStatus);
|
|
170
|
-
const state = bridge.isLoading
|
|
171
|
-
? "checking"
|
|
172
|
-
: !connected
|
|
173
|
-
? "offline"
|
|
174
|
-
: indexing
|
|
175
|
-
? "indexing"
|
|
176
|
-
: "synced";
|
|
177
|
-
const labelKey = `shell.sync.${state}`;
|
|
178
|
-
const detail = connected
|
|
179
|
-
? t(language, "shell.sync.detail")
|
|
180
|
-
: t(language, "shell.sync.detailOffline");
|
|
181
|
-
|
|
182
|
-
return (
|
|
183
|
-
<button
|
|
184
|
-
type="button"
|
|
185
|
-
className={`vscode-sync-status is-${state}`}
|
|
186
|
-
aria-label={`${t(language, "shell.sync.label")}: ${t(language, labelKey)}`}
|
|
187
|
-
title={`${t(language, "shell.sync.label")}: ${t(language, labelKey)}\n${detail}`}
|
|
188
|
-
onClick={() => {
|
|
189
|
-
window.location.hash = "/settings";
|
|
190
|
-
}}
|
|
191
|
-
>
|
|
192
|
-
<span className="vscode-sync-dot" aria-hidden="true" />
|
|
193
|
-
<span className="vscode-sync-copy">
|
|
194
|
-
<strong>{t(language, "shell.sync.label")}</strong>
|
|
195
|
-
<small>{t(language, labelKey)}</small>
|
|
196
|
-
</span>
|
|
197
|
-
</button>
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function PageLoader() {
|
|
202
|
-
return (
|
|
203
|
-
<div className="brain-shell-loader" role="status">
|
|
204
|
-
Loading Brain workspace...
|
|
205
|
-
</div>
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function useHashRoute() {
|
|
210
|
-
const read = React.useCallback(() => {
|
|
211
|
-
const hash = window.location.hash.replace(/^#/, "");
|
|
212
|
-
return hash.startsWith("/") ? hash : "/brain";
|
|
213
|
-
}, []);
|
|
214
|
-
const [route, setRoute] = React.useState(read);
|
|
215
|
-
|
|
216
|
-
React.useEffect(() => {
|
|
217
|
-
const onHashChange = () => setRoute(read());
|
|
218
|
-
window.addEventListener("hashchange", onHashChange);
|
|
219
|
-
return () => window.removeEventListener("hashchange", onHashChange);
|
|
220
|
-
}, [read]);
|
|
221
|
-
|
|
222
|
-
return route;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function navigateHash(route: string) {
|
|
226
|
-
window.location.hash = route;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
function useBrainState() {
|
|
230
|
-
const [state, setState] = React.useState<BrainState>("idle");
|
|
231
|
-
const [intensity, setIntensity] = React.useState(0.58);
|
|
232
|
-
|
|
233
|
-
const setBrain = React.useCallback((next: BrainState, nextIntensity?: number) => {
|
|
234
|
-
setState(next);
|
|
235
|
-
if (nextIntensity !== undefined) setIntensity(clamp(nextIntensity, 0.38, 1));
|
|
236
|
-
}, []);
|
|
237
|
-
|
|
238
|
-
return { state, intensity, setBrain };
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
function clamp(value: number, min: number, max: number) {
|
|
242
|
-
return Math.max(min, Math.min(max, value));
|
|
243
|
-
}
|