@celljs/ta-web 4.14.0 → 4.15.1
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 +10 -3
- package/esm/browser/components/app-view.js +4 -1
- 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/face.js +7 -2
- package/esm/browser/components/gallery.d.ts +9 -0
- package/esm/browser/components/gallery.js +57 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/lightbox.d.ts +8 -1
- package/esm/browser/components/lightbox.js +4 -1
- package/esm/browser/components/markdown.js +6 -1
- package/esm/browser/components/media.d.ts +12 -2
- package/esm/browser/components/media.js +55 -13
- package/esm/browser/components/message-list.js +3 -2
- package/esm/browser/components/notice-center.js +6 -2
- package/esm/browser/components/serve-restart.d.ts +26 -0
- package/esm/browser/components/serve-restart.js +91 -0
- package/esm/browser/components/session-view.js +19 -11
- 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 +25 -10
- package/esm/browser/components/sign-in-setup.js +3 -1
- package/esm/browser/editor/monaco-loader.js +7 -1
- package/esm/browser/extension/icons.js +3 -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 +68 -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 +984 -0
- package/esm/browser/i18n/messages-zh-tw.d.ts +3 -0
- package/esm/browser/i18n/messages-zh-tw.js +985 -0
- package/esm/browser/i18n/messages.d.ts +63 -0
- package/esm/browser/i18n/messages.js +126 -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/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +18 -0
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +2 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +45 -1
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +2 -0
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +1 -0
- package/esm/browser/util/desktop.d.ts +17 -1
- package/esm/browser/util/desktop.js +24 -0
- package/esm/browser/util/gallery.d.ts +18 -0
- package/esm/browser/util/gallery.js +123 -0
- package/esm/browser/util/link.d.ts +8 -0
- package/esm/browser/util/link.js +14 -0
- package/esm/browser/util/markdown.d.ts +11 -0
- package/esm/browser/util/markdown.js +4 -0
- package/esm/browser/util/thumbnail.d.ts +18 -0
- package/esm/browser/util/thumbnail.js +26 -0
- package/esm/browser/util/voice.d.ts +20 -1
- package/esm/browser/util/voice.js +27 -11
- package/esm/browser/workbench-protocol.d.ts +8 -0
- package/esm/browser/workbench-util.d.ts +2 -0
- package/esm/browser/workbench-util.js +6 -1
- package/esm/browser/workbench.d.ts +16 -0
- package/esm/browser/workbench.js +67 -0
- 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 +9 -2
- package/lib/browser/components/app-view.js +4 -1
- 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/face.js +7 -2
- package/lib/browser/components/gallery.d.ts +10 -0
- package/lib/browser/components/gallery.js +93 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/lightbox.d.ts +8 -1
- package/lib/browser/components/lightbox.js +4 -1
- package/lib/browser/components/markdown.js +6 -1
- package/lib/browser/components/media.d.ts +12 -2
- package/lib/browser/components/media.js +57 -13
- package/lib/browser/components/message-list.js +3 -2
- package/lib/browser/components/notice-center.js +6 -2
- package/lib/browser/components/serve-restart.d.ts +27 -0
- package/lib/browser/components/serve-restart.js +129 -0
- package/lib/browser/components/session-view.js +21 -13
- 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 +23 -8
- package/lib/browser/components/sign-in-setup.js +3 -1
- package/lib/browser/editor/monaco-loader.js +7 -1
- package/lib/browser/extension/icons.js +2 -0
- 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 +68 -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 +987 -0
- package/lib/browser/i18n/messages-zh-tw.d.ts +4 -0
- package/lib/browser/i18n/messages-zh-tw.js +988 -0
- package/lib/browser/i18n/messages.d.ts +63 -0
- package/lib/browser/i18n/messages.js +129 -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/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +18 -0
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +2 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +45 -1
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +2 -0
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +1 -0
- package/lib/browser/util/desktop.d.ts +17 -1
- package/lib/browser/util/desktop.js +24 -0
- package/lib/browser/util/gallery.d.ts +19 -0
- package/lib/browser/util/gallery.js +126 -0
- package/lib/browser/util/link.d.ts +8 -0
- package/lib/browser/util/link.js +14 -0
- package/lib/browser/util/markdown.d.ts +11 -0
- package/lib/browser/util/markdown.js +4 -0
- package/lib/browser/util/thumbnail.d.ts +19 -0
- package/lib/browser/util/thumbnail.js +29 -0
- package/lib/browser/util/voice.d.ts +20 -1
- package/lib/browser/util/voice.js +27 -11
- package/lib/browser/workbench-protocol.d.ts +8 -0
- package/lib/browser/workbench-util.d.ts +2 -0
- package/lib/browser/workbench-util.js +6 -1
- package/lib/browser/workbench.d.ts +16 -0
- package/lib/browser/workbench.js +67 -0
- package/package.json +7 -7
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/** What the page tells Apple's recognizer: of the Ta app on iOS (TaSpeech.swift of apps/ta-mobile) or of Ta Desktop on macOS. */
|
|
2
|
+
export type NativeSpeechMessage = {
|
|
3
|
+
id: string;
|
|
4
|
+
action: 'start';
|
|
5
|
+
language: string;
|
|
6
|
+
continuous: boolean;
|
|
7
|
+
hints: string[];
|
|
8
|
+
} | {
|
|
9
|
+
id: string;
|
|
10
|
+
action: 'stop';
|
|
11
|
+
};
|
|
12
|
+
/** What it answers: the words so far of a listening, or its end. */
|
|
13
|
+
export interface NativeSpeechEvent {
|
|
14
|
+
id: string;
|
|
15
|
+
text?: string;
|
|
16
|
+
final?: boolean;
|
|
17
|
+
end?: boolean;
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
1
20
|
/** Talking to ta and hearing it, with what the browser or the app has: no service, no dependency. */
|
|
2
21
|
export declare namespace Voice {
|
|
3
22
|
/** The window event the Ta app on iOS answers a listening with. */
|
|
@@ -40,7 +59,7 @@ export declare namespace Voice {
|
|
|
40
59
|
function spoken(markdown: string): string;
|
|
41
60
|
/** What a text is read in: its sentences and lines, a long one in pieces at its commas. */
|
|
42
61
|
function sentences(text: string): string[];
|
|
43
|
-
/** The language a text is read in: Chinese for Chinese, whatever the page's. */
|
|
62
|
+
/** 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. */
|
|
44
63
|
function languageOf(text: string, language: string): string;
|
|
45
64
|
/**
|
|
46
65
|
* How natural a voice sounds, from what its name and address say: the neural voices of Edge and the premium
|
|
@@ -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. */
|
|
@@ -49,6 +49,8 @@ export interface WorkbenchState {
|
|
|
49
49
|
*/
|
|
50
50
|
offlineShown?: boolean;
|
|
51
51
|
server?: TaServerInfo;
|
|
52
|
+
/** Ta restarts at the user's word (restartServer), until the page is connected to the one that started again. */
|
|
53
|
+
restarting?: boolean;
|
|
52
54
|
/**
|
|
53
55
|
* The server tells the open sessions as they change (TaServer.watchSessions): the lists are read again
|
|
54
56
|
* only now and then. Not by a Ta service of before, whose lists are read again every few seconds.
|
|
@@ -128,6 +130,12 @@ export interface TaWorkbench {
|
|
|
128
130
|
* what names no directory opens. Open conversations stay in theirs.
|
|
129
131
|
*/
|
|
130
132
|
setWorkingDirectory(cwd: string): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Restarts Ta: Ta Desktop as a whole when it started the Ta service, else the Ta service (TaServer.restartServer),
|
|
135
|
+
* which then runs the build installed now (TaServerInfo.update). What runs goes on after it. `restarting` until the
|
|
136
|
+
* page is connected again, when it loads again if it was of the build before.
|
|
137
|
+
*/
|
|
138
|
+
restartServer(): Promise<void>;
|
|
131
139
|
/**
|
|
132
140
|
* A store of a session on this connection; the caller attaches and detaches it. It can be made before
|
|
133
141
|
* there is a connection, to show a conversation kept on the device (SessionStoreOptions.initial): it is
|
|
@@ -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;
|
|
@@ -12,6 +12,12 @@ export declare class TaWorkbenchImpl implements TaWorkbench {
|
|
|
12
12
|
/** On the connection of the time, only while it is open: what it was at goes again once it opens (resend). */
|
|
13
13
|
readonly presence: PresenceReporter;
|
|
14
14
|
protected retryTimer?: ReturnType<typeof setTimeout>;
|
|
15
|
+
/** A restart asked for: whether a build was installed over the one running, and whether its connection closed yet. */
|
|
16
|
+
protected restart?: {
|
|
17
|
+
update: boolean;
|
|
18
|
+
closed: boolean;
|
|
19
|
+
timer: ReturnType<typeof setTimeout>;
|
|
20
|
+
};
|
|
15
21
|
/** While ta serve is not running: the next attempt, which `reconnect` makes at once. */
|
|
16
22
|
protected retry?: () => void;
|
|
17
23
|
protected attempts: number;
|
|
@@ -76,6 +82,14 @@ export declare class TaWorkbenchImpl implements TaWorkbench {
|
|
|
76
82
|
messages?: boolean;
|
|
77
83
|
state?: string[];
|
|
78
84
|
}): () => void;
|
|
85
|
+
restartServer(): Promise<void>;
|
|
86
|
+
/** A restart that failed, or did not come back: no longer waited for. */
|
|
87
|
+
protected restarted(): void;
|
|
88
|
+
/**
|
|
89
|
+
* Once the connection of a restart closed, the server read again is the Ta that started again: the restart is over,
|
|
90
|
+
* and a page of the build before loads again for the new one (the app on a phone has its own).
|
|
91
|
+
*/
|
|
92
|
+
protected followRestart(change: Partial<WorkbenchState>, next: WorkbenchState): void;
|
|
79
93
|
setWorkingDirectory(cwd: string): Promise<void>;
|
|
80
94
|
subscribe(listener: (state: WorkbenchState) => void): () => void;
|
|
81
95
|
start(): Promise<void>;
|
|
@@ -140,6 +154,8 @@ export declare class TaWorkbenchImpl implements TaWorkbench {
|
|
|
140
154
|
* page was not seen gets its grace from now.
|
|
141
155
|
*/
|
|
142
156
|
protected watchWake(): void;
|
|
157
|
+
/** Whether another build of Ta was installed since (TaServerInfo.update), read while the page is seen. */
|
|
158
|
+
protected checkUpdate(): Promise<void>;
|
|
143
159
|
protected update(change: Partial<WorkbenchState>): void;
|
|
144
160
|
protected keepLists(of: string): void;
|
|
145
161
|
}
|
package/lib/browser/workbench.js
CHANGED
|
@@ -16,9 +16,14 @@ const device_values_1 = require("./offline/device-values");
|
|
|
16
16
|
const presence_reporter_1 = require("./presence/presence-reporter");
|
|
17
17
|
const settings_protocol_1 = require("./settings/settings-protocol");
|
|
18
18
|
const state_protocol_1 = require("./state/state-protocol");
|
|
19
|
+
const desktop_1 = require("./util/desktop");
|
|
19
20
|
const workbench_calls_1 = require("./workbench-calls");
|
|
20
21
|
const workbench_protocol_1 = require("./workbench-protocol");
|
|
21
22
|
const workbench_util_1 = require("./workbench-util");
|
|
23
|
+
/** How often a page that is seen reads again which build of Ta is installed (TaServerInfo.update). */
|
|
24
|
+
const UPDATE_CHECK_MS = 60000;
|
|
25
|
+
/** A restart not back in this long is no longer waited for: the row of the connection says what is wrong. */
|
|
26
|
+
const RESTART_WAIT_MS = 120000;
|
|
22
27
|
let TaWorkbenchImpl = class TaWorkbenchImpl {
|
|
23
28
|
constructor() {
|
|
24
29
|
this.list = workbench_util_1.WorkbenchUtil.readHosts((0, workbench_util_1.storage)());
|
|
@@ -139,6 +144,54 @@ let TaWorkbenchImpl = class TaWorkbenchImpl {
|
|
|
139
144
|
}
|
|
140
145
|
};
|
|
141
146
|
}
|
|
147
|
+
async restartServer() {
|
|
148
|
+
var _a;
|
|
149
|
+
if (this.restart) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const timer = setTimeout(() => this.restarted(), RESTART_WAIT_MS);
|
|
153
|
+
this.restart = { update: Boolean((_a = this.current.server) === null || _a === void 0 ? void 0 : _a.update), closed: false, timer };
|
|
154
|
+
this.update({ restarting: true });
|
|
155
|
+
try {
|
|
156
|
+
const desktop = desktop_1.DesktopUtil.restart();
|
|
157
|
+
if (!(desktop && (await desktop()))) {
|
|
158
|
+
await this.server.restartServer();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
this.restarted();
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/** A restart that failed, or did not come back: no longer waited for. */
|
|
167
|
+
restarted() {
|
|
168
|
+
if (this.restart) {
|
|
169
|
+
clearTimeout(this.restart.timer);
|
|
170
|
+
this.restart = undefined;
|
|
171
|
+
this.update({ restarting: false });
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Once the connection of a restart closed, the server read again is the Ta that started again: the restart is over,
|
|
176
|
+
* and a page of the build before loads again for the new one (the app on a phone has its own).
|
|
177
|
+
*/
|
|
178
|
+
followRestart(change, next) {
|
|
179
|
+
const restart = this.restart;
|
|
180
|
+
if (!restart) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (next.status !== 'online') {
|
|
184
|
+
restart.closed = true;
|
|
185
|
+
}
|
|
186
|
+
else if (restart.closed && change.server) {
|
|
187
|
+
clearTimeout(restart.timer);
|
|
188
|
+
this.restart = undefined;
|
|
189
|
+
next.restarting = false;
|
|
190
|
+
if (restart.update && !workbench_util_1.WorkbenchUtil.isApp()) {
|
|
191
|
+
this.reload();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
142
195
|
async setWorkingDirectory(cwd) {
|
|
143
196
|
this.update({ server: await this.server.setWorkingDirectory(cwd) });
|
|
144
197
|
}
|
|
@@ -609,15 +662,29 @@ let TaWorkbenchImpl = class TaWorkbenchImpl {
|
|
|
609
662
|
}
|
|
610
663
|
else {
|
|
611
664
|
(_a = this.connection) === null || _a === void 0 ? void 0 : _a.wake();
|
|
665
|
+
void this.checkUpdate();
|
|
612
666
|
}
|
|
613
667
|
this.update({});
|
|
614
668
|
};
|
|
615
669
|
document.addEventListener('visibilitychange', wake);
|
|
616
670
|
window.addEventListener('online', wake);
|
|
617
671
|
window.addEventListener('pageshow', wake);
|
|
672
|
+
setInterval(() => void this.checkUpdate(), UPDATE_CHECK_MS);
|
|
673
|
+
}
|
|
674
|
+
/** Whether another build of Ta was installed since (TaServerInfo.update), read while the page is seen. */
|
|
675
|
+
async checkUpdate() {
|
|
676
|
+
const connection = this.connection;
|
|
677
|
+
if (!connection || this.current.status !== 'online' || this.restart || document.visibilityState === 'hidden') {
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
const server = await connection.server.getServerInfo().catch(() => undefined);
|
|
681
|
+
if (server && connection === this.connection && !this.restart) {
|
|
682
|
+
this.update({ server: workbench_util_1.WorkbenchUtil.same(this.current.server, server) });
|
|
683
|
+
}
|
|
618
684
|
}
|
|
619
685
|
update(change) {
|
|
620
686
|
const next = { ...this.current, ...change };
|
|
687
|
+
this.followRestart(change, next);
|
|
621
688
|
if (next.status !== 'offline') {
|
|
622
689
|
clearTimeout(this.graceTimer);
|
|
623
690
|
this.graceTimer = undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-web",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.15.1",
|
|
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.1",
|
|
37
|
+
"@celljs/react": "4.15.1",
|
|
38
|
+
"@celljs/ta-client": "4.15.1",
|
|
39
|
+
"@celljs/ta-protocol": "4.15.1",
|
|
40
|
+
"@celljs/ta-relay": "4.15.1",
|
|
41
|
+
"@celljs/widget": "4.15.1",
|
|
42
42
|
"@types/three": "^0.187.0",
|
|
43
43
|
"@xterm/addon-fit": "^0.11.0",
|
|
44
44
|
"@xterm/addon-unicode11": "^0.9.0",
|