@lumavox/client 0.1.1 → 0.2.0
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 +8 -5
- package/dist/client.d.ts +36 -23
- package/dist/client.js +35 -25
- package/dist/conversation.d.ts +3 -2
- package/dist/conversation.js +18 -16
- package/dist/errors.d.ts +24 -16
- package/dist/errors.js +19 -39
- package/dist/events.d.ts +25 -20
- package/dist/gen/index.d.ts +1 -1
- package/dist/gen/types.gen.d.ts +203 -260
- package/dist/protocol.gen.d.ts +4 -4
- package/dist/protocol.gen.js +4 -4
- package/dist/token.d.ts +1 -1
- package/dist/transport.js +3 -3
- package/package.json +1 -1
package/dist/protocol.gen.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The protocol, sent as the WebSocket subprotocol and echoed on `ready`. */
|
|
2
|
-
export declare const PROTOCOL = "ino.
|
|
2
|
+
export declare const PROTOCOL = "ino.v2";
|
|
3
3
|
/** Every frame a client may send; the edge closes on any other (4009). */
|
|
4
4
|
export declare const CLIENT_VERBS: readonly ["auth", "user_message", "user_audio.start", "user_audio.end", "cancel", "mute", "ping"];
|
|
5
5
|
export type ClientVerb = (typeof CLIENT_VERBS)[number];
|
|
@@ -27,9 +27,9 @@ export declare const CLOSE: {
|
|
|
27
27
|
export type CloseName = keyof typeof CLOSE;
|
|
28
28
|
/** The codes no reconnect with the same key can fix (the edge's `fatal`). */
|
|
29
29
|
export declare const FINAL_CLOSE_CODES: readonly number[];
|
|
30
|
-
export declare const
|
|
31
|
-
export declare const
|
|
32
|
-
export declare const
|
|
30
|
+
export declare const AUTH_DEADLINE_SECONDS = 10;
|
|
31
|
+
export declare const IDLE_SECONDS = 300;
|
|
32
|
+
export declare const KEEPALIVE_SECONDS = 30;
|
|
33
33
|
export declare const MAX_AUDIO_BYTES = 10485760;
|
|
34
34
|
export declare const MAX_MESSAGE_CHARS = 32000;
|
|
35
35
|
export declare const HEARINGS_IN_FLIGHT = 3;
|
package/dist/protocol.gen.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// `npm run protocol -w sdks/client`, which `scripts/sdk-protocol.mjs`
|
|
4
4
|
// fails until it is.
|
|
5
5
|
/** The protocol, sent as the WebSocket subprotocol and echoed on `ready`. */
|
|
6
|
-
export const PROTOCOL = "ino.
|
|
6
|
+
export const PROTOCOL = "ino.v2";
|
|
7
7
|
/** Every frame a client may send; the edge closes on any other (4009). */
|
|
8
8
|
export const CLIENT_VERBS = ["auth", "user_message", "user_audio.start", "user_audio.end", "cancel", "mute", "ping"];
|
|
9
9
|
/** Every event the edge sends. */
|
|
@@ -29,9 +29,9 @@ export const CLOSE = {
|
|
|
29
29
|
/** The codes no reconnect with the same key can fix (the edge's `fatal`). */
|
|
30
30
|
export const FINAL_CLOSE_CODES = [4002, 4004, 4008, 4010];
|
|
31
31
|
// The limits, as the edge holds them.
|
|
32
|
-
export const
|
|
33
|
-
export const
|
|
34
|
-
export const
|
|
32
|
+
export const AUTH_DEADLINE_SECONDS = 10;
|
|
33
|
+
export const IDLE_SECONDS = 300;
|
|
34
|
+
export const KEEPALIVE_SECONDS = 30;
|
|
35
35
|
export const MAX_AUDIO_BYTES = 10485760;
|
|
36
36
|
export const MAX_MESSAGE_CHARS = 32000;
|
|
37
37
|
export const HEARINGS_IN_FLIGHT = 3;
|
package/dist/token.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface TokenRequest {
|
|
|
17
17
|
reason: "initial" | "refused";
|
|
18
18
|
/** The HTTP status that refused it: 401. */
|
|
19
19
|
status?: number;
|
|
20
|
-
/** The socket's close code (4002–4005), or the API's error `
|
|
20
|
+
/** The socket's close code (4002–4005), or the API's error `code`. */
|
|
21
21
|
code?: number | string;
|
|
22
22
|
}
|
|
23
23
|
/** The app's way to an ephemeral key: usually a call to its own server, which mints one. */
|
package/dist/transport.js
CHANGED
|
@@ -84,7 +84,7 @@ export function parsed(text, status, requestId) {
|
|
|
84
84
|
catch (cause) {
|
|
85
85
|
throw new PlatformError({
|
|
86
86
|
status,
|
|
87
|
-
|
|
87
|
+
code: "invalid_response",
|
|
88
88
|
message: `HTTP ${status} with a body that is not JSON.`,
|
|
89
89
|
requestId,
|
|
90
90
|
cause,
|
|
@@ -163,13 +163,13 @@ export class Transport {
|
|
|
163
163
|
throw outcome.kind === "timeout"
|
|
164
164
|
? new TimeoutError({
|
|
165
165
|
status: 0,
|
|
166
|
-
|
|
166
|
+
code: "timeout",
|
|
167
167
|
message: "The API did not answer in time.",
|
|
168
168
|
requestId,
|
|
169
169
|
})
|
|
170
170
|
: new ConnectionError({
|
|
171
171
|
status: 0,
|
|
172
|
-
|
|
172
|
+
code: "connection_error",
|
|
173
173
|
message: "Could not reach the API.",
|
|
174
174
|
requestId,
|
|
175
175
|
cause: outcome.error,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumavox/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Talk to Lumavox agents from a browser, a React Native app or Node, with an end user's ephemeral key: conversations on the agent's socket, sessions, memory and relations. Zero dependencies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|