@ateam-ai-mobile/expo 0.1.10 → 0.1.12
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/dist/bootstrap.js +72 -39
- package/dist/bootstrap.js.map +1 -1
- package/dist/bootstrap.mjs +22 -4
- package/dist/bootstrap.mjs.map +1 -1
- package/dist/{chunk-C7M5WAHA.mjs → chunk-42FP5DTO.mjs} +17 -5
- package/dist/chunk-42FP5DTO.mjs.map +1 -0
- package/dist/{chunk-PCAEUX2N.mjs → chunk-6JX222YX.mjs} +21 -10
- package/dist/chunk-6JX222YX.mjs.map +1 -0
- package/dist/{chunk-GF2MPTAB.mjs → chunk-DLDG77DX.mjs} +2 -2
- package/dist/device/createDeviceProvider.js +28 -23
- package/dist/device/createDeviceProvider.js.map +1 -1
- package/dist/device/createDeviceProvider.mjs +2 -2
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/vision/index.d.mts +10 -3
- package/dist/vision/index.d.ts +10 -3
- package/dist/vision/index.js +20 -9
- package/dist/vision/index.js.map +1 -1
- package/dist/vision/index.mjs +1 -1
- package/expo-module.config.json +12 -3
- package/ios/AdaAudioModule.swift +78 -0
- package/ios/AdaVisionModule.swift +58 -13
- package/package.json +4 -4
- package/src/audio/index.ts +23 -0
- package/src/bootstrap.ts +5 -1
- package/src/device-state/domains/visual.ts +7 -2
- package/src/device-state/visualEngine.ts +15 -2
- package/src/vision/index.ts +34 -10
- package/dist/chunk-C7M5WAHA.mjs.map +0 -1
- package/dist/chunk-PCAEUX2N.mjs.map +0 -1
- /package/dist/{chunk-GF2MPTAB.mjs.map → chunk-DLDG77DX.mjs.map} +0 -0
package/dist/bootstrap.js
CHANGED
|
@@ -179,6 +179,21 @@ var import_core2 = require("@ateam-ai-mobile/core");
|
|
|
179
179
|
var import_plugin_runtime3 = require("@ateam-ai-mobile/plugin-runtime");
|
|
180
180
|
var import_ui2 = require("@ateam-ai-mobile/ui");
|
|
181
181
|
|
|
182
|
+
// src/audio/index.ts
|
|
183
|
+
var import_expo_modules_core = require("expo-modules-core");
|
|
184
|
+
var native = (0, import_expo_modules_core.requireOptionalNativeModule)("AdaAudio");
|
|
185
|
+
function createCallAudioProvider() {
|
|
186
|
+
if (!native) return null;
|
|
187
|
+
return {
|
|
188
|
+
beginCall: () => {
|
|
189
|
+
native.beginVoiceCall();
|
|
190
|
+
},
|
|
191
|
+
endCall: () => {
|
|
192
|
+
native.endVoiceCall();
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
182
197
|
// src/index.ts
|
|
183
198
|
var ExpoWebBrowser = __toESM(require("expo-web-browser"));
|
|
184
199
|
var ExpoLinking = __toESM(require("expo-linking"));
|
|
@@ -1131,12 +1146,20 @@ var VisualEngine = class {
|
|
|
1131
1146
|
this.context = p;
|
|
1132
1147
|
}
|
|
1133
1148
|
// ── session ──
|
|
1134
|
-
startSession(intent) {
|
|
1135
|
-
if (this.session)
|
|
1149
|
+
startSession(intent, facing = "back") {
|
|
1150
|
+
if (this.session) {
|
|
1151
|
+
if (this.session.facing === facing) return this.session;
|
|
1152
|
+
this.session = { ...this.session, facing };
|
|
1153
|
+
this.frames = [];
|
|
1154
|
+
this.cameraReady = false;
|
|
1155
|
+
this.notify();
|
|
1156
|
+
return this.session;
|
|
1157
|
+
}
|
|
1136
1158
|
this.session = {
|
|
1137
1159
|
id: `visual_${Date.now()}`,
|
|
1138
1160
|
intent: PROFILES[intent] ? intent : "navigation",
|
|
1139
1161
|
startedAt: Date.now(),
|
|
1162
|
+
facing,
|
|
1140
1163
|
suspended: false
|
|
1141
1164
|
};
|
|
1142
1165
|
this.notify();
|
|
@@ -1324,7 +1347,7 @@ function cameraState() {
|
|
|
1324
1347
|
// would let a guide speak about a scene nothing is watching.
|
|
1325
1348
|
available: !!session,
|
|
1326
1349
|
active: visualEngine.isCameraReady(),
|
|
1327
|
-
facing: session ?
|
|
1350
|
+
facing: session ? session.facing : "unknown"
|
|
1328
1351
|
};
|
|
1329
1352
|
}
|
|
1330
1353
|
function createVisualDomain() {
|
|
@@ -1342,7 +1365,11 @@ function createVisualDomain() {
|
|
|
1342
1365
|
};
|
|
1343
1366
|
},
|
|
1344
1367
|
async start(options) {
|
|
1345
|
-
const
|
|
1368
|
+
const facing = options?.facing ?? "back";
|
|
1369
|
+
if (facing !== "front" && facing !== "back") {
|
|
1370
|
+
throw unsupported(`visual.start facing "${String(facing)}" \u2014 use "front" or "back"`);
|
|
1371
|
+
}
|
|
1372
|
+
const s = visualEngine.startSession(options?.intent || "navigation", facing);
|
|
1346
1373
|
visualEngine.setContextProvider({ heading: currentHeading });
|
|
1347
1374
|
void startHeading("visual");
|
|
1348
1375
|
return { id: s.id, intent: s.intent, startedAt: s.startedAt };
|
|
@@ -1837,7 +1864,7 @@ var SQLite = __toESM(require("expo-sqlite"));
|
|
|
1837
1864
|
var import_async_storage6 = __toESM(require("@react-native-async-storage/async-storage"));
|
|
1838
1865
|
|
|
1839
1866
|
// src/vision/index.ts
|
|
1840
|
-
var
|
|
1867
|
+
var import_expo_modules_core2 = require("expo-modules-core");
|
|
1841
1868
|
var import_expo = require("expo");
|
|
1842
1869
|
var CameraPreview = (() => {
|
|
1843
1870
|
try {
|
|
@@ -1846,33 +1873,38 @@ var CameraPreview = (() => {
|
|
|
1846
1873
|
return null;
|
|
1847
1874
|
}
|
|
1848
1875
|
})();
|
|
1849
|
-
var
|
|
1876
|
+
var native2 = (0, import_expo_modules_core2.requireOptionalNativeModule)("AdaVision");
|
|
1877
|
+
function verb(name) {
|
|
1878
|
+
if (!native2) throw new Error("ada-vision native module not present in this build");
|
|
1879
|
+
const fn = native2[name];
|
|
1880
|
+
if (typeof fn !== "function") {
|
|
1881
|
+
throw Object.assign(new Error(`UNAVAILABLE: ada-vision ${String(name)} is not implemented on this platform (iOS only)`), { code: "UNAVAILABLE" });
|
|
1882
|
+
}
|
|
1883
|
+
return fn.bind(native2);
|
|
1884
|
+
}
|
|
1850
1885
|
function isSupported() {
|
|
1851
1886
|
try {
|
|
1852
|
-
return
|
|
1887
|
+
return native2?.isSupported() ?? false;
|
|
1853
1888
|
} catch {
|
|
1854
1889
|
return false;
|
|
1855
1890
|
}
|
|
1856
1891
|
}
|
|
1857
1892
|
function qualityById(id) {
|
|
1858
|
-
return
|
|
1893
|
+
return native2?.qualityById?.(id) ?? null;
|
|
1859
1894
|
}
|
|
1860
1895
|
async function readText(id, languages) {
|
|
1861
|
-
|
|
1862
|
-
return native.readText(id, languages ?? null);
|
|
1896
|
+
return verb("readText")(id, languages ?? null);
|
|
1863
1897
|
}
|
|
1864
1898
|
async function describe(id, maxLabels = 5) {
|
|
1865
|
-
|
|
1866
|
-
return native.describe(id, maxLabels);
|
|
1899
|
+
return verb("describe")(id, maxLabels);
|
|
1867
1900
|
}
|
|
1868
1901
|
async function detectObjects(id, maxItems = 10, minConfidence = 0.25) {
|
|
1869
|
-
|
|
1870
|
-
return native.detectObjects(id, maxItems, minConfidence);
|
|
1902
|
+
return verb("detectObjects")(id, maxItems, minConfidence);
|
|
1871
1903
|
}
|
|
1872
1904
|
|
|
1873
1905
|
// src/maps/index.ts
|
|
1874
1906
|
var import_react_native3 = require("react-native");
|
|
1875
|
-
var
|
|
1907
|
+
var import_expo_modules_core3 = require("expo-modules-core");
|
|
1876
1908
|
var ExpoLocation2 = __toESM(require("expo-location"));
|
|
1877
1909
|
|
|
1878
1910
|
// src/args.ts
|
|
@@ -1885,22 +1917,22 @@ var shown = (v) => {
|
|
|
1885
1917
|
s = s ?? String(v);
|
|
1886
1918
|
return s.length > 80 ? `${s.slice(0, 77)}...` : s;
|
|
1887
1919
|
};
|
|
1888
|
-
function refuseArgument(capability,
|
|
1889
|
-
const e = new Error(`${capability}.${
|
|
1920
|
+
function refuseArgument(capability, verb2, problem, nothing) {
|
|
1921
|
+
const e = new Error(`${capability}.${verb2}: ${problem}; ${nothing}.`);
|
|
1890
1922
|
e.code = "INVALID_ARGUMENT";
|
|
1891
1923
|
return e;
|
|
1892
1924
|
}
|
|
1893
|
-
function countArg(capability,
|
|
1925
|
+
function countArg(capability, verb2, name, value, def, max, nothing) {
|
|
1894
1926
|
const v = value ?? def;
|
|
1895
1927
|
if (typeof v !== "number" || !Number.isFinite(v) || v < 1) {
|
|
1896
|
-
throw refuseArgument(capability,
|
|
1928
|
+
throw refuseArgument(capability, verb2, `${name} must be a number from 1 (at most ${max} are used), not ${shown(value)}`, nothing);
|
|
1897
1929
|
}
|
|
1898
1930
|
return Math.min(max, Math.floor(v));
|
|
1899
1931
|
}
|
|
1900
|
-
function fractionArg(capability,
|
|
1932
|
+
function fractionArg(capability, verb2, name, value, def, nothing) {
|
|
1901
1933
|
const v = value ?? def;
|
|
1902
1934
|
if (typeof v !== "number" || !Number.isFinite(v) || v < 0 || v > 1) {
|
|
1903
|
-
throw refuseArgument(capability,
|
|
1935
|
+
throw refuseArgument(capability, verb2, `${name} must be a number from 0 to 1, not ${shown(value)}`, nothing);
|
|
1904
1936
|
}
|
|
1905
1937
|
return v;
|
|
1906
1938
|
}
|
|
@@ -1911,15 +1943,15 @@ var SEARCH_RADIUS_MAX_M = 1e5;
|
|
|
1911
1943
|
var SEARCH_LIMIT_DEFAULT = 8;
|
|
1912
1944
|
var SEARCH_LIMIT_MAX = 25;
|
|
1913
1945
|
var text = (v) => typeof v === "string" && v.trim() !== "" ? v : null;
|
|
1914
|
-
var refuseArgument2 = (
|
|
1915
|
-
function coordinateArg(
|
|
1946
|
+
var refuseArgument2 = (verb2, problem, nothing) => refuseArgument("maps", verb2, problem, nothing);
|
|
1947
|
+
function coordinateArg(verb2, name, value, nothing) {
|
|
1916
1948
|
const c = value;
|
|
1917
1949
|
const latitude = c?.latitude, longitude = c?.longitude;
|
|
1918
1950
|
if (typeof latitude === "number" && Number.isFinite(latitude) && Math.abs(latitude) <= 90 && typeof longitude === "number" && Number.isFinite(longitude) && Math.abs(longitude) <= 180) {
|
|
1919
1951
|
return { latitude, longitude };
|
|
1920
1952
|
}
|
|
1921
1953
|
throw refuseArgument2(
|
|
1922
|
-
|
|
1954
|
+
verb2,
|
|
1923
1955
|
`${name} must be { latitude, longitude } numbers (latitude -90..90, longitude -180..180), not ${shown(value)}`,
|
|
1924
1956
|
nothing
|
|
1925
1957
|
);
|
|
@@ -1999,7 +2031,7 @@ function toMapsRoute(raw) {
|
|
|
1999
2031
|
polyline: (raw.polyline ?? []).map(point)
|
|
2000
2032
|
};
|
|
2001
2033
|
}
|
|
2002
|
-
function mapsFailure(
|
|
2034
|
+
function mapsFailure(verb2, err) {
|
|
2003
2035
|
const nativeCode = String(err?.code ?? "");
|
|
2004
2036
|
const detail = String(err?.message ?? err ?? "").trim();
|
|
2005
2037
|
let code;
|
|
@@ -2018,33 +2050,33 @@ function mapsFailure(verb, err) {
|
|
|
2018
2050
|
why = "the map service failed";
|
|
2019
2051
|
}
|
|
2020
2052
|
const failure = new Error(
|
|
2021
|
-
`maps.${
|
|
2053
|
+
`maps.${verb2} could not look: ${why}. This is not "found nothing".` + (detail ? ` (${nativeCode ? nativeCode + ": " : ""}${detail})` : "")
|
|
2022
2054
|
);
|
|
2023
2055
|
failure.code = code;
|
|
2024
2056
|
return failure;
|
|
2025
2057
|
}
|
|
2026
2058
|
|
|
2027
2059
|
// src/maps/index.ts
|
|
2028
|
-
var
|
|
2060
|
+
var native3 = (0, import_expo_modules_core3.requireOptionalNativeModule)("AdaMaps");
|
|
2029
2061
|
function missingReason() {
|
|
2030
2062
|
if (import_react_native3.Platform.OS !== "ios") return `iOS (Apple MapKit) \u2014 ${import_react_native3.Platform.OS} has no implementation yet`;
|
|
2031
|
-
if (!
|
|
2063
|
+
if (!native3) return "the app build with the AdaMaps module (this build predates it \u2014 a native rebuild is needed)";
|
|
2032
2064
|
return null;
|
|
2033
2065
|
}
|
|
2034
2066
|
function isSupported2() {
|
|
2035
2067
|
try {
|
|
2036
|
-
return missingReason() === null && (
|
|
2068
|
+
return missingReason() === null && (native3?.isSupported() ?? false);
|
|
2037
2069
|
} catch {
|
|
2038
2070
|
return false;
|
|
2039
2071
|
}
|
|
2040
2072
|
}
|
|
2041
2073
|
async function search(query, near, radiusM, limit) {
|
|
2042
|
-
if (!
|
|
2043
|
-
return near ?
|
|
2074
|
+
if (!native3) throw new Error("ada-maps native module not present in this build");
|
|
2075
|
+
return near ? native3.search(query, near.latitude, near.longitude, true, radiusM, limit) : native3.search(query, 0, 0, false, radiusM, limit);
|
|
2044
2076
|
}
|
|
2045
2077
|
async function route(from, to) {
|
|
2046
|
-
if (!
|
|
2047
|
-
return
|
|
2078
|
+
if (!native3) throw new Error("ada-maps native module not present in this build");
|
|
2079
|
+
return native3.route(from.latitude, from.longitude, to.latitude, to.longitude);
|
|
2048
2080
|
}
|
|
2049
2081
|
async function reverseGeocode(at) {
|
|
2050
2082
|
const [first] = await ExpoLocation2.reverseGeocodeAsync({ latitude: at.latitude, longitude: at.longitude });
|
|
@@ -2505,15 +2537,15 @@ function createStorageAPI(pluginId) {
|
|
|
2505
2537
|
delete: (k) => import_async_storage6.default.removeItem(key(k)),
|
|
2506
2538
|
db: {
|
|
2507
2539
|
async execute(sql, params) {
|
|
2508
|
-
const
|
|
2509
|
-
if (
|
|
2540
|
+
const verb2 = sqlLeadingKeyword(sql);
|
|
2541
|
+
if (verb2 === "ATTACH" || verb2 === "DETACH" || verb2 === "VACUUM") {
|
|
2510
2542
|
throw new CapabilityUnavailableError(
|
|
2511
2543
|
"storage.db",
|
|
2512
|
-
`SQL '${
|
|
2544
|
+
`SQL '${verb2}' is not permitted: a plugin's storage is confined to its own database and cannot reach another file.`
|
|
2513
2545
|
);
|
|
2514
2546
|
}
|
|
2515
2547
|
const db = await openPluginDb(dbFile);
|
|
2516
|
-
const returnsRows =
|
|
2548
|
+
const returnsRows = verb2 === "SELECT" || verb2 === "PRAGMA" || verb2 === "WITH";
|
|
2517
2549
|
if (returnsRows) {
|
|
2518
2550
|
const rows = await db.getAllAsync(sql, params ?? []);
|
|
2519
2551
|
return { rows, changes: 0 };
|
|
@@ -2810,10 +2842,10 @@ function createVisionAPI() {
|
|
|
2810
2842
|
};
|
|
2811
2843
|
}
|
|
2812
2844
|
function createMapsAPI() {
|
|
2813
|
-
const refuseIfMissing = (
|
|
2845
|
+
const refuseIfMissing = (verb2, nothing) => {
|
|
2814
2846
|
const missing = missingReason();
|
|
2815
2847
|
if (missing) {
|
|
2816
|
-
throw new CapabilityUnavailableError(`maps.${
|
|
2848
|
+
throw new CapabilityUnavailableError(`maps.${verb2}`, `maps.${verb2} needs ${missing}; ${nothing}.`);
|
|
2817
2849
|
}
|
|
2818
2850
|
};
|
|
2819
2851
|
return {
|
|
@@ -2963,6 +2995,7 @@ function bootstrapExpoAdas(opts) {
|
|
|
2963
2995
|
const relay = opts.urls.relay;
|
|
2964
2996
|
(0, import_ui2.setPluginWebViewExtraHosts)(() => relay ? [relay()] : []);
|
|
2965
2997
|
(0, import_ui2.setOAuthProvider)(createExpoOAuthProvider({ googleIosClientId: opts.googleIosClientId }));
|
|
2998
|
+
(0, import_ui2.setCallAudioProvider)(createCallAudioProvider());
|
|
2966
2999
|
if (opts.onReachabilityChange) {
|
|
2967
3000
|
const onReach = opts.onReachabilityChange;
|
|
2968
3001
|
(0, import_core2.setAcsReachabilityReporter)({ up: () => onReach(true), down: () => onReach(false) });
|