@ateam-ai-mobile/expo 0.1.4 → 0.1.7
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/android/build.gradle +16 -0
- package/android/src/main/java/expo/modules/adavision/AdaVisionModule.kt +75 -0
- package/dist/attachmentCache-DhQTqi2E.d.mts +18 -0
- package/dist/attachmentCache-DhQTqi2E.d.ts +18 -0
- package/dist/bootstrap.d.mts +95 -0
- package/dist/bootstrap.d.ts +95 -0
- package/dist/bootstrap.js +2473 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/bootstrap.mjs +64 -0
- package/dist/bootstrap.mjs.map +1 -0
- package/dist/chunk-4BMWVN25.mjs +91 -0
- package/dist/chunk-4BMWVN25.mjs.map +1 -0
- package/dist/chunk-4XYXJYN5.mjs +1513 -0
- package/dist/chunk-4XYXJYN5.mjs.map +1 -0
- package/dist/chunk-5HM6UA2K.mjs +571 -0
- package/dist/chunk-5HM6UA2K.mjs.map +1 -0
- package/dist/chunk-6LXF3JVX.mjs +96 -0
- package/dist/chunk-6LXF3JVX.mjs.map +1 -0
- package/dist/chunk-FF6ZZZXH.mjs +71 -0
- package/dist/chunk-FF6ZZZXH.mjs.map +1 -0
- package/dist/chunk-KOXF2FZM.mjs +92 -0
- package/dist/chunk-KOXF2FZM.mjs.map +1 -0
- package/dist/chunk-L4V7OCJ3.mjs +71 -0
- package/dist/chunk-L4V7OCJ3.mjs.map +1 -0
- package/dist/chunk-TZXWVYYR.mjs +67 -0
- package/dist/chunk-TZXWVYYR.mjs.map +1 -0
- package/dist/chunk-VQJPSLHP.mjs +1801 -0
- package/dist/chunk-VQJPSLHP.mjs.map +1 -0
- package/dist/chunk-WMJKH4XE.mjs +34 -0
- package/dist/chunk-WMJKH4XE.mjs.map +1 -0
- package/dist/chunk-XQSY6MHP.mjs +213 -0
- package/dist/chunk-XQSY6MHP.mjs.map +1 -0
- package/dist/createBridge.mjs +2 -0
- package/dist/createBridge.mjs.map +1 -1
- package/dist/device/createDeviceProvider.d.mts +23 -0
- package/dist/device/createDeviceProvider.d.ts +23 -0
- package/dist/device/createDeviceProvider.js +967 -0
- package/dist/device/createDeviceProvider.js.map +1 -0
- package/dist/device/createDeviceProvider.mjs +17 -0
- package/dist/device/createDeviceProvider.mjs.map +1 -0
- package/dist/device-bridge/collectors/appEngagement.d.mts +10 -0
- package/dist/device-bridge/collectors/appEngagement.d.ts +10 -0
- package/dist/device-bridge/collectors/appEngagement.js +128 -0
- package/dist/device-bridge/collectors/appEngagement.js.map +1 -0
- package/dist/device-bridge/collectors/appEngagement.mjs +12 -0
- package/dist/device-bridge/collectors/appEngagement.mjs.map +1 -0
- package/dist/device-bridge/collectors/health.d.mts +24 -0
- package/dist/device-bridge/collectors/health.d.ts +24 -0
- package/dist/device-bridge/collectors/health.js +238 -0
- package/dist/device-bridge/collectors/health.js.map +1 -0
- package/dist/device-bridge/collectors/health.mjs +18 -0
- package/dist/device-bridge/collectors/health.mjs.map +1 -0
- package/dist/device-bridge/cookies.d.mts +49 -0
- package/dist/device-bridge/cookies.d.ts +49 -0
- package/dist/device-bridge/cookies.js +90 -0
- package/dist/device-bridge/cookies.js.map +1 -0
- package/dist/device-bridge/cookies.mjs +14 -0
- package/dist/device-bridge/cookies.mjs.map +1 -0
- package/dist/device-bridge/index.d.mts +483 -0
- package/dist/device-bridge/index.d.ts +483 -0
- package/dist/device-bridge/index.js +2084 -0
- package/dist/device-bridge/index.js.map +1 -0
- package/dist/device-bridge/index.mjs +32 -0
- package/dist/device-bridge/index.mjs.map +1 -0
- package/dist/device-bridge/nfc.d.mts +30 -0
- package/dist/device-bridge/nfc.d.ts +30 -0
- package/dist/device-bridge/nfc.js +109 -0
- package/dist/device-bridge/nfc.js.map +1 -0
- package/dist/device-bridge/nfc.mjs +14 -0
- package/dist/device-bridge/nfc.mjs.map +1 -0
- package/dist/index.d.mts +493 -18
- package/dist/index.d.ts +493 -18
- package/dist/index.js +1409 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -194
- package/dist/index.mjs.map +1 -1
- package/dist/oauth/expoOAuth.d.mts +18 -0
- package/dist/oauth/expoOAuth.d.ts +18 -0
- package/dist/oauth/expoOAuth.js +102 -0
- package/dist/oauth/expoOAuth.js.map +1 -0
- package/dist/oauth/expoOAuth.mjs +8 -0
- package/dist/oauth/expoOAuth.mjs.map +1 -0
- package/dist/types-BRanJYTn.d.mts +138 -0
- package/dist/types-BRanJYTn.d.ts +138 -0
- package/dist/vision/index.d.mts +81 -0
- package/dist/vision/index.d.ts +81 -0
- package/dist/vision/index.js +101 -0
- package/dist/vision/index.js.map +1 -0
- package/dist/vision/index.mjs +28 -0
- package/dist/vision/index.mjs.map +1 -0
- package/expo-module.config.json +9 -0
- package/ios/AdaVision.podspec +28 -0
- package/ios/AdaVisionModule.swift +432 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/analytics/coremldata.bin +0 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/coremldata.bin +0 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/metadata.json +773 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/model0/analytics/coremldata.bin +0 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/model0/coremldata.bin +0 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/model0/model.mil +720 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/model0/weights/weight.bin +0 -0
- package/ios/Resources/yolov8n-oiv7.mlmodelc/model1/coremldata.bin +0 -0
- package/package.json +107 -7
- package/src/bootstrap.ts +159 -0
- package/src/camera/CameraTaskHost.tsx +175 -0
- package/src/camera/cameraTasks.ts +129 -0
- package/src/device/createDeviceProvider.ts +832 -0
- package/src/device-bridge/actions/calendar-actions.ts +217 -0
- package/src/device-bridge/actions/dnd.ts +74 -0
- package/src/device-bridge/actions/health-actions.ts +58 -0
- package/src/device-bridge/actions/index.ts +12 -0
- package/src/device-bridge/actions/messaging.ts +74 -0
- package/src/device-bridge/actions/navigation.ts +88 -0
- package/src/device-bridge/actions/queue-poller.ts +151 -0
- package/src/device-bridge/background.ts +137 -0
- package/src/device-bridge/biometrics.ts +64 -0
- package/src/device-bridge/capabilities.ts +218 -0
- package/src/device-bridge/collectors/appEngagement.ts +120 -0
- package/src/device-bridge/collectors/battery.ts +83 -0
- package/src/device-bridge/collectors/calendar.ts +162 -0
- package/src/device-bridge/collectors/camera.ts +27 -0
- package/src/device-bridge/collectors/connectivity.ts +60 -0
- package/src/device-bridge/collectors/contacts.ts +200 -0
- package/src/device-bridge/collectors/health.ts +299 -0
- package/src/device-bridge/collectors/index.ts +12 -0
- package/src/device-bridge/collectors/location.ts +224 -0
- package/src/device-bridge/collectors/mood.ts +141 -0
- package/src/device-bridge/collectors/notifications.ts +70 -0
- package/src/device-bridge/cookies.ts +89 -0
- package/src/device-bridge/dynamic-connector.ts +422 -0
- package/src/device-bridge/index.ts +467 -0
- package/src/device-bridge/nfc.ts +85 -0
- package/src/device-bridge/plugin.ts +71 -0
- package/src/device-bridge/relay-client.ts +237 -0
- package/src/device-bridge/scanner.ts +42 -0
- package/src/device-bridge/sharing.ts +35 -0
- package/src/device-bridge/types.ts +326 -0
- package/src/device-state/activityClassifier.ts +151 -0
- package/src/device-state/activityEngine.ts +252 -0
- package/src/device-state/collectors.ts +31 -0
- package/src/device-state/domains/activity.ts +93 -0
- package/src/device-state/domains/capability.ts +60 -0
- package/src/device-state/domains/connectivity.ts +60 -0
- package/src/device-state/domains/deviceContext.ts +55 -0
- package/src/device-state/domains/interaction.ts +59 -0
- package/src/device-state/domains/spatial.ts +283 -0
- package/src/device-state/domains/visual.ts +100 -0
- package/src/device-state/headingSource.ts +84 -0
- package/src/device-state/index.ts +77 -0
- package/src/device-state/quality.ts +60 -0
- package/src/device-state/replay.ts +220 -0
- package/src/device-state/turnDetector.ts +121 -0
- package/src/device-state/visualEngine.ts +341 -0
- package/src/haptics.ts +4 -0
- package/src/index.ts +37 -0
- package/src/oauth/expoOAuth.tsx +113 -0
- package/src/vision/analysis.js +80 -0
- package/src/vision/index.ts +144 -0
- package/src/vision/ring.js +35 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
apply plugin: 'com.android.library'
|
|
2
|
+
apply plugin: 'org.jetbrains.kotlin.android'
|
|
3
|
+
apply plugin: 'expo-module-gradle-plugin'
|
|
4
|
+
|
|
5
|
+
group = 'expo.modules.adavision'
|
|
6
|
+
version = '1.0.0'
|
|
7
|
+
|
|
8
|
+
android {
|
|
9
|
+
namespace "expo.modules.adavision"
|
|
10
|
+
defaultConfig {
|
|
11
|
+
minSdkVersion safeExtGet("minSdkVersion", 24)
|
|
12
|
+
}
|
|
13
|
+
lintOptions {
|
|
14
|
+
abortOnError false
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
package expo.modules.adavision
|
|
2
|
+
|
|
3
|
+
import android.graphics.Bitmap
|
|
4
|
+
import android.graphics.BitmapFactory
|
|
5
|
+
import expo.modules.kotlin.modules.Module
|
|
6
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
7
|
+
import java.net.URI
|
|
8
|
+
import kotlin.math.max
|
|
9
|
+
import kotlin.math.sqrt
|
|
10
|
+
|
|
11
|
+
// On-device frame-quality analysis. Reads a local frame file, computes pixel
|
|
12
|
+
// statistics on a small grayscale downscale, returns only the verdict. Nothing
|
|
13
|
+
// leaves the device. readText / describe (MLKit) are a later pass.
|
|
14
|
+
class AdaVisionModule : Module() {
|
|
15
|
+
override fun definition() = ModuleDefinition {
|
|
16
|
+
Name("AdaVision")
|
|
17
|
+
|
|
18
|
+
Function("isSupported") { true }
|
|
19
|
+
|
|
20
|
+
AsyncFunction("assessQuality") { uri: String ->
|
|
21
|
+
val bmp = loadBitmap(uri) ?: throw Exception("Could not read frame at $uri")
|
|
22
|
+
assess(bmp)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private fun loadBitmap(uri: String): Bitmap? {
|
|
27
|
+
val path = if (uri.startsWith("file://")) URI(uri).path else uri
|
|
28
|
+
// inSampleSize=2 halves each dimension on decode — cheaper, still ample for stats.
|
|
29
|
+
val opts = BitmapFactory.Options().apply { inSampleSize = 2 }
|
|
30
|
+
return BitmapFactory.decodeFile(path, opts)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private fun assess(src: Bitmap): Map<String, Any?> {
|
|
34
|
+
val side = 128
|
|
35
|
+
val scaled = Bitmap.createScaledBitmap(src, side, side, true)
|
|
36
|
+
val px = IntArray(side * side)
|
|
37
|
+
scaled.getPixels(px, 0, side, 0, 0, side, side)
|
|
38
|
+
|
|
39
|
+
val gray = IntArray(side * side)
|
|
40
|
+
for (i in px.indices) {
|
|
41
|
+
val c = px[i]
|
|
42
|
+
val r = (c shr 16) and 0xFF
|
|
43
|
+
val g = (c shr 8) and 0xFF
|
|
44
|
+
val b = c and 0xFF
|
|
45
|
+
gray[i] = (0.299 * r + 0.587 * g + 0.114 * b).toInt()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var sum = 0.0
|
|
49
|
+
var sumSq = 0.0
|
|
50
|
+
for (v in gray) { val d = v.toDouble(); sum += d; sumSq += d * d }
|
|
51
|
+
val n = (side * side).toDouble()
|
|
52
|
+
val mean = sum / n
|
|
53
|
+
val std = sqrt(max(0.0, sumSq / n - mean * mean))
|
|
54
|
+
|
|
55
|
+
var lapSum = 0.0
|
|
56
|
+
var lapSumSq = 0.0
|
|
57
|
+
var count = 0
|
|
58
|
+
for (y in 1 until side - 1) {
|
|
59
|
+
for (x in 1 until side - 1) {
|
|
60
|
+
val i = y * side + x
|
|
61
|
+
val lap = 4.0 * gray[i] - gray[i - 1] - gray[i + 1] - gray[i - side] - gray[i + side]
|
|
62
|
+
lapSum += lap; lapSumSq += lap * lap; count++
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
val ln = count.toDouble()
|
|
66
|
+
val lapVar = max(0.0, lapSumSq / ln - (lapSum / ln) * (lapSum / ln))
|
|
67
|
+
|
|
68
|
+
// Heuristic thresholds on a 128×128 grayscale — tune with real frames.
|
|
69
|
+
val exposure = if (mean < 45) "dark" else if (mean > 205) "bright" else "good"
|
|
70
|
+
val obstructed = mean < 22 && std < 8
|
|
71
|
+
val blur = if (lapVar > 120) "sharp" else if (lapVar > 30) "slight" else "severe"
|
|
72
|
+
|
|
73
|
+
return mapOf("blur" to blur, "exposure" to exposure, "obstructed" to obstructed)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AttachmentCache, OutgoingAttachment, AttachmentPreview } from '@ateam-ai-mobile/core';
|
|
2
|
+
|
|
3
|
+
declare class ExpoAttachmentCache implements AttachmentCache {
|
|
4
|
+
private index;
|
|
5
|
+
private loaded;
|
|
6
|
+
private indexKey;
|
|
7
|
+
/** Pass `indexKey` when migrating from an app that already persisted an
|
|
8
|
+
* index under a different AsyncStorage key — otherwise existing users
|
|
9
|
+
* lose every cached preview on upgrade. */
|
|
10
|
+
constructor(opts?: {
|
|
11
|
+
indexKey?: string;
|
|
12
|
+
});
|
|
13
|
+
ready(): Promise<void>;
|
|
14
|
+
save(jobId: string, attachments: OutgoingAttachment[]): Promise<void>;
|
|
15
|
+
get(jobId: string): AttachmentPreview[] | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { ExpoAttachmentCache as E };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AttachmentCache, OutgoingAttachment, AttachmentPreview } from '@ateam-ai-mobile/core';
|
|
2
|
+
|
|
3
|
+
declare class ExpoAttachmentCache implements AttachmentCache {
|
|
4
|
+
private index;
|
|
5
|
+
private loaded;
|
|
6
|
+
private indexKey;
|
|
7
|
+
/** Pass `indexKey` when migrating from an app that already persisted an
|
|
8
|
+
* index under a different AsyncStorage key — otherwise existing users
|
|
9
|
+
* lose every cached preview on upgrade. */
|
|
10
|
+
constructor(opts?: {
|
|
11
|
+
indexKey?: string;
|
|
12
|
+
});
|
|
13
|
+
ready(): Promise<void>;
|
|
14
|
+
save(jobId: string, attachments: OutgoingAttachment[]): Promise<void>;
|
|
15
|
+
get(jobId: string): AttachmentPreview[] | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { ExpoAttachmentCache as E };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { TokenProvider, AdasUser, AdasSession } from '@ateam-ai-mobile/core';
|
|
2
|
+
import { RegisteredPlugin } from '@ateam-ai-mobile/plugin-runtime';
|
|
3
|
+
import { UIActionRoute } from '@ateam-ai-mobile/ui';
|
|
4
|
+
import { E as ExpoAttachmentCache } from './attachmentCache-DhQTqi2E.mjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* bootstrapExpoAdas — the single, self-contained SDK bootstrap (R10).
|
|
8
|
+
*
|
|
9
|
+
* The final high-level entry point of the "fat SDK / thin shell" arc: it folds
|
|
10
|
+
* the ~15 hand-wired seams the host used to assemble in its own adas.ts into ONE
|
|
11
|
+
* call, so the shell stops manually assembling platform providers/collectors/
|
|
12
|
+
* plugins. Internally it initializes, in the order the migrated code established:
|
|
13
|
+
* the Expo providers (haptics/bundle cache/clipboard/attachment cache + the
|
|
14
|
+
* device-primitive provider), the host-bundled native plugins, the plugin-WebView
|
|
15
|
+
* allow-list, native OAuth, the ACS reachability reporter, the L3 DeviceState
|
|
16
|
+
* engine (with the SDK's OWN collectors — the shell injects none), the plugin/
|
|
17
|
+
* UI-action navigator, and finally the core config+token bridge (initAdas).
|
|
18
|
+
*
|
|
19
|
+
* The API is DERIVED from the host's migrated adas.ts, not invented. Everything
|
|
20
|
+
* the host still owns is passed in as a small values-and-getters bag: endpoint
|
|
21
|
+
* getters (the host owns the dev/prod switch), the identity/token bridge, its
|
|
22
|
+
* branded Google client id, its host-bundled plugin resolvers, the native
|
|
23
|
+
* WebView module from its build, and its router callback.
|
|
24
|
+
*
|
|
25
|
+
* A SUBPATH (`@ateam-ai-mobile/expo/bootstrap`), like /device and /oauth: it
|
|
26
|
+
* statically pulls the optional expo native modules (via createDeviceProvider /
|
|
27
|
+
* the device-state collectors / the OAuth provider), so it must not sit on the
|
|
28
|
+
* package's main entry, which a host without those modules still has to build.
|
|
29
|
+
*
|
|
30
|
+
* The two physical reasoning paths stay DISTINCT and are wired as SEPARATE
|
|
31
|
+
* statements — never a merged bridge: LOCAL (the local tool registry + device
|
|
32
|
+
* state the plugin/voice runtime reads) and SERVER (the relay allow-list here;
|
|
33
|
+
* the DeviceBridge relay runtime itself is started by the host lifecycle, out of
|
|
34
|
+
* this module-load bootstrap's scope).
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/** A host-bundled native plugin: one lazy resolver registered under one or more ids. */
|
|
38
|
+
interface NativePluginRegistration {
|
|
39
|
+
resolver: () => Promise<RegisteredPlugin>;
|
|
40
|
+
ids: string[];
|
|
41
|
+
}
|
|
42
|
+
interface BootstrapExpoAdasOptions {
|
|
43
|
+
/**
|
|
44
|
+
* Endpoint GETTERS — the host owns the dev/prod env switch, so these are read
|
|
45
|
+
* live on every SDK request (never snapshotted). `core` is required; the rest
|
|
46
|
+
* are optional (voice/consumer-auth features light up when present).
|
|
47
|
+
*/
|
|
48
|
+
urls: {
|
|
49
|
+
core: () => string;
|
|
50
|
+
voice?: () => string;
|
|
51
|
+
consumerAuth?: () => string;
|
|
52
|
+
/** Trusted extra host for plugin WebViews (the relay device-bridge auth flows). */
|
|
53
|
+
relay?: () => string;
|
|
54
|
+
};
|
|
55
|
+
/** The host's token bridge — outcome mapping (transient vs auth_failed) owned by the host. */
|
|
56
|
+
tokenProvider: TokenProvider;
|
|
57
|
+
/** Current user projection for chat routing (host reads its auth store). */
|
|
58
|
+
getUser: () => AdasUser | null;
|
|
59
|
+
/** Active tenant getter (signed-in tenant, falling back to the pre-auth pick). */
|
|
60
|
+
tenant?: () => string;
|
|
61
|
+
/** Adopt a freshly-minted session on tenant switch (host persists tenant-first, then logs in). */
|
|
62
|
+
onSession?: (session: AdasSession) => void | Promise<void>;
|
|
63
|
+
/** The host's bundled Google iOS client id, for the join/open-join OAuth path. */
|
|
64
|
+
googleIosClientId?: string;
|
|
65
|
+
/** Host-bundled native plugins (AuthWebView, ConnectionsPanel, …) — lazy resolvers. */
|
|
66
|
+
nativePlugins?: NativePluginRegistration[];
|
|
67
|
+
/** Native modules remote bundles may require() (e.g. react-native-webview) — from the host build. */
|
|
68
|
+
bundleModules?: Record<string, unknown>;
|
|
69
|
+
/** Pre-SDK AsyncStorage keys, so an existing install keeps its warm caches. */
|
|
70
|
+
storageKeys?: {
|
|
71
|
+
attachmentIndex?: string;
|
|
72
|
+
bundleIndex?: string;
|
|
73
|
+
};
|
|
74
|
+
/** Connectivity sink — the SDK reports fetch reachability up/down; the host feeds its banner. */
|
|
75
|
+
onReachabilityChange?: (up: boolean) => void;
|
|
76
|
+
/** Open the host's plugin screen for a UI-action chip (the host owns its router). */
|
|
77
|
+
navigateToPlugin: (route: UIActionRoute) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Reachability probe URL for the device-primitive connectivity API. The host
|
|
80
|
+
* passes this EXPLICITLY (typically `${core}/health`) as a load-time snapshot —
|
|
81
|
+
* deliberately NOT derived from `urls.core()`, so a dev/E2E core override does
|
|
82
|
+
* not silently flow into the health probe (the asymmetry the host relied on).
|
|
83
|
+
*/
|
|
84
|
+
reachabilityUrl?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Wire the entire Expo-backed ADAS platform in one call. Run for its side effect
|
|
88
|
+
* at module load, before the router mounts. Returns the attachment cache so the
|
|
89
|
+
* host can hand it to anything that needs it (initAdas already received it).
|
|
90
|
+
*/
|
|
91
|
+
declare function bootstrapExpoAdas(opts: BootstrapExpoAdasOptions): {
|
|
92
|
+
attachmentCache: ExpoAttachmentCache;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export { type BootstrapExpoAdasOptions, type NativePluginRegistration, bootstrapExpoAdas };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { TokenProvider, AdasUser, AdasSession } from '@ateam-ai-mobile/core';
|
|
2
|
+
import { RegisteredPlugin } from '@ateam-ai-mobile/plugin-runtime';
|
|
3
|
+
import { UIActionRoute } from '@ateam-ai-mobile/ui';
|
|
4
|
+
import { E as ExpoAttachmentCache } from './attachmentCache-DhQTqi2E.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* bootstrapExpoAdas — the single, self-contained SDK bootstrap (R10).
|
|
8
|
+
*
|
|
9
|
+
* The final high-level entry point of the "fat SDK / thin shell" arc: it folds
|
|
10
|
+
* the ~15 hand-wired seams the host used to assemble in its own adas.ts into ONE
|
|
11
|
+
* call, so the shell stops manually assembling platform providers/collectors/
|
|
12
|
+
* plugins. Internally it initializes, in the order the migrated code established:
|
|
13
|
+
* the Expo providers (haptics/bundle cache/clipboard/attachment cache + the
|
|
14
|
+
* device-primitive provider), the host-bundled native plugins, the plugin-WebView
|
|
15
|
+
* allow-list, native OAuth, the ACS reachability reporter, the L3 DeviceState
|
|
16
|
+
* engine (with the SDK's OWN collectors — the shell injects none), the plugin/
|
|
17
|
+
* UI-action navigator, and finally the core config+token bridge (initAdas).
|
|
18
|
+
*
|
|
19
|
+
* The API is DERIVED from the host's migrated adas.ts, not invented. Everything
|
|
20
|
+
* the host still owns is passed in as a small values-and-getters bag: endpoint
|
|
21
|
+
* getters (the host owns the dev/prod switch), the identity/token bridge, its
|
|
22
|
+
* branded Google client id, its host-bundled plugin resolvers, the native
|
|
23
|
+
* WebView module from its build, and its router callback.
|
|
24
|
+
*
|
|
25
|
+
* A SUBPATH (`@ateam-ai-mobile/expo/bootstrap`), like /device and /oauth: it
|
|
26
|
+
* statically pulls the optional expo native modules (via createDeviceProvider /
|
|
27
|
+
* the device-state collectors / the OAuth provider), so it must not sit on the
|
|
28
|
+
* package's main entry, which a host without those modules still has to build.
|
|
29
|
+
*
|
|
30
|
+
* The two physical reasoning paths stay DISTINCT and are wired as SEPARATE
|
|
31
|
+
* statements — never a merged bridge: LOCAL (the local tool registry + device
|
|
32
|
+
* state the plugin/voice runtime reads) and SERVER (the relay allow-list here;
|
|
33
|
+
* the DeviceBridge relay runtime itself is started by the host lifecycle, out of
|
|
34
|
+
* this module-load bootstrap's scope).
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/** A host-bundled native plugin: one lazy resolver registered under one or more ids. */
|
|
38
|
+
interface NativePluginRegistration {
|
|
39
|
+
resolver: () => Promise<RegisteredPlugin>;
|
|
40
|
+
ids: string[];
|
|
41
|
+
}
|
|
42
|
+
interface BootstrapExpoAdasOptions {
|
|
43
|
+
/**
|
|
44
|
+
* Endpoint GETTERS — the host owns the dev/prod env switch, so these are read
|
|
45
|
+
* live on every SDK request (never snapshotted). `core` is required; the rest
|
|
46
|
+
* are optional (voice/consumer-auth features light up when present).
|
|
47
|
+
*/
|
|
48
|
+
urls: {
|
|
49
|
+
core: () => string;
|
|
50
|
+
voice?: () => string;
|
|
51
|
+
consumerAuth?: () => string;
|
|
52
|
+
/** Trusted extra host for plugin WebViews (the relay device-bridge auth flows). */
|
|
53
|
+
relay?: () => string;
|
|
54
|
+
};
|
|
55
|
+
/** The host's token bridge — outcome mapping (transient vs auth_failed) owned by the host. */
|
|
56
|
+
tokenProvider: TokenProvider;
|
|
57
|
+
/** Current user projection for chat routing (host reads its auth store). */
|
|
58
|
+
getUser: () => AdasUser | null;
|
|
59
|
+
/** Active tenant getter (signed-in tenant, falling back to the pre-auth pick). */
|
|
60
|
+
tenant?: () => string;
|
|
61
|
+
/** Adopt a freshly-minted session on tenant switch (host persists tenant-first, then logs in). */
|
|
62
|
+
onSession?: (session: AdasSession) => void | Promise<void>;
|
|
63
|
+
/** The host's bundled Google iOS client id, for the join/open-join OAuth path. */
|
|
64
|
+
googleIosClientId?: string;
|
|
65
|
+
/** Host-bundled native plugins (AuthWebView, ConnectionsPanel, …) — lazy resolvers. */
|
|
66
|
+
nativePlugins?: NativePluginRegistration[];
|
|
67
|
+
/** Native modules remote bundles may require() (e.g. react-native-webview) — from the host build. */
|
|
68
|
+
bundleModules?: Record<string, unknown>;
|
|
69
|
+
/** Pre-SDK AsyncStorage keys, so an existing install keeps its warm caches. */
|
|
70
|
+
storageKeys?: {
|
|
71
|
+
attachmentIndex?: string;
|
|
72
|
+
bundleIndex?: string;
|
|
73
|
+
};
|
|
74
|
+
/** Connectivity sink — the SDK reports fetch reachability up/down; the host feeds its banner. */
|
|
75
|
+
onReachabilityChange?: (up: boolean) => void;
|
|
76
|
+
/** Open the host's plugin screen for a UI-action chip (the host owns its router). */
|
|
77
|
+
navigateToPlugin: (route: UIActionRoute) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Reachability probe URL for the device-primitive connectivity API. The host
|
|
80
|
+
* passes this EXPLICITLY (typically `${core}/health`) as a load-time snapshot —
|
|
81
|
+
* deliberately NOT derived from `urls.core()`, so a dev/E2E core override does
|
|
82
|
+
* not silently flow into the health probe (the asymmetry the host relied on).
|
|
83
|
+
*/
|
|
84
|
+
reachabilityUrl?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Wire the entire Expo-backed ADAS platform in one call. Run for its side effect
|
|
88
|
+
* at module load, before the router mounts. Returns the attachment cache so the
|
|
89
|
+
* host can hand it to anything that needs it (initAdas already received it).
|
|
90
|
+
*/
|
|
91
|
+
declare function bootstrapExpoAdas(opts: BootstrapExpoAdasOptions): {
|
|
92
|
+
attachmentCache: ExpoAttachmentCache;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export { type BootstrapExpoAdasOptions, type NativePluginRegistration, bootstrapExpoAdas };
|