@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,144 @@
|
|
|
1
|
+
// ada-vision — on-device image understanding, our own native code (no camera lib).
|
|
2
|
+
//
|
|
3
|
+
// On-device, frames never leave the phone:
|
|
4
|
+
// assessQuality(uri) — one-shot quality of a LOCAL frame file.
|
|
5
|
+
// startVision()/onVisionFrame — the headless camera session that publishes a
|
|
6
|
+
// timeline frame (id + quality, never pixels) at a
|
|
7
|
+
// cadence; readText/describe/detectObjects resolve
|
|
8
|
+
// a published id ON-DEVICE.
|
|
9
|
+
//
|
|
10
|
+
// The luma math mirrors ./analysis.js (which has the exhaustive unit tests).
|
|
11
|
+
//
|
|
12
|
+
// requireOptionalNativeModule: on a binary WITHOUT the native module, the import
|
|
13
|
+
// is null, isSupported() is false, and the session calls refuse cleanly (no crash).
|
|
14
|
+
|
|
15
|
+
import type { ComponentType } from 'react';
|
|
16
|
+
import { requireOptionalNativeModule } from 'expo-modules-core';
|
|
17
|
+
import { requireNativeView } from 'expo';
|
|
18
|
+
|
|
19
|
+
/** TEST-ONLY live preview bound to the same headless session (so a tester can
|
|
20
|
+
* aim). The real Guide runs headless and never mounts this. Null on a binary
|
|
21
|
+
* without the native view, so importing this module never crashes. */
|
|
22
|
+
export const CameraPreview: ComponentType<any> | null = (() => {
|
|
23
|
+
try { return requireNativeView('AdaVision'); } catch { return null; }
|
|
24
|
+
})();
|
|
25
|
+
|
|
26
|
+
export interface RawFrameQuality {
|
|
27
|
+
blur: 'sharp' | 'slight' | 'severe' | 'unknown';
|
|
28
|
+
exposure: 'good' | 'dark' | 'bright' | 'unknown';
|
|
29
|
+
/** true = lens covered; false = clearly not; null = not assessed. */
|
|
30
|
+
obstructed: boolean | null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface Subscription { remove(): void }
|
|
34
|
+
|
|
35
|
+
/** A published timeline frame from the vision session (metadata only — never
|
|
36
|
+
* pixels; the buffer stays in the native ring, resolved by id). */
|
|
37
|
+
export interface VisionFrame {
|
|
38
|
+
id: string;
|
|
39
|
+
ts: number;
|
|
40
|
+
expiresAt: number;
|
|
41
|
+
blur: RawFrameQuality['blur'];
|
|
42
|
+
exposure: RawFrameQuality['exposure'];
|
|
43
|
+
obstructed: RawFrameQuality['obstructed'];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** One OCR result on a frame — matches the SDK's VisionText. */
|
|
47
|
+
export interface VisionText {
|
|
48
|
+
text: string;
|
|
49
|
+
/** 0..1 recogniser confidence (never a 1.0 filler). */
|
|
50
|
+
confidence: number | null;
|
|
51
|
+
/** Normalised 0..1 box, origin TOP-left. */
|
|
52
|
+
box?: { x: number; y: number; width: number; height: number };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** One classifier label — a vocabulary term, NOT prose. Matches VisionLabel. */
|
|
56
|
+
export interface VisionLabel {
|
|
57
|
+
label: string;
|
|
58
|
+
confidence: number | null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** One detected object — a located item with a box, from the bundled detector. */
|
|
62
|
+
export interface VisionObject {
|
|
63
|
+
/** Open-Images class name (e.g. "Car", "Traffic light", "Building", "Person"). */
|
|
64
|
+
label: string;
|
|
65
|
+
/** 0..1 detector confidence. */
|
|
66
|
+
confidence: number | null;
|
|
67
|
+
/** Normalised 0..1 box, origin TOP-left. */
|
|
68
|
+
box?: { x: number; y: number; width: number; height: number };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface AdaVisionNative {
|
|
72
|
+
isSupported(): boolean;
|
|
73
|
+
assessQuality(uri: string): Promise<RawFrameQuality>;
|
|
74
|
+
startVision(intervalMs: number): Promise<void>;
|
|
75
|
+
stopVision(): void;
|
|
76
|
+
visionRetentionMs(): number;
|
|
77
|
+
qualityById(id: string): RawFrameQuality | null;
|
|
78
|
+
readText(id: string, languages: string[] | null): Promise<VisionText[]>;
|
|
79
|
+
describe(id: string, maxLabels: number): Promise<VisionLabel[]>;
|
|
80
|
+
detectObjects(id: string, maxItems: number, minConfidence: number): Promise<VisionObject[]>;
|
|
81
|
+
addListener(event: 'visionFrame', cb: (f: VisionFrame) => void): Subscription;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const native = requireOptionalNativeModule<AdaVisionNative>('AdaVision');
|
|
85
|
+
|
|
86
|
+
/** Is the native vision module present in this binary? */
|
|
87
|
+
export function isSupported(): boolean {
|
|
88
|
+
try { return native?.isSupported() ?? false; } catch { return false; }
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** One-shot: measure a frame's quality from its LOCAL file. Throws if it cannot look. */
|
|
92
|
+
export async function assessQuality(uri: string): Promise<RawFrameQuality> {
|
|
93
|
+
if (!native) throw new Error('ada-vision native module not present in this build');
|
|
94
|
+
return native.assessQuality(uri);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ── Vision session (feeds the Visual Engine) ──
|
|
98
|
+
|
|
99
|
+
/** Start the vision session — publishes a timeline frame every `intervalMs`. */
|
|
100
|
+
export async function startVision(intervalMs = 1000): Promise<void> {
|
|
101
|
+
if (!native) throw new Error('ada-vision native module not present in this build');
|
|
102
|
+
return native.startVision(intervalMs);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Stop the vision session and release the camera. */
|
|
106
|
+
export function stopVision(): void {
|
|
107
|
+
native?.stopVision?.();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Subscribe to published timeline frames (id + quality + expiry; no pixels). */
|
|
111
|
+
export function onVisionFrame(cb: (f: VisionFrame) => void): Subscription {
|
|
112
|
+
if (!native) return { remove() {} };
|
|
113
|
+
return native.addListener('visionFrame', cb);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** How far back the native ring can still resolve a frame id (ms). */
|
|
117
|
+
export function visionRetentionMs(): number {
|
|
118
|
+
return native?.visionRetentionMs?.() ?? 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Resolve a published frame id → its measured quality (null if evicted). */
|
|
122
|
+
export function qualityById(id: string): RawFrameQuality | null {
|
|
123
|
+
return native?.qualityById?.(id) ?? null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** On-device OCR on a published frame. [] = looked, no text; throws = couldn't look. */
|
|
127
|
+
export async function readText(id: string, languages?: string[]): Promise<VisionText[]> {
|
|
128
|
+
if (!native) throw new Error('ada-vision native module not present in this build');
|
|
129
|
+
return native.readText(id, languages ?? null);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** On-device image classification → labels (not prose). [] = nothing recognised. */
|
|
133
|
+
export async function describe(id: string, maxLabels = 5): Promise<VisionLabel[]> {
|
|
134
|
+
if (!native) throw new Error('ada-vision native module not present in this build');
|
|
135
|
+
return native.describe(id, maxLabels);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** On-device object detection (bundled YOLOv8n, Open-Images vocabulary) → located
|
|
139
|
+
* items with boxes. [] = looked, found nothing above `minConfidence`; throws =
|
|
140
|
+
* couldn't look (id aged out, or the model isn't in this build). */
|
|
141
|
+
export async function detectObjects(id: string, maxItems = 10, minConfidence = 0.25): Promise<VisionObject[]> {
|
|
142
|
+
if (!native) throw new Error('ada-vision native module not present in this build');
|
|
143
|
+
return native.detectObjects(id, maxItems, minConfidence);
|
|
144
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Reference for the native VisionSession frame ring (ios/AdaVisionModule.swift).
|
|
2
|
+
// The native side mirrors this; the tests pin the invariant GPT flagged:
|
|
3
|
+
// a frame id from an OLD camera session, or one evicted from the ring, must
|
|
4
|
+
// NEVER resolve. "Cannot look at that frame" (null) must never be confusable
|
|
5
|
+
// with a stale hit from a previous session.
|
|
6
|
+
//
|
|
7
|
+
// Two independent guarantees, both modelled here: ids are generation-scoped
|
|
8
|
+
// (vf_<gen>_<ts>), AND the ring is cleared on start(). Either alone prevents a
|
|
9
|
+
// stale resolve; together it can't happen.
|
|
10
|
+
|
|
11
|
+
export function createRing({ cap = 12, intervalMs = 1000 } = {}) {
|
|
12
|
+
let generation = 0;
|
|
13
|
+
let entries = []; // { id, quality }
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
/** A new camera session: bump generation, clear the ring. */
|
|
17
|
+
start() { generation += 1; entries = []; },
|
|
18
|
+
/** Session ended: nothing is resolvable. */
|
|
19
|
+
stop() { entries = []; },
|
|
20
|
+
/** The ring's actual retention (ms) — feeds the engine's window clamp. */
|
|
21
|
+
retentionMs() { return cap * intervalMs; },
|
|
22
|
+
/** Publish a frame → mint a generation-scoped id, retain (bounded). */
|
|
23
|
+
publish(quality, tsMs) {
|
|
24
|
+
const id = `vf_${generation}_${tsMs}`;
|
|
25
|
+
entries.push({ id, quality });
|
|
26
|
+
if (entries.length > cap) entries.splice(0, entries.length - cap);
|
|
27
|
+
return id;
|
|
28
|
+
},
|
|
29
|
+
/** Resolve by id → quality, or null when evicted / old-generation / unknown. */
|
|
30
|
+
qualityById(id) {
|
|
31
|
+
const e = entries.find(x => x.id === id);
|
|
32
|
+
return e ? e.quality : null;
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|