File size: 10,926 Bytes
8a29801
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/**

 * MentraOS-only migration surface, re-exported by the private

 * `@mentra/engine-host-internal` workspace package.

 *

 * Raw zustand stores and service singletons that the Mentra app's host-side

 * services (and the `@/stores/*` / `@/utils/*` shims) still reach into while

 * the typed `engine` facades grow. Everything here either mutates runtime

 * state or exposes a store/service directly, so none of it belongs on the

 * OEM-facing `@mentra/engine` main entry: new host code should read/act

 * through `engine.*` instead.

 *

 * Every `/internal` import in mobile/src is counted (report-only) by

 * scripts/check-mobile-runtime-boundary.sh; the burn-down plan is

 * cloud-v2/docs/issues/020-glasses-status-boundary/integration-review.md §D.

 * Types that only describe these internal surfaces live here with them;

 * types host UI renders with stay on the main entry.

 */

export {isDevMiniappAllowed} from "./runtime/bootstrap"

// Miniapp runtime plumbing: WebView bridge, registry, launcher, engine.
export {default as webviewBridge} from "./services/WebviewBridge"
export {
  default as appRegistry,
  normalizeManifestPermissions,
  normalizeManifestActions,
  buildHardwareRequirements,
  saveLocalAppRunningState,
  assertDevBuildAllowed,
  registerDevApp,
  unregisterDevApp,
  getDevAppRecords,
  DEV_APP_PACKAGE_NAME,
  hasAssignmentReason,
  SignedMiniappDevBuildError,
  type DevAppRecord,
  type InstallBundleOptions,
  type MiniappReleaseIdentity,
} from "./services/AppRegistry"
export {default as displayProcessor} from "./services/DisplayProcessor"
export {default as localDisplayManager, type DisplayPayload} from "./services/LocalDisplayManager"
export {default as localMiniappRuntime, type InstalledMiniappManifest} from "./services/LocalMiniappRuntime"
export {
  miniappLauncher,
  MiniappAgeRestrictedError,
  type LaunchHints,
  type LaunchResult,
  type ResolvedBundle,
} from "./services/MiniappLauncher"
export {miniappOrigin, miniappOriginHost, miniappOriginUrl, type MiniappOriginPlatform} from "./services/miniappOrigin"
export {resolveMiniappDataPartition} from "./services/miniappDataPartition"
export {
  applyMiniappWebStorageOps,
  fillMiniappWebStorage,
  markMiniappWebStorageLoaded,
  markMiniappWebStorageOriginUnknown,
  MINIAPP_WEB_STORAGE_CAP_BYTES,
  miniappWebStorageEntries,
  openMiniappWebStorage,
  removedMiniappWebStorageKeys,
  type MiniappWebStorageOp,
  type MiniappWebStorageSession,
} from "./services/miniappWebStorage"
export {installMiniappFromJsonUrl} from "./services/manualMiniappInstall"
export {installMiniapp, InstallMiniappError, isLocalNetworkMiniappUrl} from "./services/installMiniapp"
export {
  installMiniappRelease,
  MiniappInstallCancelledError,
  type MiniappReleaseArchive,
  type ReleaseInstallOptions,
} from "./services/miniappReleaseInstall"
export {markMiniappUpdateDeferred} from "./services/deferredMiniappUpdates"
export {canShowRunningUpdatePrompt} from "./services/runningUpdatePrompt"
export {MiniappRunningError} from "./utils/storeInstallRuntime"
export {sha256Hex} from "./utils/sha256"
export {
  MentraJSRouter,
  type MentraJSCrustBinding,
  type OutboundMessagePayload as MentraJSOutboundMessage,
  type RouterLogger as MentraJSRouterLogger,
} from "./services/MentraJSRouter"
export {buildMentraUiShim, type MentraUiShimOptions} from "./services/mentraUiShim"
export {
  MentraUIRouter,
  type MentraUICrustBinding,
  type MentraUIHostChannelHandler,
  type MentraUIHostReply,
} from "./services/MentraUIRouter"
// Stream preview: the runtime-to-host seam and the read-only meeting view it authorizes against.
export {
  setStreamPreviewHost,
  getStreamPreviewHost,
  StreamPreviewError,
  type StreamPreviewHostPort,
  type StreamPreviewStartRequest,
  type StreamPreviewStartResult,
  type StreamPreviewStatusEvent,
} from "./services/streamPreviewPort"
export {acsMeetingPreviewSource, type StreamPreviewMeetingSource} from "./services/streamPreviewMeetingSource"
export {
  MentraJSCrashController,
  type CrashState,
  type CrashOutcome,
  type CrashControllerOptions,
} from "./services/MentraJSCrashController"
export {ensureMiniappEngine, getMiniappEngine, type MiniappEngine} from "./services/MiniappEngine"
export {
  redactSecrets,
  MentraJSLogThrottle,
  MentraJSLogRingBuffer,
  type ThrottleOptions,
} from "./services/MentraJSLogPipeline"
// WebView-injection script builders (miniapp globals + mentra-ui shim).
export {
  buildMiniappGlobalsScript,
  getCapsuleMenuRect,
  type BuildMiniappGlobalsOptions,
  type CapsuleMenuRect,
  type MiniappColorScheme,
  type MiniappSafeArea,
} from "./utils/miniappGlobals"

// Speech/audio coordinators and model managers.
export {default as localSttFallbackCoordinator} from "./services/LocalSttFallbackCoordinator"
export {default as micStateCoordinator} from "./services/MicStateCoordinator"
// Microphone ownership. Applications acquire a semantic session here; the
// engine decides what the use case requires of the hardware.
export {default as micSessionManager, MIC_SOURCE_CONFLICT} from "./services/MicSessionManager"
export type {MicSession, MicSessionOptions} from "./services/MicSessionManager"
export {
  GAIN_DB,
  MIC_TUNING_FIRMWARE_DEFAULTS,
  MIC_USE_CASE_LOUDNESS_GATE,
  MIC_USE_CASE_PROFILES,
  VOICE_CALL_PACKAGES,
  ENGINE_ONLY_USE_CASES,
  ENGINE_OWNER_PREFIX,
  resolveMicPolicy,
  scaleMicTuningToGain,
} from "./services/micPolicy"
export type {MicSource, MicTuningProfile, MicUseCase} from "./services/micPolicy"
export {default as audioPlaybackService} from "./services/AudioPlaybackService"
export {default as sttModelManager, STTModelManager} from "./services/STTModelManager"
export {default as ttsModelManager, TTSModelManager} from "./services/TTSModelManager"
export {default as offlineSpeechModelService} from "./services/OfflineSpeechModelService"
export {default as wakeWordModelManager, WakeWordModelManager} from "./services/WakeWordModelManager"
export type {WakeWordModelInfo} from "./services/WakeWordModelManager"

export {default as navigationService} from "./services/NavigationService"
// Phone GPS — the background location task + tier control. Importing this
// module registers the background task, so the entry that MantleManager loads
// must keep re-exporting it (was: the main barrel).
export {phoneLocationService, stopPhoneLocation} from "./services/PhoneLocationService"
// Clock-skew fix commands (BLE writes) used by OTA + gallery sync.
export {fixGlassesClockIfSkewed, maybeFixGlassesClockFromVersionInfo} from "./services/glassesClockSync"
// OTA manifest-URL resolution (dev-override/legacy-build/env/prod).
export {resolveOtaManifestUrl} from "./services/otaManifestUrl"
// Flat OTA check helpers (network + BLE state). Host usage is a tracked
// burn-down surface (§F); the sanctioned path is engine.ota.checkForUpdates().
export {
  fetchVersionInfo,
  checkVersionUpdateAvailable,
  getLatestVersionInfo,
  findMatchingMtkPatch,
  checkBesUpdate,
  checkForOtaUpdate,
  checkCurrentGlassesForUpdate,
} from "./services/OtaUpdateCheckService"

// Gallery cluster — sync orchestrator, glasses-camera HTTP API, media/storage,
// settings, validation and the service-to-service notice bus. Host gallery UI
// renders engine.gallery; these are the underlying services.
export {detectClockSkew, isSyncManifestEmpty, CLOCK_SKEW_TOLERANCE_MS} from "./services/gallerySyncClock"
export {gallerySyncService} from "./services/asg/gallerySyncService"
export {asgCameraApi} from "./services/asg/asgCameraApi"
export {localStorageService} from "./services/asg/localStorageService"
export {mediaProcessingQueue} from "./services/asg/mediaProcessingQueue"
export {gallerySettingsService} from "./services/asg/gallerySettingsService"
export {cameraRollExportCoordinator, type CameraRollExportSummary} from "./services/asg/cameraRollExportCoordinator"
export {
  INVALID_DOWNLOADED_MEDIA,
  validateCaptureMetadataForDownload,
  validateDownloadedMediaFile,
} from "./services/asg/galleryMediaValidation"
export {emitGalleryNotice, onGalleryNotice} from "./services/asg/galleryNotices"

// Phone-side capture coordinators.
export {phonePhotoCoordinator} from "./services/PhonePhotoCoordinator"
export {phoneStreamCoordinator} from "./services/PhoneStreamCoordinator"

// Raw runtime stores (re-exported via the host @/stores/* shims). Read models
// live on the engine facades; these are the migration escape hatch.
export {useDisplayStore, flushDisplayCoalesceForTests} from "./stores/display"
export {useCoreStore} from "./stores/core"
export {useConnectionStore} from "./stores/connection"
export {useCloudClientStatusStore} from "./stores/cloudClientStatus"
export type {RuntimeAudioTransport, RuntimeSnapshot, RuntimeStatus} from "./stores/cloudClientStatus"
export {SETTINGS, OFFLINE_APPLETS, useSettingsStore, useSetting} from "./stores/settings"
export {MENTRA_LIVE_SETTING_KEYS, getBluetoothSettingKeysForDevice} from "./stores/bluetoothSettingKeys"
export {useAppStatusStore, installAppStoreHooks, type AppStoreHooks} from "./stores/apps"

// Cloud client + credentials + v1 comms.
export {cloudSecureStore} from "./utils/cloudClient/cloudSecureStore"
// Core credentials in the platform secure store, moved out of MMKV once.
export {createPlatformCredentialVault, mmkvLegacyCredentials} from "./utils/credentials/platform"
export type {CredentialLocation, CredentialVault} from "./utils/credentials/credentialVault"
export {cloudClientService} from "./services/CloudClientService"
export {createCloudUdpSocket} from "./utils/cloudClient/RnUdpAdapter"
// Fleet: the workspace screens ask the assignment reconciler to read desired state now.
export {notifyFleetWorkspaceLeft, triggerAssignmentReconcile} from "./services/fleet/assignmentReconcilerHost"
export {fleetEvents} from "./services/fleet/fleetEvents"
export {
  getFleetManagementState,
  onFleetManagementStateChanged,
  type FleetManagementState,
} from "./services/fleet/fleetManagementState"

// Log ring buffer + console interception (bug-report attachments).
export {logBuffer, type LogEntry} from "./utils/devLogging"

// Bluetooth SDK internal compatibility passthrough. Prefer an engine facade
// when one exists; this remains an escape hatch for app-only compatibility
// needs (its event TYPES stay on the main entry).
export {default as BluetoothSdk} from "@mentra/bluetooth-sdk/internal"

// Engine-owned MMKV instance + debug helper.
export {storage, printDirectory} from "./utils/storage"
// Process-wide event bus — one shared instance for engine services + host
// (re-exported via the @/utils/GlobalEventEmitter shim).
export {default as GlobalEventEmitter} from "./utils/GlobalEventEmitter"