@celljs/ta-web 4.11.0 → 4.13.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-extension.js +14 -0
- package/esm/browser/assistant/assistant-initiative.d.ts +27 -0
- package/esm/browser/assistant/assistant-initiative.js +76 -0
- package/esm/browser/assistant/assistant-task-source.d.ts +7 -0
- package/esm/browser/assistant/assistant-task-source.js +12 -2
- package/esm/browser/assistant/assistant-view.js +10 -6
- package/esm/browser/assistant/assistant.d.ts +5 -0
- package/esm/browser/assistant/assistant.js +25 -6
- package/esm/browser/chat/chat-view.js +6 -5
- package/esm/browser/components/app-nav.d.ts +3 -1
- package/esm/browser/components/app-nav.js +5 -2
- package/esm/browser/components/app-view.js +26 -13
- package/esm/browser/components/asks-badge.d.ts +5 -0
- package/esm/browser/components/asks-badge.js +8 -0
- package/esm/browser/components/chat-asks.d.ts +46 -0
- package/esm/browser/components/chat-asks.js +101 -0
- package/esm/browser/components/chat-list.d.ts +7 -1
- package/esm/browser/components/chat-list.js +46 -17
- package/esm/browser/components/composer-addon-util.d.ts +11 -0
- package/esm/browser/components/composer-addon-util.js +40 -0
- package/esm/browser/components/composer-addons.d.ts +1 -7
- package/esm/browser/components/composer-addons.js +1 -27
- package/esm/browser/components/composer-box.d.ts +1 -0
- package/esm/browser/components/composer-box.js +50 -28
- package/esm/browser/components/composer.d.ts +10 -1
- package/esm/browser/components/composer.js +61 -22
- package/esm/browser/components/connection-bar.js +31 -12
- package/esm/browser/components/conversation-scroll-hooks.d.ts +16 -0
- package/esm/browser/components/conversation-scroll-hooks.js +98 -0
- package/esm/browser/components/conversation-scroll-util.d.ts +35 -0
- package/esm/browser/components/conversation-scroll-util.js +74 -0
- package/esm/browser/components/conversation-scroll.d.ts +57 -33
- package/esm/browser/components/conversation-scroll.js +188 -123
- package/esm/browser/components/discover-view.js +5 -1
- package/esm/browser/components/earlier-messages.d.ts +10 -3
- package/esm/browser/components/earlier-messages.js +14 -8
- package/esm/browser/components/face.d.ts +24 -0
- package/esm/browser/components/face.js +42 -0
- package/esm/browser/components/folder-picker.d.ts +2 -0
- package/esm/browser/components/folder-picker.js +7 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/markdown.js +4 -2
- package/esm/browser/components/media.js +25 -11
- package/esm/browser/components/mermaid-view.js +45 -3
- package/esm/browser/components/message-actions.js +1 -0
- package/esm/browser/components/message-footer.d.ts +4 -0
- package/esm/browser/components/message-footer.js +8 -1
- package/esm/browser/components/message-list.d.ts +15 -1
- package/esm/browser/components/message-list.js +204 -41
- package/esm/browser/components/phone-shell.d.ts +7 -2
- package/esm/browser/components/phone-shell.js +9 -3
- package/esm/browser/components/relay-services.d.ts +24 -0
- package/esm/browser/components/relay-services.js +249 -0
- package/esm/browser/components/relay-view.js +17 -1
- package/esm/browser/components/remote-hosts.js +1 -1
- package/esm/browser/components/session-view.d.ts +3 -1
- package/esm/browser/components/session-view.js +23 -7
- package/esm/browser/components/settings-controls.js +3 -3
- package/esm/browser/components/settings-parts.js +13 -1
- package/esm/browser/components/stop-times.d.ts +47 -0
- package/esm/browser/components/stop-times.js +81 -0
- package/esm/browser/components/ta-avatar.js +6 -0
- package/esm/browser/components/tool-result.d.ts +13 -0
- package/esm/browser/components/tool-result.js +138 -0
- package/esm/browser/components/tool-view.js +5 -15
- package/esm/browser/components/use-stop-times.d.ts +3 -0
- package/esm/browser/components/use-stop-times.js +17 -0
- package/esm/browser/components/web-composer.js +2 -1
- package/esm/browser/device/photo-picker.d.ts +14 -0
- package/esm/browser/device/photo-picker.js +48 -0
- package/esm/browser/device/row-swipe.d.ts +2 -0
- package/esm/browser/device/row-swipe.js +8 -2
- package/esm/browser/device/sheet-swipe.d.ts +1 -1
- package/esm/browser/device/sheet-swipe.js +17 -3
- package/esm/browser/extension/extension-view.d.ts +3 -1
- package/esm/browser/extension/extension-view.js +7 -0
- package/esm/browser/extension/icons.js +10 -1
- package/esm/browser/extension/web-api-components.d.ts +21 -3
- package/esm/browser/extension/web-api-contributions.d.ts +128 -0
- package/esm/browser/extension/web-extension-api.d.ts +45 -48
- package/esm/browser/extension/web-extension-context.d.ts +6 -1
- package/esm/browser/extension/web-extension-context.js +72 -7
- package/esm/browser/extension/web-extension-protocol.d.ts +18 -2
- package/esm/browser/extension/web-extension-protocol.js +2 -0
- package/esm/browser/extension/web-extension-run.d.ts +3 -2
- package/esm/browser/extension/web-extension-run.js +3 -0
- package/esm/browser/extension/web-extensions.d.ts +2 -8
- package/esm/browser/extension/web-extensions.js +12 -35
- package/esm/browser/extension/web-page-list.d.ts +25 -0
- package/esm/browser/extension/web-page-list.js +35 -0
- package/esm/browser/extension/web-session-notices.d.ts +6 -1
- package/esm/browser/extension/web-session-notices.js +30 -4
- package/esm/browser/extension/web-sharing.d.ts +5 -2
- package/esm/browser/extension/web-sharing.js +10 -1
- package/esm/browser/i18n/locales.d.ts +77 -1
- package/esm/browser/i18n/messages.d.ts +76 -0
- package/esm/browser/i18n/messages.js +154 -2
- package/esm/browser/links/links-protocol.d.ts +2 -0
- package/esm/browser/links/links.d.ts +7 -2
- package/esm/browser/links/links.js +16 -9
- package/esm/browser/markdown/code-renderers.d.ts +4 -0
- package/esm/browser/markdown/code-renderers.js +4 -0
- package/esm/browser/markdown/lazy.d.ts +8 -0
- package/esm/browser/markdown/lazy.js +35 -0
- package/esm/browser/markdown/mermaid.d.ts +15 -3
- package/esm/browser/markdown/mermaid.js +45 -6
- package/esm/browser/notices/notices-protocol.d.ts +5 -0
- package/esm/browser/notices/notices.d.ts +19 -0
- package/esm/browser/notices/notices.js +85 -2
- package/esm/browser/notices/session-notices.d.ts +5 -2
- package/esm/browser/notices/session-notices.js +10 -1
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +2 -1
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +53 -0
- package/esm/browser/style/device.js +3 -0
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +27 -9
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +5 -0
- package/esm/browser/style/phone.d.ts +1 -1
- package/esm/browser/style/phone.js +2 -0
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +16 -3
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +19 -0
- package/esm/browser/util/desktop.d.ts +18 -1
- package/esm/browser/util/desktop.js +13 -0
- package/esm/browser/util/frame.d.ts +2 -0
- package/esm/browser/util/frame.js +2 -0
- package/esm/browser/util/process.d.ts +69 -2
- package/esm/browser/util/process.js +163 -8
- package/esm/browser/util/progress.d.ts +6 -1
- package/esm/browser/util/progress.js +11 -2
- package/esm/browser/util/scroll-rest.d.ts +10 -0
- package/esm/browser/util/scroll-rest.js +44 -0
- package/esm/browser/util/tool-result.d.ts +32 -0
- package/esm/browser/util/tool-result.js +85 -0
- package/esm/browser/util/tool.js +7 -0
- package/lib/browser/assistant/assistant-extension.js +14 -0
- package/lib/browser/assistant/assistant-initiative.d.ts +28 -0
- package/lib/browser/assistant/assistant-initiative.js +80 -0
- package/lib/browser/assistant/assistant-task-source.d.ts +7 -0
- package/lib/browser/assistant/assistant-task-source.js +12 -2
- package/lib/browser/assistant/assistant-view.js +8 -4
- package/lib/browser/assistant/assistant.d.ts +5 -0
- package/lib/browser/assistant/assistant.js +24 -5
- package/lib/browser/chat/chat-view.js +6 -5
- package/lib/browser/components/app-nav.d.ts +3 -1
- package/lib/browser/components/app-nav.js +5 -2
- package/lib/browser/components/app-view.js +25 -12
- package/lib/browser/components/asks-badge.d.ts +6 -0
- package/lib/browser/components/asks-badge.js +44 -0
- package/lib/browser/components/chat-asks.d.ts +47 -0
- package/lib/browser/components/chat-asks.js +104 -0
- package/lib/browser/components/chat-list.d.ts +7 -1
- package/lib/browser/components/chat-list.js +46 -17
- package/lib/browser/components/composer-addon-util.d.ts +12 -0
- package/lib/browser/components/composer-addon-util.js +76 -0
- package/lib/browser/components/composer-addons.d.ts +1 -7
- package/lib/browser/components/composer-addons.js +2 -29
- package/lib/browser/components/composer-box.d.ts +1 -0
- package/lib/browser/components/composer-box.js +48 -26
- package/lib/browser/components/composer.d.ts +10 -1
- package/lib/browser/components/composer.js +61 -21
- package/lib/browser/components/connection-bar.js +30 -11
- package/lib/browser/components/conversation-scroll-hooks.d.ts +17 -0
- package/lib/browser/components/conversation-scroll-hooks.js +135 -0
- package/lib/browser/components/conversation-scroll-util.d.ts +36 -0
- package/lib/browser/components/conversation-scroll-util.js +78 -0
- package/lib/browser/components/conversation-scroll.d.ts +57 -33
- package/lib/browser/components/conversation-scroll.js +189 -158
- package/lib/browser/components/discover-view.js +5 -1
- package/lib/browser/components/earlier-messages.d.ts +10 -3
- package/lib/browser/components/earlier-messages.js +16 -9
- package/lib/browser/components/face.d.ts +25 -0
- package/lib/browser/components/face.js +79 -0
- package/lib/browser/components/folder-picker.d.ts +2 -0
- package/lib/browser/components/folder-picker.js +7 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/markdown.js +3 -1
- package/lib/browser/components/media.js +24 -10
- package/lib/browser/components/mermaid-view.js +45 -3
- package/lib/browser/components/message-actions.js +1 -0
- package/lib/browser/components/message-footer.d.ts +4 -0
- package/lib/browser/components/message-footer.js +8 -0
- package/lib/browser/components/message-list.d.ts +15 -1
- package/lib/browser/components/message-list.js +200 -35
- package/lib/browser/components/phone-shell.d.ts +7 -2
- package/lib/browser/components/phone-shell.js +9 -3
- package/lib/browser/components/relay-services.d.ts +25 -0
- package/lib/browser/components/relay-services.js +286 -0
- package/lib/browser/components/relay-view.js +17 -1
- package/lib/browser/components/remote-hosts.js +1 -1
- package/lib/browser/components/session-view.d.ts +3 -1
- package/lib/browser/components/session-view.js +23 -7
- package/lib/browser/components/settings-controls.js +3 -3
- package/lib/browser/components/settings-parts.js +13 -1
- package/lib/browser/components/stop-times.d.ts +48 -0
- package/lib/browser/components/stop-times.js +85 -0
- package/lib/browser/components/ta-avatar.js +6 -0
- package/lib/browser/components/tool-result.d.ts +14 -0
- package/lib/browser/components/tool-result.js +175 -0
- package/lib/browser/components/tool-view.js +10 -20
- package/lib/browser/components/use-stop-times.d.ts +4 -0
- package/lib/browser/components/use-stop-times.js +53 -0
- package/lib/browser/components/web-composer.js +2 -1
- package/lib/browser/device/photo-picker.d.ts +15 -0
- package/lib/browser/device/photo-picker.js +51 -0
- package/lib/browser/device/row-swipe.d.ts +2 -0
- package/lib/browser/device/row-swipe.js +8 -2
- package/lib/browser/device/sheet-swipe.d.ts +1 -1
- package/lib/browser/device/sheet-swipe.js +17 -3
- package/lib/browser/extension/extension-view.d.ts +3 -1
- package/lib/browser/extension/extension-view.js +8 -1
- package/lib/browser/extension/icons.js +9 -0
- package/lib/browser/extension/web-api-components.d.ts +21 -3
- package/lib/browser/extension/web-api-contributions.d.ts +128 -0
- package/lib/browser/extension/web-extension-api.d.ts +45 -48
- package/lib/browser/extension/web-extension-context.d.ts +6 -1
- package/lib/browser/extension/web-extension-context.js +73 -8
- package/lib/browser/extension/web-extension-protocol.d.ts +18 -2
- package/lib/browser/extension/web-extension-protocol.js +2 -0
- package/lib/browser/extension/web-extension-run.d.ts +3 -2
- package/lib/browser/extension/web-extension-run.js +3 -0
- package/lib/browser/extension/web-extensions.d.ts +2 -8
- package/lib/browser/extension/web-extensions.js +12 -35
- package/lib/browser/extension/web-page-list.d.ts +26 -0
- package/lib/browser/extension/web-page-list.js +39 -0
- package/lib/browser/extension/web-session-notices.d.ts +6 -1
- package/lib/browser/extension/web-session-notices.js +30 -4
- package/lib/browser/extension/web-sharing.d.ts +5 -2
- package/lib/browser/extension/web-sharing.js +10 -1
- package/lib/browser/i18n/locales.d.ts +77 -1
- package/lib/browser/i18n/messages.d.ts +76 -0
- package/lib/browser/i18n/messages.js +154 -2
- package/lib/browser/links/links-protocol.d.ts +2 -0
- package/lib/browser/links/links.d.ts +7 -2
- package/lib/browser/links/links.js +16 -9
- package/lib/browser/markdown/code-renderers.d.ts +4 -0
- package/lib/browser/markdown/code-renderers.js +5 -1
- package/lib/browser/markdown/lazy.d.ts +8 -0
- package/lib/browser/markdown/lazy.js +37 -1
- package/lib/browser/markdown/mermaid.d.ts +15 -3
- package/lib/browser/markdown/mermaid.js +44 -5
- package/lib/browser/notices/notices-protocol.d.ts +5 -0
- package/lib/browser/notices/notices.d.ts +19 -0
- package/lib/browser/notices/notices.js +84 -1
- package/lib/browser/notices/session-notices.d.ts +5 -2
- package/lib/browser/notices/session-notices.js +10 -1
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +2 -1
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +53 -0
- package/lib/browser/style/device.js +3 -0
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +27 -9
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +5 -0
- package/lib/browser/style/phone.d.ts +1 -1
- package/lib/browser/style/phone.js +2 -0
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +16 -3
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +19 -0
- package/lib/browser/util/desktop.d.ts +18 -1
- package/lib/browser/util/desktop.js +13 -0
- package/lib/browser/util/frame.d.ts +2 -0
- package/lib/browser/util/frame.js +2 -0
- package/lib/browser/util/process.d.ts +69 -2
- package/lib/browser/util/process.js +165 -9
- package/lib/browser/util/progress.d.ts +6 -1
- package/lib/browser/util/progress.js +11 -2
- package/lib/browser/util/scroll-rest.d.ts +11 -0
- package/lib/browser/util/scroll-rest.js +47 -0
- package/lib/browser/util/tool-result.d.ts +33 -0
- package/lib/browser/util/tool-result.js +88 -0
- package/lib/browser/util/tool.js +7 -0
- package/package.json +7 -7
|
@@ -25,7 +25,10 @@ export interface WebSettingsSection {
|
|
|
25
25
|
/** A row of the settings of an extension: a label and a description as Ta's rows have, and its control. */
|
|
26
26
|
export interface WebSettingRow {
|
|
27
27
|
key: string;
|
|
28
|
+
/** Empty for a row that is all control (a panel that says what it is itself); still found by `search`. */
|
|
28
29
|
label: WebLabel;
|
|
30
|
+
/** More words the search of the settings finds it by. */
|
|
31
|
+
search?: WebLabel;
|
|
29
32
|
description?: WebLabel;
|
|
30
33
|
/** The control, beside the label; with `stacked`, under it, for a wide one (a model picker, a list). */
|
|
31
34
|
render: React.ComponentType;
|
|
@@ -101,6 +104,11 @@ export interface WebView {
|
|
|
101
104
|
discover?: boolean;
|
|
102
105
|
/** A page: the line a list shows under its name, as a messenger does — the last thing said there, and when. */
|
|
103
106
|
preview?(): WebViewPreview | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* A page under Discover: a small mark at the end of its row, as WeChat shows the face of the friend who posted last
|
|
109
|
+
* by Moments. Nothing to count; nothing, when there is nothing new.
|
|
110
|
+
*/
|
|
111
|
+
mark?: React.ComponentType;
|
|
104
112
|
/** A page: whoever is there answers now; a list that shows it marks it so, as a conversation answering. */
|
|
105
113
|
busy?(): boolean;
|
|
106
114
|
/** What `preview` or `busy` gives changed: the lists read it again. */
|
|
@@ -130,6 +138,36 @@ export interface WebShareTarget {
|
|
|
130
138
|
/** Of a package of this computer (listPackages, or one of its web extensions), handed on through the relay. */
|
|
131
139
|
packageId?: string;
|
|
132
140
|
}
|
|
141
|
+
/** How far something goes on its own: `act` does it, the rest asks the user first (WebInitiative). */
|
|
142
|
+
export type WebInitiativeLevel = 'off' | 'digest' | 'ask' | 'act';
|
|
143
|
+
/** A kind of thing the page does for the user that may need their go (the double starting a task). */
|
|
144
|
+
export interface WebInitiativeKind {
|
|
145
|
+
/** `<area>.<verb>`: `double.start-task`. */
|
|
146
|
+
id: string;
|
|
147
|
+
title: {
|
|
148
|
+
en: string;
|
|
149
|
+
zh: string;
|
|
150
|
+
};
|
|
151
|
+
/** What it does can be taken back: one that cannot never goes past `ask`. */
|
|
152
|
+
reversible: boolean;
|
|
153
|
+
/** Where it starts. */
|
|
154
|
+
level: WebInitiativeLevel;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* How far the page goes on its own with what it does for the user, as an extension that keeps the user's trust
|
|
158
|
+
* answers (WebExtensionAPI.registerInitiative): asked first or not, from what the user answered before. Without one,
|
|
159
|
+
* the settings of the page say.
|
|
160
|
+
*/
|
|
161
|
+
export interface WebInitiative {
|
|
162
|
+
/** Where the kind is now; it is defined the first time. */
|
|
163
|
+
level(kind: WebInitiativeKind): Promise<WebInitiativeLevel>;
|
|
164
|
+
/** The user chose, in a setting of the page: kept there; `null` gives it back. */
|
|
165
|
+
setLevel(kind: WebInitiativeKind, level: WebInitiativeLevel | null): Promise<void>;
|
|
166
|
+
/** What the user answered when asked: it moves the level. */
|
|
167
|
+
record(kind: WebInitiativeKind, outcome: 'accepted' | 'declined', title: string): Promise<void>;
|
|
168
|
+
/** A level may have changed. */
|
|
169
|
+
subscribe?(listener: () => void): () => void;
|
|
170
|
+
}
|
|
133
171
|
/** A conversation of the lists, as a {@link WebChatIconSource} reads it: open, or saved in its file. */
|
|
134
172
|
export interface WebChat {
|
|
135
173
|
/** Its file; none for a new one that has said nothing yet. */
|
|
@@ -175,6 +213,15 @@ export interface WebHomeItem {
|
|
|
175
213
|
at?: number;
|
|
176
214
|
/** Not seen yet: the amber dot of a row of the lists. */
|
|
177
215
|
unseen?: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* The title of a section of its own, which the user folds as those of Ta (members, channels), after them: rows of the
|
|
218
|
+
* same section together. None: right under the double. Newer than some Ta apps, which list it under the double.
|
|
219
|
+
*/
|
|
220
|
+
section?: string;
|
|
221
|
+
/** Drawn in place of the icon on its tile, `size` wide: a face of its own (a group's). */
|
|
222
|
+
face?: React.ComponentType<{
|
|
223
|
+
size: number;
|
|
224
|
+
}>;
|
|
178
225
|
/** A promise keeps the row busy. */
|
|
179
226
|
open(): unknown;
|
|
180
227
|
}
|
|
@@ -293,6 +340,23 @@ export interface WebToolRenderer {
|
|
|
293
340
|
* `next()` is what the resolvers after it would use, so `next() ?? mine` only fills in.
|
|
294
341
|
*/
|
|
295
342
|
export type WebToolRendererResolver = (toolName: string, next: () => WebToolRenderer | undefined) => WebToolRenderer | undefined;
|
|
343
|
+
/**
|
|
344
|
+
* A conversation that waits for the user to decide (ui.useAsks): its last turn asked and they did not answer or let it
|
|
345
|
+
* go, or a dialog of it waits for an answer.
|
|
346
|
+
*/
|
|
347
|
+
export interface WebAsk {
|
|
348
|
+
/** Its session file: `openChat` shows it; the id of its session before it has one. */
|
|
349
|
+
sessionFile: string;
|
|
350
|
+
/** Its session, while it is open. */
|
|
351
|
+
sessionId?: string;
|
|
352
|
+
cwd: string;
|
|
353
|
+
/** As the list of chats names it. */
|
|
354
|
+
title: string;
|
|
355
|
+
/** What it asks, on one line (TaSessionInfo.asking); none for a dialog that waits, whose words are in it. */
|
|
356
|
+
question?: string;
|
|
357
|
+
/** When it asked: the latest first. */
|
|
358
|
+
at: number;
|
|
359
|
+
}
|
|
296
360
|
/**
|
|
297
361
|
* A piece of work handed out on the user's behalf. `waiting`: it cannot go on without the user (a question,
|
|
298
362
|
* its turn in a channel); what has ended is `done`, `failed` or `stopped`.
|
|
@@ -347,6 +411,18 @@ export interface WebCodeRendererProps {
|
|
|
347
411
|
language: string;
|
|
348
412
|
/** False while the reply still streams it: the code may stop anywhere. */
|
|
349
413
|
closed: boolean;
|
|
414
|
+
/**
|
|
415
|
+
* Sends words as the user to the conversation the block is in (after its turn, if it works): a choice in it
|
|
416
|
+
* answered with a tap. None where no conversation holds the block (`ui.Markdown` of a page). Newer than some
|
|
417
|
+
* Ta apps, whose props have no `send`: there `pi.sendUserMessage` reaches the conversation shown.
|
|
418
|
+
*/
|
|
419
|
+
send?: (text: string) => Promise<void>;
|
|
420
|
+
/**
|
|
421
|
+
* What the user said after the reply the block is in, once they did: a choice it offers was made (the words sent
|
|
422
|
+
* by `send`, or typed). None while they did not answer, and where no conversation holds the block. Newer than
|
|
423
|
+
* some Ta apps.
|
|
424
|
+
*/
|
|
425
|
+
answer?: string;
|
|
350
426
|
}
|
|
351
427
|
export interface WebCustomMessage {
|
|
352
428
|
role: 'custom';
|
|
@@ -382,4 +458,56 @@ export interface WebSessionNotice {
|
|
|
382
458
|
label: string;
|
|
383
459
|
run(): void;
|
|
384
460
|
}[];
|
|
461
|
+
/** What it is about when it is no conversation's (a room asks for a permission): in place of a conversation's name. */
|
|
462
|
+
title?: string;
|
|
463
|
+
/**
|
|
464
|
+
* A view a tap opens (`<extension name>/<view name>`), for news of an extension that is no conversation's: the
|
|
465
|
+
* extension shows it on the page itself, so the page tells of it only by a notice of the system while away.
|
|
466
|
+
*/
|
|
467
|
+
view?: string;
|
|
468
|
+
}
|
|
469
|
+
/** Lines and columns of a file, from 1: a line, a place in it, or a range. */
|
|
470
|
+
export interface TextSelection {
|
|
471
|
+
startLine: number;
|
|
472
|
+
startColumn?: number;
|
|
473
|
+
endLine?: number;
|
|
474
|
+
endColumn?: number;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* What a link of a reply points to, once the page knows it is there: a file or a directory of `cwd`
|
|
478
|
+
* (`path` relative to it, `''` for `cwd` itself), or a page of the web, opened inside Ta.
|
|
479
|
+
*/
|
|
480
|
+
export type WebLink = {
|
|
481
|
+
type: 'file';
|
|
482
|
+
cwd: string;
|
|
483
|
+
path: string;
|
|
484
|
+
selection?: TextSelection;
|
|
485
|
+
} | {
|
|
486
|
+
type: 'directory';
|
|
487
|
+
cwd: string;
|
|
488
|
+
path: string;
|
|
489
|
+
} | {
|
|
490
|
+
type: 'url';
|
|
491
|
+
url: string;
|
|
492
|
+
};
|
|
493
|
+
/** True when it opened the link; false leaves it to the next opener. */
|
|
494
|
+
export type WebOpener = (link: WebLink) => boolean | Promise<boolean>;
|
|
495
|
+
export interface WebOpenerOptions {
|
|
496
|
+
/**
|
|
497
|
+
* It opens some links only, of its own (a link of a share): it is asked before the others, and for links that
|
|
498
|
+
* go out of Ta too (one scanned, opened with Cmd or Ctrl, pasted in Quick open), which the others are not.
|
|
499
|
+
*/
|
|
500
|
+
specific?: boolean;
|
|
501
|
+
}
|
|
502
|
+
/** A conversation as a list shows it: an open one has its session, one kept on the disk its file only. */
|
|
503
|
+
export interface WebSessionRef {
|
|
504
|
+
sessionId?: string;
|
|
505
|
+
sessionFile?: string;
|
|
506
|
+
cwd: string;
|
|
507
|
+
/** As the list names it. */
|
|
508
|
+
title: string;
|
|
509
|
+
/** TaSessionInfo.group. */
|
|
510
|
+
group?: string;
|
|
385
511
|
}
|
|
512
|
+
/** The entries an extension adds to the menu of a conversation of a list (registerSessionMenu); none for some. */
|
|
513
|
+
export type WebSessionMenu = (session: WebSessionRef) => WebMenuItem[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TaEvent, TaPackageServer, TaRemoteServer, TaRoomEvent, TaRoomServer, TaServer, TaSessionInfo, TaSettingsServer, TaTerminalServer, TaWorkspaceServer } from '@celljs/ta-protocol';
|
|
1
|
+
import type { TaEvent, TaPackageServer, TaRemoteServer, TaRoomEvent, TaRoomServer, TaSavedSessionInfo, TaServer, TaSessionInfo, TaSettingsServer, TaTerminalServer, TaWorkspaceServer } from '@celljs/ta-protocol';
|
|
2
2
|
import type * as React from 'react';
|
|
3
3
|
import type { Mood } from '../avatar/dino-avatar.js';
|
|
4
4
|
import type { DeviceState } from '../device/device-protocol.js';
|
|
@@ -6,8 +6,8 @@ import type { TaFiles } from '../files/files-protocol.js';
|
|
|
6
6
|
import type { GameProps } from '../game/game-protocol.js';
|
|
7
7
|
import type { Game3DProps } from '../game/game3d-protocol.js';
|
|
8
8
|
import type { Language, Theme } from '../settings/settings-protocol.js';
|
|
9
|
-
import type { CodeEditorProps, DiffEditorProps, WebComposerProps, WebDialogProps, WebEmptyProps, WebFolderPickerProps, WebFullScreenProps, WebHoldToTalkProps, WebImageViewerProps, WebModelPickerProps, WebPictureCardsProps, WebPictureProps, WebSelectBarProps, WebSelectCheckProps, WebSkeletonProps, WebStackProps, WebSwipeRowProps, WebSwitchProps, WebVoice } from './web-api-components.js';
|
|
10
|
-
import type { WebChatIconSource, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor, WebHomeEntry, WebHomeSource, WebMenuItem, WebSearchSource, WebSessionNotice, WebSettingsSection, WebShareTarget, WebTaskEntry, WebTaskRemoval, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebViewInfo, WidgetOptions } from './web-api-contributions.js';
|
|
9
|
+
import type { CodeEditorProps, DiffEditorProps, WebComposerProps, WebDialogProps, WebEmptyProps, WebFaceProps, WebFolderPickerProps, WebFullScreenProps, WebGroupFaceProps, WebHoldToTalkProps, WebImageViewerProps, WebModelPickerProps, WebPictureCardsProps, WebPictureProps, WebSelectBarProps, WebSelectCheckProps, WebSkeletonProps, WebStackProps, WebSwipeRowProps, WebSwitchProps, WebVoice } from './web-api-components.js';
|
|
10
|
+
import type { WebAsk, WebChatIconSource, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor, WebHomeEntry, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebOpenerOptions, WebSearchSource, WebSessionMenu, WebSessionNotice, WebSettingsSection, WebShareTarget, WebTaskEntry, WebTaskRemoval, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebViewInfo, WidgetOptions } from './web-api-contributions.js';
|
|
11
11
|
import type { WebDesktop, WebFileDrag } from './web-api-desktop.js';
|
|
12
12
|
import type { WebTerminal, WebTerminalOptions } from './web-api-terminal.js';
|
|
13
13
|
import type { WebPageInfo } from './web-pages.js';
|
|
@@ -83,6 +83,11 @@ export interface WebExtensionAPI {
|
|
|
83
83
|
* each day (a daily brief). Newer than some Ta apps: `pi.registerHomeItems?.(…)`.
|
|
84
84
|
*/
|
|
85
85
|
registerHomeItems(source: WebHomeSource): void;
|
|
86
|
+
/**
|
|
87
|
+
* How far the page goes on its own with what it does for the user (the double starting a task): the extension that
|
|
88
|
+
* keeps the user's trust answers; the first registered is asked. Newer than some Ta apps: `pi.registerInitiative?.(…)`.
|
|
89
|
+
*/
|
|
90
|
+
registerInitiative(initiative: WebInitiative): void;
|
|
86
91
|
/** A tool of the conversations the page opens, run in the browser. */
|
|
87
92
|
registerTool(tool: WebTool): void;
|
|
88
93
|
/**
|
|
@@ -134,6 +139,17 @@ export interface WebExtensionAPI {
|
|
|
134
139
|
* A session still opening (a promise of its id) is in front at once, as it opens, under `opening`: the user sees the click take.
|
|
135
140
|
*/
|
|
136
141
|
switchSession(session: string | Promise<string>, opening?: WebSessionOpening): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Shows the conversation of a session file of Ta as the lists open it: at once as the page or the device has it,
|
|
144
|
+
* opened again in one round trip when it closed; false when no conversation has it. Newer than some Ta apps:
|
|
145
|
+
* `pi.openChat?.(…)`.
|
|
146
|
+
*/
|
|
147
|
+
openChat(sessionFile: string): Promise<boolean>;
|
|
148
|
+
/**
|
|
149
|
+
* Opens a link as a click on a link of a reply does: the openers of extensions first (a link of a share, of a
|
|
150
|
+
* card, of an extension), else a page in the browser of the workbench. Newer than some Ta apps: `pi.openLink?.(…)`.
|
|
151
|
+
*/
|
|
152
|
+
openLink(url: string): Promise<void>;
|
|
137
153
|
/**
|
|
138
154
|
* Calls a method of the server side of the extension's package (`pi.host` of its package.json, which
|
|
139
155
|
* ta serve runs for the packages that come with Ta), with JSON values: what the page cannot do itself.
|
|
@@ -170,51 +186,6 @@ export interface WebExtensionAPI {
|
|
|
170
186
|
}
|
|
171
187
|
/** The rooms of ta serve (TaRoomServer), which the page watches for the extensions that listen (`onRoomEvent`). */
|
|
172
188
|
export type WebRooms = Omit<TaRoomServer, 'watch' | 'unwatch'>;
|
|
173
|
-
/** Lines and columns of a file, from 1: a line, a place in it, or a range. */
|
|
174
|
-
export interface TextSelection {
|
|
175
|
-
startLine: number;
|
|
176
|
-
startColumn?: number;
|
|
177
|
-
endLine?: number;
|
|
178
|
-
endColumn?: number;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* What a link of a reply points to, once the page knows it is there: a file or a directory of `cwd`
|
|
182
|
-
* (`path` relative to it, `''` for `cwd` itself), or a page of the web, opened inside Ta.
|
|
183
|
-
*/
|
|
184
|
-
export type WebLink = {
|
|
185
|
-
type: 'file';
|
|
186
|
-
cwd: string;
|
|
187
|
-
path: string;
|
|
188
|
-
selection?: TextSelection;
|
|
189
|
-
} | {
|
|
190
|
-
type: 'directory';
|
|
191
|
-
cwd: string;
|
|
192
|
-
path: string;
|
|
193
|
-
} | {
|
|
194
|
-
type: 'url';
|
|
195
|
-
url: string;
|
|
196
|
-
};
|
|
197
|
-
/** True when it opened the link; false leaves it to the next opener. */
|
|
198
|
-
export type WebOpener = (link: WebLink) => boolean | Promise<boolean>;
|
|
199
|
-
export interface WebOpenerOptions {
|
|
200
|
-
/**
|
|
201
|
-
* It opens some links only, of its own (a link of a share): it is asked before the others, and for links that
|
|
202
|
-
* go out of Ta too (one scanned, opened with Cmd or Ctrl, pasted in Quick open), which the others are not.
|
|
203
|
-
*/
|
|
204
|
-
specific?: boolean;
|
|
205
|
-
}
|
|
206
|
-
/** A conversation as a list shows it: an open one has its session, one kept on the disk its file only. */
|
|
207
|
-
export interface WebSessionRef {
|
|
208
|
-
sessionId?: string;
|
|
209
|
-
sessionFile?: string;
|
|
210
|
-
cwd: string;
|
|
211
|
-
/** As the list names it. */
|
|
212
|
-
title: string;
|
|
213
|
-
/** TaSessionInfo.group. */
|
|
214
|
-
group?: string;
|
|
215
|
-
}
|
|
216
|
-
/** The entries an extension adds to the menu of a conversation of a list (registerSessionMenu); none for some. */
|
|
217
|
-
export type WebSessionMenu = (session: WebSessionRef) => WebMenuItem[];
|
|
218
189
|
/** What a session still opening is shown as (`switchSession`): the head of its conversation, till it comes. */
|
|
219
190
|
export interface WebSessionOpening {
|
|
220
191
|
title?: string;
|
|
@@ -354,6 +325,18 @@ export interface WebExtensionUI {
|
|
|
354
325
|
* (`isStreaming`), what was said last. The same array until one changes.
|
|
355
326
|
*/
|
|
356
327
|
useSessions(): readonly TaSessionInfo[];
|
|
328
|
+
/**
|
|
329
|
+
* A React hook: the saved conversations of the last days (Settings.chatArchiveDays) as the lists of the page have
|
|
330
|
+
* them, read again as sessions close; not those older. The same array until one changes. Rather than reading
|
|
331
|
+
* `server.listSavedSessions()` again and again. Newer than some Ta apps: `pi.ui.useSavedSessions?.()`.
|
|
332
|
+
*/
|
|
333
|
+
useSavedSessions(): readonly TaSavedSessionInfo[];
|
|
334
|
+
/**
|
|
335
|
+
* A React hook: the conversations that wait for the user to decide, as the list of chats shows them at its top
|
|
336
|
+
* (TaSessionInfo.asking unless let go, a dialog that waits), the latest first. Newer than some Ta apps:
|
|
337
|
+
* `pi.ui.useAsks?.()`.
|
|
338
|
+
*/
|
|
339
|
+
useAsks(): readonly WebAsk[];
|
|
357
340
|
/**
|
|
358
341
|
* Shows a view of any web extension by its id, `<extension name>/<view name>` (`assistant/assistant`
|
|
359
342
|
* for the double): a page in the main area, a tool of the workbench as its tab; `''` the conversation again.
|
|
@@ -417,6 +400,12 @@ export interface WebExtensionUI {
|
|
|
417
400
|
* it opened; says why not in a notice.
|
|
418
401
|
*/
|
|
419
402
|
openShared(text: string): Promise<boolean>;
|
|
403
|
+
/**
|
|
404
|
+
* Connects to another Ta by a pairing link (`ta pair`, or the device a Ta that let the user in gave them, docs/design/
|
|
405
|
+
* ta-team.md 8.2), and switches to it once it answered, as adding a computer does: the page loads again. Resolves
|
|
406
|
+
* false (saying why in a notice) when it did not answer or refused. Newer than some Ta apps: `pi.ui.connect?.(…)`.
|
|
407
|
+
*/
|
|
408
|
+
connect?(link: string): Promise<boolean>;
|
|
420
409
|
/** Stops an extension started on open that runs (in the background): it starts again when opened. */
|
|
421
410
|
stopExtension(name: string): void;
|
|
422
411
|
/** Takes a page (WebPageInfo.id) out of those used lately. */
|
|
@@ -436,6 +425,14 @@ export interface WebExtensionUI {
|
|
|
436
425
|
size?: number;
|
|
437
426
|
mark?: string;
|
|
438
427
|
}>;
|
|
428
|
+
/**
|
|
429
|
+
* The face of one who is not Ta, as the agents of channels have: a coloured shape with eyes that blink, one of 16,
|
|
430
|
+
* by `face` or the same for the same `seed` (an id) on every device; `online` a dot at its corner. Newer than
|
|
431
|
+
* some Ta apps: `pi.ui.Face ?? fallback`.
|
|
432
|
+
*/
|
|
433
|
+
readonly Face: React.ComponentType<WebFaceProps>;
|
|
434
|
+
/** A group, as a channel is drawn: the first of `members` in front, the next behind. Newer than some Ta apps. */
|
|
435
|
+
readonly GroupFace: React.ComponentType<WebGroupFaceProps>;
|
|
439
436
|
/** The lucide icons of the page, by name (extension/icons.ts): a web extension cannot import them. */
|
|
440
437
|
readonly icons: Readonly<Record<string, WebIcon>>;
|
|
441
438
|
/** Monaco, the editor of VS Code, on the text of a file; it loads the first time one is shown. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type TaServer, type TaSettingsServer } from '@celljs/ta-protocol';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { TaFiles } from '../files/files-protocol.js';
|
|
4
4
|
import type { GameProps } from '../game/game-protocol.js';
|
|
@@ -9,6 +9,7 @@ import type { TaSessionNotices } from '../notices/session-notices.js';
|
|
|
9
9
|
import type { TaSettings } from '../settings/settings-protocol.js';
|
|
10
10
|
import type { TaState } from '../state/state-protocol.js';
|
|
11
11
|
import type { TaWorkbench } from '../workbench-protocol.js';
|
|
12
|
+
import type { WebCodeRendererProps } from './web-api-contributions.js';
|
|
12
13
|
import type { WebEditorTabs } from './web-editor-tabs.js';
|
|
13
14
|
import type { CodeEditorProps, DiffEditorProps, WebComposerProps, WebExtensionAPI, WebExtensionUI, WebFolderPickerProps, WebHoldToTalkProps, WebModelPickerProps, WebStorage, WebViewInfo, WebVoice } from './web-extension-api.js';
|
|
14
15
|
import { type TaWebExtensions, type WebExtensionConversation, type WebSessionSwitcher } from './web-extension-protocol.js';
|
|
@@ -45,6 +46,10 @@ export interface WebExtensionContextHost {
|
|
|
45
46
|
export declare class WebExtensionContext {
|
|
46
47
|
protected readonly host: WebExtensionContextHost;
|
|
47
48
|
constructor(host: WebExtensionContextHost);
|
|
49
|
+
/** The server, whose messages for a conversation say they came from the extension. */
|
|
50
|
+
static marked(server: TaServer, mark: (text: string) => string): TaServer;
|
|
51
|
+
/** A renderer of code whose `send` (a choice tapped in it) says it came from the extension. */
|
|
52
|
+
static replying(Renderer: React.ComponentType<WebCodeRendererProps>, mark: (text: string) => string): React.ComponentType<WebCodeRendererProps>;
|
|
48
53
|
/** Monaco and the games in the theme and language of the settings, the same component for every extension. */
|
|
49
54
|
protected readonly codeEditor: (props: CodeEditorProps) => React.FunctionComponentElement<CodeEditorProps & {
|
|
50
55
|
settings: TaSettings;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { TaMessageSource, } from '@celljs/ta-protocol';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { useBusy } from '../components/busy.js';
|
|
4
|
+
import { ChatAskUtil, LET_GO_ASKS } from '../components/chat-asks.js';
|
|
3
5
|
import { PINNED } from '../components/chat-list.js';
|
|
4
6
|
import { CodeEditor } from '../components/code-editor.js';
|
|
5
7
|
import { ContextMenuUtil, useContextMenu } from '../components/context-menu.js';
|
|
6
|
-
import { useConversationScroll } from '../components/conversation-scroll.js';
|
|
8
|
+
import { useConversationScroll } from '../components/conversation-scroll-hooks.js';
|
|
7
9
|
import { DiffEditor } from '../components/diff-editor.js';
|
|
8
10
|
import { EmptyState } from '../components/empty-state.js';
|
|
11
|
+
import { Face, GroupFace } from '../components/face.js';
|
|
9
12
|
import { FolderPicker } from '../components/folder-picker.js';
|
|
10
13
|
import { FullScreen } from '../components/full-screen.js';
|
|
11
14
|
import { HoldToTalk } from '../components/hold-to-talk.js';
|
|
@@ -77,6 +80,27 @@ export class WebExtensionContext {
|
|
|
77
80
|
onClose,
|
|
78
81
|
}); };
|
|
79
82
|
}
|
|
83
|
+
/** The server, whose messages for a conversation say they came from the extension. */
|
|
84
|
+
static marked(server, mark) {
|
|
85
|
+
const sending = new Set(['prompt', 'steer', 'followUp']);
|
|
86
|
+
return new Proxy(server, {
|
|
87
|
+
get(target, property, receiver) {
|
|
88
|
+
const value = Reflect.get(target, property, receiver);
|
|
89
|
+
if (!sending.has(property) || typeof value !== 'function') {
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
return (sessionId, input) => value.call(target, sessionId, { ...input, message: mark(input.message) });
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/** A renderer of code whose `send` (a choice tapped in it) says it came from the extension. */
|
|
97
|
+
static replying(Renderer, mark) {
|
|
98
|
+
return function Replying(props) {
|
|
99
|
+
const { send } = props;
|
|
100
|
+
const marked = React.useMemo(() => send && ((text) => send(mark(text))), [send]);
|
|
101
|
+
return React.createElement(Renderer, { ...props, send: marked });
|
|
102
|
+
};
|
|
103
|
+
}
|
|
80
104
|
create(run) {
|
|
81
105
|
const { host } = this;
|
|
82
106
|
const { workbench, files } = host;
|
|
@@ -90,10 +114,16 @@ export class WebExtensionContext {
|
|
|
90
114
|
};
|
|
91
115
|
/** What acts for the user: refused once the extension stopped. */
|
|
92
116
|
const live = (action) => run.stopped ? Promise.reject(new Error(`The web extension ${run.loaded.name} has stopped.`)) : action();
|
|
117
|
+
// What it sends as the user says it came from this package (TaMessageSource): a page shows so.
|
|
118
|
+
const mark = (text) => TaMessageSource.mark(text, run.loaded.name);
|
|
119
|
+
let server;
|
|
93
120
|
return {
|
|
94
121
|
React,
|
|
95
122
|
get server() {
|
|
96
|
-
|
|
123
|
+
if ((server === null || server === void 0 ? void 0 : server.of) !== workbench.server) {
|
|
124
|
+
server = { of: workbench.server, marked: WebExtensionContext.marked(workbench.server, mark) };
|
|
125
|
+
}
|
|
126
|
+
return server.marked;
|
|
97
127
|
},
|
|
98
128
|
get workspace() {
|
|
99
129
|
return workbench.workspace;
|
|
@@ -122,7 +152,7 @@ export class WebExtensionContext {
|
|
|
122
152
|
storage: { ...this.storage(run), directory: cwd => this.storage(run, cwd) },
|
|
123
153
|
registerView: (name, view) => register(() => run.views.set(name, view)),
|
|
124
154
|
registerMessageRenderer: (customType, renderer) => register(() => run.renderers.set(customType, renderer)),
|
|
125
|
-
registerCodeRenderer: (language, renderer) => register(() => run.codeRenderers.set(language.trim().toLowerCase(), renderer)),
|
|
155
|
+
registerCodeRenderer: (language, renderer) => register(() => run.codeRenderers.set(language.trim().toLowerCase(), WebExtensionContext.replying(renderer, mark))),
|
|
126
156
|
registerAvatar: avatar => register(() => {
|
|
127
157
|
run.avatar = avatar;
|
|
128
158
|
}),
|
|
@@ -131,6 +161,7 @@ export class WebExtensionContext {
|
|
|
131
161
|
registerToolRenderer: resolver => register(() => run.toolRenderers.push(resolver)),
|
|
132
162
|
registerTasks: source => register(() => run.taskSources.push(source)),
|
|
133
163
|
registerHomeItems: source => register(() => run.homeSources.push(source)),
|
|
164
|
+
registerInitiative: initiative => register(() => run.initiatives.push(initiative)),
|
|
134
165
|
registerSearch: source => register(() => run.searches.push(source)),
|
|
135
166
|
registerComposerAddon: addon => register(() => run.composerAddons.push(addon)),
|
|
136
167
|
registerSettings: section => register(() => run.settingsSections.push(section)),
|
|
@@ -160,7 +191,7 @@ export class WebExtensionContext {
|
|
|
160
191
|
if (!send) {
|
|
161
192
|
throw new Error('No conversation is shown yet.');
|
|
162
193
|
}
|
|
163
|
-
await send(text);
|
|
194
|
+
await send(mark(text));
|
|
164
195
|
}),
|
|
165
196
|
switchSession: (session, opening) => live(async () => {
|
|
166
197
|
const switcher = host.switcher();
|
|
@@ -171,6 +202,8 @@ export class WebExtensionContext {
|
|
|
171
202
|
host.extensions.showPage('');
|
|
172
203
|
await shown;
|
|
173
204
|
}),
|
|
205
|
+
openChat: sessionFile => live(() => host.links.openConversation(sessionFile)),
|
|
206
|
+
openLink: url => live(() => host.links.open({ type: 'url', url })),
|
|
174
207
|
openTemporary: (source, from) => live(() => host.extensions.openTemporary(source, from)),
|
|
175
208
|
callHost: (method, ...params) => live(() => workbench.packages.callPackageHost(run.loaded.name, method, params)),
|
|
176
209
|
reloadExtensions: () => live(() => host.extensions.reloadPackages()),
|
|
@@ -235,6 +268,17 @@ export class WebExtensionContext {
|
|
|
235
268
|
const sessions = () => workbench.state.sessions;
|
|
236
269
|
return React.useSyncExternalStore(listener => workbench.subscribe(listener), sessions, sessions);
|
|
237
270
|
},
|
|
271
|
+
useSavedSessions: () => {
|
|
272
|
+
const saved = () => workbench.state.saved;
|
|
273
|
+
return React.useSyncExternalStore(listener => workbench.subscribe(listener), saved, saved);
|
|
274
|
+
},
|
|
275
|
+
useAsks: () => {
|
|
276
|
+
const read = () => workbench.state;
|
|
277
|
+
const { sessions, saved } = React.useSyncExternalStore(listener => workbench.subscribe(listener), read, read);
|
|
278
|
+
const letGo = () => host.persisted.get(LET_GO_ASKS);
|
|
279
|
+
const kept = React.useSyncExternalStore(listener => host.persisted.subscribe(listener), letGo, letGo);
|
|
280
|
+
return React.useMemo(() => ChatAskUtil.list(sessions, saved, kept), [sessions, saved, kept]);
|
|
281
|
+
},
|
|
238
282
|
useDevice,
|
|
239
283
|
showView: id => (run.stopped ? Promise.resolve(false) : host.extensions.showView(id)),
|
|
240
284
|
usePages: () => {
|
|
@@ -250,12 +294,28 @@ export class WebExtensionContext {
|
|
|
250
294
|
return [menu, openSections];
|
|
251
295
|
},
|
|
252
296
|
attachMenu: ContextMenuUtil.attach,
|
|
253
|
-
scanCode: Scanner.available()
|
|
297
|
+
scanCode: Scanner.available()
|
|
298
|
+
? instructions => (run.stopped ? Promise.resolve(undefined) : Scanner.scan(instructions, messageOf(settings.state.language, 'ta.cancel')))
|
|
299
|
+
: undefined,
|
|
254
300
|
scan: CodeScan.available() ? () => (run.stopped ? Promise.resolve() : new CodeScan(host).scan()) : undefined,
|
|
255
301
|
stopExtension: name => !run.stopped && host.extensions.stopExtension(name),
|
|
256
302
|
shareExtension: target => !run.stopped && host.extensions.share(target),
|
|
257
303
|
custom: component => WebExtensionRunUtil.track(run, () => host.extensions.showCustom(run.loaded.name, component)),
|
|
258
304
|
openShared: text => (run.stopped ? Promise.resolve(false) : host.extensions.openShared(text)),
|
|
305
|
+
connect: async (link) => {
|
|
306
|
+
if (run.stopped) {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
try {
|
|
310
|
+
await host.workbench.signIn(link);
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
313
|
+
catch (failure) {
|
|
314
|
+
const refused = (failure === null || failure === void 0 ? void 0 : failure.reason) === 'refused';
|
|
315
|
+
notices.notify(messageOf(settings.state.language, refused ? 'ta.hosts.refused' : 'ta.hosts.unreachable'), { level: 'error' });
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
},
|
|
259
319
|
forgetPage: id => !run.stopped && host.extensions.forgetPage(id),
|
|
260
320
|
useTasks: () => React.useSyncExternalStore(host.extensions.tasks.subscribe, host.extensions.tasks.tasks, host.extensions.tasks.tasks),
|
|
261
321
|
useHomeItems: () => React.useSyncExternalStore(host.extensions.home.subscribe, host.extensions.home.items, host.extensions.home.items),
|
|
@@ -265,16 +325,21 @@ export class WebExtensionContext {
|
|
|
265
325
|
icons: WEB_ICONS,
|
|
266
326
|
CodeEditor: this.codeEditor,
|
|
267
327
|
DiffEditor: this.diffEditor,
|
|
268
|
-
// Ends with the extension.
|
|
328
|
+
// Ends with the extension: one made after it stopped is ended at once.
|
|
269
329
|
createTerminal: (options) => {
|
|
270
330
|
const terminal = new DefaultWebTerminal(settings, (target, open) => void host.links.open(target, open), options);
|
|
271
|
-
|
|
331
|
+
WebExtensionRunUtil.track(run, () => () => terminal.dispose());
|
|
332
|
+
if (run.stopped) {
|
|
333
|
+
terminal.dispose();
|
|
334
|
+
}
|
|
272
335
|
return terminal;
|
|
273
336
|
},
|
|
274
337
|
Game: this.game,
|
|
275
338
|
Game3D: this.game3d,
|
|
276
339
|
FullScreen,
|
|
277
340
|
Stack: PhoneStack,
|
|
341
|
+
Face,
|
|
342
|
+
GroupFace,
|
|
278
343
|
Composer: this.composer,
|
|
279
344
|
HoldToTalk: this.holdToTalk,
|
|
280
345
|
voice: this.voice,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TaEvent, TaTemporaryFrom, TaWebExtensionInfo } from '@celljs/ta-protocol';
|
|
2
2
|
import type * as React from 'react';
|
|
3
3
|
import type { MessageId } from '../i18n/messages.js';
|
|
4
|
-
import type { WebAvatarProps, WebChatIconSource, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor, WebExtensionFactory, WebIcon, WebImage, WebLabel, WebMenuItem, WebOpener, WebSearchSource, WebSessionMenu, WebSessionOpening, WebSettingsSection, WebShareTarget, WebTool, WebToolRendererResolver, WebViewLocation, WebViewPreview, WidgetOptions } from './web-extension-api.js';
|
|
4
|
+
import type { WebAvatarProps, WebChatIconSource, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor, WebExtensionFactory, WebIcon, WebImage, WebInitiative, WebLabel, WebMenuItem, WebOpener, WebSearchSource, WebSessionMenu, WebSessionOpening, WebSettingsSection, WebShareTarget, WebTool, WebToolRendererResolver, WebViewLocation, WebViewPreview, WidgetOptions } from './web-extension-api.js';
|
|
5
5
|
import type { WebHomeBoard } from './web-home.js';
|
|
6
6
|
import type { PageUsage, WebPageInfo } from './web-pages.js';
|
|
7
7
|
import type { WebTaskBoard } from './web-tasks.js';
|
|
@@ -62,6 +62,8 @@ export interface WebViewEntry {
|
|
|
62
62
|
discover?: boolean;
|
|
63
63
|
menu?(): WebMenuItem[][];
|
|
64
64
|
preview?(): WebViewPreview | undefined;
|
|
65
|
+
/** WebView.mark. */
|
|
66
|
+
mark?: React.ComponentType;
|
|
65
67
|
busy?(): boolean;
|
|
66
68
|
subscribePreview?(listener: () => void): () => void;
|
|
67
69
|
send?(text: string, images?: WebImage[]): Promise<void>;
|
|
@@ -113,6 +115,8 @@ export interface WebExtensionsState {
|
|
|
113
115
|
avatars: Record<string, React.ComponentType<WebAvatarProps>>;
|
|
114
116
|
/** The icons extensions give conversations of theirs (WebExtensionAPI.registerChatIcon), with the extension of each. */
|
|
115
117
|
chatIcons: WebChatIconEntry[];
|
|
118
|
+
/** What answers how far the page goes on its own (WebExtensionAPI.registerInitiative), in the order registered. */
|
|
119
|
+
initiatives: WebInitiative[];
|
|
116
120
|
/** The first tool of each name. */
|
|
117
121
|
tools: WebTool[];
|
|
118
122
|
/** How calls of tools read (WebExtensionAPI.registerToolRenderer), in the order the extensions loaded. */
|
|
@@ -137,6 +141,11 @@ export interface WebExtensionsState {
|
|
|
137
141
|
conversationShown: boolean;
|
|
138
142
|
/** The session of the conversation shown. */
|
|
139
143
|
sessionId?: string;
|
|
144
|
+
/**
|
|
145
|
+
* The list of the computer's extensions was asked for once, answered or not: before, the views of a first
|
|
146
|
+
* start (nothing kept, WebViewUtil.KEPT) are still on their way.
|
|
147
|
+
*/
|
|
148
|
+
loaded: boolean;
|
|
140
149
|
/** The view of the page shown in the main area; `''` for the conversation. */
|
|
141
150
|
page: string;
|
|
142
151
|
/** Counts the pages shown, the same one again too: on a phone a page shown comes to the front. */
|
|
@@ -177,7 +186,14 @@ export declare namespace WebLabelUtil {
|
|
|
177
186
|
}
|
|
178
187
|
/** What `on` and `sendUserMessage` of web extensions reach: the conversation shown. */
|
|
179
188
|
/** Shows a session as the conversation: `switchSession` of web extensions. */
|
|
180
|
-
|
|
189
|
+
/**
|
|
190
|
+
* What the page shows as the conversation: an open session by its id, one still opening by the promise of its id, or the
|
|
191
|
+
* conversation of a session file, opened as the lists open it (at once from what the page or the device has).
|
|
192
|
+
*/
|
|
193
|
+
export type WebSessionTarget = string | Promise<string> | {
|
|
194
|
+
sessionFile: string;
|
|
195
|
+
};
|
|
196
|
+
export type WebSessionSwitcher = (session: WebSessionTarget, opening?: WebSessionOpening) => Promise<void>;
|
|
181
197
|
export interface WebExtensionConversation {
|
|
182
198
|
/** None for a new conversation, which opens with its first message. */
|
|
183
199
|
send?(text: string): Promise<void>;
|
|
@@ -14,6 +14,7 @@ export var WebExtensionsStateUtil;
|
|
|
14
14
|
codeRenderers: {},
|
|
15
15
|
avatars: {},
|
|
16
16
|
chatIcons: [],
|
|
17
|
+
initiatives: [],
|
|
17
18
|
tools: [],
|
|
18
19
|
toolRenderers: [],
|
|
19
20
|
openers: [],
|
|
@@ -22,6 +23,7 @@ export var WebExtensionsStateUtil;
|
|
|
22
23
|
customs: [],
|
|
23
24
|
editors: [],
|
|
24
25
|
focus: 0,
|
|
26
|
+
loaded: false,
|
|
25
27
|
page: '',
|
|
26
28
|
pageShown: 0,
|
|
27
29
|
conversationShown: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TaEvent } from '@celljs/ta-protocol';
|
|
2
2
|
import type * as React from 'react';
|
|
3
|
-
import type { WebChatIconSource, WebComposerAddon, WebHomeSource, WebOpener, WebSearchSource, WebSessionMenu, WebSettingsSection, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WidgetOptions } from './web-extension-api.js';
|
|
3
|
+
import type { WebChatIconSource, WebComposerAddon, WebHomeSource, WebInitiative, WebOpener, WebSearchSource, WebSessionMenu, WebSettingsSection, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WidgetOptions } from './web-extension-api.js';
|
|
4
4
|
import type { LoadedWebExtension, WebExtensionsState } from './web-extension-protocol.js';
|
|
5
5
|
/** What an extension registered through its API: all of it goes when it stops. */
|
|
6
6
|
export interface WebRegistrations {
|
|
@@ -14,6 +14,7 @@ export interface WebRegistrations {
|
|
|
14
14
|
avatar?: WebExtensionsState['avatars'][string];
|
|
15
15
|
chatIcons: WebChatIconSource[];
|
|
16
16
|
homeSources: WebHomeSource[];
|
|
17
|
+
initiatives: WebInitiative[];
|
|
17
18
|
tools: WebTool[];
|
|
18
19
|
toolRenderers: WebToolRendererResolver[];
|
|
19
20
|
openers: WebOpener[];
|
|
@@ -50,5 +51,5 @@ export declare namespace WebExtensionRunUtil {
|
|
|
50
51
|
/** Subscribes for the extension: undone when it stops, or by the function returned. */
|
|
51
52
|
function track(run: WebExtensionRun, subscribe: () => () => void): () => void;
|
|
52
53
|
/** What the extensions that run registered, as the page shows it: the first of a message type or a tool name wins. */
|
|
53
|
-
function collect(runs: readonly WebExtensionRun[], onOpen: (id: string) => boolean): Pick<WebExtensionsState, 'openers' | 'specificOpeners' | 'sessionMenus' | 'extensions' | 'views' | 'widgets' | 'composerAddons' | 'settingsSections' | 'renderers' | 'codeRenderers' | 'avatars' | 'chatIcons' | 'tools' | 'toolRenderers' | 'searches'>;
|
|
54
|
+
function collect(runs: readonly WebExtensionRun[], onOpen: (id: string) => boolean): Pick<WebExtensionsState, 'openers' | 'specificOpeners' | 'sessionMenus' | 'extensions' | 'views' | 'widgets' | 'composerAddons' | 'settingsSections' | 'renderers' | 'codeRenderers' | 'avatars' | 'chatIcons' | 'initiatives' | 'tools' | 'toolRenderers' | 'searches'>;
|
|
54
55
|
}
|
|
@@ -11,6 +11,7 @@ export var WebExtensionRunUtil;
|
|
|
11
11
|
avatar: undefined,
|
|
12
12
|
chatIcons: [],
|
|
13
13
|
homeSources: [],
|
|
14
|
+
initiatives: [],
|
|
14
15
|
tools: [],
|
|
15
16
|
toolRenderers: [],
|
|
16
17
|
openers: [],
|
|
@@ -86,6 +87,7 @@ export var WebExtensionRunUtil;
|
|
|
86
87
|
discover: view.discover,
|
|
87
88
|
menu: (_a = view.menu) === null || _a === void 0 ? void 0 : _a.bind(view),
|
|
88
89
|
preview: (_b = view.preview) === null || _b === void 0 ? void 0 : _b.bind(view),
|
|
90
|
+
mark: view.mark,
|
|
89
91
|
busy: (_c = view.busy) === null || _c === void 0 ? void 0 : _c.bind(view),
|
|
90
92
|
subscribePreview: (_d = view.subscribe) === null || _d === void 0 ? void 0 : _d.bind(view),
|
|
91
93
|
send: (_e = view.send) === null || _e === void 0 ? void 0 : _e.bind(view),
|
|
@@ -110,6 +112,7 @@ export var WebExtensionRunUtil;
|
|
|
110
112
|
codeRenderers,
|
|
111
113
|
avatars,
|
|
112
114
|
chatIcons: runs.flatMap(run => run.chatIcons.map(source => ({ extension: run.loaded.name, source }))),
|
|
115
|
+
initiatives: runs.flatMap(run => run.initiatives),
|
|
113
116
|
tools,
|
|
114
117
|
toolRenderers: runs.flatMap(run => run.toolRenderers),
|
|
115
118
|
searches: runs.flatMap(run => run.searches).sort((a, b) => { var _a, _b; return ((_a = a.order) !== null && _a !== void 0 ? _a : DEFAULT_ORDER) - ((_b = b.order) !== null && _b !== void 0 ? _b : DEFAULT_ORDER); }),
|
|
@@ -15,6 +15,7 @@ import { BuiltinWebExtension, type LoadedWebExtension, TaWebExtensions, type Web
|
|
|
15
15
|
import { type WebExtensionRun } from './web-extension-run.js';
|
|
16
16
|
import { WebHomeBoard } from './web-home.js';
|
|
17
17
|
import { WebOnDemand } from './web-on-demand.js';
|
|
18
|
+
import { WebPageList } from './web-page-list.js';
|
|
18
19
|
import type { WebPageInfo } from './web-pages.js';
|
|
19
20
|
import { WebSharing } from './web-sharing.js';
|
|
20
21
|
import { WebTaskBoard } from './web-tasks.js';
|
|
@@ -44,14 +45,7 @@ export declare class TaWebExtensionsImpl implements TaWebExtensions {
|
|
|
44
45
|
/** The views of the navigation kept from before (WebViewUtil.KEPT), in their places until the extensions have loaded once. */
|
|
45
46
|
protected placeholders?: WebViewEntry[];
|
|
46
47
|
protected started?: WebOnDemand;
|
|
47
|
-
|
|
48
|
-
protected listedPages?: {
|
|
49
|
-
state: WebExtensionsState;
|
|
50
|
-
language: string;
|
|
51
|
-
navigation: unknown;
|
|
52
|
-
handheld: boolean;
|
|
53
|
-
pages: WebPageInfo[];
|
|
54
|
-
};
|
|
48
|
+
protected readonly pageList: WebPageList;
|
|
55
49
|
get state(): WebExtensionsState;
|
|
56
50
|
protected init(): void;
|
|
57
51
|
/** The extensions started on open (ta-launcher.md). */
|