@celljs/ta-protocol 4.16.0 → 4.17.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/esm/common/app-protocol.d.ts +115 -0
- package/esm/common/app-protocol.js +199 -0
- package/esm/common/delegate-protocol.d.ts +30 -0
- package/esm/common/delegate-protocol.js +52 -0
- package/esm/common/deployment-protocol.d.ts +59 -0
- package/esm/common/deployment-protocol.js +135 -0
- package/esm/common/error-protocol.d.ts +42 -0
- package/esm/common/error-protocol.js +45 -0
- package/esm/common/event-protocol.d.ts +63 -0
- package/esm/common/event-protocol.js +2 -0
- package/esm/common/gateway-protocol.d.ts +29 -0
- package/esm/common/index.d.ts +9 -0
- package/esm/common/index.js +9 -0
- package/esm/common/message-protocol.d.ts +95 -0
- package/esm/common/message-protocol.js +237 -0
- package/esm/common/page-protocol.d.ts +56 -0
- package/esm/common/page-protocol.js +12 -0
- package/esm/common/path-map.d.ts +24 -0
- package/esm/common/path-map.js +127 -0
- package/esm/common/presence-protocol.js +1 -1
- package/esm/common/redactor.d.ts +12 -0
- package/esm/common/redactor.js +49 -11
- package/esm/common/relay-protocol.d.ts +20 -0
- package/esm/common/room-protocol.d.ts +7 -1
- package/esm/common/ta-extension-host.d.ts +31 -1
- package/esm/common/ta-extension-host.js +2 -0
- package/esm/common/ta-protocol.d.ts +50 -175
- package/esm/common/ta-protocol.js +0 -234
- package/esm/common/voice-protocol.d.ts +139 -0
- package/esm/common/voice-protocol.js +3 -0
- package/lib/common/app-protocol.d.ts +116 -0
- package/lib/common/app-protocol.js +202 -0
- package/lib/common/delegate-protocol.d.ts +31 -0
- package/lib/common/delegate-protocol.js +55 -0
- package/lib/common/deployment-protocol.d.ts +60 -0
- package/lib/common/deployment-protocol.js +139 -0
- package/lib/common/error-protocol.d.ts +43 -0
- package/lib/common/error-protocol.js +48 -0
- package/lib/common/event-protocol.d.ts +64 -0
- package/lib/common/event-protocol.js +3 -0
- package/lib/common/gateway-protocol.d.ts +29 -0
- package/lib/common/index.d.ts +9 -0
- package/lib/common/index.js +9 -0
- package/lib/common/message-protocol.d.ts +96 -0
- package/lib/common/message-protocol.js +240 -0
- package/lib/common/page-protocol.d.ts +57 -0
- package/lib/common/page-protocol.js +15 -0
- package/lib/common/path-map.d.ts +25 -0
- package/lib/common/path-map.js +130 -0
- package/lib/common/presence-protocol.js +7 -7
- package/lib/common/redactor.d.ts +12 -0
- package/lib/common/redactor.js +49 -11
- package/lib/common/relay-protocol.d.ts +20 -0
- package/lib/common/room-protocol.d.ts +7 -1
- package/lib/common/ta-extension-host.d.ts +31 -1
- package/lib/common/ta-extension-host.js +3 -1
- package/lib/common/ta-protocol.d.ts +50 -175
- package/lib/common/ta-protocol.js +1 -235
- package/lib/common/voice-protocol.d.ts +140 -0
- package/lib/common/voice-protocol.js +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { TaPackageText } from './package-protocol';
|
|
2
|
+
import type { TaRelayOption } from './relay-protocol';
|
|
3
|
+
export declare const TaVoiceServer: unique symbol;
|
|
4
|
+
export declare const TA_VOICE_SERVICE = "TaVoiceServer";
|
|
5
|
+
/** A field of the form to add a service of a type (docs/design/ta-voice.md): the same as those of relays. */
|
|
6
|
+
export type TaVoiceOption = TaRelayOption;
|
|
7
|
+
/** A type of voice service a package registered, as the page shows it to add one. */
|
|
8
|
+
export interface TaVoiceTypeInfo {
|
|
9
|
+
type: string;
|
|
10
|
+
title: TaPackageText;
|
|
11
|
+
hint?: TaPackageText;
|
|
12
|
+
/** The name of an icon of `pi.ui.icons`. */
|
|
13
|
+
icon?: string;
|
|
14
|
+
options: TaVoiceOption[];
|
|
15
|
+
/** It reads text given to it; without, Ta reads with the voice of the device and the service only listens. */
|
|
16
|
+
speaks: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** A service of voices.json, as the page sees it: never a password or a key. */
|
|
19
|
+
export interface TaVoiceService {
|
|
20
|
+
id: string;
|
|
21
|
+
type: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
/** Where it is, in a few words (a host). */
|
|
24
|
+
where?: string;
|
|
25
|
+
options?: Record<string, unknown>;
|
|
26
|
+
/** Its type is of a package that is off. */
|
|
27
|
+
unavailable?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** The services of calls and the one in use (TaVoiceServer.listVoices). */
|
|
30
|
+
export interface TaVoices {
|
|
31
|
+
services: TaVoiceService[];
|
|
32
|
+
/** The service calls use; undefined: the voice of the device. */
|
|
33
|
+
use?: string;
|
|
34
|
+
types: TaVoiceTypeInfo[];
|
|
35
|
+
/** voices.json in the agent directory, to edit by hand. */
|
|
36
|
+
file: string;
|
|
37
|
+
}
|
|
38
|
+
/** A voice opened for a call (TaVoiceServer.openVoice). */
|
|
39
|
+
export interface TaVoiceSession {
|
|
40
|
+
voiceId: string;
|
|
41
|
+
/** The rate of the PCM16 mono a page sends (sendVoice). */
|
|
42
|
+
inputRate: number;
|
|
43
|
+
/** The rate of the PCM16 mono of `audio` events. */
|
|
44
|
+
outputRate: number;
|
|
45
|
+
speaks: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** What a voice opened by a connection tells it (TaClient.onVoiceEvent). */
|
|
48
|
+
export type TaVoiceEvent =
|
|
49
|
+
/** The user began to speak: Ta stops reading (barge-in). */
|
|
50
|
+
{
|
|
51
|
+
voiceId: string;
|
|
52
|
+
type: 'speech';
|
|
53
|
+
}
|
|
54
|
+
/** What the user said so far; `final` once a sentence ended. */
|
|
55
|
+
| {
|
|
56
|
+
voiceId: string;
|
|
57
|
+
type: 'text';
|
|
58
|
+
text: string;
|
|
59
|
+
final: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** Audio of the reading `say`: base64 of PCM16 mono at `outputRate`. */
|
|
62
|
+
| {
|
|
63
|
+
voiceId: string;
|
|
64
|
+
type: 'audio';
|
|
65
|
+
say: number;
|
|
66
|
+
data: string;
|
|
67
|
+
}
|
|
68
|
+
/** The reading `say` has all its audio sent. */
|
|
69
|
+
| {
|
|
70
|
+
voiceId: string;
|
|
71
|
+
type: 'said';
|
|
72
|
+
say: number;
|
|
73
|
+
}
|
|
74
|
+
/** It closed, by itself (`error` then says why) or as asked. */
|
|
75
|
+
| {
|
|
76
|
+
voiceId: string;
|
|
77
|
+
type: 'closed';
|
|
78
|
+
error?: string;
|
|
79
|
+
};
|
|
80
|
+
/** The voices of calls for pages (docs/design/ta-voice.md). */
|
|
81
|
+
export interface TaVoiceServer {
|
|
82
|
+
listVoices(): Promise<TaVoices>;
|
|
83
|
+
/** Adds a service of a registered type after opening it once: a wrong key is said now. Its id. */
|
|
84
|
+
addVoice(type: string, options: Record<string, unknown>, name?: string): Promise<string>;
|
|
85
|
+
/**
|
|
86
|
+
* Changes a service after opening it once with what it would be: its fields (a secret left empty keeps the one
|
|
87
|
+
* kept) and its name; a wrong key is said now and nothing changes.
|
|
88
|
+
*/
|
|
89
|
+
updateVoice(id: string, options: Record<string, unknown>, name?: string): Promise<void>;
|
|
90
|
+
removeVoice(id: string): Promise<void>;
|
|
91
|
+
/** The service calls use from now on; null for the voice of the device. */
|
|
92
|
+
chooseVoice(id: string | null): Promise<void>;
|
|
93
|
+
/** Opens the service in use for a call of this connection; it closes as the connection does. */
|
|
94
|
+
openVoice(options: {
|
|
95
|
+
language: string;
|
|
96
|
+
}): Promise<TaVoiceSession>;
|
|
97
|
+
/** PCM16 mono at `inputRate`, base64. */
|
|
98
|
+
sendVoice(voiceId: string, audio: string): Promise<void>;
|
|
99
|
+
/** Reads text: the id its audio and its `said` carry. */
|
|
100
|
+
sayVoice(voiceId: string, text: string): Promise<number>;
|
|
101
|
+
/** Stops what it reads. */
|
|
102
|
+
hushVoice(voiceId: string): Promise<void>;
|
|
103
|
+
closeVoice(voiceId: string): Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
/** What a voice service tells Ta as it runs (TaVoiceType.open). */
|
|
106
|
+
export interface TaVoiceEngineEvents {
|
|
107
|
+
speech(): void;
|
|
108
|
+
text(text: string, final: boolean): void;
|
|
109
|
+
audio(pcm: Uint8Array, say: number): void;
|
|
110
|
+
said(say: number): void;
|
|
111
|
+
/** It closed by itself: the connection dropped, the service refused. */
|
|
112
|
+
closed(error?: string): void;
|
|
113
|
+
}
|
|
114
|
+
/** A voice service opened (TaVoiceType.open): what Ta sends it. */
|
|
115
|
+
export interface TaVoiceEngine {
|
|
116
|
+
readonly inputRate: number;
|
|
117
|
+
readonly outputRate: number;
|
|
118
|
+
/** PCM16 mono at `inputRate`. */
|
|
119
|
+
send(pcm: Uint8Array): void;
|
|
120
|
+
/** Reads text aloud, its audio told with `say`; only of a type that `speaks`. */
|
|
121
|
+
say?(text: string, say: number): void;
|
|
122
|
+
/** Stops what it reads; its audio coming late is dropped by Ta anyway. */
|
|
123
|
+
hush(): void;
|
|
124
|
+
close(): void;
|
|
125
|
+
}
|
|
126
|
+
/** A type of voice service a package adds (TaExtensionVoices.registerType): its form, and how it opens. */
|
|
127
|
+
export interface TaVoiceType extends Omit<TaVoiceTypeInfo, 'type'> {
|
|
128
|
+
/** Where it is, in a few words for the list: a host. */
|
|
129
|
+
where(options: Record<string, unknown>): string;
|
|
130
|
+
/** Connects; resolves once it is ready to hear, rejects with why it is not (a wrong key). */
|
|
131
|
+
open(options: Record<string, unknown>, call: {
|
|
132
|
+
language: string;
|
|
133
|
+
}, events: TaVoiceEngineEvents): Promise<TaVoiceEngine>;
|
|
134
|
+
}
|
|
135
|
+
/** voices.json for the server side of packages (TaExtensionHost.voices). */
|
|
136
|
+
export interface TaExtensionVoices {
|
|
137
|
+
/** A type of service: `"type": "<type>"` in voices.json and a form in Settings. Gone with what it returns, or when the package stops. */
|
|
138
|
+
registerType(type: string, definition: TaVoiceType): () => void;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=voice-protocol.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TA_VOICE_SERVICE = exports.TaVoiceServer = void 0;
|
|
4
|
+
exports.TaVoiceServer = Symbol('TaVoiceServer');
|
|
5
|
+
exports.TA_VOICE_SERVICE = 'TaVoiceServer';
|
|
6
|
+
//# sourceMappingURL=voice-protocol.js.map
|