@ateam-ai-mobile/plugin-runtime 0.1.8 → 0.1.10
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/{chunk-RXR6M623.mjs → chunk-SICFDA5K.mjs} +121 -15
- package/dist/chunk-SICFDA5K.mjs.map +1 -0
- package/dist/index.d.mts +114 -18
- package/dist/index.d.ts +114 -18
- package/dist/index.js +142 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -59
- package/dist/index.mjs.map +1 -1
- package/dist/{loader-UUOPZQSI.mjs → loader-MSZ4PVTO.mjs} +2 -2
- package/package.json +2 -2
- package/src/api/plugins.ts +15 -9
- package/src/bundles/bundleManager.ts +28 -9
- package/src/bundles/bundleModuleNames.ts +52 -0
- package/src/bundles/bundleUrl.ts +41 -0
- package/src/bundles/storage.ts +52 -0
- package/src/hooks/usePlugin.ts +2 -1
- package/src/index.ts +10 -36
- package/src/sdk/CameraPreview.tsx +7 -0
- package/src/sdk/device-state.ts +20 -7
- package/src/sdk/index.ts +34 -0
- package/src/sdk/types.ts +13 -0
- package/src/sdk/voice.ts +48 -4
- package/src/tools/loader.ts +4 -2
- package/src/tools/registry.ts +2 -2
- package/dist/chunk-RXR6M623.mjs.map +0 -1
- /package/dist/{loader-UUOPZQSI.mjs.map → loader-MSZ4PVTO.mjs.map} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -6,12 +6,15 @@ import { View, TextInput } from 'react-native';
|
|
|
6
6
|
export { ActivityIndicator, Animated, FlatList, Image, Modal, Platform, Pressable, RefreshControl, ScrollView, SectionList, StyleSheet, Switch, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Device state — Device Bridge v2, the SEMANTIC layer.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* Repo path:
|
|
12
12
|
* packages/plugin-runtime/src/sdk/device-state.ts
|
|
13
|
-
*
|
|
14
|
-
* '@adas/
|
|
13
|
+
* Module specifier for plugin bundles:
|
|
14
|
+
* '@adas/plugin-sdk' — the only SDK module a bundle can require. This file
|
|
15
|
+
* once named '@adas/device-state' here (4110943); the require shim never
|
|
16
|
+
* resolved it, so a bundle that imported it got `{}` and failed later. It is
|
|
17
|
+
* now refused by name at evaluation (bundles/bundleModuleNames.ts).
|
|
15
18
|
*
|
|
16
19
|
* ─────────────────────────────────────────────────────────────────────────
|
|
17
20
|
* WHICH LAYER AM I IN?
|
|
@@ -22,7 +25,7 @@ export { ActivityIndicator, Animated, FlatList, Image, Modal, Platform, Pressabl
|
|
|
22
25
|
* Returns a BARE value. THROWS when it cannot.
|
|
23
26
|
* Declared in the manifest as `capabilities: { camera: true }`
|
|
24
27
|
* (the legacy `native: {}` field is still honoured).
|
|
25
|
-
*
|
|
28
|
+
* Its types are imported from '@adas/plugin-sdk'.
|
|
26
29
|
*
|
|
27
30
|
* props.deviceState.* SEMANTIC. "What is true right now, and how well do
|
|
28
31
|
* we know it?"
|
|
@@ -31,7 +34,8 @@ export { ActivityIndicator, Animated, FlatList, Image, Modal, Platform, Pressabl
|
|
|
31
34
|
* and able to say `unknown` in every field.
|
|
32
35
|
* A read NEVER throws for absence.
|
|
33
36
|
* Declared in the manifest as `stateDomains: ['visual']`.
|
|
34
|
-
*
|
|
37
|
+
* Defined in this file; its types and helpers are
|
|
38
|
+
* imported from '@adas/plugin-sdk' too.
|
|
35
39
|
*
|
|
36
40
|
* The two containers are the discriminator. Every semantic call in a plugin
|
|
37
41
|
* begins with the eight characters `deviceState.`; every mechanical call
|
|
@@ -519,8 +523,19 @@ interface VisualDomain {
|
|
|
519
523
|
}
|
|
520
524
|
/** FROZEN (API_FREEZE §5, VOCABULARY §"Human Activity Values"). */
|
|
521
525
|
type HumanActivity = 'stationary' | 'walking' | 'running' | 'cycling' | 'driving' | 'unknown';
|
|
522
|
-
/**
|
|
523
|
-
|
|
526
|
+
/**
|
|
527
|
+
* FROZEN. Independent of HumanActivity — walking+pocket, driving+mounted.
|
|
528
|
+
*
|
|
529
|
+
* What is returned TODAY: `handheld`, `table` and `unknown` only. Do not write
|
|
530
|
+
* a branch that waits for `pocket` or `mounted`; it will never run. A pocketed
|
|
531
|
+
* phone shows up in the Visual domain's frame quality (`obstructed: true` /
|
|
532
|
+
* `exposure: 'dark'`), not here.
|
|
533
|
+
*/
|
|
534
|
+
type DevicePlacement = 'handheld'
|
|
535
|
+
/** RESERVED — never returned until the proximity/light sensor is wired. */
|
|
536
|
+
| 'pocket' | 'table'
|
|
537
|
+
/** RESERVED — never returned until Bluetooth/CarPlay mount context is wired. */
|
|
538
|
+
| 'mounted' | 'unknown';
|
|
524
539
|
/**
|
|
525
540
|
* FROZEN. Note `driving` is BOTH an intent here and a HumanActivity value
|
|
526
541
|
* above. The docs define no relationship between the two and do not flag the
|
|
@@ -1014,6 +1029,7 @@ declare namespace deviceState {
|
|
|
1014
1029
|
*
|
|
1015
1030
|
* See docs/handoff/SPEC_voice_session_without_the_voice_screen_2026-09-12.md.
|
|
1016
1031
|
*/
|
|
1032
|
+
|
|
1017
1033
|
/** The session lifecycle — identical vocabulary to the built-in `CallState`. */
|
|
1018
1034
|
type VoiceState = 'idle' | 'connecting' | 'connected' | 'error';
|
|
1019
1035
|
/** One line of the conversation. `tool` entries are device/skill tool activity. */
|
|
@@ -1022,6 +1038,40 @@ interface VoiceTranscriptEntry {
|
|
|
1022
1038
|
text: string;
|
|
1023
1039
|
ts: number;
|
|
1024
1040
|
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Why a device-tool call the session received did not produce a result.
|
|
1043
|
+
* - the tool RAN and did not return: `not_found` | `no_context` | `timeout` |
|
|
1044
|
+
* `failed` (it threw) — see DeviceToolFailureReason;
|
|
1045
|
+
* - the phone REFUSED it before running: `not_ready` (Core's tool allowset for
|
|
1046
|
+
* this session had not arrived yet — transient, a retry can succeed) or
|
|
1047
|
+
* `not_authorized` (not allowed in this session — final);
|
|
1048
|
+
* - `invalid`: the call itself was malformed (it named no tool, or carried no
|
|
1049
|
+
* correlationId to answer on) — not run.
|
|
1050
|
+
*/
|
|
1051
|
+
type VoiceDeviceToolReason = DeviceToolFailureReason | 'not_ready' | 'not_authorized' | 'invalid';
|
|
1052
|
+
/**
|
|
1053
|
+
* One finished device-tool call, as `VoiceSnapshot.lastDeviceTool` reports it.
|
|
1054
|
+
* `name` and `at` keep their original meaning, so a reader of just those two is
|
|
1055
|
+
* unaffected.
|
|
1056
|
+
*/
|
|
1057
|
+
type VoiceDeviceToolCall = {
|
|
1058
|
+
/** The tool the model called ('' if the call named none — see `invalid`). */
|
|
1059
|
+
name: string;
|
|
1060
|
+
/** Epoch ms the call REACHED the phone (not when it finished — that is at + ms). */
|
|
1061
|
+
at: number;
|
|
1062
|
+
/** Milliseconds from arrival to outcome (≈0 for a refusal). */
|
|
1063
|
+
ms: number;
|
|
1064
|
+
} & ({
|
|
1065
|
+
ok: true;
|
|
1066
|
+
reason: null;
|
|
1067
|
+
error: null;
|
|
1068
|
+
} | {
|
|
1069
|
+
ok: false;
|
|
1070
|
+
reason: VoiceDeviceToolReason;
|
|
1071
|
+
/** What went wrong, clipped to 200 characters: tool errors can echo the
|
|
1072
|
+
* call's arguments, which may carry what the user said. */
|
|
1073
|
+
error: string;
|
|
1074
|
+
});
|
|
1025
1075
|
/** A point-in-time read of the session — what a reasoning loop polls. */
|
|
1026
1076
|
interface VoiceSnapshot {
|
|
1027
1077
|
state: VoiceState;
|
|
@@ -1045,13 +1095,18 @@ interface VoiceSnapshot {
|
|
|
1045
1095
|
/** The last error, if `state === 'error'`; also carries a refusal reason when
|
|
1046
1096
|
* this surface was handed to a plugin that did not declare `voice`. */
|
|
1047
1097
|
lastError: string | null;
|
|
1048
|
-
/**
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1098
|
+
/**
|
|
1099
|
+
* The most recently FINISHED device-tool call the model made through this
|
|
1100
|
+
* session, with its outcome — or null if none has finished yet. Set once the
|
|
1101
|
+
* outcome is known (ran, refused, malformed, threw, timed out), never on
|
|
1102
|
+
* arrival, so a refused call can no longer look like one that ran.
|
|
1103
|
+
*
|
|
1104
|
+
* SCOPED to the caller: a plugin sees only calls to tools IT registered (never
|
|
1105
|
+
* another solution's tool names or errors, even on its own call); the platform
|
|
1106
|
+
* sees every call. Cleared when the session ends or a new one starts.
|
|
1107
|
+
* Diagnostic — every solution's debug view gets "why did that call fail" free.
|
|
1108
|
+
*/
|
|
1109
|
+
lastDeviceTool: VoiceDeviceToolCall | null;
|
|
1055
1110
|
/** The sessionId the Core allowset is bound to. Diagnostic: authorization
|
|
1056
1111
|
* requires it to equal `sessionId`; a mismatch is why tools refuse. */
|
|
1057
1112
|
authorizedSessionId: string | null;
|
|
@@ -1937,6 +1992,18 @@ interface DeviceToolContext {
|
|
|
1937
1992
|
signal?: AbortSignal;
|
|
1938
1993
|
}
|
|
1939
1994
|
type DeviceToolFn = (args: any, ctx: DeviceToolContext) => Promise<any> | any;
|
|
1995
|
+
/**
|
|
1996
|
+
* Why running a device tool produced no result (`callDeviceTool`'s
|
|
1997
|
+
* `{ ok: false, reason }`). The one list: the registry returns these, and the
|
|
1998
|
+
* voice snapshot's `lastDeviceTool.reason` carries them unchanged.
|
|
1999
|
+
* - `not_found` — no tool is registered under that name.
|
|
2000
|
+
* - `no_context` — the tool's device context could not be built.
|
|
2001
|
+
* - `timeout` — the tool did not finish within the call's timeout.
|
|
2002
|
+
* - `failed` — the tool threw; the error is its message.
|
|
2003
|
+
* A tool that RETURNS a value has succeeded as far as the platform is concerned,
|
|
2004
|
+
* even if the value describes a failure — throw to report one.
|
|
2005
|
+
*/
|
|
2006
|
+
type DeviceToolFailureReason = 'not_found' | 'no_context' | 'timeout' | 'failed';
|
|
1940
2007
|
interface DeviceToolDefinition {
|
|
1941
2008
|
/** Domain name, as the catalog and the caller see it. e.g. "guide.observe" */
|
|
1942
2009
|
name: string;
|
|
@@ -2310,7 +2377,7 @@ type DeviceToolOutcome = {
|
|
|
2310
2377
|
} | {
|
|
2311
2378
|
ok: false;
|
|
2312
2379
|
error: string;
|
|
2313
|
-
reason:
|
|
2380
|
+
reason: DeviceToolFailureReason;
|
|
2314
2381
|
};
|
|
2315
2382
|
/**
|
|
2316
2383
|
* Override how a device tool reaches the Device Bridge. Rarely needed — the
|
|
@@ -3028,7 +3095,15 @@ declare function supportsNative(manifest: PluginManifest): boolean;
|
|
|
3028
3095
|
*/
|
|
3029
3096
|
declare function getNativeComponentId(manifest: PluginManifest): string | null;
|
|
3030
3097
|
/**
|
|
3031
|
-
*
|
|
3098
|
+
* The native bundle URL for a manifest that has a bundle on the server, or null.
|
|
3099
|
+
*
|
|
3100
|
+
* Core writes `bundleUrl` into the manifest only when the connector's bundle
|
|
3101
|
+
* exists, so its PRESENCE says "there is a bundle". Its SPELLING is not used:
|
|
3102
|
+
* Core writes the id unencoded, and a connector could inject any URL. The URL
|
|
3103
|
+
* returned is always the one derivation, pluginBundleUrl(manifest.id), the same
|
|
3104
|
+
* one the rendered surface uses. Returning the manifest's own string (6294cc3)
|
|
3105
|
+
* gave the device-tool loader a second spelling, so one plugin downloaded and
|
|
3106
|
+
* evaluated twice, as two module instances (MGAP-C8).
|
|
3032
3107
|
*/
|
|
3033
3108
|
declare function getNativeBundleUrl(manifest: PluginManifest): string | null;
|
|
3034
3109
|
/**
|
|
@@ -3063,6 +3138,27 @@ declare function getPlugin(pluginId: string): Promise<PluginManifest | null>;
|
|
|
3063
3138
|
*/
|
|
3064
3139
|
declare function resolvePluginUrl(manifest: PluginManifest, tenant?: string): string;
|
|
3065
3140
|
|
|
3141
|
+
/**
|
|
3142
|
+
* THE bundle URL of a plugin: the one place it is spelled.
|
|
3143
|
+
*
|
|
3144
|
+
* Core serves a plugin's React Native bundle at
|
|
3145
|
+
* `/api/ui-plugins/<pluginId>/bundle.js`, where the id is URL-encoded because
|
|
3146
|
+
* plugin ids contain ':' (`mcp:<connector>:<plugin>`). The bundle manager keys
|
|
3147
|
+
* everything it holds by this string: evaluated modules, in-flight downloads and
|
|
3148
|
+
* the disk index. To it, two spellings of one plugin's URL are two plugins, which
|
|
3149
|
+
* means two downloads, two evaluations and two separate copies of module state.
|
|
3150
|
+
*
|
|
3151
|
+
* That happened (MGAP-C8). The rendered surface derived the encoded route, while
|
|
3152
|
+
* the device-tool loader (6294cc3) used the manifest's `bundleUrl`, which Core
|
|
3153
|
+
* fills in UNENCODED. A plugin that was on screen and also had device tools ran
|
|
3154
|
+
* as two module instances, and its tools never saw its UI's state.
|
|
3155
|
+
*
|
|
3156
|
+
* So the URL is DERIVED from the plugin id and never read from a manifest (a
|
|
3157
|
+
* connector-supplied URL is ignored, as in ea435149). Every path that builds a
|
|
3158
|
+
* plugin's bundle URL, or looks one up, calls this function.
|
|
3159
|
+
*/
|
|
3160
|
+
declare function pluginBundleUrl(pluginId: string): string;
|
|
3161
|
+
|
|
3066
3162
|
interface SurfaceDrawerProps {
|
|
3067
3163
|
visible: boolean;
|
|
3068
3164
|
onClose: () => void;
|
|
@@ -3210,4 +3306,4 @@ declare function isInlineSurface(m: SurfaceManifest): m is InlineSurfaceManifest
|
|
|
3210
3306
|
|
|
3211
3307
|
declare function SurfaceDispatcher(): react_jsx_runtime.JSX.Element;
|
|
3212
3308
|
|
|
3213
|
-
export { ActionButton, type ActivitySnapshot, AdaOrb, type AdaOrbState, Badge, type BiometricsAPI, type BiometricsAPIv2, type BluetoothAPI, type BluetoothDevice, type Bridge, type BundleCacheEntry, type BundleStorage, type CameraAPI, CameraPreview, type CameraPreviewProps, type CapabilitySnapshot, type CapabilityStatus, Card, type Confidence, type ConnectivityAPI, type ConnectivitySnapshot, type CookiesAPI, type DeviceBridgeDomain, type DeviceContextSnapshot, type DeviceState, type DeviceToolContext, type DeviceToolDefinition, type DeviceToolFn, type DeviceToolOutcome, type DeviceToolSummary, type DeviceToolsAction, type DeviceToolsSessionDeps, EmptyState, type EnvironmentSnapshot, ErrorState, type FileSystemAPI, type Freshness, type HapticsAPI, type InlineSurfaceManifest, type InteractionSnapshot, ListItem, type LoadedBundleInfo, type LoadedBundleSource, LoadingState, type LocationAPI, type MapsAPI, type MapsAddress, type MapsCoordinate, type MapsPlace, type MapsRoute, type MapsRouteStep, MemoryBundleStorage, type MountSurfaceManifest, type NativeCapabilities$1 as NativeCapabilities, type NfcAPI, type NotificationsAPI, PLATFORM_VOICE_CALLER, type PluginManifest as PlatformPluginManifest, type PluginBridge, type PluginContext, type PluginGrants, type PluginHooks$1 as PluginHooks, type PluginManifest$1 as PluginManifest, type PluginNative, type PluginProps, type PluginRuntimeProps, type PluginRuntimeSource, PluginSDK, type PluginSummary, type PluginSurfaceMeta, type RegisteredPlugin, type RegisteredServicePlugin, type RegisteredToolsPlugin, type RegisteredUIPlugin, type RemotePlugin, type RenderMode, type ScannerAPI, SearchBar, type SessionSnapshot, type SharingAPI, type SpatialEvent, type SpatialIntent, type SpatialPoint, type SpatialSnapshot, type SpatialStateEvent, type StateEvent, type StateListener, type StateQuality, type StorageAPI, type Subscription, SurfaceCard, type SurfaceCardProps, SurfaceDispatcher, SurfaceDrawer, type SurfaceDrawerProps, SurfaceFullscreen, type SurfaceFullscreenProps, type SurfaceManifest, type SurfacePlacement, type SurfaceType, type SurfaceVisibility, TabBar, type ThemeTokens, type TrustedToolDeclaration, type VisionAPI, type VisionFrameQuality, type VisionLabel, type VisionObject, type VisionText, type VisualSnapshot, type VoiceAPI, type VoiceCaller, type VoiceEvent, type VoicePersona, type VoiceSessionProvider, type VoiceSnapshot, type VoiceStartOptions, type VoiceState, type VoiceSubscription, type VoiceTranscriptEntry, type WebViewCookie, __resetSessionSyncForTest, bundleManager, callDeviceTool, clearDeviceTools, createNativeBridge, deviceState as deviceStateV2, deviceToolsActionForSession, ensureDeviceToolsLoaded, explainCapability, gateDeviceState, gatePluginNative, gateVoice, getCameraPreviewProvider, getHaptics, getNativeBundleHash, getNativeBundleUrl, getNativeComponentId, getPlugin, getPluginNative, handleServerDeviceToolCall, hasDeviceTool, implementedStateDomains, implementedVoice, isActionable, isDeviceToolCommand, isInlineSurface, isMountSurface, listDeviceTools, listPlugins, nativePluginRegistry, neverObserved, register, registerBundleModules, registerDeviceTools, registerNativePlugin, registerPlatformDeviceTools, registerService, registerTools, resetDeviceToolLoader, resolvePluginGrants, resolvePluginRuntimeProps, resolvePluginUrl, setBundleStorage, setCameraPreviewProvider, setDeviceStateProvider, setDeviceToolContextProvider, setDeviceToolResultPoster, setHapticsProvider, setPluginNativeProvider, setPluginThemeColors, setVoiceProvider, supportsNative, supportsWebView, syncDeviceToolsForSession, unregisterDeviceTools, unregisterNativePlugin, useApi, useNativeBridge, usePlugin, usePluginTheme, useRemotePlugins, useSurfaceStore };
|
|
3309
|
+
export { ActionButton, type ActivitySnapshot, AdaOrb, type AdaOrbState, Badge, type BiometricsAPI, type BiometricsAPIv2, type BluetoothAPI, type BluetoothDevice, type Bridge, type BundleCacheEntry, type BundleStorage, type CameraAPI, CameraPreview, type CameraPreviewProps, type CapabilitySnapshot, type CapabilityStatus, Card, type Confidence, type ConnectivityAPI, type ConnectivitySnapshot, type CookiesAPI, type DeviceBridgeDomain, type DeviceContextSnapshot, type DeviceState, type DeviceToolContext, type DeviceToolDefinition, type DeviceToolFailureReason, type DeviceToolFn, type DeviceToolOutcome, type DeviceToolSummary, type DeviceToolsAction, type DeviceToolsSessionDeps, EmptyState, type EnvironmentSnapshot, ErrorState, type FileSystemAPI, type Freshness, type HapticsAPI, type InlineSurfaceManifest, type InteractionSnapshot, ListItem, type LoadedBundleInfo, type LoadedBundleSource, LoadingState, type LocationAPI, type MapsAPI, type MapsAddress, type MapsCoordinate, type MapsPlace, type MapsRoute, type MapsRouteStep, MemoryBundleStorage, type MountSurfaceManifest, type NativeCapabilities$1 as NativeCapabilities, type NfcAPI, type NotificationsAPI, PLATFORM_VOICE_CALLER, type PluginManifest as PlatformPluginManifest, type PluginBridge, type PluginContext, type PluginGrants, type PluginHooks$1 as PluginHooks, type PluginManifest$1 as PluginManifest, type PluginNative, type PluginProps, type PluginRuntimeProps, type PluginRuntimeSource, PluginSDK, type PluginSummary, type PluginSurfaceMeta, type RegisteredPlugin, type RegisteredServicePlugin, type RegisteredToolsPlugin, type RegisteredUIPlugin, type RemotePlugin, type RenderMode, type ScannerAPI, SearchBar, type SessionSnapshot, type SharingAPI, type SpatialEvent, type SpatialIntent, type SpatialPoint, type SpatialSnapshot, type SpatialStateEvent, type StateEvent, type StateListener, type StateQuality, type StorageAPI, type Subscription, SurfaceCard, type SurfaceCardProps, SurfaceDispatcher, SurfaceDrawer, type SurfaceDrawerProps, SurfaceFullscreen, type SurfaceFullscreenProps, type SurfaceManifest, type SurfacePlacement, type SurfaceType, type SurfaceVisibility, TabBar, type ThemeTokens, type TrustedToolDeclaration, type VisionAPI, type VisionFrameQuality, type VisionLabel, type VisionObject, type VisionText, type VisualSnapshot, type VoiceAPI, type VoiceCaller, type VoiceDeviceToolCall, type VoiceDeviceToolReason, type VoiceEvent, type VoicePersona, type VoiceSessionProvider, type VoiceSnapshot, type VoiceStartOptions, type VoiceState, type VoiceSubscription, type VoiceTranscriptEntry, type WebViewCookie, __resetSessionSyncForTest, bundleManager, callDeviceTool, clearDeviceTools, createNativeBridge, deviceState as deviceStateV2, deviceToolsActionForSession, ensureDeviceToolsLoaded, explainCapability, gateDeviceState, gatePluginNative, gateVoice, getCameraPreviewProvider, getHaptics, getNativeBundleHash, getNativeBundleUrl, getNativeComponentId, getPlugin, getPluginNative, handleServerDeviceToolCall, hasDeviceTool, implementedStateDomains, implementedVoice, isActionable, isDeviceToolCommand, isInlineSurface, isMountSurface, listDeviceTools, listPlugins, nativePluginRegistry, neverObserved, pluginBundleUrl, register, registerBundleModules, registerDeviceTools, registerNativePlugin, registerPlatformDeviceTools, registerService, registerTools, resetDeviceToolLoader, resolvePluginGrants, resolvePluginRuntimeProps, resolvePluginUrl, setBundleStorage, setCameraPreviewProvider, setDeviceStateProvider, setDeviceToolContextProvider, setDeviceToolResultPoster, setHapticsProvider, setPluginNativeProvider, setPluginThemeColors, setVoiceProvider, supportsNative, supportsWebView, syncDeviceToolsForSession, unregisterDeviceTools, unregisterNativePlugin, useApi, useNativeBridge, usePlugin, usePluginTheme, useRemotePlugins, useSurfaceStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,12 +6,15 @@ import { View, TextInput } from 'react-native';
|
|
|
6
6
|
export { ActivityIndicator, Animated, FlatList, Image, Modal, Platform, Pressable, RefreshControl, ScrollView, SectionList, StyleSheet, Switch, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Device state — Device Bridge v2, the SEMANTIC layer.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* Repo path:
|
|
12
12
|
* packages/plugin-runtime/src/sdk/device-state.ts
|
|
13
|
-
*
|
|
14
|
-
* '@adas/
|
|
13
|
+
* Module specifier for plugin bundles:
|
|
14
|
+
* '@adas/plugin-sdk' — the only SDK module a bundle can require. This file
|
|
15
|
+
* once named '@adas/device-state' here (4110943); the require shim never
|
|
16
|
+
* resolved it, so a bundle that imported it got `{}` and failed later. It is
|
|
17
|
+
* now refused by name at evaluation (bundles/bundleModuleNames.ts).
|
|
15
18
|
*
|
|
16
19
|
* ─────────────────────────────────────────────────────────────────────────
|
|
17
20
|
* WHICH LAYER AM I IN?
|
|
@@ -22,7 +25,7 @@ export { ActivityIndicator, Animated, FlatList, Image, Modal, Platform, Pressabl
|
|
|
22
25
|
* Returns a BARE value. THROWS when it cannot.
|
|
23
26
|
* Declared in the manifest as `capabilities: { camera: true }`
|
|
24
27
|
* (the legacy `native: {}` field is still honoured).
|
|
25
|
-
*
|
|
28
|
+
* Its types are imported from '@adas/plugin-sdk'.
|
|
26
29
|
*
|
|
27
30
|
* props.deviceState.* SEMANTIC. "What is true right now, and how well do
|
|
28
31
|
* we know it?"
|
|
@@ -31,7 +34,8 @@ export { ActivityIndicator, Animated, FlatList, Image, Modal, Platform, Pressabl
|
|
|
31
34
|
* and able to say `unknown` in every field.
|
|
32
35
|
* A read NEVER throws for absence.
|
|
33
36
|
* Declared in the manifest as `stateDomains: ['visual']`.
|
|
34
|
-
*
|
|
37
|
+
* Defined in this file; its types and helpers are
|
|
38
|
+
* imported from '@adas/plugin-sdk' too.
|
|
35
39
|
*
|
|
36
40
|
* The two containers are the discriminator. Every semantic call in a plugin
|
|
37
41
|
* begins with the eight characters `deviceState.`; every mechanical call
|
|
@@ -519,8 +523,19 @@ interface VisualDomain {
|
|
|
519
523
|
}
|
|
520
524
|
/** FROZEN (API_FREEZE §5, VOCABULARY §"Human Activity Values"). */
|
|
521
525
|
type HumanActivity = 'stationary' | 'walking' | 'running' | 'cycling' | 'driving' | 'unknown';
|
|
522
|
-
/**
|
|
523
|
-
|
|
526
|
+
/**
|
|
527
|
+
* FROZEN. Independent of HumanActivity — walking+pocket, driving+mounted.
|
|
528
|
+
*
|
|
529
|
+
* What is returned TODAY: `handheld`, `table` and `unknown` only. Do not write
|
|
530
|
+
* a branch that waits for `pocket` or `mounted`; it will never run. A pocketed
|
|
531
|
+
* phone shows up in the Visual domain's frame quality (`obstructed: true` /
|
|
532
|
+
* `exposure: 'dark'`), not here.
|
|
533
|
+
*/
|
|
534
|
+
type DevicePlacement = 'handheld'
|
|
535
|
+
/** RESERVED — never returned until the proximity/light sensor is wired. */
|
|
536
|
+
| 'pocket' | 'table'
|
|
537
|
+
/** RESERVED — never returned until Bluetooth/CarPlay mount context is wired. */
|
|
538
|
+
| 'mounted' | 'unknown';
|
|
524
539
|
/**
|
|
525
540
|
* FROZEN. Note `driving` is BOTH an intent here and a HumanActivity value
|
|
526
541
|
* above. The docs define no relationship between the two and do not flag the
|
|
@@ -1014,6 +1029,7 @@ declare namespace deviceState {
|
|
|
1014
1029
|
*
|
|
1015
1030
|
* See docs/handoff/SPEC_voice_session_without_the_voice_screen_2026-09-12.md.
|
|
1016
1031
|
*/
|
|
1032
|
+
|
|
1017
1033
|
/** The session lifecycle — identical vocabulary to the built-in `CallState`. */
|
|
1018
1034
|
type VoiceState = 'idle' | 'connecting' | 'connected' | 'error';
|
|
1019
1035
|
/** One line of the conversation. `tool` entries are device/skill tool activity. */
|
|
@@ -1022,6 +1038,40 @@ interface VoiceTranscriptEntry {
|
|
|
1022
1038
|
text: string;
|
|
1023
1039
|
ts: number;
|
|
1024
1040
|
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Why a device-tool call the session received did not produce a result.
|
|
1043
|
+
* - the tool RAN and did not return: `not_found` | `no_context` | `timeout` |
|
|
1044
|
+
* `failed` (it threw) — see DeviceToolFailureReason;
|
|
1045
|
+
* - the phone REFUSED it before running: `not_ready` (Core's tool allowset for
|
|
1046
|
+
* this session had not arrived yet — transient, a retry can succeed) or
|
|
1047
|
+
* `not_authorized` (not allowed in this session — final);
|
|
1048
|
+
* - `invalid`: the call itself was malformed (it named no tool, or carried no
|
|
1049
|
+
* correlationId to answer on) — not run.
|
|
1050
|
+
*/
|
|
1051
|
+
type VoiceDeviceToolReason = DeviceToolFailureReason | 'not_ready' | 'not_authorized' | 'invalid';
|
|
1052
|
+
/**
|
|
1053
|
+
* One finished device-tool call, as `VoiceSnapshot.lastDeviceTool` reports it.
|
|
1054
|
+
* `name` and `at` keep their original meaning, so a reader of just those two is
|
|
1055
|
+
* unaffected.
|
|
1056
|
+
*/
|
|
1057
|
+
type VoiceDeviceToolCall = {
|
|
1058
|
+
/** The tool the model called ('' if the call named none — see `invalid`). */
|
|
1059
|
+
name: string;
|
|
1060
|
+
/** Epoch ms the call REACHED the phone (not when it finished — that is at + ms). */
|
|
1061
|
+
at: number;
|
|
1062
|
+
/** Milliseconds from arrival to outcome (≈0 for a refusal). */
|
|
1063
|
+
ms: number;
|
|
1064
|
+
} & ({
|
|
1065
|
+
ok: true;
|
|
1066
|
+
reason: null;
|
|
1067
|
+
error: null;
|
|
1068
|
+
} | {
|
|
1069
|
+
ok: false;
|
|
1070
|
+
reason: VoiceDeviceToolReason;
|
|
1071
|
+
/** What went wrong, clipped to 200 characters: tool errors can echo the
|
|
1072
|
+
* call's arguments, which may carry what the user said. */
|
|
1073
|
+
error: string;
|
|
1074
|
+
});
|
|
1025
1075
|
/** A point-in-time read of the session — what a reasoning loop polls. */
|
|
1026
1076
|
interface VoiceSnapshot {
|
|
1027
1077
|
state: VoiceState;
|
|
@@ -1045,13 +1095,18 @@ interface VoiceSnapshot {
|
|
|
1045
1095
|
/** The last error, if `state === 'error'`; also carries a refusal reason when
|
|
1046
1096
|
* this surface was handed to a plugin that did not declare `voice`. */
|
|
1047
1097
|
lastError: string | null;
|
|
1048
|
-
/**
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1098
|
+
/**
|
|
1099
|
+
* The most recently FINISHED device-tool call the model made through this
|
|
1100
|
+
* session, with its outcome — or null if none has finished yet. Set once the
|
|
1101
|
+
* outcome is known (ran, refused, malformed, threw, timed out), never on
|
|
1102
|
+
* arrival, so a refused call can no longer look like one that ran.
|
|
1103
|
+
*
|
|
1104
|
+
* SCOPED to the caller: a plugin sees only calls to tools IT registered (never
|
|
1105
|
+
* another solution's tool names or errors, even on its own call); the platform
|
|
1106
|
+
* sees every call. Cleared when the session ends or a new one starts.
|
|
1107
|
+
* Diagnostic — every solution's debug view gets "why did that call fail" free.
|
|
1108
|
+
*/
|
|
1109
|
+
lastDeviceTool: VoiceDeviceToolCall | null;
|
|
1055
1110
|
/** The sessionId the Core allowset is bound to. Diagnostic: authorization
|
|
1056
1111
|
* requires it to equal `sessionId`; a mismatch is why tools refuse. */
|
|
1057
1112
|
authorizedSessionId: string | null;
|
|
@@ -1937,6 +1992,18 @@ interface DeviceToolContext {
|
|
|
1937
1992
|
signal?: AbortSignal;
|
|
1938
1993
|
}
|
|
1939
1994
|
type DeviceToolFn = (args: any, ctx: DeviceToolContext) => Promise<any> | any;
|
|
1995
|
+
/**
|
|
1996
|
+
* Why running a device tool produced no result (`callDeviceTool`'s
|
|
1997
|
+
* `{ ok: false, reason }`). The one list: the registry returns these, and the
|
|
1998
|
+
* voice snapshot's `lastDeviceTool.reason` carries them unchanged.
|
|
1999
|
+
* - `not_found` — no tool is registered under that name.
|
|
2000
|
+
* - `no_context` — the tool's device context could not be built.
|
|
2001
|
+
* - `timeout` — the tool did not finish within the call's timeout.
|
|
2002
|
+
* - `failed` — the tool threw; the error is its message.
|
|
2003
|
+
* A tool that RETURNS a value has succeeded as far as the platform is concerned,
|
|
2004
|
+
* even if the value describes a failure — throw to report one.
|
|
2005
|
+
*/
|
|
2006
|
+
type DeviceToolFailureReason = 'not_found' | 'no_context' | 'timeout' | 'failed';
|
|
1940
2007
|
interface DeviceToolDefinition {
|
|
1941
2008
|
/** Domain name, as the catalog and the caller see it. e.g. "guide.observe" */
|
|
1942
2009
|
name: string;
|
|
@@ -2310,7 +2377,7 @@ type DeviceToolOutcome = {
|
|
|
2310
2377
|
} | {
|
|
2311
2378
|
ok: false;
|
|
2312
2379
|
error: string;
|
|
2313
|
-
reason:
|
|
2380
|
+
reason: DeviceToolFailureReason;
|
|
2314
2381
|
};
|
|
2315
2382
|
/**
|
|
2316
2383
|
* Override how a device tool reaches the Device Bridge. Rarely needed — the
|
|
@@ -3028,7 +3095,15 @@ declare function supportsNative(manifest: PluginManifest): boolean;
|
|
|
3028
3095
|
*/
|
|
3029
3096
|
declare function getNativeComponentId(manifest: PluginManifest): string | null;
|
|
3030
3097
|
/**
|
|
3031
|
-
*
|
|
3098
|
+
* The native bundle URL for a manifest that has a bundle on the server, or null.
|
|
3099
|
+
*
|
|
3100
|
+
* Core writes `bundleUrl` into the manifest only when the connector's bundle
|
|
3101
|
+
* exists, so its PRESENCE says "there is a bundle". Its SPELLING is not used:
|
|
3102
|
+
* Core writes the id unencoded, and a connector could inject any URL. The URL
|
|
3103
|
+
* returned is always the one derivation, pluginBundleUrl(manifest.id), the same
|
|
3104
|
+
* one the rendered surface uses. Returning the manifest's own string (6294cc3)
|
|
3105
|
+
* gave the device-tool loader a second spelling, so one plugin downloaded and
|
|
3106
|
+
* evaluated twice, as two module instances (MGAP-C8).
|
|
3032
3107
|
*/
|
|
3033
3108
|
declare function getNativeBundleUrl(manifest: PluginManifest): string | null;
|
|
3034
3109
|
/**
|
|
@@ -3063,6 +3138,27 @@ declare function getPlugin(pluginId: string): Promise<PluginManifest | null>;
|
|
|
3063
3138
|
*/
|
|
3064
3139
|
declare function resolvePluginUrl(manifest: PluginManifest, tenant?: string): string;
|
|
3065
3140
|
|
|
3141
|
+
/**
|
|
3142
|
+
* THE bundle URL of a plugin: the one place it is spelled.
|
|
3143
|
+
*
|
|
3144
|
+
* Core serves a plugin's React Native bundle at
|
|
3145
|
+
* `/api/ui-plugins/<pluginId>/bundle.js`, where the id is URL-encoded because
|
|
3146
|
+
* plugin ids contain ':' (`mcp:<connector>:<plugin>`). The bundle manager keys
|
|
3147
|
+
* everything it holds by this string: evaluated modules, in-flight downloads and
|
|
3148
|
+
* the disk index. To it, two spellings of one plugin's URL are two plugins, which
|
|
3149
|
+
* means two downloads, two evaluations and two separate copies of module state.
|
|
3150
|
+
*
|
|
3151
|
+
* That happened (MGAP-C8). The rendered surface derived the encoded route, while
|
|
3152
|
+
* the device-tool loader (6294cc3) used the manifest's `bundleUrl`, which Core
|
|
3153
|
+
* fills in UNENCODED. A plugin that was on screen and also had device tools ran
|
|
3154
|
+
* as two module instances, and its tools never saw its UI's state.
|
|
3155
|
+
*
|
|
3156
|
+
* So the URL is DERIVED from the plugin id and never read from a manifest (a
|
|
3157
|
+
* connector-supplied URL is ignored, as in ea435149). Every path that builds a
|
|
3158
|
+
* plugin's bundle URL, or looks one up, calls this function.
|
|
3159
|
+
*/
|
|
3160
|
+
declare function pluginBundleUrl(pluginId: string): string;
|
|
3161
|
+
|
|
3066
3162
|
interface SurfaceDrawerProps {
|
|
3067
3163
|
visible: boolean;
|
|
3068
3164
|
onClose: () => void;
|
|
@@ -3210,4 +3306,4 @@ declare function isInlineSurface(m: SurfaceManifest): m is InlineSurfaceManifest
|
|
|
3210
3306
|
|
|
3211
3307
|
declare function SurfaceDispatcher(): react_jsx_runtime.JSX.Element;
|
|
3212
3308
|
|
|
3213
|
-
export { ActionButton, type ActivitySnapshot, AdaOrb, type AdaOrbState, Badge, type BiometricsAPI, type BiometricsAPIv2, type BluetoothAPI, type BluetoothDevice, type Bridge, type BundleCacheEntry, type BundleStorage, type CameraAPI, CameraPreview, type CameraPreviewProps, type CapabilitySnapshot, type CapabilityStatus, Card, type Confidence, type ConnectivityAPI, type ConnectivitySnapshot, type CookiesAPI, type DeviceBridgeDomain, type DeviceContextSnapshot, type DeviceState, type DeviceToolContext, type DeviceToolDefinition, type DeviceToolFn, type DeviceToolOutcome, type DeviceToolSummary, type DeviceToolsAction, type DeviceToolsSessionDeps, EmptyState, type EnvironmentSnapshot, ErrorState, type FileSystemAPI, type Freshness, type HapticsAPI, type InlineSurfaceManifest, type InteractionSnapshot, ListItem, type LoadedBundleInfo, type LoadedBundleSource, LoadingState, type LocationAPI, type MapsAPI, type MapsAddress, type MapsCoordinate, type MapsPlace, type MapsRoute, type MapsRouteStep, MemoryBundleStorage, type MountSurfaceManifest, type NativeCapabilities$1 as NativeCapabilities, type NfcAPI, type NotificationsAPI, PLATFORM_VOICE_CALLER, type PluginManifest as PlatformPluginManifest, type PluginBridge, type PluginContext, type PluginGrants, type PluginHooks$1 as PluginHooks, type PluginManifest$1 as PluginManifest, type PluginNative, type PluginProps, type PluginRuntimeProps, type PluginRuntimeSource, PluginSDK, type PluginSummary, type PluginSurfaceMeta, type RegisteredPlugin, type RegisteredServicePlugin, type RegisteredToolsPlugin, type RegisteredUIPlugin, type RemotePlugin, type RenderMode, type ScannerAPI, SearchBar, type SessionSnapshot, type SharingAPI, type SpatialEvent, type SpatialIntent, type SpatialPoint, type SpatialSnapshot, type SpatialStateEvent, type StateEvent, type StateListener, type StateQuality, type StorageAPI, type Subscription, SurfaceCard, type SurfaceCardProps, SurfaceDispatcher, SurfaceDrawer, type SurfaceDrawerProps, SurfaceFullscreen, type SurfaceFullscreenProps, type SurfaceManifest, type SurfacePlacement, type SurfaceType, type SurfaceVisibility, TabBar, type ThemeTokens, type TrustedToolDeclaration, type VisionAPI, type VisionFrameQuality, type VisionLabel, type VisionObject, type VisionText, type VisualSnapshot, type VoiceAPI, type VoiceCaller, type VoiceEvent, type VoicePersona, type VoiceSessionProvider, type VoiceSnapshot, type VoiceStartOptions, type VoiceState, type VoiceSubscription, type VoiceTranscriptEntry, type WebViewCookie, __resetSessionSyncForTest, bundleManager, callDeviceTool, clearDeviceTools, createNativeBridge, deviceState as deviceStateV2, deviceToolsActionForSession, ensureDeviceToolsLoaded, explainCapability, gateDeviceState, gatePluginNative, gateVoice, getCameraPreviewProvider, getHaptics, getNativeBundleHash, getNativeBundleUrl, getNativeComponentId, getPlugin, getPluginNative, handleServerDeviceToolCall, hasDeviceTool, implementedStateDomains, implementedVoice, isActionable, isDeviceToolCommand, isInlineSurface, isMountSurface, listDeviceTools, listPlugins, nativePluginRegistry, neverObserved, register, registerBundleModules, registerDeviceTools, registerNativePlugin, registerPlatformDeviceTools, registerService, registerTools, resetDeviceToolLoader, resolvePluginGrants, resolvePluginRuntimeProps, resolvePluginUrl, setBundleStorage, setCameraPreviewProvider, setDeviceStateProvider, setDeviceToolContextProvider, setDeviceToolResultPoster, setHapticsProvider, setPluginNativeProvider, setPluginThemeColors, setVoiceProvider, supportsNative, supportsWebView, syncDeviceToolsForSession, unregisterDeviceTools, unregisterNativePlugin, useApi, useNativeBridge, usePlugin, usePluginTheme, useRemotePlugins, useSurfaceStore };
|
|
3309
|
+
export { ActionButton, type ActivitySnapshot, AdaOrb, type AdaOrbState, Badge, type BiometricsAPI, type BiometricsAPIv2, type BluetoothAPI, type BluetoothDevice, type Bridge, type BundleCacheEntry, type BundleStorage, type CameraAPI, CameraPreview, type CameraPreviewProps, type CapabilitySnapshot, type CapabilityStatus, Card, type Confidence, type ConnectivityAPI, type ConnectivitySnapshot, type CookiesAPI, type DeviceBridgeDomain, type DeviceContextSnapshot, type DeviceState, type DeviceToolContext, type DeviceToolDefinition, type DeviceToolFailureReason, type DeviceToolFn, type DeviceToolOutcome, type DeviceToolSummary, type DeviceToolsAction, type DeviceToolsSessionDeps, EmptyState, type EnvironmentSnapshot, ErrorState, type FileSystemAPI, type Freshness, type HapticsAPI, type InlineSurfaceManifest, type InteractionSnapshot, ListItem, type LoadedBundleInfo, type LoadedBundleSource, LoadingState, type LocationAPI, type MapsAPI, type MapsAddress, type MapsCoordinate, type MapsPlace, type MapsRoute, type MapsRouteStep, MemoryBundleStorage, type MountSurfaceManifest, type NativeCapabilities$1 as NativeCapabilities, type NfcAPI, type NotificationsAPI, PLATFORM_VOICE_CALLER, type PluginManifest as PlatformPluginManifest, type PluginBridge, type PluginContext, type PluginGrants, type PluginHooks$1 as PluginHooks, type PluginManifest$1 as PluginManifest, type PluginNative, type PluginProps, type PluginRuntimeProps, type PluginRuntimeSource, PluginSDK, type PluginSummary, type PluginSurfaceMeta, type RegisteredPlugin, type RegisteredServicePlugin, type RegisteredToolsPlugin, type RegisteredUIPlugin, type RemotePlugin, type RenderMode, type ScannerAPI, SearchBar, type SessionSnapshot, type SharingAPI, type SpatialEvent, type SpatialIntent, type SpatialPoint, type SpatialSnapshot, type SpatialStateEvent, type StateEvent, type StateListener, type StateQuality, type StorageAPI, type Subscription, SurfaceCard, type SurfaceCardProps, SurfaceDispatcher, SurfaceDrawer, type SurfaceDrawerProps, SurfaceFullscreen, type SurfaceFullscreenProps, type SurfaceManifest, type SurfacePlacement, type SurfaceType, type SurfaceVisibility, TabBar, type ThemeTokens, type TrustedToolDeclaration, type VisionAPI, type VisionFrameQuality, type VisionLabel, type VisionObject, type VisionText, type VisualSnapshot, type VoiceAPI, type VoiceCaller, type VoiceDeviceToolCall, type VoiceDeviceToolReason, type VoiceEvent, type VoicePersona, type VoiceSessionProvider, type VoiceSnapshot, type VoiceStartOptions, type VoiceState, type VoiceSubscription, type VoiceTranscriptEntry, type WebViewCookie, __resetSessionSyncForTest, bundleManager, callDeviceTool, clearDeviceTools, createNativeBridge, deviceState as deviceStateV2, deviceToolsActionForSession, ensureDeviceToolsLoaded, explainCapability, gateDeviceState, gatePluginNative, gateVoice, getCameraPreviewProvider, getHaptics, getNativeBundleHash, getNativeBundleUrl, getNativeComponentId, getPlugin, getPluginNative, handleServerDeviceToolCall, hasDeviceTool, implementedStateDomains, implementedVoice, isActionable, isDeviceToolCommand, isInlineSurface, isMountSurface, listDeviceTools, listPlugins, nativePluginRegistry, neverObserved, pluginBundleUrl, register, registerBundleModules, registerDeviceTools, registerNativePlugin, registerPlatformDeviceTools, registerService, registerTools, resetDeviceToolLoader, resolvePluginGrants, resolvePluginRuntimeProps, resolvePluginUrl, setBundleStorage, setCameraPreviewProvider, setDeviceStateProvider, setDeviceToolContextProvider, setDeviceToolResultPoster, setHapticsProvider, setPluginNativeProvider, setPluginThemeColors, setVoiceProvider, supportsNative, supportsWebView, syncDeviceToolsForSession, unregisterDeviceTools, unregisterNativePlugin, useApi, useNativeBridge, usePlugin, usePluginTheme, useRemotePlugins, useSurfaceStore };
|