@ateam-ai-mobile/plugin-runtime 0.1.5 → 0.1.8
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 +3085 -0
- package/dist/chunk-RXR6M623.mjs.map +1 -0
- package/dist/index.d.mts +2083 -12
- package/dist/index.d.ts +2083 -12
- package/dist/index.js +2605 -1332
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +265 -2157
- package/dist/index.mjs.map +1 -1
- package/dist/loader-UUOPZQSI.mjs +9 -0
- package/dist/loader-UUOPZQSI.mjs.map +1 -0
- package/package.json +2 -2
- package/src/bundles/bundleManager.ts +496 -51
- package/src/bundles/integrity.ts +29 -0
- package/src/bundles/storage.ts +59 -0
- package/src/deviceStateHost.ts +222 -0
- package/src/hooks/usePlugin.ts +14 -4
- package/src/host.ts +82 -8
- package/src/index.ts +96 -2
- package/src/pluginRuntime.ts +108 -0
- package/src/sdk/CameraPreview.tsx +94 -0
- package/src/sdk/device-state.ts +1315 -0
- package/src/sdk/index.ts +42 -3
- package/src/sdk/registration.ts +40 -0
- package/src/sdk/types.ts +489 -8
- package/src/sdk/voice.ts +186 -0
- package/src/tools/loader.ts +185 -0
- package/src/tools/platformTools.ts +41 -0
- package/src/tools/registry.ts +190 -0
- package/src/tools/serverCalls.ts +78 -0
- package/src/tools/sessionSync.ts +107 -0
- package/src/voiceHost.ts +128 -0
package/src/sdk/index.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
// Registration API
|
|
8
|
-
export { register, registerService } from './registration';
|
|
9
|
-
import { register, registerService } from './registration';
|
|
10
|
-
export const PluginSDK = { register, registerService } as const;
|
|
8
|
+
export { register, registerService, registerTools } from './registration';
|
|
9
|
+
import { register, registerService, registerTools } from './registration';
|
|
10
|
+
export const PluginSDK = { register, registerService, registerTools } as const;
|
|
11
11
|
|
|
12
12
|
// Types
|
|
13
13
|
export type {
|
|
@@ -24,9 +24,23 @@ export type {
|
|
|
24
24
|
ConnectivityAPI,
|
|
25
25
|
FileSystemAPI,
|
|
26
26
|
CookiesAPI,
|
|
27
|
+
WebViewCookie,
|
|
27
28
|
SharingAPI,
|
|
28
29
|
ScannerAPI,
|
|
29
30
|
NfcAPI,
|
|
31
|
+
BluetoothAPI,
|
|
32
|
+
BluetoothDevice,
|
|
33
|
+
VisionAPI,
|
|
34
|
+
VisionText,
|
|
35
|
+
VisionLabel,
|
|
36
|
+
VisionObject,
|
|
37
|
+
VisionFrameQuality,
|
|
38
|
+
MapsAPI,
|
|
39
|
+
MapsCoordinate,
|
|
40
|
+
MapsAddress,
|
|
41
|
+
MapsPlace,
|
|
42
|
+
MapsRoute,
|
|
43
|
+
MapsRouteStep,
|
|
30
44
|
BiometricsAPI,
|
|
31
45
|
BiometricsAPIv2,
|
|
32
46
|
NativeCapabilities,
|
|
@@ -36,8 +50,29 @@ export type {
|
|
|
36
50
|
RegisteredPlugin,
|
|
37
51
|
RegisteredUIPlugin,
|
|
38
52
|
RegisteredServicePlugin,
|
|
53
|
+
RegisteredToolsPlugin,
|
|
54
|
+
DeviceToolContext,
|
|
55
|
+
DeviceToolDefinition,
|
|
56
|
+
DeviceToolFn,
|
|
39
57
|
} from './types';
|
|
40
58
|
|
|
59
|
+
// Voice — the live conversational SESSION surface (props.voice).
|
|
60
|
+
export type {
|
|
61
|
+
VoiceAPI,
|
|
62
|
+
VoiceState,
|
|
63
|
+
VoiceSnapshot,
|
|
64
|
+
VoiceTranscriptEntry,
|
|
65
|
+
VoiceStartOptions,
|
|
66
|
+
VoicePersona,
|
|
67
|
+
VoiceEvent,
|
|
68
|
+
VoiceSubscription,
|
|
69
|
+
VoiceCaller,
|
|
70
|
+
VoiceSessionProvider,
|
|
71
|
+
} from './voice';
|
|
72
|
+
// The privileged platform caller (a value) — the host injects the owner-aware
|
|
73
|
+
// provider and its own surfaces call it as this caller. See VoiceSessionProvider.
|
|
74
|
+
export { PLATFORM_VOICE_CALLER } from './voice';
|
|
75
|
+
|
|
41
76
|
// RN primitives (plugins import from the SDK, not from react-native)
|
|
42
77
|
export {
|
|
43
78
|
View,
|
|
@@ -72,5 +107,9 @@ export {
|
|
|
72
107
|
} from './components';
|
|
73
108
|
|
|
74
109
|
// Theme + API hooks
|
|
110
|
+
// Showing the camera is a COMPONENT, not a native module handed to bundles —
|
|
111
|
+
// one door, one lock. See CameraPreview.tsx for why.
|
|
112
|
+
export { CameraPreview } from './CameraPreview';
|
|
113
|
+
export type { CameraPreviewProps } from './CameraPreview';
|
|
75
114
|
export { usePluginTheme, setPluginThemeColors } from './usePluginTheme';
|
|
76
115
|
export { useApi } from './useApi';
|
package/src/sdk/registration.ts
CHANGED
|
@@ -3,29 +3,69 @@
|
|
|
3
3
|
* Solution developers use these to register their plugins.
|
|
4
4
|
*/
|
|
5
5
|
import type {
|
|
6
|
+
DeviceToolDefinition,
|
|
6
7
|
NativeCapabilities,
|
|
7
8
|
PluginHooks,
|
|
8
9
|
PluginProps,
|
|
9
10
|
RegisteredUIPlugin,
|
|
10
11
|
RegisteredServicePlugin,
|
|
12
|
+
RegisteredToolsPlugin,
|
|
11
13
|
} from './types';
|
|
14
|
+
import type { DeviceBridgeDomain } from './device-state';
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* Register a UI or hybrid plugin (has a visual component).
|
|
18
|
+
*
|
|
19
|
+
* `tools` is optional: a plugin may ship UI and local tools together. Tools are
|
|
20
|
+
* picked up when the bundle loads, independently of whether the UI is mounted.
|
|
15
21
|
*/
|
|
16
22
|
export function register(
|
|
17
23
|
id: string,
|
|
18
24
|
config: {
|
|
19
25
|
type?: 'ui' | 'hybrid';
|
|
20
26
|
capabilities?: NativeCapabilities;
|
|
27
|
+
/** L3 DeviceState domains this plugin's UI reads via props.deviceState (e.g.
|
|
28
|
+
* ['spatial','visual']). Carried through so a HOST-registered plugin (no
|
|
29
|
+
* server manifest) can declare its domains — resolvePluginRuntimeProps reads
|
|
30
|
+
* this as the trusted source when there is no manifest. Dropping it here left
|
|
31
|
+
* every registered UI plugin with no L3, silently. Mirrors registerTools. */
|
|
32
|
+
stateDomains?: DeviceBridgeDomain[];
|
|
21
33
|
Component: React.FC<PluginProps>;
|
|
34
|
+
tools?: DeviceToolDefinition[];
|
|
22
35
|
},
|
|
23
36
|
): RegisteredUIPlugin {
|
|
24
37
|
return {
|
|
25
38
|
id,
|
|
26
39
|
type: config.type || 'ui',
|
|
27
40
|
capabilities: config.capabilities,
|
|
41
|
+
stateDomains: config.stateDomains,
|
|
28
42
|
Component: config.Component,
|
|
43
|
+
tools: config.tools,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Register a tools-only plugin — a `tools/` section with no UI at all.
|
|
49
|
+
*
|
|
50
|
+
* Nothing here mounts. The tools become callable as soon as the bundle is
|
|
51
|
+
* evaluated, and stay callable with nothing of the plugin on screen.
|
|
52
|
+
*/
|
|
53
|
+
export function registerTools(
|
|
54
|
+
id: string,
|
|
55
|
+
config: {
|
|
56
|
+
capabilities?: NativeCapabilities;
|
|
57
|
+
/** L3 DeviceState domains the tools read via ctx.deviceState (e.g. ['visual']).
|
|
58
|
+
* For a remote bundle the MANIFEST grants them — see RegisteredToolsPlugin. */
|
|
59
|
+
stateDomains?: DeviceBridgeDomain[];
|
|
60
|
+
tools: DeviceToolDefinition[];
|
|
61
|
+
},
|
|
62
|
+
): RegisteredToolsPlugin {
|
|
63
|
+
return {
|
|
64
|
+
id,
|
|
65
|
+
type: 'tools',
|
|
66
|
+
capabilities: config.capabilities,
|
|
67
|
+
stateDomains: config.stateDomains,
|
|
68
|
+
tools: config.tools,
|
|
29
69
|
};
|
|
30
70
|
}
|
|
31
71
|
|