@ateam-ai-mobile/expo 0.1.18 → 0.1.20

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.
Files changed (68) hide show
  1. package/dist/bootstrap.d.mts +11 -0
  2. package/dist/bootstrap.d.ts +11 -0
  3. package/dist/bootstrap.js +12 -2
  4. package/dist/bootstrap.js.map +1 -1
  5. package/dist/bootstrap.mjs +11 -3
  6. package/dist/bootstrap.mjs.map +1 -1
  7. package/dist/capabilities/index.d.mts +112 -0
  8. package/dist/capabilities/index.d.ts +112 -0
  9. package/dist/{chunk-Z5AI2SXX.mjs → capabilities/index.js} +995 -225
  10. package/dist/capabilities/index.js.map +1 -0
  11. package/dist/capabilities/index.mjs +595 -0
  12. package/dist/capabilities/index.mjs.map +1 -0
  13. package/dist/chunk-AE55BKYV.mjs +24 -0
  14. package/dist/chunk-AE55BKYV.mjs.map +1 -0
  15. package/dist/chunk-GA7DS3PA.mjs +14 -0
  16. package/dist/chunk-GA7DS3PA.mjs.map +1 -0
  17. package/dist/chunk-GW7YGXOW.mjs +47 -0
  18. package/dist/chunk-GW7YGXOW.mjs.map +1 -0
  19. package/dist/chunk-IJPR5ITF.mjs +19 -0
  20. package/dist/chunk-IJPR5ITF.mjs.map +1 -0
  21. package/dist/chunk-KRGCWVDJ.mjs +815 -0
  22. package/dist/chunk-KRGCWVDJ.mjs.map +1 -0
  23. package/dist/chunk-RZDAY2GS.mjs +1009 -0
  24. package/dist/chunk-RZDAY2GS.mjs.map +1 -0
  25. package/dist/{chunk-DLDG77DX.mjs → chunk-SOUNJY7R.mjs} +6 -6
  26. package/dist/device/createDeviceProvider.mjs +4 -3
  27. package/dist/device-bridge/collectors/health.d.mts +1 -1
  28. package/dist/device-bridge/collectors/health.d.ts +1 -1
  29. package/dist/device-bridge/deviceId.d.mts +23 -0
  30. package/dist/device-bridge/deviceId.d.ts +23 -0
  31. package/dist/device-bridge/deviceId.js +45 -0
  32. package/dist/device-bridge/deviceId.js.map +1 -0
  33. package/dist/device-bridge/deviceId.mjs +12 -0
  34. package/dist/device-bridge/deviceId.mjs.map +1 -0
  35. package/dist/device-bridge/index.d.mts +2 -2
  36. package/dist/device-bridge/index.d.ts +2 -2
  37. package/dist/device-bridge/index.mjs +7 -5
  38. package/dist/push/index.d.mts +24 -0
  39. package/dist/push/index.d.ts +24 -0
  40. package/dist/push/index.js +224 -0
  41. package/dist/push/index.js.map +1 -0
  42. package/dist/push/index.mjs +174 -0
  43. package/dist/push/index.mjs.map +1 -0
  44. package/dist/push/silentSync.d.mts +8 -0
  45. package/dist/push/silentSync.d.ts +8 -0
  46. package/dist/push/silentSync.js +1075 -0
  47. package/dist/push/silentSync.js.map +1 -0
  48. package/dist/push/silentSync.mjs +67 -0
  49. package/dist/push/silentSync.mjs.map +1 -0
  50. package/dist/{types-BRanJYTn.d.mts → types-DFsbxj1m.d.mts} +1 -1
  51. package/dist/{types-BRanJYTn.d.ts → types-DFsbxj1m.d.ts} +1 -1
  52. package/package.json +29 -6
  53. package/src/bootstrap.ts +19 -0
  54. package/src/capabilities/CapabilitiesSetup.tsx +239 -0
  55. package/src/capabilities/CapabilityCard.tsx +188 -0
  56. package/src/capabilities/choices.ts +65 -0
  57. package/src/capabilities/config.ts +32 -0
  58. package/src/capabilities/index.ts +22 -0
  59. package/src/capabilities/store.ts +358 -0
  60. package/src/device-bridge/deviceId.ts +33 -0
  61. package/src/device-bridge/plugin.ts +1 -1
  62. package/src/push/index.ts +18 -0
  63. package/src/push/messaging.ts +49 -0
  64. package/src/push/registration.ts +31 -0
  65. package/src/push/silentSync.ts +83 -0
  66. package/src/push/usePushNotifications.ts +224 -0
  67. package/dist/chunk-Z5AI2SXX.mjs.map +0 -1
  68. /package/dist/{chunk-DLDG77DX.mjs.map → chunk-SOUNJY7R.mjs.map} +0 -0
@@ -5,19 +5,23 @@ import {
5
5
  createDeviceState,
6
6
  setupExpoProviders
7
7
  } from "./chunk-42FP5DTO.mjs";
8
+ import {
9
+ configureDeviceSync
10
+ } from "./chunk-GA7DS3PA.mjs";
8
11
  import {
9
12
  createDeviceProvider
10
- } from "./chunk-DLDG77DX.mjs";
13
+ } from "./chunk-SOUNJY7R.mjs";
14
+ import "./chunk-4BMWVN25.mjs";
11
15
  import "./chunk-6JX222YX.mjs";
12
16
  import "./chunk-6LXF3JVX.mjs";
13
17
  import "./chunk-FF6ZZZXH.mjs";
18
+ import "./chunk-KRGCWVDJ.mjs";
14
19
  import {
15
20
  connectivity_exports,
16
21
  location_exports
17
- } from "./chunk-Z5AI2SXX.mjs";
22
+ } from "./chunk-RZDAY2GS.mjs";
18
23
  import "./chunk-KOXF2FZM.mjs";
19
24
  import "./chunk-XQSY6MHP.mjs";
20
- import "./chunk-4BMWVN25.mjs";
21
25
  import "./chunk-7FWYEHN5.mjs";
22
26
  import "./chunk-J6XRNX7P.mjs";
23
27
  import "./chunk-WMJKH4XE.mjs";
@@ -55,6 +59,10 @@ function bootstrapExpoAdas(opts) {
55
59
  }
56
60
  const relay = opts.urls.relay;
57
61
  setPluginWebViewExtraHosts(() => relay ? [relay()] : []);
62
+ if (opts.deviceSync) {
63
+ if (!relay) throw new Error("bootstrapExpoAdas: deviceSync needs urls.relay");
64
+ configureDeviceSync({ relayUrl: relay, ...opts.deviceSync });
65
+ }
58
66
  setOAuthProvider(createExpoOAuthProvider({ googleIosClientId: opts.googleIosClientId }));
59
67
  setCallAudioProvider(createCallAudioProvider());
60
68
  if (opts.onReachabilityChange) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/bootstrap.ts","../src/audio/index.ts"],"sourcesContent":["/**\n * bootstrapExpoAdas — the single, self-contained SDK bootstrap (R10).\n *\n * The final high-level entry point of the \"fat SDK / thin shell\" arc: it folds\n * the ~15 hand-wired seams the host used to assemble in its own adas.ts into ONE\n * call, so the shell stops manually assembling platform providers/collectors/\n * plugins. Internally it initializes, in the order the migrated code established:\n * the Expo providers (haptics/bundle cache/clipboard/attachment cache + the\n * device-primitive provider), the host-bundled native plugins, the plugin-WebView\n * allow-list, native OAuth, the ACS reachability reporter, the L3 DeviceState\n * engine (with the SDK's OWN collectors — the shell injects none), the plugin/\n * UI-action navigator, and finally the core config+token bridge (initAdas).\n *\n * The API is DERIVED from the host's migrated adas.ts, not invented. Everything\n * the host still owns is passed in as a small values-and-getters bag: endpoint\n * getters (the host owns the dev/prod switch), the identity/token bridge, its\n * branded Google client id, its host-bundled plugin resolvers, the native\n * WebView module from its build, and its router callback.\n *\n * A SUBPATH (`@ateam-ai-mobile/expo/bootstrap`), like /device and /oauth: it\n * statically pulls the optional expo native modules (via createDeviceProvider /\n * the device-state collectors / the OAuth provider), so it must not sit on the\n * package's main entry, which a host without those modules still has to build.\n *\n * The two physical reasoning paths stay DISTINCT and are wired as SEPARATE\n * statements — never a merged bridge: LOCAL (the local tool registry + device\n * state the plugin/voice runtime reads) and SERVER (the relay allow-list here;\n * the DeviceBridge relay runtime itself is started by the host lifecycle, out of\n * this module-load bootstrap's scope).\n */\nimport { initAdas, setAcsReachabilityReporter, type TokenProvider, type AdasUser, type AdasSession } from '@ateam-ai-mobile/core';\nimport { setDeviceStateProvider, registerNativePlugin, registerPlatformDeviceTools, type RegisteredPlugin } from '@ateam-ai-mobile/plugin-runtime';\nimport { setOAuthProvider, setUIActionNavigator, setPluginWebViewExtraHosts, setCallAudioProvider, type UIActionRoute } from '@ateam-ai-mobile/ui';\nimport { createCallAudioProvider } from './audio';\n\nimport { setupExpoProviders, type ExpoAttachmentCache } from './index';\nimport { createDeviceProvider } from './device/createDeviceProvider';\nimport { createDeviceState } from './device-state';\nimport { createExpoOAuthProvider } from './oauth/expoOAuth';\nimport * as deviceConnectivity from './device-bridge/collectors/connectivity';\nimport * as deviceLocation from './device-bridge/collectors/location';\n\n/** A host-bundled native plugin: one lazy resolver registered under one or more ids. */\nexport interface NativePluginRegistration {\n resolver: () => Promise<RegisteredPlugin>;\n ids: string[];\n}\n\nexport interface BootstrapExpoAdasOptions {\n /**\n * Endpoint GETTERS — the host owns the dev/prod env switch, so these are read\n * live on every SDK request (never snapshotted). `core` is required; the rest\n * are optional (voice/consumer-auth features light up when present).\n */\n urls: {\n core: () => string;\n voice?: () => string;\n consumerAuth?: () => string;\n /** Trusted extra host for plugin WebViews (the relay device-bridge auth flows). */\n relay?: () => string;\n };\n /** The host's token bridge — outcome mapping (transient vs auth_failed) owned by the host. */\n tokenProvider: TokenProvider;\n /** Current user projection for chat routing (host reads its auth store). */\n getUser: () => AdasUser | null;\n /** Active tenant getter (signed-in tenant, falling back to the pre-auth pick). */\n tenant?: () => string;\n /** Adopt a freshly-minted session on tenant switch (host persists tenant-first, then logs in). */\n onSession?: (session: AdasSession) => void | Promise<void>;\n /** The host's bundled Google iOS client id, for the join/open-join OAuth path. */\n googleIosClientId?: string;\n /** Host-bundled native plugins (AuthWebView, ConnectionsPanel, …) — lazy resolvers. */\n nativePlugins?: NativePluginRegistration[];\n /** Native modules remote bundles may require() (e.g. react-native-webview) — from the host build. */\n bundleModules?: Record<string, unknown>;\n /** Pre-SDK AsyncStorage keys, so an existing install keeps its warm caches. */\n storageKeys?: { attachmentIndex?: string; bundleIndex?: string };\n /** Connectivity sink — the SDK reports fetch reachability up/down; the host feeds its banner. */\n onReachabilityChange?: (up: boolean) => void;\n /** Open the host's plugin screen for a UI-action chip (the host owns its router). */\n navigateToPlugin: (route: UIActionRoute) => void;\n /**\n * Reachability probe URL for the device-primitive connectivity API. The host\n * passes this EXPLICITLY (typically `${core}/health`) as a load-time snapshot —\n * deliberately NOT derived from `urls.core()`, so a dev/E2E core override does\n * not silently flow into the health probe (the asymmetry the host relied on).\n */\n reachabilityUrl?: string;\n}\n\n/**\n * Wire the entire Expo-backed ADAS platform in one call. Run for its side effect\n * at module load, before the router mounts. Returns the attachment cache so the\n * host can hand it to anything that needs it (initAdas already received it).\n */\nexport function bootstrapExpoAdas(opts: BootstrapExpoAdasOptions): { attachmentCache: ExpoAttachmentCache } {\n // Expo providers + the device-primitive implementation (props.device). The SDK\n // owns createDeviceProvider; the shell injects only its reachability URL.\n const { attachmentCache } = setupExpoProviders({\n bundleModules: opts.bundleModules,\n attachmentIndexKey: opts.storageKeys?.attachmentIndex,\n bundleIndexKey: opts.storageKeys?.bundleIndex,\n deviceProvider: createDeviceProvider({ reachabilityUrl: opts.reachabilityUrl }),\n });\n\n // Host-bundled native plugins: register each lazy resolver under its id aliases.\n for (const plugin of opts.nativePlugins ?? []) {\n for (const id of plugin.ids) registerNativePlugin(id, plugin.resolver);\n }\n\n // Plugin WebViews may navigate to the relay (device-bridge auth flows) —\n // whitelist it alongside core/voice. Getter → live across env switches.\n const relay = opts.urls.relay;\n setPluginWebViewExtraHosts(() => (relay ? [relay()] : []));\n\n // Native OAuth for the relocated auth screens (the ONLY native OAuth wiring).\n setOAuthProvider(createExpoOAuthProvider({ googleIosClientId: opts.googleIosClientId }));\n\n // The voice call's device audio mode (echo cancellation on the loudspeaker).\n setCallAudioProvider(createCallAudioProvider());\n\n // ACS fetch outcomes feed the host's connectivity banner (any response = up,\n // thrown fetch = down). The host's sink stays host-side (lazy, no load cycle).\n if (opts.onReachabilityChange) {\n const onReach = opts.onReachabilityChange;\n setAcsReachabilityReporter({ up: () => onReach(true), down: () => onReach(false) });\n }\n\n // L3 DeviceState (props.deviceState) — the SEMANTIC layer, wired with the SDK's\n // OWN device-bridge collectors. The shell injects none (the R10 payoff): an\n // undeclared/unimplemented domain returns explicit `unknown`s, never a silent\n // undefined. Kept a SEPARATE statement from the SERVER relay — the two\n // reasoning paths never merge.\n setDeviceStateProvider(\n createDeviceState({ connectivity: deviceConnectivity, location: deviceLocation }),\n );\n\n // LOCAL device tools — register the static, host-owned platform tools\n // (device.echo / device.ping) at load, so the device path answers even before\n // any plugin bundle or sign-in: the platform tier deliberately does not depend\n // on the thing being proved. A tenant's EXTERNAL device tools load on\n // session-authenticated, which the host wires to its auth-session subscription\n // via syncDeviceToolsForSession() — ambient, not voice-triggered.\n registerPlatformDeviceTools();\n\n // Plugin/UI-action chips delegate navigation to the host's router.\n setUIActionNavigator(opts.navigateToPlugin);\n\n // Core config + token bridge. URL getters (not snapshots) so the env switch\n // flows through; identity/token bridge owned by the host.\n initAdas({\n coreUrl: opts.urls.core,\n ...(opts.urls.voice ? { voiceUrl: opts.urls.voice } : {}),\n ...(opts.urls.consumerAuth ? { consumerAuthUrl: opts.urls.consumerAuth } : {}),\n ...(opts.onSession ? { onSession: opts.onSession } : {}),\n ...(opts.tenant ? { tenant: opts.tenant } : {}),\n getUser: opts.getUser,\n tokenProvider: opts.tokenProvider,\n attachmentCache,\n });\n\n return { attachmentCache };\n}\n","// Call audio mode for the voice call — see ios/AdaAudioModule.swift for why.\n//\n// requireOptionalNativeModule: on a binary WITHOUT the module (any build before\n// it shipped) this is null and the provider is a no-op, so an OTA carrying this\n// JS can never crash an older binary. Android: no module yet (its WebView echo\n// path is untouched).\nimport { requireOptionalNativeModule } from 'expo-modules-core';\nimport type { CallAudioProvider } from '@ateam-ai-mobile/ui';\n\ninterface AdaAudioNative {\n beginVoiceCall(): boolean;\n endVoiceCall(): boolean;\n}\n\nconst native = requireOptionalNativeModule<AdaAudioNative>('AdaAudio');\n\nexport function createCallAudioProvider(): CallAudioProvider | null {\n if (!native) return null;\n return {\n beginCall: () => { native.beginVoiceCall(); },\n endCall: () => { native.endVoiceCall(); },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAS,UAAU,kCAAuF;AAC1G,SAAS,wBAAwB,sBAAsB,mCAA0D;AACjH,SAAS,kBAAkB,sBAAsB,4BAA4B,4BAAgD;;;AC1B7H,SAAS,mCAAmC;AAQ5C,IAAM,SAAS,4BAA4C,UAAU;AAE9D,SAAS,0BAAoD;AAClE,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO;AAAA,IACL,WAAW,MAAM;AAAE,aAAO,eAAe;AAAA,IAAG;AAAA,IAC5C,SAAS,MAAM;AAAE,aAAO,aAAa;AAAA,IAAG;AAAA,EAC1C;AACF;;;ADyEO,SAAS,kBAAkB,MAA0E;AAG1G,QAAM,EAAE,gBAAgB,IAAI,mBAAmB;AAAA,IAC7C,eAAe,KAAK;AAAA,IACpB,oBAAoB,KAAK,aAAa;AAAA,IACtC,gBAAgB,KAAK,aAAa;AAAA,IAClC,gBAAgB,qBAAqB,EAAE,iBAAiB,KAAK,gBAAgB,CAAC;AAAA,EAChF,CAAC;AAGD,aAAW,UAAU,KAAK,iBAAiB,CAAC,GAAG;AAC7C,eAAW,MAAM,OAAO,IAAK,sBAAqB,IAAI,OAAO,QAAQ;AAAA,EACvE;AAIA,QAAM,QAAQ,KAAK,KAAK;AACxB,6BAA2B,MAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAE;AAGzD,mBAAiB,wBAAwB,EAAE,mBAAmB,KAAK,kBAAkB,CAAC,CAAC;AAGvF,uBAAqB,wBAAwB,CAAC;AAI9C,MAAI,KAAK,sBAAsB;AAC7B,UAAM,UAAU,KAAK;AACrB,+BAA2B,EAAE,IAAI,MAAM,QAAQ,IAAI,GAAG,MAAM,MAAM,QAAQ,KAAK,EAAE,CAAC;AAAA,EACpF;AAOA;AAAA,IACE,kBAAkB,EAAE,cAAc,sBAAoB,UAAU,iBAAe,CAAC;AAAA,EAClF;AAQA,8BAA4B;AAG5B,uBAAqB,KAAK,gBAAgB;AAI1C,WAAS;AAAA,IACP,SAAS,KAAK,KAAK;AAAA,IACnB,GAAI,KAAK,KAAK,QAAQ,EAAE,UAAU,KAAK,KAAK,MAAM,IAAI,CAAC;AAAA,IACvD,GAAI,KAAK,KAAK,eAAe,EAAE,iBAAiB,KAAK,KAAK,aAAa,IAAI,CAAC;AAAA,IAC5E,GAAI,KAAK,YAAY,EAAE,WAAW,KAAK,UAAU,IAAI,CAAC;AAAA,IACtD,GAAI,KAAK,SAAS,EAAE,QAAQ,KAAK,OAAO,IAAI,CAAC;AAAA,IAC7C,SAAS,KAAK;AAAA,IACd,eAAe,KAAK;AAAA,IACpB;AAAA,EACF,CAAC;AAED,SAAO,EAAE,gBAAgB;AAC3B;","names":[]}
1
+ {"version":3,"sources":["../src/bootstrap.ts","../src/audio/index.ts"],"sourcesContent":["/**\n * bootstrapExpoAdas — the single, self-contained SDK bootstrap (R10).\n *\n * The final high-level entry point of the \"fat SDK / thin shell\" arc: it folds\n * the ~15 hand-wired seams the host used to assemble in its own adas.ts into ONE\n * call, so the shell stops manually assembling platform providers/collectors/\n * plugins. Internally it initializes, in the order the migrated code established:\n * the Expo providers (haptics/bundle cache/clipboard/attachment cache + the\n * device-primitive provider), the host-bundled native plugins, the plugin-WebView\n * allow-list, native OAuth, the ACS reachability reporter, the L3 DeviceState\n * engine (with the SDK's OWN collectors — the shell injects none), the plugin/\n * UI-action navigator, and finally the core config+token bridge (initAdas).\n *\n * The API is DERIVED from the host's migrated adas.ts, not invented. Everything\n * the host still owns is passed in as a small values-and-getters bag: endpoint\n * getters (the host owns the dev/prod switch), the identity/token bridge, its\n * branded Google client id, its host-bundled plugin resolvers, the native\n * WebView module from its build, and its router callback.\n *\n * A SUBPATH (`@ateam-ai-mobile/expo/bootstrap`), like /device and /oauth: it\n * statically pulls the optional expo native modules (via createDeviceProvider /\n * the device-state collectors / the OAuth provider), so it must not sit on the\n * package's main entry, which a host without those modules still has to build.\n *\n * The two physical reasoning paths stay DISTINCT and are wired as SEPARATE\n * statements — never a merged bridge: LOCAL (the local tool registry + device\n * state the plugin/voice runtime reads) and SERVER (the relay allow-list here;\n * the DeviceBridge relay runtime itself is started by the host lifecycle, out of\n * this module-load bootstrap's scope).\n */\nimport { initAdas, setAcsReachabilityReporter, type TokenProvider, type AdasUser, type AdasSession } from '@ateam-ai-mobile/core';\nimport { setDeviceStateProvider, registerNativePlugin, registerPlatformDeviceTools, type RegisteredPlugin } from '@ateam-ai-mobile/plugin-runtime';\nimport { setOAuthProvider, setUIActionNavigator, setPluginWebViewExtraHosts, setCallAudioProvider, type UIActionRoute } from '@ateam-ai-mobile/ui';\nimport { createCallAudioProvider } from './audio';\n\nimport { setupExpoProviders, type ExpoAttachmentCache } from './index';\nimport { createDeviceProvider } from './device/createDeviceProvider';\nimport { createDeviceState } from './device-state';\nimport { createExpoOAuthProvider } from './oauth/expoOAuth';\nimport * as deviceConnectivity from './device-bridge/collectors/connectivity';\nimport * as deviceLocation from './device-bridge/collectors/location';\nimport { configureDeviceSync } from './capabilities/config';\nimport type { SecureKv } from './device-bridge/deviceId';\n\n/** A host-bundled native plugin: one lazy resolver registered under one or more ids. */\nexport interface NativePluginRegistration {\n resolver: () => Promise<RegisteredPlugin>;\n ids: string[];\n}\n\nexport interface BootstrapExpoAdasOptions {\n /**\n * Endpoint GETTERS — the host owns the dev/prod env switch, so these are read\n * live on every SDK request (never snapshotted). `core` is required; the rest\n * are optional (voice/consumer-auth features light up when present).\n */\n urls: {\n core: () => string;\n voice?: () => string;\n consumerAuth?: () => string;\n /** Trusted extra host for plugin WebViews (the relay device-bridge auth flows). */\n relay?: () => string;\n };\n /** The host's token bridge — outcome mapping (transient vs auth_failed) owned by the host. */\n tokenProvider: TokenProvider;\n /** Current user projection for chat routing (host reads its auth store). */\n getUser: () => AdasUser | null;\n /** Active tenant getter (signed-in tenant, falling back to the pre-auth pick). */\n tenant?: () => string;\n /** Adopt a freshly-minted session on tenant switch (host persists tenant-first, then logs in). */\n onSession?: (session: AdasSession) => void | Promise<void>;\n /** The host's bundled Google iOS client id, for the join/open-join OAuth path. */\n googleIosClientId?: string;\n /** Host-bundled native plugins (AuthWebView, ConnectionsPanel, …) — lazy resolvers. */\n nativePlugins?: NativePluginRegistration[];\n /** Native modules remote bundles may require() (e.g. react-native-webview) — from the host build. */\n bundleModules?: Record<string, unknown>;\n /** Pre-SDK AsyncStorage keys, so an existing install keeps its warm caches. */\n storageKeys?: { attachmentIndex?: string; bundleIndex?: string };\n /** Connectivity sink — the SDK reports fetch reachability up/down; the host feeds its banner. */\n onReachabilityChange?: (up: boolean) => void;\n /** Open the host's plugin screen for a UI-action chip (the host owns its router). */\n navigateToPlugin: (route: UIActionRoute) => void;\n /**\n * Reachability probe URL for the device-primitive connectivity API. The host\n * passes this EXPLICITLY (typically `${core}/health`) as a load-time snapshot —\n * deliberately NOT derived from `urls.core()`, so a dev/E2E core override does\n * not silently flow into the health probe (the asymmetry the host relied on).\n */\n reachabilityUrl?: string;\n /**\n * Device sync (the user's device permissions → the relay). Needs `urls.relay`.\n * Leave it out and the capabilities store refuses to start the bridge, by name.\n */\n deviceSync?: {\n /** The relay's shared key, sent as `Authorization: Bearer`. */\n relayKey: string;\n /** Secure storage for the install's device id (Keychain / Keystore). */\n secureStorage: SecureKv;\n };\n}\n\n/**\n * Wire the entire Expo-backed ADAS platform in one call. Run for its side effect\n * at module load, before the router mounts. Returns the attachment cache so the\n * host can hand it to anything that needs it (initAdas already received it).\n */\nexport function bootstrapExpoAdas(opts: BootstrapExpoAdasOptions): { attachmentCache: ExpoAttachmentCache } {\n // Expo providers + the device-primitive implementation (props.device). The SDK\n // owns createDeviceProvider; the shell injects only its reachability URL.\n const { attachmentCache } = setupExpoProviders({\n bundleModules: opts.bundleModules,\n attachmentIndexKey: opts.storageKeys?.attachmentIndex,\n bundleIndexKey: opts.storageKeys?.bundleIndex,\n deviceProvider: createDeviceProvider({ reachabilityUrl: opts.reachabilityUrl }),\n });\n\n // Host-bundled native plugins: register each lazy resolver under its id aliases.\n for (const plugin of opts.nativePlugins ?? []) {\n for (const id of plugin.ids) registerNativePlugin(id, plugin.resolver);\n }\n\n // Plugin WebViews may navigate to the relay (device-bridge auth flows) —\n // whitelist it alongside core/voice. Getter → live across env switches.\n const relay = opts.urls.relay;\n setPluginWebViewExtraHosts(() => (relay ? [relay()] : []));\n\n // Device sync settings for the capabilities store — values only; the bootstrap\n // loads no device-bridge code for this.\n if (opts.deviceSync) {\n if (!relay) throw new Error('bootstrapExpoAdas: deviceSync needs urls.relay');\n configureDeviceSync({ relayUrl: relay, ...opts.deviceSync });\n }\n\n // Native OAuth for the relocated auth screens (the ONLY native OAuth wiring).\n setOAuthProvider(createExpoOAuthProvider({ googleIosClientId: opts.googleIosClientId }));\n\n // The voice call's device audio mode (echo cancellation on the loudspeaker).\n setCallAudioProvider(createCallAudioProvider());\n\n // ACS fetch outcomes feed the host's connectivity banner (any response = up,\n // thrown fetch = down). The host's sink stays host-side (lazy, no load cycle).\n if (opts.onReachabilityChange) {\n const onReach = opts.onReachabilityChange;\n setAcsReachabilityReporter({ up: () => onReach(true), down: () => onReach(false) });\n }\n\n // L3 DeviceState (props.deviceState) — the SEMANTIC layer, wired with the SDK's\n // OWN device-bridge collectors. The shell injects none (the R10 payoff): an\n // undeclared/unimplemented domain returns explicit `unknown`s, never a silent\n // undefined. Kept a SEPARATE statement from the SERVER relay — the two\n // reasoning paths never merge.\n setDeviceStateProvider(\n createDeviceState({ connectivity: deviceConnectivity, location: deviceLocation }),\n );\n\n // LOCAL device tools — register the static, host-owned platform tools\n // (device.echo / device.ping) at load, so the device path answers even before\n // any plugin bundle or sign-in: the platform tier deliberately does not depend\n // on the thing being proved. A tenant's EXTERNAL device tools load on\n // session-authenticated, which the host wires to its auth-session subscription\n // via syncDeviceToolsForSession() — ambient, not voice-triggered.\n registerPlatformDeviceTools();\n\n // Plugin/UI-action chips delegate navigation to the host's router.\n setUIActionNavigator(opts.navigateToPlugin);\n\n // Core config + token bridge. URL getters (not snapshots) so the env switch\n // flows through; identity/token bridge owned by the host.\n initAdas({\n coreUrl: opts.urls.core,\n ...(opts.urls.voice ? { voiceUrl: opts.urls.voice } : {}),\n ...(opts.urls.consumerAuth ? { consumerAuthUrl: opts.urls.consumerAuth } : {}),\n ...(opts.onSession ? { onSession: opts.onSession } : {}),\n ...(opts.tenant ? { tenant: opts.tenant } : {}),\n getUser: opts.getUser,\n tokenProvider: opts.tokenProvider,\n attachmentCache,\n });\n\n return { attachmentCache };\n}\n","// Call audio mode for the voice call — see ios/AdaAudioModule.swift for why.\n//\n// requireOptionalNativeModule: on a binary WITHOUT the module (any build before\n// it shipped) this is null and the provider is a no-op, so an OTA carrying this\n// JS can never crash an older binary. Android: no module yet (its WebView echo\n// path is untouched).\nimport { requireOptionalNativeModule } from 'expo-modules-core';\nimport type { CallAudioProvider } from '@ateam-ai-mobile/ui';\n\ninterface AdaAudioNative {\n beginVoiceCall(): boolean;\n endVoiceCall(): boolean;\n}\n\nconst native = requireOptionalNativeModule<AdaAudioNative>('AdaAudio');\n\nexport function createCallAudioProvider(): CallAudioProvider | null {\n if (!native) return null;\n return {\n beginCall: () => { native.beginVoiceCall(); },\n endCall: () => { native.endVoiceCall(); },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAS,UAAU,kCAAuF;AAC1G,SAAS,wBAAwB,sBAAsB,mCAA0D;AACjH,SAAS,kBAAkB,sBAAsB,4BAA4B,4BAAgD;;;AC1B7H,SAAS,mCAAmC;AAQ5C,IAAM,SAAS,4BAA4C,UAAU;AAE9D,SAAS,0BAAoD;AAClE,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO;AAAA,IACL,WAAW,MAAM;AAAE,aAAO,eAAe;AAAA,IAAG;AAAA,IAC5C,SAAS,MAAM;AAAE,aAAO,aAAa;AAAA,IAAG;AAAA,EAC1C;AACF;;;ADqFO,SAAS,kBAAkB,MAA0E;AAG1G,QAAM,EAAE,gBAAgB,IAAI,mBAAmB;AAAA,IAC7C,eAAe,KAAK;AAAA,IACpB,oBAAoB,KAAK,aAAa;AAAA,IACtC,gBAAgB,KAAK,aAAa;AAAA,IAClC,gBAAgB,qBAAqB,EAAE,iBAAiB,KAAK,gBAAgB,CAAC;AAAA,EAChF,CAAC;AAGD,aAAW,UAAU,KAAK,iBAAiB,CAAC,GAAG;AAC7C,eAAW,MAAM,OAAO,IAAK,sBAAqB,IAAI,OAAO,QAAQ;AAAA,EACvE;AAIA,QAAM,QAAQ,KAAK,KAAK;AACxB,6BAA2B,MAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAE;AAIzD,MAAI,KAAK,YAAY;AACnB,QAAI,CAAC,MAAO,OAAM,IAAI,MAAM,gDAAgD;AAC5E,wBAAoB,EAAE,UAAU,OAAO,GAAG,KAAK,WAAW,CAAC;AAAA,EAC7D;AAGA,mBAAiB,wBAAwB,EAAE,mBAAmB,KAAK,kBAAkB,CAAC,CAAC;AAGvF,uBAAqB,wBAAwB,CAAC;AAI9C,MAAI,KAAK,sBAAsB;AAC7B,UAAM,UAAU,KAAK;AACrB,+BAA2B,EAAE,IAAI,MAAM,QAAQ,IAAI,GAAG,MAAM,MAAM,QAAQ,KAAK,EAAE,CAAC;AAAA,EACpF;AAOA;AAAA,IACE,kBAAkB,EAAE,cAAc,sBAAoB,UAAU,iBAAe,CAAC;AAAA,EAClF;AAQA,8BAA4B;AAG5B,uBAAqB,KAAK,gBAAgB;AAI1C,WAAS;AAAA,IACP,SAAS,KAAK,KAAK;AAAA,IACnB,GAAI,KAAK,KAAK,QAAQ,EAAE,UAAU,KAAK,KAAK,MAAM,IAAI,CAAC;AAAA,IACvD,GAAI,KAAK,KAAK,eAAe,EAAE,iBAAiB,KAAK,KAAK,aAAa,IAAI,CAAC;AAAA,IAC5E,GAAI,KAAK,YAAY,EAAE,WAAW,KAAK,UAAU,IAAI,CAAC;AAAA,IACtD,GAAI,KAAK,SAAS,EAAE,QAAQ,KAAK,OAAO,IAAI,CAAC;AAAA,IAC7C,SAAS,KAAK;AAAA,IACd,eAAe,KAAK;AAAA,IACpB;AAAA,EACF,CAAC;AAED,SAAO,EAAE,gBAAgB;AAC3B;","names":[]}
@@ -0,0 +1,112 @@
1
+ import * as zustand from 'zustand';
2
+ import { P as PermissionState } from '../types-DFsbxj1m.mjs';
3
+ import { SecureKv } from '../device-bridge/deviceId.mjs';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { ReactNode } from 'react';
6
+
7
+ /**
8
+ * Device permissions — the one source of truth for what this device shares.
9
+ *
10
+ * Owns the DeviceBridge instance. Capability definitions come FROM the device
11
+ * bridge (allBuiltIn()), not hardcoded anywhere.
12
+ *
13
+ * Two levels of permission:
14
+ * 1. User opt-in (a toggle in the host's UI) — saved in AsyncStorage
15
+ * 2. OS permission (system dialog) — requested only AFTER the user opts in
16
+ *
17
+ * Flow:
18
+ * App start → initialize() loads built-in caps + saved choices
19
+ * Setup screen → user toggles → completeSetup()
20
+ * Host sees signed in + hasCompletedSetup → startBridge()
21
+ * startBridge() → registers enabled caps, requests OS perms, starts sync
22
+ * Settings toggle → toggleCapability() → starts/stops sync on the fly
23
+ *
24
+ * Moved from ateam-mobile src/stores/capabilitiesStore.ts (2026-10-29). The
25
+ * tenant and user are now read from the SDK session at start (never a stored
26
+ * copy), the bridge no longer starts under a made-up 'default' user, and a
27
+ * start after a team switch replaces the bridge that still synced to the old
28
+ * team (the old switch-time stop went away with the app's switchTenant, df7f6f72).
29
+ */
30
+ interface CapabilityState {
31
+ id: string;
32
+ name: string;
33
+ description: string;
34
+ reason: string;
35
+ icon: string;
36
+ requiresPermission: boolean;
37
+ /** User's choice in the host's UI */
38
+ enabled: boolean;
39
+ /** OS-level permission status */
40
+ osPermission: PermissionState;
41
+ }
42
+ interface CapabilitiesState {
43
+ capabilities: CapabilityState[];
44
+ hasCompletedSetup: boolean;
45
+ isLoading: boolean;
46
+ bridgeRunning: boolean;
47
+ /** Initialize — load built-in capabilities from device-bridge + saved user preferences */
48
+ initialize: () => Promise<void>;
49
+ /** Toggle a capability on/off, persist, and update bridge if running */
50
+ toggleCapability: (id: string, enabled: boolean) => Promise<void>;
51
+ /** Update OS permission state for a capability */
52
+ setOsPermission: (id: string, state: PermissionState) => void;
53
+ /** Mark initial setup as complete */
54
+ completeSetup: () => Promise<void>;
55
+ /**
56
+ * Start the device bridge for the signed-in user and team (call after setup is
57
+ * done, and again whenever the team or user changes). Safe to call often: calls
58
+ * run one at a time, a bridge already running for this session is kept, and one
59
+ * running for another team or user is replaced.
60
+ */
61
+ startBridge: () => Promise<void>;
62
+ /** Stop the device bridge (call on sign-out; a team switch is a startBridge() call) */
63
+ stopBridge: () => void;
64
+ /** Force an immediate sync of all permitted capabilities. */
65
+ syncNow: () => Promise<{
66
+ ok: boolean;
67
+ error?: string;
68
+ }>;
69
+ }
70
+ declare const useCapabilitiesStore: zustand.UseBoundStore<zustand.StoreApi<CapabilitiesState>>;
71
+
72
+ /**
73
+ * Device-sync settings the host provides once (bootstrapExpoAdas `deviceSync`,
74
+ * or configureDeviceSync directly). Kept apart from the store so the bootstrap
75
+ * can set them without loading the device bridge at module load.
76
+ */
77
+
78
+ interface DeviceSyncConfig {
79
+ /** Relay base URL getter — read on every start, so an env switch flows through. */
80
+ relayUrl: () => string;
81
+ /** The relay's shared key, sent as `Authorization: Bearer`. Empty = the relay answers 401. */
82
+ relayKey: string;
83
+ /** Secure storage for the install's device id. */
84
+ secureStorage: SecureKv;
85
+ }
86
+ declare function configureDeviceSync(next: DeviceSyncConfig): void;
87
+
88
+ interface CapabilitiesSetupProps {
89
+ /** Called after the user continues or skips; the choices are already saved. */
90
+ onComplete: () => void;
91
+ /** Drawn above the title — e.g. the host's logo. */
92
+ header?: ReactNode;
93
+ title?: string;
94
+ subtitle?: string;
95
+ /** Shown while the saved choices load. Default: a spinner. */
96
+ loading?: ReactNode;
97
+ }
98
+ /**
99
+ * Drop-in first-run screen: the user picks what this device shares, then
100
+ * continues (or skips, which turns everything off). Reads and writes
101
+ * useCapabilitiesStore; the host starts the bridge once setup is complete.
102
+ */
103
+ declare function CapabilitiesSetup({ onComplete, header, title, subtitle, loading, }: CapabilitiesSetupProps): react_jsx_runtime.JSX.Element;
104
+
105
+ interface CapabilityCardProps {
106
+ capability: CapabilityState;
107
+ onToggle: (id: string, enabled: boolean) => void;
108
+ }
109
+ /** One capability with its on/off switch and OS-permission badge. */
110
+ declare function CapabilityCard({ capability, onToggle }: CapabilityCardProps): react_jsx_runtime.JSX.Element;
111
+
112
+ export { CapabilitiesSetup, type CapabilitiesSetupProps, CapabilityCard, type CapabilityCardProps, type CapabilityState, type DeviceSyncConfig, configureDeviceSync, useCapabilitiesStore };
@@ -0,0 +1,112 @@
1
+ import * as zustand from 'zustand';
2
+ import { P as PermissionState } from '../types-DFsbxj1m.js';
3
+ import { SecureKv } from '../device-bridge/deviceId.js';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { ReactNode } from 'react';
6
+
7
+ /**
8
+ * Device permissions — the one source of truth for what this device shares.
9
+ *
10
+ * Owns the DeviceBridge instance. Capability definitions come FROM the device
11
+ * bridge (allBuiltIn()), not hardcoded anywhere.
12
+ *
13
+ * Two levels of permission:
14
+ * 1. User opt-in (a toggle in the host's UI) — saved in AsyncStorage
15
+ * 2. OS permission (system dialog) — requested only AFTER the user opts in
16
+ *
17
+ * Flow:
18
+ * App start → initialize() loads built-in caps + saved choices
19
+ * Setup screen → user toggles → completeSetup()
20
+ * Host sees signed in + hasCompletedSetup → startBridge()
21
+ * startBridge() → registers enabled caps, requests OS perms, starts sync
22
+ * Settings toggle → toggleCapability() → starts/stops sync on the fly
23
+ *
24
+ * Moved from ateam-mobile src/stores/capabilitiesStore.ts (2026-10-29). The
25
+ * tenant and user are now read from the SDK session at start (never a stored
26
+ * copy), the bridge no longer starts under a made-up 'default' user, and a
27
+ * start after a team switch replaces the bridge that still synced to the old
28
+ * team (the old switch-time stop went away with the app's switchTenant, df7f6f72).
29
+ */
30
+ interface CapabilityState {
31
+ id: string;
32
+ name: string;
33
+ description: string;
34
+ reason: string;
35
+ icon: string;
36
+ requiresPermission: boolean;
37
+ /** User's choice in the host's UI */
38
+ enabled: boolean;
39
+ /** OS-level permission status */
40
+ osPermission: PermissionState;
41
+ }
42
+ interface CapabilitiesState {
43
+ capabilities: CapabilityState[];
44
+ hasCompletedSetup: boolean;
45
+ isLoading: boolean;
46
+ bridgeRunning: boolean;
47
+ /** Initialize — load built-in capabilities from device-bridge + saved user preferences */
48
+ initialize: () => Promise<void>;
49
+ /** Toggle a capability on/off, persist, and update bridge if running */
50
+ toggleCapability: (id: string, enabled: boolean) => Promise<void>;
51
+ /** Update OS permission state for a capability */
52
+ setOsPermission: (id: string, state: PermissionState) => void;
53
+ /** Mark initial setup as complete */
54
+ completeSetup: () => Promise<void>;
55
+ /**
56
+ * Start the device bridge for the signed-in user and team (call after setup is
57
+ * done, and again whenever the team or user changes). Safe to call often: calls
58
+ * run one at a time, a bridge already running for this session is kept, and one
59
+ * running for another team or user is replaced.
60
+ */
61
+ startBridge: () => Promise<void>;
62
+ /** Stop the device bridge (call on sign-out; a team switch is a startBridge() call) */
63
+ stopBridge: () => void;
64
+ /** Force an immediate sync of all permitted capabilities. */
65
+ syncNow: () => Promise<{
66
+ ok: boolean;
67
+ error?: string;
68
+ }>;
69
+ }
70
+ declare const useCapabilitiesStore: zustand.UseBoundStore<zustand.StoreApi<CapabilitiesState>>;
71
+
72
+ /**
73
+ * Device-sync settings the host provides once (bootstrapExpoAdas `deviceSync`,
74
+ * or configureDeviceSync directly). Kept apart from the store so the bootstrap
75
+ * can set them without loading the device bridge at module load.
76
+ */
77
+
78
+ interface DeviceSyncConfig {
79
+ /** Relay base URL getter — read on every start, so an env switch flows through. */
80
+ relayUrl: () => string;
81
+ /** The relay's shared key, sent as `Authorization: Bearer`. Empty = the relay answers 401. */
82
+ relayKey: string;
83
+ /** Secure storage for the install's device id. */
84
+ secureStorage: SecureKv;
85
+ }
86
+ declare function configureDeviceSync(next: DeviceSyncConfig): void;
87
+
88
+ interface CapabilitiesSetupProps {
89
+ /** Called after the user continues or skips; the choices are already saved. */
90
+ onComplete: () => void;
91
+ /** Drawn above the title — e.g. the host's logo. */
92
+ header?: ReactNode;
93
+ title?: string;
94
+ subtitle?: string;
95
+ /** Shown while the saved choices load. Default: a spinner. */
96
+ loading?: ReactNode;
97
+ }
98
+ /**
99
+ * Drop-in first-run screen: the user picks what this device shares, then
100
+ * continues (or skips, which turns everything off). Reads and writes
101
+ * useCapabilitiesStore; the host starts the bridge once setup is complete.
102
+ */
103
+ declare function CapabilitiesSetup({ onComplete, header, title, subtitle, loading, }: CapabilitiesSetupProps): react_jsx_runtime.JSX.Element;
104
+
105
+ interface CapabilityCardProps {
106
+ capability: CapabilityState;
107
+ onToggle: (id: string, enabled: boolean) => void;
108
+ }
109
+ /** One capability with its on/off switch and OS-permission badge. */
110
+ declare function CapabilityCard({ capability, onToggle }: CapabilityCardProps): react_jsx_runtime.JSX.Element;
111
+
112
+ export { CapabilitiesSetup, type CapabilitiesSetupProps, CapabilityCard, type CapabilityCardProps, type CapabilityState, type DeviceSyncConfig, configureDeviceSync, useCapabilitiesStore };