@glassly/cloud-client 0.4.3 → 0.4.4-beta.1319
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
CHANGED
|
@@ -6,29 +6,32 @@ Glassly cloud over the wire protocol defined in
|
|
|
6
6
|
handling the handshake, message envelopes, and per-module message flows
|
|
7
7
|
(camera, audio, maps, reports, …).
|
|
8
8
|
|
|
9
|
-
Its
|
|
10
|
-
which lists
|
|
11
|
-
this package
|
|
9
|
+
Its consumers are the Glassly App and
|
|
10
|
+
[`@glassly/engine`](https://www.npmjs.com/package/@glassly/engine), which lists
|
|
11
|
+
it under `dependencies`, so an app embedding the engine gets this package
|
|
12
|
+
automatically.
|
|
12
13
|
|
|
13
14
|
## Install
|
|
14
15
|
|
|
15
16
|
```sh
|
|
16
|
-
npm install @glassly/cloud-client
|
|
17
|
+
npm install @glassly/cloud-client
|
|
17
18
|
```
|
|
18
19
|
|
|
19
|
-
> Currently published on the `dev` dist-tag (prerelease channel).
|
|
20
|
-
|
|
21
20
|
## Entry points
|
|
22
21
|
|
|
23
22
|
| Import | Use |
|
|
24
23
|
| --- | --- |
|
|
25
|
-
| `@glassly/cloud-client` | platform-neutral core: `CloudClient` plus the public config, transport, and error types (wire-protocol types are deliberately *not* re-exported
|
|
24
|
+
| `@glassly/cloud-client` | platform-neutral core: `CloudClient` plus the public config, transport, and error types (wire-protocol types are deliberately *not* re-exported; import those from `@glassly/cloud-protocol`) |
|
|
26
25
|
| `@glassly/cloud-client/react-native` | React Native transport bindings (used by the engine) |
|
|
27
|
-
| `@glassly/cloud-client/node` | Node transport bindings
|
|
26
|
+
| `@glassly/cloud-client/node` | Node transport bindings; requires the optional [`ws`](https://www.npmjs.com/package/ws) peer (`npm i ws`) |
|
|
28
27
|
|
|
29
28
|
The package ships TypeScript source and targets consumers that compile TS
|
|
30
29
|
themselves (Metro / bundlers / tsc).
|
|
31
30
|
|
|
31
|
+
## Modules
|
|
32
|
+
|
|
33
|
+
`CloudClient` exposes `auth`, `runtime` and `core`. `core` exists when the config sets `endpoints.core` and `auth.core`. It groups stateless REST calls: `store` (below), `miniapps.getRegistry`, `reports` and `supportProfile`. `runtime` carries the session connection and its modules, including `tts`, `maps` and `llm`. The design is in [`docs/issues/004-cloud-client/spec.md`](https://github.com/tetramo-labs/glassly/blob/dev/cloud/docs/issues/004-cloud-client/spec.md).
|
|
34
|
+
|
|
32
35
|
## Miniapp store catalog
|
|
33
36
|
|
|
34
37
|
Host integrations can browse published miniapps through an authenticated
|
|
@@ -47,13 +50,19 @@ if (listing.iconUrl) {
|
|
|
47
50
|
|
|
48
51
|
| Method | Returns |
|
|
49
52
|
| --- | --- |
|
|
50
|
-
| `core.store.list()` | `Promise<StoreCatalogResponse>`: `{generatedAt, listings}`; the complete catalog, for local search and tag filtering. |
|
|
51
|
-
| `core.store.get(packageName)` | `Promise<StoreListing>`: one published listing. |
|
|
53
|
+
| `core.store.list(options?)` | `Promise<StoreCatalogResponse>`: `{generatedAt, listings}`; the complete catalog, for local search and tag filtering. |
|
|
54
|
+
| `core.store.get(packageName, options?)` | `Promise<StoreListing>`: one published listing. |
|
|
55
|
+
| `core.store.releases(packageName, options?)` | `Promise<StoreReleasesResponse>`: every published release of a listing, newest first, each with its own bundle. |
|
|
52
56
|
| `core.store.fetchAsset(url)` | `Promise<Uint8Array>`: authenticated icon/screenshot bytes, accepting a listing URL or a path. |
|
|
53
57
|
|
|
58
|
+
`options` is `{hostVersion?: string | null}`, sent as the `hostVersion` query parameter.
|
|
59
|
+
|
|
54
60
|
Listings include identity, tagline, description, tags, author, featured status,
|
|
55
61
|
published version, miniapp type and Always On default, permissions, hardware
|
|
56
|
-
requirements, icon
|
|
62
|
+
requirements, the icon URL, and bundle `{url, sha256, sizeBytes}`. Screenshots
|
|
63
|
+
come in two galleries, `glassesScreenshots` (the glasses display, wide) and
|
|
64
|
+
`phoneScreenshots` (the miniapp's phone page, portrait), each `{url, width, height}`
|
|
65
|
+
in display order; `screenshots` repeats the glasses set for older hosts.
|
|
57
66
|
Fetch icons and screenshots through `fetchAsset` so Core receives the user's
|
|
58
67
|
Bearer token. The host owns installation, compatibility checks, and updates;
|
|
59
68
|
listing or fetching an asset does not install a miniapp. These APIs belong to
|
|
@@ -62,4 +71,7 @@ the host's cloud client, not the miniapp's read-only `session.cloud` module.
|
|
|
62
71
|
## Part of Glassly
|
|
63
72
|
|
|
64
73
|
Source lives in the [Glassly monorepo](https://github.com/tetramo-labs/glassly)
|
|
65
|
-
under `cloud/packages/cloud-client
|
|
74
|
+
under `cloud/packages/cloud-client`; the parent is the
|
|
75
|
+
[Cloud README](https://github.com/tetramo-labs/glassly/tree/dev/cloud#readme).
|
|
76
|
+
Issues and contributions welcome there. Run the tests with `bun test` from that
|
|
77
|
+
folder. CI is dispatch-only, so run them locally. From the repo root, [`bun run check`](https://github.com/tetramo-labs/glassly/blob/dev/AGENTS.md#whole-repo) runs `bun test packages` when your branch changes `cloud/`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glassly/cloud-client",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4-beta.1319",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"exports": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"test": "bun test"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@glassly/cloud-protocol": "0.4.
|
|
15
|
+
"@glassly/cloud-protocol": "0.4.4-beta.1319",
|
|
16
16
|
"tweetnacl": "^1.0.3"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
package/src/modules/core/core.ts
CHANGED
|
@@ -61,6 +61,8 @@ export type {
|
|
|
61
61
|
* resource, not part of the live session wire contract.
|
|
62
62
|
*/
|
|
63
63
|
export interface StoreListing {
|
|
64
|
+
importSource?: {tag: string; name: string}
|
|
65
|
+
requiredGlassesModel?: string
|
|
64
66
|
packageName: string;
|
|
65
67
|
name: string;
|
|
66
68
|
tagline: string;
|
|
@@ -79,6 +81,8 @@ export interface StoreListing {
|
|
|
79
81
|
/** Authenticated asset URL; fetch through `core.store.fetchAsset`. */
|
|
80
82
|
iconUrl: string | null;
|
|
81
83
|
screenshots: StoreListingScreenshot[];
|
|
84
|
+
glassesScreenshots: StoreListingScreenshot[];
|
|
85
|
+
phoneScreenshots: StoreListingScreenshot[];
|
|
82
86
|
bundle: { url: string; sha256: string; sizeBytes: number };
|
|
83
87
|
publishedAt: string;
|
|
84
88
|
updatedAt: string;
|
|
@@ -109,6 +113,7 @@ export interface StoreCatalogResponse {
|
|
|
109
113
|
|
|
110
114
|
/** One published release of a listing (`GET /api/client/store/:packageName/releases`). */
|
|
111
115
|
export interface StoreRelease {
|
|
116
|
+
requiredGlassesModel?: string
|
|
112
117
|
version: string;
|
|
113
118
|
/** The listing's active release. */
|
|
114
119
|
current: boolean;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type {
|
|
13
13
|
QuotaStatusPayload,
|
|
14
|
+
StreamErrorPayload,
|
|
14
15
|
TranscriptionData,
|
|
15
16
|
TranslationData,
|
|
16
17
|
ProtocolError,
|
|
@@ -31,6 +32,7 @@ export interface RuntimeEvents {
|
|
|
31
32
|
translation: TranslationData;
|
|
32
33
|
/** Plan-quota block state changed for a metered stream (stream.quota). */
|
|
33
34
|
quota: QuotaStatusPayload;
|
|
35
|
+
speechFailure: StreamErrorPayload;
|
|
34
36
|
connected: void;
|
|
35
37
|
disconnected: { reason: string };
|
|
36
38
|
status: RuntimeSnapshot;
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
import type {
|
|
20
20
|
AudioSubscription,
|
|
21
21
|
QuotaStatusPayload,
|
|
22
|
+
StreamErrorPayload,
|
|
22
23
|
TranscriptionData,
|
|
23
24
|
TranslationData,
|
|
24
25
|
ProtocolError,
|
|
@@ -88,6 +89,7 @@ export interface RuntimeModule {
|
|
|
88
89
|
onTranscript(handler: (data: TranscriptionData) => void): () => void;
|
|
89
90
|
onTranslation(handler: (data: TranslationData) => void): () => void;
|
|
90
91
|
onQuota(handler: (data: QuotaStatusPayload) => void): () => void;
|
|
92
|
+
onSpeechFailure(handler: (data: StreamErrorPayload) => void): () => void;
|
|
91
93
|
|
|
92
94
|
requestManagedPhoto(opts: PhotoOptions): Promise<{ requestId: string; readUrl: string }>;
|
|
93
95
|
startManagedPhoto(opts: PhotoOptions): Promise<{ requestId: string; uploadUrl: string; readUrl: string }>;
|
|
@@ -276,6 +278,9 @@ export class Runtime implements RuntimeModule {
|
|
|
276
278
|
case "stream.quota":
|
|
277
279
|
this.emitter.emit("quota", msg.payload);
|
|
278
280
|
break;
|
|
281
|
+
case "stream.error":
|
|
282
|
+
this.emitter.emit("speechFailure", msg.payload);
|
|
283
|
+
break;
|
|
279
284
|
case "audio.udp_liveness_ack":
|
|
280
285
|
this.handleUdpLivenessAck(msg.payload);
|
|
281
286
|
break;
|
|
@@ -494,6 +499,10 @@ export class Runtime implements RuntimeModule {
|
|
|
494
499
|
return this.emitter.on("quota", handler);
|
|
495
500
|
}
|
|
496
501
|
|
|
502
|
+
onSpeechFailure(handler: (data: StreamErrorPayload) => void): () => void {
|
|
503
|
+
return this.emitter.on("speechFailure", handler);
|
|
504
|
+
}
|
|
505
|
+
|
|
497
506
|
onConnected(handler: () => void): () => void {
|
|
498
507
|
// The "connected" event carries no payload; adapt the void payload to the
|
|
499
508
|
// caller's zero-arg handler.
|