@glassly/miniapp 0.1.0-dev.26
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/README.md +275 -0
- package/dist/background/index.d.ts +64 -0
- package/dist/background/index.d.ts.map +1 -0
- package/dist/background/index.js +26 -0
- package/dist/background/index.js.map +1 -0
- package/dist/background/register.d.ts +39 -0
- package/dist/background/register.d.ts.map +1 -0
- package/dist/background/register.js +72 -0
- package/dist/background/register.js.map +1 -0
- package/dist/dev-reload.d.ts +21 -0
- package/dist/dev-reload.d.ts.map +1 -0
- package/dist/dev-reload.js +60 -0
- package/dist/dev-reload.js.map +1 -0
- package/dist/envelope.d.ts +23 -0
- package/dist/envelope.d.ts.map +1 -0
- package/dist/envelope.js +47 -0
- package/dist/envelope.js.map +1 -0
- package/dist/globals.d.ts +54 -0
- package/dist/globals.d.ts.map +1 -0
- package/dist/globals.js +12 -0
- package/dist/globals.js.map +1 -0
- package/dist/hardware.d.ts +24 -0
- package/dist/hardware.d.ts.map +1 -0
- package/dist/hardware.js +20 -0
- package/dist/hardware.js.map +1 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/actions.d.ts +81 -0
- package/dist/modules/actions.d.ts.map +1 -0
- package/dist/modules/actions.js +137 -0
- package/dist/modules/actions.js.map +1 -0
- package/dist/modules/ai.d.ts +211 -0
- package/dist/modules/ai.d.ts.map +1 -0
- package/dist/modules/ai.js +117 -0
- package/dist/modules/ai.js.map +1 -0
- package/dist/modules/auth.d.ts +25 -0
- package/dist/modules/auth.d.ts.map +1 -0
- package/dist/modules/auth.js +52 -0
- package/dist/modules/auth.js.map +1 -0
- package/dist/modules/base64.d.ts +16 -0
- package/dist/modules/base64.d.ts.map +1 -0
- package/dist/modules/base64.js +92 -0
- package/dist/modules/base64.js.map +1 -0
- package/dist/modules/blob.d.ts +161 -0
- package/dist/modules/blob.d.ts.map +1 -0
- package/dist/modules/blob.js +277 -0
- package/dist/modules/blob.js.map +1 -0
- package/dist/modules/camera.d.ts +183 -0
- package/dist/modules/camera.d.ts.map +1 -0
- package/dist/modules/camera.js +119 -0
- package/dist/modules/camera.js.map +1 -0
- package/dist/modules/cloud.d.ts +34 -0
- package/dist/modules/cloud.d.ts.map +1 -0
- package/dist/modules/cloud.js +70 -0
- package/dist/modules/cloud.js.map +1 -0
- package/dist/modules/dashboard.d.ts +24 -0
- package/dist/modules/dashboard.d.ts.map +1 -0
- package/dist/modules/dashboard.js +39 -0
- package/dist/modules/dashboard.js.map +1 -0
- package/dist/modules/display.d.ts +174 -0
- package/dist/modules/display.d.ts.map +1 -0
- package/dist/modules/display.js +83 -0
- package/dist/modules/display.js.map +1 -0
- package/dist/modules/events.d.ts +178 -0
- package/dist/modules/events.d.ts.map +1 -0
- package/dist/modules/events.js +168 -0
- package/dist/modules/events.js.map +1 -0
- package/dist/modules/glasses.d.ts +36 -0
- package/dist/modules/glasses.d.ts.map +1 -0
- package/dist/modules/glasses.js +52 -0
- package/dist/modules/glasses.js.map +1 -0
- package/dist/modules/heading.d.ts +16 -0
- package/dist/modules/heading.d.ts.map +1 -0
- package/dist/modules/heading.js +20 -0
- package/dist/modules/heading.js.map +1 -0
- package/dist/modules/imu.d.ts +31 -0
- package/dist/modules/imu.d.ts.map +1 -0
- package/dist/modules/imu.js +40 -0
- package/dist/modules/imu.js.map +1 -0
- package/dist/modules/input.d.ts +50 -0
- package/dist/modules/input.d.ts.map +1 -0
- package/dist/modules/input.js +70 -0
- package/dist/modules/input.js.map +1 -0
- package/dist/modules/keys.d.ts +30 -0
- package/dist/modules/keys.d.ts.map +1 -0
- package/dist/modules/keys.js +37 -0
- package/dist/modules/keys.js.map +1 -0
- package/dist/modules/languages.d.ts +42 -0
- package/dist/modules/languages.d.ts.map +1 -0
- package/dist/modules/languages.js +57 -0
- package/dist/modules/languages.js.map +1 -0
- package/dist/modules/led.d.ts +35 -0
- package/dist/modules/led.d.ts.map +1 -0
- package/dist/modules/led.js +39 -0
- package/dist/modules/led.js.map +1 -0
- package/dist/modules/location.d.ts +27 -0
- package/dist/modules/location.d.ts.map +1 -0
- package/dist/modules/location.js +35 -0
- package/dist/modules/location.js.map +1 -0
- package/dist/modules/memory.d.ts +126 -0
- package/dist/modules/memory.d.ts.map +1 -0
- package/dist/modules/memory.js +141 -0
- package/dist/modules/memory.js.map +1 -0
- package/dist/modules/mic.d.ts +61 -0
- package/dist/modules/mic.d.ts.map +1 -0
- package/dist/modules/mic.js +94 -0
- package/dist/modules/mic.js.map +1 -0
- package/dist/modules/miniapps.d.ts +82 -0
- package/dist/modules/miniapps.d.ts.map +1 -0
- package/dist/modules/miniapps.js +58 -0
- package/dist/modules/miniapps.js.map +1 -0
- package/dist/modules/navigation.d.ts +332 -0
- package/dist/modules/navigation.d.ts.map +1 -0
- package/dist/modules/navigation.js +387 -0
- package/dist/modules/navigation.js.map +1 -0
- package/dist/modules/permissions.d.ts +58 -0
- package/dist/modules/permissions.d.ts.map +1 -0
- package/dist/modules/permissions.js +66 -0
- package/dist/modules/permissions.js.map +1 -0
- package/dist/modules/phone.d.ts +95 -0
- package/dist/modules/phone.d.ts.map +1 -0
- package/dist/modules/phone.js +110 -0
- package/dist/modules/phone.js.map +1 -0
- package/dist/modules/pivots/engine.d.ts +169 -0
- package/dist/modules/pivots/engine.d.ts.map +1 -0
- package/dist/modules/pivots/engine.js +778 -0
- package/dist/modules/pivots/engine.js.map +1 -0
- package/dist/modules/pivots/geometry.d.ts +84 -0
- package/dist/modules/pivots/geometry.d.ts.map +1 -0
- package/dist/modules/pivots/geometry.js +371 -0
- package/dist/modules/pivots/geometry.js.map +1 -0
- package/dist/modules/pivots/instructions.d.ts +139 -0
- package/dist/modules/pivots/instructions.d.ts.map +1 -0
- package/dist/modules/pivots/instructions.js +281 -0
- package/dist/modules/pivots/instructions.js.map +1 -0
- package/dist/modules/speaker.d.ts +175 -0
- package/dist/modules/speaker.d.ts.map +1 -0
- package/dist/modules/speaker.js +249 -0
- package/dist/modules/speaker.js.map +1 -0
- package/dist/modules/speakers.d.ts +29 -0
- package/dist/modules/speakers.d.ts.map +1 -0
- package/dist/modules/speakers.js +38 -0
- package/dist/modules/speakers.js.map +1 -0
- package/dist/modules/storage.d.ts +50 -0
- package/dist/modules/storage.d.ts.map +1 -0
- package/dist/modules/storage.js +99 -0
- package/dist/modules/storage.js.map +1 -0
- package/dist/modules/stream.d.ts +133 -0
- package/dist/modules/stream.d.ts.map +1 -0
- package/dist/modules/stream.js +53 -0
- package/dist/modules/stream.js.map +1 -0
- package/dist/modules/system.d.ts +71 -0
- package/dist/modules/system.d.ts.map +1 -0
- package/dist/modules/system.js +65 -0
- package/dist/modules/system.js.map +1 -0
- package/dist/modules/transcription.d.ts +99 -0
- package/dist/modules/transcription.d.ts.map +1 -0
- package/dist/modules/transcription.js +126 -0
- package/dist/modules/transcription.js.map +1 -0
- package/dist/modules/translation.d.ts +65 -0
- package/dist/modules/translation.d.ts.map +1 -0
- package/dist/modules/translation.js +121 -0
- package/dist/modules/translation.js.map +1 -0
- package/dist/modules/ui.d.ts +186 -0
- package/dist/modules/ui.d.ts.map +1 -0
- package/dist/modules/ui.js +289 -0
- package/dist/modules/ui.js.map +1 -0
- package/dist/protocol.d.ts +390 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +419 -0
- package/dist/protocol.js.map +1 -0
- package/dist/react/MiniappHeader.d.ts +44 -0
- package/dist/react/MiniappHeader.d.ts.map +1 -0
- package/dist/react/MiniappHeader.js +32 -0
- package/dist/react/MiniappHeader.js.map +1 -0
- package/dist/react/MiniappProvider.d.ts +33 -0
- package/dist/react/MiniappProvider.d.ts.map +1 -0
- package/dist/react/MiniappProvider.js +15 -0
- package/dist/react/MiniappProvider.js.map +1 -0
- package/dist/react/capsuleHeaderLayout.d.ts +3 -0
- package/dist/react/capsuleHeaderLayout.d.ts.map +1 -0
- package/dist/react/capsuleHeaderLayout.js +5 -0
- package/dist/react/capsuleHeaderLayout.js.map +1 -0
- package/dist/react/index.d.ts +13 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +9 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/useCapabilities.d.ts +26 -0
- package/dist/react/useCapabilities.d.ts.map +1 -0
- package/dist/react/useCapabilities.js +27 -0
- package/dist/react/useCapabilities.js.map +1 -0
- package/dist/react/useCapsuleHeaderStyle.d.ts +27 -0
- package/dist/react/useCapsuleHeaderStyle.d.ts.map +1 -0
- package/dist/react/useCapsuleHeaderStyle.js +39 -0
- package/dist/react/useCapsuleHeaderStyle.js.map +1 -0
- package/dist/react/useColorScheme.d.ts +18 -0
- package/dist/react/useColorScheme.d.ts.map +1 -0
- package/dist/react/useColorScheme.js +24 -0
- package/dist/react/useColorScheme.js.map +1 -0
- package/dist/react/useConnected.d.ts +17 -0
- package/dist/react/useConnected.d.ts.map +1 -0
- package/dist/react/useConnected.js +39 -0
- package/dist/react/useConnected.js.map +1 -0
- package/dist/react/useRpc.d.ts +29 -0
- package/dist/react/useRpc.d.ts.map +1 -0
- package/dist/react/useRpc.js +82 -0
- package/dist/react/useRpc.js.map +1 -0
- package/dist/react/useSafeArea.d.ts +21 -0
- package/dist/react/useSafeArea.d.ts.map +1 -0
- package/dist/react/useSafeArea.js +22 -0
- package/dist/react/useSafeArea.js.map +1 -0
- package/dist/session.d.ts +355 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +688 -0
- package/dist/session.js.map +1 -0
- package/dist/sub-path-types.test-d.d.ts +40 -0
- package/dist/sub-path-types.test-d.d.ts.map +1 -0
- package/dist/sub-path-types.test-d.js +37 -0
- package/dist/sub-path-types.test-d.js.map +1 -0
- package/dist/transport/auto.d.ts +35 -0
- package/dist/transport/auto.d.ts.map +1 -0
- package/dist/transport/auto.js +124 -0
- package/dist/transport/auto.js.map +1 -0
- package/dist/transport/dispatch.d.ts +43 -0
- package/dist/transport/dispatch.d.ts.map +1 -0
- package/dist/transport/dispatch.js +91 -0
- package/dist/transport/dispatch.js.map +1 -0
- package/dist/transport/local-socket.d.ts +28 -0
- package/dist/transport/local-socket.d.ts.map +1 -0
- package/dist/transport/local-socket.js +80 -0
- package/dist/transport/local-socket.js.map +1 -0
- package/dist/transport/mock.d.ts +54 -0
- package/dist/transport/mock.d.ts.map +1 -0
- package/dist/transport/mock.js +210 -0
- package/dist/transport/mock.js.map +1 -0
- package/dist/transport/postmessage.d.ts +36 -0
- package/dist/transport/postmessage.d.ts.map +1 -0
- package/dist/transport/postmessage.js +78 -0
- package/dist/transport/postmessage.js.map +1 -0
- package/dist/transport/types.d.ts +25 -0
- package/dist/transport/types.d.ts.map +1 -0
- package/dist/transport/types.js +11 -0
- package/dist/transport/types.js.map +1 -0
- package/dist/ui/index.d.ts +107 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +32 -0
- package/dist/ui/index.js.map +1 -0
- package/package.json +88 -0
- package/src/background/index.ts +177 -0
- package/src/background/register.ts +89 -0
- package/src/dev-reload.ts +59 -0
- package/src/envelope.ts +54 -0
- package/src/globals.ts +62 -0
- package/src/hardware.ts +25 -0
- package/src/index.ts +216 -0
- package/src/modules/actions.ts +189 -0
- package/src/modules/ai.ts +281 -0
- package/src/modules/auth.ts +68 -0
- package/src/modules/base64.ts +87 -0
- package/src/modules/blob.ts +341 -0
- package/src/modules/camera.ts +258 -0
- package/src/modules/cloud.ts +94 -0
- package/src/modules/dashboard.ts +51 -0
- package/src/modules/display.ts +214 -0
- package/src/modules/events.ts +318 -0
- package/src/modules/glasses.ts +58 -0
- package/src/modules/heading.ts +23 -0
- package/src/modules/imu.ts +44 -0
- package/src/modules/input.ts +87 -0
- package/src/modules/keys.ts +46 -0
- package/src/modules/languages.ts +72 -0
- package/src/modules/led.ts +61 -0
- package/src/modules/location.ts +39 -0
- package/src/modules/memory.ts +224 -0
- package/src/modules/mic.ts +103 -0
- package/src/modules/miniapps.ts +103 -0
- package/src/modules/navigation.ts +674 -0
- package/src/modules/permissions.ts +83 -0
- package/src/modules/phone.ts +155 -0
- package/src/modules/pivots/engine.ts +863 -0
- package/src/modules/pivots/geometry.ts +409 -0
- package/src/modules/pivots/instructions.ts +341 -0
- package/src/modules/speaker.ts +347 -0
- package/src/modules/speakers.ts +40 -0
- package/src/modules/storage.ts +109 -0
- package/src/modules/stream.ts +168 -0
- package/src/modules/system.ts +113 -0
- package/src/modules/transcription.ts +180 -0
- package/src/modules/translation.ts +156 -0
- package/src/modules/ui.ts +481 -0
- package/src/protocol.ts +482 -0
- package/src/react/MiniappHeader.tsx +114 -0
- package/src/react/MiniappProvider.tsx +50 -0
- package/src/react/capsuleHeaderLayout.ts +11 -0
- package/src/react/index.ts +12 -0
- package/src/react/useCapabilities.ts +29 -0
- package/src/react/useCapsuleHeaderStyle.ts +55 -0
- package/src/react/useColorScheme.ts +26 -0
- package/src/react/useConnected.ts +47 -0
- package/src/react/useRpc.ts +103 -0
- package/src/react/useSafeArea.ts +36 -0
- package/src/session.ts +969 -0
- package/src/sub-path-types.test-d.ts +60 -0
- package/src/transport/auto.ts +143 -0
- package/src/transport/dispatch.ts +106 -0
- package/src/transport/local-socket.ts +91 -0
- package/src/transport/mock.ts +255 -0
- package/src/transport/postmessage.ts +95 -0
- package/src/transport/types.ts +26 -0
- package/src/ui/index.ts +129 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview MiniappsModule — `session.miniapps`.
|
|
3
|
+
*
|
|
4
|
+
* Discover and control the lifecycle of OTHER miniapps: list, start, stop.
|
|
5
|
+
* SYSTEM-only — every call rejects with NOT_PERMITTED unless the caller is a
|
|
6
|
+
* system app (Glassly AI is the first consumer). The action *capability* layer
|
|
7
|
+
* (invoke / handle) lives on `session.actions`, not here — these three are
|
|
8
|
+
* operations on the app as a whole, not on a declared action.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {MiniappRequestType} from "../protocol"
|
|
12
|
+
import {MiniappSession} from "../session"
|
|
13
|
+
|
|
14
|
+
/** A declared action surfaced by {@link MiniappsModule.list}. */
|
|
15
|
+
export interface MiniappActionInfo {
|
|
16
|
+
id: string
|
|
17
|
+
description: string
|
|
18
|
+
/**
|
|
19
|
+
* JSON-Schema input descriptor (the MCP-compatible subset). Maps verbatim
|
|
20
|
+
* to an MCP tool `inputSchema`. Undefined for actions that take no params.
|
|
21
|
+
*/
|
|
22
|
+
parameters?: Record<string, unknown>
|
|
23
|
+
/** JSON-Schema descriptor for the structured value returned by the action. */
|
|
24
|
+
outputSchema?: Record<string, unknown>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Hardware compatibility for a listed miniapp. Structurally mirrors the host's
|
|
29
|
+
* `CompatibilityResult` so the runtime can pass it straight through.
|
|
30
|
+
*/
|
|
31
|
+
export interface MiniappCompatibility {
|
|
32
|
+
isCompatible: boolean
|
|
33
|
+
missingRequired: Array<{type: string; level?: string}>
|
|
34
|
+
missingOptional: Array<{type: string; level?: string}>
|
|
35
|
+
warnings: string[]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** One installed miniapp, as surfaced to a system caller. */
|
|
39
|
+
export interface MiniappInfo {
|
|
40
|
+
packageName: string
|
|
41
|
+
name: string
|
|
42
|
+
description?: string
|
|
43
|
+
version: string
|
|
44
|
+
running: boolean
|
|
45
|
+
compatibility: MiniappCompatibility
|
|
46
|
+
/** Declared actions (empty if the miniapp declares none). */
|
|
47
|
+
actions: MiniappActionInfo[]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ListMiniappsOptions {
|
|
51
|
+
/** Include incompatible miniapps too (default false — compatible-only). */
|
|
52
|
+
includeIncompatible?: boolean
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export class MiniappsModule {
|
|
56
|
+
constructor(private readonly session: MiniappSession) {}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* List installed miniapps. Compatible-only by default; pass
|
|
60
|
+
* `{includeIncompatible: true}` to include the rest (each carries a
|
|
61
|
+
* `compatibility` result with the missing hardware). SYSTEM-only.
|
|
62
|
+
*/
|
|
63
|
+
async list(opts?: ListMiniappsOptions): Promise<MiniappInfo[]> {
|
|
64
|
+
const result = await this.session.sendRequest<MiniappInfo[]>({
|
|
65
|
+
type: MiniappRequestType.MINIAPPS_LIST,
|
|
66
|
+
includeIncompatible: opts?.includeIncompatible ?? false,
|
|
67
|
+
})
|
|
68
|
+
return result ?? []
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Start another miniapp in the **background** — spawns its background JS
|
|
73
|
+
* context without changing the user's phone navigation or foregrounding
|
|
74
|
+
* anything. The app reports as running and can handle actions / drive the
|
|
75
|
+
* glasses immediately; its WebView only mounts if the user later opens it.
|
|
76
|
+
* SYSTEM-only.
|
|
77
|
+
*/
|
|
78
|
+
async start(packageName: string): Promise<void> {
|
|
79
|
+
await this.session.sendRequest<void>({
|
|
80
|
+
type: MiniappRequestType.MINIAPPS_START,
|
|
81
|
+
packageName,
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Stop another miniapp. SYSTEM-only. */
|
|
86
|
+
async stop(packageName: string): Promise<void> {
|
|
87
|
+
await this.session.sendRequest<void>({
|
|
88
|
+
type: MiniappRequestType.MINIAPPS_STOP,
|
|
89
|
+
packageName,
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Stop THIS miniapp — the host tears the background context down shortly
|
|
95
|
+
* after. Not system-gated: an app may always stop itself. Fire-and-forget
|
|
96
|
+
* (no reply — the caller is going away); flush anything pending first, e.g.
|
|
97
|
+
* defer this with a short setTimeout from an action handler so the
|
|
98
|
+
* ACTION_RESULT reaches the caller before teardown.
|
|
99
|
+
*/
|
|
100
|
+
stopSelf(): void {
|
|
101
|
+
this.session.sendOneShot({type: MiniappRequestType.MINIAPPS_STOP_SELF})
|
|
102
|
+
}
|
|
103
|
+
}
|