@celljs/ta-web 4.20.0 → 4.21.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/browser/account/device-account.d.ts +65 -1
- package/esm/browser/account/device-account.js +206 -6
- package/esm/browser/assistant/call-turn-end.d.ts +55 -0
- package/esm/browser/assistant/call-turn-end.js +68 -0
- package/esm/browser/assistant/realtime-voice.js +3 -3
- package/esm/browser/assistant/voice-call.d.ts +19 -28
- package/esm/browser/assistant/voice-call.js +64 -51
- package/esm/browser/components/account-menu.d.ts +9 -4
- package/esm/browser/components/account-menu.js +59 -22
- package/esm/browser/components/account-view.d.ts +33 -7
- package/esm/browser/components/account-view.js +140 -79
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/cloud-sign-in-view.js +4 -1
- package/esm/browser/components/host-view.d.ts +15 -8
- package/esm/browser/components/host-view.js +23 -70
- package/esm/browser/components/me-view.d.ts +2 -2
- package/esm/browser/components/me-view.js +7 -6
- package/esm/browser/components/profile-view.d.ts +11 -0
- package/esm/browser/components/profile-view.js +85 -0
- package/esm/browser/components/workbench-view.js +42 -7
- package/esm/browser/extension/web-api-components.d.ts +2 -2
- package/esm/browser/i18n/locales.d.ts +12 -1
- package/esm/browser/i18n/messages-ja.js +15 -4
- package/esm/browser/i18n/messages-zh-tw.js +15 -4
- package/esm/browser/i18n/messages.d.ts +11 -0
- package/esm/browser/i18n/messages.js +30 -8
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +2 -1
- package/esm/browser/style/dialogs.d.ts +1 -1
- package/esm/browser/style/dialogs.js +6 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +6 -0
- package/esm/browser/util/turn-end.d.ts +8 -0
- package/esm/browser/util/turn-end.js +78 -35
- package/esm/browser/workbench-hosts.d.ts +4 -1
- package/esm/browser/workbench-hosts.js +17 -0
- package/esm/browser/workbench-protocol.d.ts +8 -0
- package/lib/browser/account/device-account.d.ts +65 -1
- package/lib/browser/account/device-account.js +206 -6
- package/lib/browser/assistant/call-turn-end.d.ts +56 -0
- package/lib/browser/assistant/call-turn-end.js +72 -0
- package/lib/browser/assistant/realtime-voice.js +3 -3
- package/lib/browser/assistant/voice-call.d.ts +19 -28
- package/lib/browser/assistant/voice-call.js +67 -54
- package/lib/browser/components/account-menu.d.ts +9 -4
- package/lib/browser/components/account-menu.js +57 -20
- package/lib/browser/components/account-view.d.ts +33 -7
- package/lib/browser/components/account-view.js +142 -77
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/cloud-sign-in-view.js +4 -1
- package/lib/browser/components/host-view.d.ts +15 -8
- package/lib/browser/components/host-view.js +22 -68
- package/lib/browser/components/me-view.d.ts +2 -2
- package/lib/browser/components/me-view.js +7 -6
- package/lib/browser/components/profile-view.d.ts +12 -0
- package/lib/browser/components/profile-view.js +123 -0
- package/lib/browser/components/workbench-view.js +39 -4
- package/lib/browser/extension/web-api-components.d.ts +2 -2
- package/lib/browser/i18n/locales.d.ts +12 -1
- package/lib/browser/i18n/messages-ja.js +15 -4
- package/lib/browser/i18n/messages-zh-tw.js +15 -4
- package/lib/browser/i18n/messages.d.ts +11 -0
- package/lib/browser/i18n/messages.js +30 -8
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +2 -1
- package/lib/browser/style/dialogs.d.ts +1 -1
- package/lib/browser/style/dialogs.js +6 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +6 -0
- package/lib/browser/util/turn-end.d.ts +8 -0
- package/lib/browser/util/turn-end.js +78 -35
- package/lib/browser/workbench-hosts.d.ts +4 -1
- package/lib/browser/workbench-hosts.js +17 -0
- package/lib/browser/workbench-protocol.d.ts +8 -0
- package/package.json +7 -7
|
@@ -230,6 +230,12 @@ exports.PAGES_STYLE = `
|
|
|
230
230
|
.ta-picture-actions { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
|
|
231
231
|
.ta-picture-actions > .ta-button { height: 40px; }
|
|
232
232
|
.ta-picture-actions > .ta-input { height: 40px; }
|
|
233
|
+
/* The profile (profile-view.tsx): the picture, the name, then its rows */
|
|
234
|
+
.ta-profile { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 6px 0 2px; }
|
|
235
|
+
.ta-profile-picture { display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; }
|
|
236
|
+
.ta-profile-name { max-width: 100%; margin-bottom: 6px; font-size: calc(17px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-text); }
|
|
237
|
+
.ta-profile .ta-list-group { width: 100%; text-align: left; }
|
|
238
|
+
.ta-profile-hint { margin: 0; max-width: 320px; text-align: center; color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); line-height: 1.5; }
|
|
233
239
|
.ta-look { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; }
|
|
234
240
|
.ta-look-stage { height: 120px; flex: none; display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 8px; }
|
|
235
241
|
.ta-look-figure, .ta-look-walk { border-radius: 12px; background: var(--ta-raised); display: grid; place-items: center; }
|
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
export declare namespace TurnEnd {
|
|
7
7
|
/** How many letters and digits it holds, a filler alone (a breath, "嗯嗯", "uh-huh") counting none. */
|
|
8
8
|
function words(text: string): number;
|
|
9
|
+
/** What sounds alone say: the user thinks (a hesitation, an opener) or agrees (a backchannel). */
|
|
10
|
+
type Sounds = 'hesitation' | 'backchannel';
|
|
11
|
+
/**
|
|
12
|
+
* Whether what was said holds sounds alone and no words yet ("哎", "嗯,那个", "uh-huh"): a hesitation when any of
|
|
13
|
+
* them is of someone who thinks, else a backchannel; undefined when it holds words, or nothing, or asks ("啊?",
|
|
14
|
+
* "and then?").
|
|
15
|
+
*/
|
|
16
|
+
function sounds(text: string): Sounds | undefined;
|
|
9
17
|
/** It ends as a sentence does: a full stop, a question or an exclamation mark. */
|
|
10
18
|
function ended(text: string): boolean;
|
|
11
19
|
/** It ends on a word that leads on, a comma or an ellipsis: the user is still to say more. */
|
|
@@ -8,42 +8,46 @@ exports.TurnEnd = void 0;
|
|
|
8
8
|
*/
|
|
9
9
|
var TurnEnd;
|
|
10
10
|
(function (TurnEnd) {
|
|
11
|
+
/** Sounds of someone who thinks, alone in a sentence: no words, and the user is to say more. */
|
|
12
|
+
const HESITATIONS = ['呃', '额', '啊', '哎', '诶', '欸', '唔', 'えっと', 'えーと', 'あの', 'あのー', 'um', 'umm', 'uh', 'uhh', 'er', 'erm', 'hmm', 'ah'];
|
|
13
|
+
/** Sounds of someone who listens or agrees, alone in a sentence: no words, though they may be an answer ("嗯"). */
|
|
14
|
+
const BACKCHANNELS = ['嗯', '嗯嗯', '哦', '噢', '哦哦', '对对', '对对对', '好好', 'うん', 'ええ', 'はい', 'mm', 'mhm', 'uh-huh', 'oh'];
|
|
11
15
|
/** Sounds of someone who thinks or listens, alone in a sentence: no words. */
|
|
12
|
-
const FILLERS = [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
16
|
+
const FILLERS = [...HESITATIONS, ...BACKCHANNELS];
|
|
17
|
+
/** Words one begins with while thinking ("那个…", "就是…"): alone, nothing is said yet. */
|
|
18
|
+
const OPENERS = [
|
|
19
|
+
'那个',
|
|
20
|
+
'这个',
|
|
21
|
+
'就是',
|
|
22
|
+
'然后',
|
|
23
|
+
'还有',
|
|
24
|
+
'而且',
|
|
25
|
+
'但是',
|
|
26
|
+
'可是',
|
|
27
|
+
'不过',
|
|
28
|
+
'因为',
|
|
29
|
+
'所以',
|
|
30
|
+
'如果',
|
|
31
|
+
'或者',
|
|
32
|
+
'比如',
|
|
33
|
+
'那',
|
|
34
|
+
'就',
|
|
35
|
+
'那個',
|
|
36
|
+
'這個',
|
|
37
|
+
'還有',
|
|
38
|
+
'因為',
|
|
39
|
+
'比如說',
|
|
40
|
+
'それから',
|
|
41
|
+
'でも',
|
|
42
|
+
'だから',
|
|
43
|
+
'けど',
|
|
44
|
+
'あと',
|
|
45
|
+
'and',
|
|
46
|
+
'but',
|
|
47
|
+
'so',
|
|
48
|
+
'because',
|
|
49
|
+
'like',
|
|
50
|
+
'then',
|
|
47
51
|
];
|
|
48
52
|
/** Words at the end of what was said that lead on to more: the user is not done. */
|
|
49
53
|
const LEADING = [
|
|
@@ -122,6 +126,45 @@ var TurnEnd;
|
|
|
122
126
|
return FILLERS.some(filler => bare(filler) === letters) ? 0 : letters.length;
|
|
123
127
|
}
|
|
124
128
|
TurnEnd.words = words;
|
|
129
|
+
/** The sounds of the list, by their letters, longest first: a sentence of them is taken apart greedily. */
|
|
130
|
+
const SOUNDS = [
|
|
131
|
+
...HESITATIONS.map(word => [word, 'hesitation']),
|
|
132
|
+
...OPENERS.map(word => [word, 'hesitation']),
|
|
133
|
+
...BACKCHANNELS.map(word => [word, 'backchannel']),
|
|
134
|
+
]
|
|
135
|
+
.map(([word, kind]) => [bare(word), kind])
|
|
136
|
+
.sort((a, b) => b[0].length - a[0].length);
|
|
137
|
+
/**
|
|
138
|
+
* Whether what was said holds sounds alone and no words yet ("哎", "嗯,那个", "uh-huh"): a hesitation when any of
|
|
139
|
+
* them is of someone who thinks, else a backchannel; undefined when it holds words, or nothing, or asks ("啊?",
|
|
140
|
+
* "and then?").
|
|
141
|
+
*/
|
|
142
|
+
function sounds(text) {
|
|
143
|
+
if (/[??]\s*$/u.test(text)) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
// "uh-huh" is one sound; words of Latin letters are whole words, those of other scripts run together.
|
|
147
|
+
const chunks = text
|
|
148
|
+
.toLowerCase()
|
|
149
|
+
.replace(/(\p{L})-(\p{L})/gu, '$1$2')
|
|
150
|
+
.split(/[^\p{L}\p{N}]+/u)
|
|
151
|
+
.filter(Boolean);
|
|
152
|
+
let kind;
|
|
153
|
+
for (const chunk of chunks) {
|
|
154
|
+
let rest = chunk;
|
|
155
|
+
while (rest) {
|
|
156
|
+
const latin = /^[a-z]+$/.test(rest);
|
|
157
|
+
const found = SOUNDS.find(([word]) => (latin ? rest === word : rest.startsWith(word)));
|
|
158
|
+
if (!found) {
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
kind = kind === 'hesitation' ? kind : found[1];
|
|
162
|
+
rest = rest.slice(found[0].length);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return kind;
|
|
166
|
+
}
|
|
167
|
+
TurnEnd.sounds = sounds;
|
|
125
168
|
/** It ends as a sentence does: a full stop, a question or an exclamation mark. */
|
|
126
169
|
function ended(text) {
|
|
127
170
|
const trimmed = text.trim().replace(/["'”’」』))]+$/u, '');
|
|
@@ -2,7 +2,7 @@ import type { TaConnection } from '@celljs/ta-client';
|
|
|
2
2
|
import type { TaServerInfo } from '@celljs/ta-protocol';
|
|
3
3
|
import { type HostList } from './hosts';
|
|
4
4
|
import { WorkbenchLists } from './workbench-lists';
|
|
5
|
-
import type { Credential } from './workbench-protocol';
|
|
5
|
+
import type { Credential, SavedHost } from './workbench-protocol';
|
|
6
6
|
/** The computers this device signs in to: which is in use, and what is kept of each. */
|
|
7
7
|
export declare abstract class WorkbenchHosts extends WorkbenchLists {
|
|
8
8
|
protected list: HostList;
|
|
@@ -16,8 +16,11 @@ export declare abstract class WorkbenchHosts extends WorkbenchLists {
|
|
|
16
16
|
* used at once when none is.
|
|
17
17
|
*/
|
|
18
18
|
addAccountHost(link: string, account: string): Promise<void>;
|
|
19
|
+
markAccountHost(hostId: string, account: string): void;
|
|
19
20
|
/** The computers the account brought: those of `account`, or all of them when the device left the account. */
|
|
20
21
|
forgetAccountHosts(account?: string): void;
|
|
22
|
+
parkHosts(ids: string[]): SavedHost[];
|
|
23
|
+
restoreHosts(hosts: SavedHost[]): void;
|
|
21
24
|
switchTo(hostId: string): void;
|
|
22
25
|
forget(hostId: string): void;
|
|
23
26
|
rename(hostId: string, name: string): void;
|
|
@@ -33,6 +33,10 @@ class WorkbenchHosts extends workbench_lists_1.WorkbenchLists {
|
|
|
33
33
|
* used at once when none is.
|
|
34
34
|
*/
|
|
35
35
|
async addAccountHost(link, account) {
|
|
36
|
+
// One reached directly already (a Ta in the cloud, by its gateway): not a second entry through the relay.
|
|
37
|
+
if (this.list.hosts.some(one => one.account === account && 'token' in one.credential)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
36
40
|
const credential = workbench_util_1.WorkbenchUtil.credential(link);
|
|
37
41
|
const id = workbench_util_1.WorkbenchUtil.serverOf(credential, (0, workbench_util_1.pageHost)());
|
|
38
42
|
if (this.current.status === 'signed-out' && !this.list.current) {
|
|
@@ -42,12 +46,25 @@ class WorkbenchHosts extends workbench_lists_1.WorkbenchLists {
|
|
|
42
46
|
}
|
|
43
47
|
this.keepHosts(hosts_1.HostUtil.keep(this.list, id, credential, account, Date.now()));
|
|
44
48
|
}
|
|
49
|
+
markAccountHost(hostId, account) {
|
|
50
|
+
this.keepHosts({ ...this.list, hosts: this.list.hosts.map(one => (one.id === hostId ? { ...one, account } : one)) });
|
|
51
|
+
}
|
|
45
52
|
/** The computers the account brought: those of `account`, or all of them when the device left the account. */
|
|
46
53
|
forgetAccountHosts(account) {
|
|
47
54
|
for (const host of this.list.hosts.filter(one => one.account && (account === undefined || one.account === account))) {
|
|
48
55
|
this.forget(host.id);
|
|
49
56
|
}
|
|
50
57
|
}
|
|
58
|
+
parkHosts(ids) {
|
|
59
|
+
const parked = this.list.hosts.filter(one => ids.includes(one.id));
|
|
60
|
+
const current = this.list.current && ids.includes(this.list.current) ? undefined : this.list.current;
|
|
61
|
+
this.keepHosts({ ...(current ? { current } : {}), hosts: this.list.hosts.filter(one => !ids.includes(one.id)) });
|
|
62
|
+
return parked;
|
|
63
|
+
}
|
|
64
|
+
restoreHosts(hosts) {
|
|
65
|
+
const ids = new Set(hosts.map(one => one.id));
|
|
66
|
+
this.keepHosts({ ...(this.list.current ? { current: this.list.current } : {}), hosts: [...this.list.hosts.filter(one => !ids.has(one.id)), ...hosts] });
|
|
67
|
+
}
|
|
51
68
|
switchTo(hostId) {
|
|
52
69
|
const host = this.list.hosts.find(one => one.id === hostId);
|
|
53
70
|
if (!host || (hostId === this.current.host && this.current.status !== 'signed-out')) {
|
|
@@ -132,8 +132,16 @@ export interface TaWorkbench {
|
|
|
132
132
|
rename(hostId: string, name: string): void;
|
|
133
133
|
/** A way into a computer of the user's account (docs/design/ta-account.md): kept, used at once when none is. */
|
|
134
134
|
addAccountHost(link: string, account: string): Promise<void>;
|
|
135
|
+
/** A computer this device brought into its account (docs/design/ta-me.md 4) is its device `account` there. */
|
|
136
|
+
markAccountHost(hostId: string, account: string): void;
|
|
135
137
|
/** The computers the account brought: those of `account`, or all when the device left the account. */
|
|
136
138
|
forgetAccountHosts(account?: string): void;
|
|
139
|
+
/**
|
|
140
|
+
* Takes the computers of an account the user switched away from off the list, what the page kept of them kept on the
|
|
141
|
+
* device (docs/design/ta-me.md 4): back as they were with restoreHosts.
|
|
142
|
+
*/
|
|
143
|
+
parkHosts(ids: string[]): SavedHost[];
|
|
144
|
+
restoreHosts(hosts: SavedHost[]): void;
|
|
137
145
|
/** Forgets the computer in use and loads the page again, at the sign-in, with the other computers kept. */
|
|
138
146
|
signOut(): void;
|
|
139
147
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-web",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.21.0",
|
|
4
4
|
"description": "The web client of ta serve: sessions, streaming messages, tool runs with diffs, and dialogs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@celljs/core": "4.
|
|
37
|
-
"@celljs/react": "4.
|
|
38
|
-
"@celljs/ta-client": "4.
|
|
39
|
-
"@celljs/ta-protocol": "4.
|
|
40
|
-
"@celljs/ta-relay": "4.
|
|
41
|
-
"@celljs/widget": "4.
|
|
36
|
+
"@celljs/core": "4.21.0",
|
|
37
|
+
"@celljs/react": "4.21.0",
|
|
38
|
+
"@celljs/ta-client": "4.21.0",
|
|
39
|
+
"@celljs/ta-protocol": "4.21.0",
|
|
40
|
+
"@celljs/ta-relay": "4.21.0",
|
|
41
|
+
"@celljs/widget": "4.21.0",
|
|
42
42
|
"@types/three": "^0.187.0",
|
|
43
43
|
"@xterm/addon-fit": "^0.11.0",
|
|
44
44
|
"@xterm/addon-unicode11": "^0.9.0",
|