@glassly/cloud-client 0.4.3 → 0.4.4-dev.1305
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 +20 -11
- package/package.json +2 -2
- package/src/modules/runtime/emitter.ts +2 -0
- package/src/modules/runtime/runtime.ts +9 -0
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,10 +50,13 @@ 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
62
|
requirements, icon and screenshot URLs, and bundle `{url, sha256, sizeBytes}`.
|
|
@@ -62,4 +68,7 @@ the host's cloud client, not the miniapp's read-only `session.cloud` module.
|
|
|
62
68
|
## Part of Glassly
|
|
63
69
|
|
|
64
70
|
Source lives in the [Glassly monorepo](https://github.com/tetramo-labs/glassly)
|
|
65
|
-
under `cloud/packages/cloud-client
|
|
71
|
+
under `cloud/packages/cloud-client`; the parent is the
|
|
72
|
+
[Cloud README](https://github.com/tetramo-labs/glassly/tree/dev/cloud#readme).
|
|
73
|
+
Issues and contributions welcome there. Run the tests with `bun test` from that
|
|
74
|
+
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-dev.1305",
|
|
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-dev.1305",
|
|
16
16
|
"tweetnacl": "^1.0.3"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
@@ -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.
|