Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
98 lines
4.0 KiB
TypeScript
98 lines
4.0 KiB
TypeScript
import React, { useEffect } from 'react';
|
|
|
|
import { initializeFonts } from './application/state/fontStore';
|
|
import { initializeUIFonts } from './application/state/uiFontStore';
|
|
import { useSettingsChromeStore } from './application/state/settingsChromeStore';
|
|
import { I18nProvider } from './application/i18n/I18nProvider';
|
|
import type { useSettingsState } from './application/state/useSettingsState';
|
|
import type { useAppLockState } from './application/state/useAppLockState';
|
|
import { ToastProvider } from './components/ui/toast';
|
|
import { TooltipProvider } from './components/ui/tooltip';
|
|
import { ScriptAutomationRoot } from './components/scripts/ScriptAutomationRoot';
|
|
import { ExternalMcpApprovalsHost } from './components/ai/ExternalMcpApprovalsHost';
|
|
import { PluginAuthenticationHost } from './components/plugins/PluginAuthenticationHost';
|
|
import { useExternalMcpGrantPersister } from './components/ai/useExternalMcpGrantPersister';
|
|
import { setupMcpApprovalBridge } from './infrastructure/ai/shared/approvalGate';
|
|
import { setupCodexAppServerInteractionBridge } from './infrastructure/ai/shared/codexAppServerInteractions';
|
|
import { AppShell } from './application/app/AppShell';
|
|
import { AppLocalStateProvider } from './application/app/AppLocalState';
|
|
import { AppSideEffects } from './application/app/AppSideEffects';
|
|
import { SessionPublisher } from './application/app/publishers/SessionPublisher';
|
|
import { SettingsPublisher } from './application/app/publishers/SettingsPublisher';
|
|
import { VaultPublisher } from './application/app/publishers/VaultPublisher';
|
|
import { AppLockRuntimePublisher } from './application/app/publishers/AppLockRuntimePublisher';
|
|
|
|
// Initialize fonts eagerly at app startup
|
|
initializeFonts();
|
|
initializeUIFonts();
|
|
|
|
type SettingsState = ReturnType<typeof useSettingsState>;
|
|
type AppLockState = ReturnType<typeof useAppLockState>;
|
|
|
|
/**
|
|
* Bridges the locale out of settings chrome without pulling App into a
|
|
* settings-subscribing mega component.
|
|
*/
|
|
function SettingsI18nProvider({ children }: { children: React.ReactNode }) {
|
|
const { uiLanguage } = useSettingsChromeStore();
|
|
return <I18nProvider locale={uiLanguage}>{children}</I18nProvider>;
|
|
}
|
|
|
|
/**
|
|
* Thin coordinator: no vault/session/settings React subscriptions and no
|
|
* domain bag construction. Publishers own mega hooks; Host islands build
|
|
* shell bags; AppSideEffects owns reactive effects + local UI publishing.
|
|
*/
|
|
function App() {
|
|
return (
|
|
<AppLocalStateProvider>
|
|
<AppSideEffects />
|
|
<AppShell />
|
|
</AppLocalStateProvider>
|
|
);
|
|
}
|
|
|
|
/**
|
|
* `AppLockGate` (index.tsx) owns `useSettingsState` / `useAppLockState` so the
|
|
* lock overlay can render before app children mount, and it owns the
|
|
* splash-removal + rendererReady signal (deep links must wait for unlock).
|
|
* App forwards the gate's settings instance into SettingsPublisher so the
|
|
* runtime slot/context still publish a single settings runtime.
|
|
*/
|
|
function AppWithProviders({ settings, appLock }: { settings: SettingsState; appLock: AppLockState }) {
|
|
const isPeerSessionWindow = typeof window !== 'undefined' && window.location.hash.startsWith('#/session-window');
|
|
|
|
useEffect(() => {
|
|
return setupMcpApprovalBridge();
|
|
}, []);
|
|
|
|
useEffect(() => {
|
|
return setupCodexAppServerInteractionBridge();
|
|
}, []);
|
|
|
|
useExternalMcpGrantPersister();
|
|
|
|
return (
|
|
<SettingsPublisher settings={settings}>
|
|
<AppLockRuntimePublisher appLock={appLock} appLockEnabled={settings.appLockSettings.enabled}>
|
|
<SettingsI18nProvider>
|
|
<ToastProvider>
|
|
<TooltipProvider delayDuration={300}>
|
|
<ScriptAutomationRoot />
|
|
<ExternalMcpApprovalsHost />
|
|
<PluginAuthenticationHost />
|
|
<VaultPublisher>
|
|
<SessionPublisher persistSessionRestore={!isPeerSessionWindow}>
|
|
<App />
|
|
</SessionPublisher>
|
|
</VaultPublisher>
|
|
</TooltipProvider>
|
|
</ToastProvider>
|
|
</SettingsI18nProvider>
|
|
</AppLockRuntimePublisher>
|
|
</SettingsPublisher>
|
|
);
|
|
}
|
|
|
|
export default AppWithProviders;
|