@celljs/ta-web 4.14.0 → 4.15.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.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/assistant/assistant-initiative.js +1 -1
- package/esm/browser/components/access-view.js +3 -2
- package/esm/browser/components/account-menu.js +2 -2
- package/esm/browser/components/auth-view.d.ts +1 -1
- package/esm/browser/components/auth-view.js +38 -10
- package/esm/browser/components/custom-provider-advanced.d.ts +14 -0
- package/esm/browser/components/custom-provider-advanced.js +50 -0
- package/esm/browser/components/custom-provider-util.d.ts +38 -0
- package/esm/browser/components/custom-provider-util.js +103 -0
- package/esm/browser/components/custom-provider-view.d.ts +11 -0
- package/esm/browser/components/custom-provider-view.js +181 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/settings-choices.js +2 -3
- package/esm/browser/components/settings-controls.d.ts +7 -1
- package/esm/browser/components/settings-controls.js +8 -0
- package/esm/browser/components/settings-parts.js +11 -5
- package/esm/browser/components/sign-in-setup.js +3 -1
- package/esm/browser/editor/monaco-loader.js +7 -1
- package/esm/browser/extension/web-api-contributions.d.ts +3 -0
- package/esm/browser/extension/web-extension-api.d.ts +7 -0
- package/esm/browser/extension/web-extension-context.d.ts +2 -0
- package/esm/browser/extension/web-extension-context.js +19 -0
- package/esm/browser/game/game-loader.js +22 -2
- package/esm/browser/game/game3d-protocol.d.ts +13 -4
- package/esm/browser/i18n/locales.d.ts +56 -1
- package/esm/browser/i18n/locales.js +25 -1
- package/esm/browser/i18n/messages-ja.d.ts +2 -0
- package/esm/browser/i18n/messages-ja.js +972 -0
- package/esm/browser/i18n/messages-zh-tw.d.ts +3 -0
- package/esm/browser/i18n/messages-zh-tw.js +973 -0
- package/esm/browser/i18n/messages.d.ts +51 -0
- package/esm/browser/i18n/messages.js +102 -1
- package/esm/browser/i18n/use-t.js +3 -2
- package/esm/browser/settings/settings-protocol.d.ts +3 -2
- package/esm/browser/settings/settings-protocol.js +4 -3
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +45 -1
- package/esm/browser/util/desktop.d.ts +12 -1
- package/esm/browser/util/desktop.js +14 -0
- package/esm/browser/util/voice.d.ts +20 -1
- package/esm/browser/util/voice.js +27 -11
- package/esm/browser/workbench-util.d.ts +2 -0
- package/esm/browser/workbench-util.js +6 -1
- package/lib/browser/assistant/assistant-initiative.js +1 -1
- package/lib/browser/components/access-view.js +3 -2
- package/lib/browser/components/account-menu.js +2 -2
- package/lib/browser/components/auth-view.d.ts +1 -1
- package/lib/browser/components/auth-view.js +37 -9
- package/lib/browser/components/custom-provider-advanced.d.ts +15 -0
- package/lib/browser/components/custom-provider-advanced.js +86 -0
- package/lib/browser/components/custom-provider-util.d.ts +39 -0
- package/lib/browser/components/custom-provider-util.js +106 -0
- package/lib/browser/components/custom-provider-view.d.ts +12 -0
- package/lib/browser/components/custom-provider-view.js +217 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/settings-choices.js +1 -2
- package/lib/browser/components/settings-controls.d.ts +7 -1
- package/lib/browser/components/settings-controls.js +9 -0
- package/lib/browser/components/settings-parts.js +10 -4
- package/lib/browser/components/sign-in-setup.js +3 -1
- package/lib/browser/editor/monaco-loader.js +7 -1
- package/lib/browser/extension/web-api-contributions.d.ts +3 -0
- package/lib/browser/extension/web-extension-api.d.ts +7 -0
- package/lib/browser/extension/web-extension-context.d.ts +2 -0
- package/lib/browser/extension/web-extension-context.js +19 -0
- package/lib/browser/game/game-loader.js +22 -2
- package/lib/browser/game/game3d-protocol.d.ts +13 -4
- package/lib/browser/i18n/locales.d.ts +56 -1
- package/lib/browser/i18n/locales.js +25 -1
- package/lib/browser/i18n/messages-ja.d.ts +3 -0
- package/lib/browser/i18n/messages-ja.js +975 -0
- package/lib/browser/i18n/messages-zh-tw.d.ts +4 -0
- package/lib/browser/i18n/messages-zh-tw.js +976 -0
- package/lib/browser/i18n/messages.d.ts +51 -0
- package/lib/browser/i18n/messages.js +105 -2
- package/lib/browser/i18n/use-t.js +2 -1
- package/lib/browser/settings/settings-protocol.d.ts +3 -2
- package/lib/browser/settings/settings-protocol.js +4 -3
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +45 -1
- package/lib/browser/util/desktop.d.ts +12 -1
- package/lib/browser/util/desktop.js +14 -0
- package/lib/browser/util/voice.d.ts +20 -1
- package/lib/browser/util/voice.js +27 -11
- package/lib/browser/workbench-util.d.ts +2 -0
- package/lib/browser/workbench-util.js +6 -1
- package/package.json +7 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Voice = void 0;
|
|
4
|
+
const desktop_1 = require("./desktop");
|
|
4
5
|
/** Talking to ta and hearing it, with what the browser or the app has: no service, no dependency. */
|
|
5
6
|
var Voice;
|
|
6
7
|
(function (Voice) {
|
|
@@ -66,10 +67,24 @@ var Voice;
|
|
|
66
67
|
const scope = globalThis;
|
|
67
68
|
return (_a = scope.SpeechRecognition) !== null && _a !== void 0 ? _a : scope.webkitSpeechRecognition;
|
|
68
69
|
}
|
|
69
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Apple's recognizer: of the Ta app on iOS, where WebKit's repeats what it heard and leaves out punctuation, and of
|
|
72
|
+
* Ta Desktop on macOS, where Chrome's, which Electron has, always fails with `network` (only Chrome may use its service).
|
|
73
|
+
*/
|
|
70
74
|
function nativeSpeech() {
|
|
71
75
|
var _a, _b;
|
|
72
|
-
|
|
76
|
+
const ios = (_b = (_a = globalThis.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers) === null || _b === void 0 ? void 0 : _b.taSpeech;
|
|
77
|
+
if (ios) {
|
|
78
|
+
return {
|
|
79
|
+
post: message => ios.postMessage(message),
|
|
80
|
+
onAnswer: listener => {
|
|
81
|
+
const heard = (event) => listener(event.detail);
|
|
82
|
+
globalThis.addEventListener(Voice.NATIVE_EVENT, heard);
|
|
83
|
+
return () => globalThis.removeEventListener(Voice.NATIVE_EVENT, heard);
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return desktop_1.DesktopUtil.speech();
|
|
73
88
|
}
|
|
74
89
|
function canListen() {
|
|
75
90
|
return nativeSpeech() !== undefined || recognitionClass() !== undefined;
|
|
@@ -157,23 +172,21 @@ var Voice;
|
|
|
157
172
|
function listenNatively(native, language, onText, onEnd, options) {
|
|
158
173
|
const id = crypto.randomUUID();
|
|
159
174
|
let ended = false;
|
|
160
|
-
const
|
|
161
|
-
const answer = event.detail;
|
|
175
|
+
const stopHearing = native.onAnswer(answer => {
|
|
162
176
|
if (ended || (answer === null || answer === void 0 ? void 0 : answer.id) !== id) {
|
|
163
177
|
return;
|
|
164
178
|
}
|
|
165
179
|
if (answer.end) {
|
|
166
180
|
ended = true;
|
|
167
|
-
|
|
181
|
+
stopHearing();
|
|
168
182
|
onEnd(answer.error === 'no-speech' ? undefined : answer.error);
|
|
169
183
|
}
|
|
170
184
|
else if (typeof answer.text === 'string') {
|
|
171
185
|
onText(answer.text, answer.final === true);
|
|
172
186
|
}
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
native.
|
|
176
|
-
return { stop: () => !ended && native.postMessage({ id, action: 'stop' }) };
|
|
187
|
+
});
|
|
188
|
+
native.post({ id, action: 'start', language, continuous: options.continuous === true, hints: hints(options.hints) });
|
|
189
|
+
return { stop: () => !ended && native.post({ id, action: 'stop' }) };
|
|
177
190
|
}
|
|
178
191
|
function canSpeak() {
|
|
179
192
|
return typeof speechSynthesis !== 'undefined';
|
|
@@ -228,9 +241,12 @@ var Voice;
|
|
|
228
241
|
return pieces;
|
|
229
242
|
}
|
|
230
243
|
Voice.sentences = sentences;
|
|
231
|
-
/** The language a text is read in: Chinese for Chinese, whatever the page's. */
|
|
244
|
+
/** The language a text is read in: Japanese for kana, Chinese for other Han (the page's, if Chinese or Japanese), whatever the page's. */
|
|
232
245
|
function languageOf(text, language) {
|
|
233
|
-
|
|
246
|
+
if (/[\u3040-\u30ff]/.test(text)) {
|
|
247
|
+
return 'ja-JP';
|
|
248
|
+
}
|
|
249
|
+
return /[\u4e00-\u9fff]/.test(text) && !/^(zh|ja)\b/i.test(language) ? 'zh-CN' : language;
|
|
234
250
|
}
|
|
235
251
|
Voice.languageOf = languageOf;
|
|
236
252
|
/** Toys and the voices of a screen reader of old (Eloquence), which sound as machines. */
|
|
@@ -47,6 +47,8 @@ export declare namespace WorkbenchUtil {
|
|
|
47
47
|
* the app, or at an address that is not this machine's. A sign-in there cannot come back to it by itself.
|
|
48
48
|
*/
|
|
49
49
|
function elsewhere(hostId: string | undefined, hostname?: string): boolean;
|
|
50
|
+
/** An address of this machine alone (`localhost`, `127.0.0.1`, `::1`), which no provider of accounts sends a browser back to. */
|
|
51
|
+
function loopback(hostname?: string): boolean;
|
|
50
52
|
/** In the Ta app on a phone, where no ta serve serves the page: it reaches one through a relay. */
|
|
51
53
|
function isApp(): boolean;
|
|
52
54
|
function readPairing(text: string | null): RelayPairing | undefined;
|
|
@@ -81,9 +81,14 @@ var WorkbenchUtil;
|
|
|
81
81
|
* the app, or at an address that is not this machine's. A sign-in there cannot come back to it by itself.
|
|
82
82
|
*/
|
|
83
83
|
function elsewhere(hostId, hostname = typeof location === 'undefined' ? '' : location.hostname) {
|
|
84
|
-
return isApp() || Boolean(hostId === null || hostId === void 0 ? void 0 : hostId.startsWith('relay ')) || !
|
|
84
|
+
return isApp() || Boolean(hostId === null || hostId === void 0 ? void 0 : hostId.startsWith('relay ')) || !loopback(hostname);
|
|
85
85
|
}
|
|
86
86
|
WorkbenchUtil.elsewhere = elsewhere;
|
|
87
|
+
/** An address of this machine alone (`localhost`, `127.0.0.1`, `::1`), which no provider of accounts sends a browser back to. */
|
|
88
|
+
function loopback(hostname = typeof location === 'undefined' ? '' : location.hostname) {
|
|
89
|
+
return ['localhost', '127.0.0.1', '[::1]', '::1'].includes(hostname);
|
|
90
|
+
}
|
|
91
|
+
WorkbenchUtil.loopback = loopback;
|
|
87
92
|
/** In the Ta app on a phone, where no ta serve serves the page: it reaches one through a relay. */
|
|
88
93
|
function isApp() {
|
|
89
94
|
var _a, _b;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-web",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.15.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.15.0",
|
|
37
|
+
"@celljs/react": "4.15.0",
|
|
38
|
+
"@celljs/ta-client": "4.15.0",
|
|
39
|
+
"@celljs/ta-protocol": "4.15.0",
|
|
40
|
+
"@celljs/ta-relay": "4.15.0",
|
|
41
|
+
"@celljs/widget": "4.15.0",
|
|
42
42
|
"@types/three": "^0.187.0",
|
|
43
43
|
"@xterm/addon-fit": "^0.11.0",
|
|
44
44
|
"@xterm/addon-unicode11": "^0.9.0",
|