File size: 4,376 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 | /**
* Runtime-shared constants and DTOs.
*
* The old host-injected runtime adapter surface has moved behind engine-owned
* services and `engine.configure({auth, config, analytics})`. Keep this file
* limited to stable types that are shared across those services.
*/
export type CloudClientConnectionStatus = "connected" | "connecting" | "reconnecting" | "disconnected"
export type CloudClientAudioTransport = "udp" | "ws" | "offline" | "none"
export interface CloudClientStatusSnapshot {
status: CloudClientConnectionStatus
audioTransport: CloudClientAudioTransport
}
export interface MiniappAuthToken {
mentraUserId: string
tenantId?: string
token: string
expiresAt: number
}
/**
* Result of an offline TTS synthesis. The engine's TTSModelManager produces
* this directly; the type is kept exported for hosts that wrap it.
*/
export interface TtsSynthesisResult {
audioUrl: string
cleanup?: () => Promise<void> | void
}
/**
* Stable settings keys read by engine services. Hosts must wire their own
* settings store keys to these names. Mobile already uses these strings.
*/
export const ISLAND_SETTINGS_KEYS = {
localSttFallbackActive: "local_stt_fallback_active",
defaultWearable: "default_wearable",
coreToken: "core_token",
cameraFov: "camera_fov",
} as const
/**
* Navigation event payloads. Mirror the host's NavigationService types but are
* duplicated here so the engine module does not import host types.
*/
export type NavManeuverEvent = {
kind: "maneuver"
maneuverType: string
distanceMeters: number
fromRoad?: string | null
toRoad?: string | null
nextStepRoad?: string | null
distanceToDestinationMeters?: number
timeToDestinationSeconds?: number
currentSpeedMps?: number | null
speedLimitMps?: number | null
routeHeadingDeg?: number | null
}
export type NavOffRouteEvent = {kind: "off_route"; offRouteDistanceMeters: number}
export type NavReroutingEvent = {kind: "rerouting"}
export type NavArrivedEvent = {kind: "arrived"}
export type NavErrorEvent = {kind: "error"; message: string; terminal?: boolean}
export type NavUpdate = NavManeuverEvent | NavOffRouteEvent | NavReroutingEvent | NavArrivedEvent | NavErrorEvent
export type NavLocation = {
lat: number
lng: number
accuracy: number | null
timestamp: number
}
export type NavRouteStep = {
lat: number
lng: number
routeIndex: number
road: string | null
maneuver: string
distanceMeters: number
}
export type NavRoute = {
points: Array<{lat: number; lng: number}>
steps?: NavRouteStep[]
}
export type NavTripSnapshot = {
active: boolean
mode?: string
stops?: Array<{lat: number; lng: number}>
currentStopIndex?: number
route?: NavRoute
maneuver?: NavManeuverEvent
distanceToDestinationMeters?: number
timeToDestinationSeconds?: number
currentSpeedMps?: number | null
speedLimitMps?: number | null
}
export interface StreamVideoConfig {
width?: number
height?: number
bitrate?: number
/** WHIP minimum target in bps; omitted leaves it unset. Clamped to the maximum. */
minBitrateBps?: number
/** WHIP startup bitrate in bps, clamped to the requested bounds. */
initialBitrateBps?: number
fps?: number
}
export interface StreamAudioConfig {
bitrate?: number
sampleRate?: number
echoCancellation?: boolean
noiseSuppression?: boolean
}
export type CameraRoiPosition = "center" | "bottom" | "top"
export type CameraFovPreset = "narrow" | "standard" | "wide"
export type CameraFovRequest =
| {
fov: number
roiPosition?: CameraRoiPosition
}
| {
preset: CameraFovPreset
}
export interface CameraFovResult {
requestId: string
fov: number
roiPosition: CameraRoiPosition
timestamp: number
}
/** One audited inter-miniapp call. */
export interface InteropAuditEvent {
/** The system app that made the call. */
caller: string
op: "list" | "start" | "stop" | "install" | "uninstall" | "invoke"
/** Target miniapp (start/stop/invoke). */
target?: string
/** Action id (invoke only). */
actionId?: string
/** True if the call was permitted and accepted; false on denial / pre-flight failure. */
ok: boolean
/** MiniappErrorCode when ok is false. */
errorCode?: string
}
|