@ateam-ai-mobile/expo 0.1.11 → 0.1.13

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 CHANGED
@@ -1146,12 +1146,20 @@ var VisualEngine = class {
1146
1146
  this.context = p;
1147
1147
  }
1148
1148
  // ── session ──
1149
- startSession(intent) {
1150
- if (this.session) return 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
+ }
1151
1158
  this.session = {
1152
1159
  id: `visual_${Date.now()}`,
1153
1160
  intent: PROFILES[intent] ? intent : "navigation",
1154
1161
  startedAt: Date.now(),
1162
+ facing,
1155
1163
  suspended: false
1156
1164
  };
1157
1165
  this.notify();
@@ -1339,7 +1347,7 @@ function cameraState() {
1339
1347
  // would let a guide speak about a scene nothing is watching.
1340
1348
  available: !!session,
1341
1349
  active: visualEngine.isCameraReady(),
1342
- facing: session ? "back" : "unknown"
1350
+ facing: session ? session.facing : "unknown"
1343
1351
  };
1344
1352
  }
1345
1353
  function createVisualDomain() {
@@ -1357,7 +1365,11 @@ function createVisualDomain() {
1357
1365
  };
1358
1366
  },
1359
1367
  async start(options) {
1360
- const s = visualEngine.startSession(options?.intent || "navigation");
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);
1361
1373
  visualEngine.setContextProvider({ heading: currentHeading });
1362
1374
  void startHeading("visual");
1363
1375
  return { id: s.id, intent: s.intent, startedAt: s.startedAt };
@@ -1862,6 +1874,14 @@ var CameraPreview = (() => {
1862
1874
  }
1863
1875
  })();
1864
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
+ }
1865
1885
  function isSupported() {
1866
1886
  try {
1867
1887
  return native2?.isSupported() ?? false;
@@ -1873,16 +1893,13 @@ function qualityById(id) {
1873
1893
  return native2?.qualityById?.(id) ?? null;
1874
1894
  }
1875
1895
  async function readText(id, languages) {
1876
- if (!native2) throw new Error("ada-vision native module not present in this build");
1877
- return native2.readText(id, languages ?? null);
1896
+ return verb("readText")(id, languages ?? null);
1878
1897
  }
1879
1898
  async function describe(id, maxLabels = 5) {
1880
- if (!native2) throw new Error("ada-vision native module not present in this build");
1881
- return native2.describe(id, maxLabels);
1899
+ return verb("describe")(id, maxLabels);
1882
1900
  }
1883
1901
  async function detectObjects(id, maxItems = 10, minConfidence = 0.25) {
1884
- if (!native2) throw new Error("ada-vision native module not present in this build");
1885
- return native2.detectObjects(id, maxItems, minConfidence);
1902
+ return verb("detectObjects")(id, maxItems, minConfidence);
1886
1903
  }
1887
1904
 
1888
1905
  // src/maps/index.ts
@@ -1900,22 +1917,22 @@ var shown = (v) => {
1900
1917
  s = s ?? String(v);
1901
1918
  return s.length > 80 ? `${s.slice(0, 77)}...` : s;
1902
1919
  };
1903
- function refuseArgument(capability, verb, problem, nothing) {
1904
- const e = new Error(`${capability}.${verb}: ${problem}; ${nothing}.`);
1920
+ function refuseArgument(capability, verb2, problem, nothing) {
1921
+ const e = new Error(`${capability}.${verb2}: ${problem}; ${nothing}.`);
1905
1922
  e.code = "INVALID_ARGUMENT";
1906
1923
  return e;
1907
1924
  }
1908
- function countArg(capability, verb, name, value, def, max, nothing) {
1925
+ function countArg(capability, verb2, name, value, def, max, nothing) {
1909
1926
  const v = value ?? def;
1910
1927
  if (typeof v !== "number" || !Number.isFinite(v) || v < 1) {
1911
- throw refuseArgument(capability, verb, `${name} must be a number from 1 (at most ${max} are used), not ${shown(value)}`, nothing);
1928
+ throw refuseArgument(capability, verb2, `${name} must be a number from 1 (at most ${max} are used), not ${shown(value)}`, nothing);
1912
1929
  }
1913
1930
  return Math.min(max, Math.floor(v));
1914
1931
  }
1915
- function fractionArg(capability, verb, name, value, def, nothing) {
1932
+ function fractionArg(capability, verb2, name, value, def, nothing) {
1916
1933
  const v = value ?? def;
1917
1934
  if (typeof v !== "number" || !Number.isFinite(v) || v < 0 || v > 1) {
1918
- throw refuseArgument(capability, verb, `${name} must be a number from 0 to 1, not ${shown(value)}`, nothing);
1935
+ throw refuseArgument(capability, verb2, `${name} must be a number from 0 to 1, not ${shown(value)}`, nothing);
1919
1936
  }
1920
1937
  return v;
1921
1938
  }
@@ -1926,15 +1943,15 @@ var SEARCH_RADIUS_MAX_M = 1e5;
1926
1943
  var SEARCH_LIMIT_DEFAULT = 8;
1927
1944
  var SEARCH_LIMIT_MAX = 25;
1928
1945
  var text = (v) => typeof v === "string" && v.trim() !== "" ? v : null;
1929
- var refuseArgument2 = (verb, problem, nothing) => refuseArgument("maps", verb, problem, nothing);
1930
- function coordinateArg(verb, name, value, nothing) {
1946
+ var refuseArgument2 = (verb2, problem, nothing) => refuseArgument("maps", verb2, problem, nothing);
1947
+ function coordinateArg(verb2, name, value, nothing) {
1931
1948
  const c = value;
1932
1949
  const latitude = c?.latitude, longitude = c?.longitude;
1933
1950
  if (typeof latitude === "number" && Number.isFinite(latitude) && Math.abs(latitude) <= 90 && typeof longitude === "number" && Number.isFinite(longitude) && Math.abs(longitude) <= 180) {
1934
1951
  return { latitude, longitude };
1935
1952
  }
1936
1953
  throw refuseArgument2(
1937
- verb,
1954
+ verb2,
1938
1955
  `${name} must be { latitude, longitude } numbers (latitude -90..90, longitude -180..180), not ${shown(value)}`,
1939
1956
  nothing
1940
1957
  );
@@ -2014,7 +2031,7 @@ function toMapsRoute(raw) {
2014
2031
  polyline: (raw.polyline ?? []).map(point)
2015
2032
  };
2016
2033
  }
2017
- function mapsFailure(verb, err) {
2034
+ function mapsFailure(verb2, err) {
2018
2035
  const nativeCode = String(err?.code ?? "");
2019
2036
  const detail = String(err?.message ?? err ?? "").trim();
2020
2037
  let code;
@@ -2033,7 +2050,7 @@ function mapsFailure(verb, err) {
2033
2050
  why = "the map service failed";
2034
2051
  }
2035
2052
  const failure = new Error(
2036
- `maps.${verb} could not look: ${why}. This is not "found nothing".` + (detail ? ` (${nativeCode ? nativeCode + ": " : ""}${detail})` : "")
2053
+ `maps.${verb2} could not look: ${why}. This is not "found nothing".` + (detail ? ` (${nativeCode ? nativeCode + ": " : ""}${detail})` : "")
2037
2054
  );
2038
2055
  failure.code = code;
2039
2056
  return failure;
@@ -2520,15 +2537,15 @@ function createStorageAPI(pluginId) {
2520
2537
  delete: (k) => import_async_storage6.default.removeItem(key(k)),
2521
2538
  db: {
2522
2539
  async execute(sql, params) {
2523
- const verb = sqlLeadingKeyword(sql);
2524
- if (verb === "ATTACH" || verb === "DETACH" || verb === "VACUUM") {
2540
+ const verb2 = sqlLeadingKeyword(sql);
2541
+ if (verb2 === "ATTACH" || verb2 === "DETACH" || verb2 === "VACUUM") {
2525
2542
  throw new CapabilityUnavailableError(
2526
2543
  "storage.db",
2527
- `SQL '${verb}' is not permitted: a plugin's storage is confined to its own database and cannot reach another file.`
2544
+ `SQL '${verb2}' is not permitted: a plugin's storage is confined to its own database and cannot reach another file.`
2528
2545
  );
2529
2546
  }
2530
2547
  const db = await openPluginDb(dbFile);
2531
- const returnsRows = verb === "SELECT" || verb === "PRAGMA" || verb === "WITH";
2548
+ const returnsRows = verb2 === "SELECT" || verb2 === "PRAGMA" || verb2 === "WITH";
2532
2549
  if (returnsRows) {
2533
2550
  const rows = await db.getAllAsync(sql, params ?? []);
2534
2551
  return { rows, changes: 0 };
@@ -2825,10 +2842,10 @@ function createVisionAPI() {
2825
2842
  };
2826
2843
  }
2827
2844
  function createMapsAPI() {
2828
- const refuseIfMissing = (verb, nothing) => {
2845
+ const refuseIfMissing = (verb2, nothing) => {
2829
2846
  const missing = missingReason();
2830
2847
  if (missing) {
2831
- throw new CapabilityUnavailableError(`maps.${verb}`, `maps.${verb} needs ${missing}; ${nothing}.`);
2848
+ throw new CapabilityUnavailableError(`maps.${verb2}`, `maps.${verb2} needs ${missing}; ${nothing}.`);
2832
2849
  }
2833
2850
  };
2834
2851
  return {