@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
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { WebInitiative, WebInitiativeKind } from '../extension/web-api-contributions';
|
|
2
|
+
import type { TaWebExtensions } from '../extension/web-extension-protocol';
|
|
3
|
+
import type { Settings, TaSettings } from '../settings/settings-protocol';
|
|
4
|
+
/** The double starting a task it hands out: by default without asking, as pi asks nothing (Settings.confirmTasks). */
|
|
5
|
+
export declare const START_TASK: WebInitiativeKind;
|
|
6
|
+
/**
|
|
7
|
+
* Whether the double asks before it starts a task, kept with the extension that keeps the user's trust when there is
|
|
8
|
+
* one (WebExtensionAPI.registerInitiative): its level drives Settings.confirmTasks (`act` does not ask), what the user
|
|
9
|
+
* answers moves it, and the user's own switch (the + of the box, the settings) is kept there as their choice. Without
|
|
10
|
+
* one, Settings.confirmTasks alone, as before.
|
|
11
|
+
*/
|
|
12
|
+
export declare class AssistantInitiative {
|
|
13
|
+
protected readonly extensions: () => TaWebExtensions | undefined;
|
|
14
|
+
protected readonly settings: () => TaSettings;
|
|
15
|
+
/** Settings.confirmTasks as the level last made it: a change to another value is the user's. */
|
|
16
|
+
protected synced?: boolean;
|
|
17
|
+
protected current?: WebInitiative;
|
|
18
|
+
protected unwatch?: () => void;
|
|
19
|
+
protected unwatchProvider?: () => void;
|
|
20
|
+
constructor(extensions: () => TaWebExtensions | undefined, settings: () => TaSettings);
|
|
21
|
+
start(): void;
|
|
22
|
+
/** The settings changed: a new value of Settings.confirmTasks not of the level is the user's, kept as their choice. */
|
|
23
|
+
settingsChanged(settings: Settings): void;
|
|
24
|
+
/** What the user answered when the double asked. */
|
|
25
|
+
record(outcome: 'accepted' | 'declined', title: string): void;
|
|
26
|
+
protected sync(): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=assistant-initiative.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AssistantInitiative = exports.START_TASK = void 0;
|
|
4
|
+
/** The double starting a task it hands out: by default without asking, as pi asks nothing (Settings.confirmTasks). */
|
|
5
|
+
exports.START_TASK = {
|
|
6
|
+
id: 'double.start-task',
|
|
7
|
+
title: { en: 'The double starts the tasks it hands out', zh: '分身开始它交出的任务' },
|
|
8
|
+
reversible: true,
|
|
9
|
+
level: 'act',
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Whether the double asks before it starts a task, kept with the extension that keeps the user's trust when there is
|
|
13
|
+
* one (WebExtensionAPI.registerInitiative): its level drives Settings.confirmTasks (`act` does not ask), what the user
|
|
14
|
+
* answers moves it, and the user's own switch (the + of the box, the settings) is kept there as their choice. Without
|
|
15
|
+
* one, Settings.confirmTasks alone, as before.
|
|
16
|
+
*/
|
|
17
|
+
class AssistantInitiative {
|
|
18
|
+
constructor(extensions, settings) {
|
|
19
|
+
this.extensions = extensions;
|
|
20
|
+
this.settings = settings;
|
|
21
|
+
}
|
|
22
|
+
start() {
|
|
23
|
+
const extensions = this.extensions();
|
|
24
|
+
if (this.unwatch || !extensions) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const pick = () => {
|
|
28
|
+
var _a, _b, _c;
|
|
29
|
+
const next = (_a = extensions.state.initiatives) === null || _a === void 0 ? void 0 : _a[0];
|
|
30
|
+
if (next === this.current) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
(_b = this.unwatchProvider) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
34
|
+
this.current = next;
|
|
35
|
+
this.synced = undefined;
|
|
36
|
+
this.unwatchProvider = (_c = next === null || next === void 0 ? void 0 : next.subscribe) === null || _c === void 0 ? void 0 : _c.call(next, () => void this.sync());
|
|
37
|
+
void this.sync();
|
|
38
|
+
};
|
|
39
|
+
this.unwatch = extensions.subscribe(pick);
|
|
40
|
+
pick();
|
|
41
|
+
}
|
|
42
|
+
/** The settings changed: a new value of Settings.confirmTasks not of the level is the user's, kept as their choice. */
|
|
43
|
+
settingsChanged(settings) {
|
|
44
|
+
const provider = this.current;
|
|
45
|
+
if (!provider || this.synced === undefined || settings.confirmTasks === this.synced) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.synced = settings.confirmTasks;
|
|
49
|
+
void provider.setLevel(exports.START_TASK, settings.confirmTasks ? 'ask' : 'act').catch(() => undefined);
|
|
50
|
+
}
|
|
51
|
+
/** What the user answered when the double asked. */
|
|
52
|
+
record(outcome, title) {
|
|
53
|
+
var _a;
|
|
54
|
+
void ((_a = this.current) === null || _a === void 0 ? void 0 : _a.record(exports.START_TASK, outcome, title).catch(() => undefined));
|
|
55
|
+
}
|
|
56
|
+
async sync() {
|
|
57
|
+
const provider = this.current;
|
|
58
|
+
if (!provider) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const asking = (await provider.level(exports.START_TASK).catch(() => undefined)) !== 'act';
|
|
62
|
+
if (provider !== this.current) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const settings = this.settings();
|
|
66
|
+
const now = settings.state.settings.confirmTasks;
|
|
67
|
+
// The first time: the user turned asking on before a level was kept, which is their choice.
|
|
68
|
+
if (this.synced === undefined && now && !asking) {
|
|
69
|
+
this.synced = true;
|
|
70
|
+
await provider.setLevel(exports.START_TASK, 'ask').catch(() => undefined);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.synced = asking;
|
|
74
|
+
if (now !== asking) {
|
|
75
|
+
settings.update({ confirmTasks: asking });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.AssistantInitiative = AssistantInitiative;
|
|
80
|
+
//# sourceMappingURL=assistant-initiative.js.map
|
|
@@ -13,6 +13,12 @@ export interface AssistantTaskActions {
|
|
|
13
13
|
menu(task: AssistantTask): WebMenuItem[][];
|
|
14
14
|
/** Deletes it without asking (WebTask.remove). */
|
|
15
15
|
remove(task: AssistantTask): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* What the conversation of a task asks the user to decide, its turn over (TaSessionInfo.asking, unless let go):
|
|
18
|
+
* the task waits for them. `watchAsking` tells when that may have changed (the list of sessions, what was let go).
|
|
19
|
+
*/
|
|
20
|
+
asking?(task: AssistantTask): string | undefined;
|
|
21
|
+
watchAsking?(listener: () => void): () => void;
|
|
16
22
|
}
|
|
17
23
|
/** What of a task's session the list shows: a new task object only when it changes. */
|
|
18
24
|
interface Shown {
|
|
@@ -39,6 +45,7 @@ export declare class AssistantTaskSource implements WebTaskSource {
|
|
|
39
45
|
}>;
|
|
40
46
|
protected readonly listeners: Set<() => void>;
|
|
41
47
|
protected stopAssistant?: () => void;
|
|
48
|
+
protected stopAsking?: () => void;
|
|
42
49
|
constructor(assistant: TaAssistant, actions: AssistantTaskActions);
|
|
43
50
|
tasks(): readonly WebTask[];
|
|
44
51
|
subscribe(listener: () => void): () => void;
|
|
@@ -32,8 +32,10 @@ class AssistantTaskSource {
|
|
|
32
32
|
return this.list;
|
|
33
33
|
}
|
|
34
34
|
subscribe(listener) {
|
|
35
|
+
var _a, _b;
|
|
35
36
|
if (this.listeners.size === 0) {
|
|
36
37
|
this.stopAssistant = this.assistant.subscribe(state => this.sync(state));
|
|
38
|
+
this.stopAsking = (_b = (_a = this.actions).watchAsking) === null || _b === void 0 ? void 0 : _b.call(_a, () => this.build());
|
|
37
39
|
this.sync(this.assistant.state);
|
|
38
40
|
// The lists show them before the double is opened.
|
|
39
41
|
void this.assistant.loadTasks().catch(() => undefined);
|
|
@@ -52,9 +54,11 @@ class AssistantTaskSource {
|
|
|
52
54
|
this.sync(this.assistant.state);
|
|
53
55
|
}
|
|
54
56
|
dispose() {
|
|
55
|
-
var _a;
|
|
57
|
+
var _a, _b;
|
|
56
58
|
(_a = this.stopAssistant) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
57
59
|
this.stopAssistant = undefined;
|
|
60
|
+
(_b = this.stopAsking) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
61
|
+
this.stopAsking = undefined;
|
|
58
62
|
for (const { stop } of this.stores.values()) {
|
|
59
63
|
stop();
|
|
60
64
|
}
|
|
@@ -113,18 +117,24 @@ class AssistantTaskSource {
|
|
|
113
117
|
}
|
|
114
118
|
}
|
|
115
119
|
status(task, state) {
|
|
120
|
+
var _a, _b;
|
|
116
121
|
if (task.status === 'running' && state && state.pendingUi.length > 0) {
|
|
117
122
|
return 'waiting';
|
|
118
123
|
}
|
|
124
|
+
if (task.status !== 'running' && !task.takenOver && ((_b = (_a = this.actions).asking) === null || _b === void 0 ? void 0 : _b.call(_a, task))) {
|
|
125
|
+
return 'waiting';
|
|
126
|
+
}
|
|
119
127
|
return task.status;
|
|
120
128
|
}
|
|
121
129
|
detail(task, status, state) {
|
|
130
|
+
var _a, _b;
|
|
122
131
|
const { t } = this.actions;
|
|
123
132
|
if (task.takenOver) {
|
|
124
133
|
return t('ta.task.takenOver');
|
|
125
134
|
}
|
|
126
135
|
if (status === 'waiting') {
|
|
127
|
-
|
|
136
|
+
const asking = task.status === 'running' ? undefined : (_b = (_a = this.actions).asking) === null || _b === void 0 ? void 0 : _b.call(_a, task);
|
|
137
|
+
return asking ? t('ta.chat.toAsk', { question: asking }) : t('ta.task.waiting');
|
|
128
138
|
}
|
|
129
139
|
return activity(task, state, t);
|
|
130
140
|
}
|
|
@@ -43,6 +43,7 @@ const composer_1 = require("../components/composer");
|
|
|
43
43
|
const composer_addons_1 = require("../components/composer-addons");
|
|
44
44
|
const connection_bar_1 = require("../components/connection-bar");
|
|
45
45
|
const conversation_scroll_1 = require("../components/conversation-scroll");
|
|
46
|
+
const conversation_scroll_hooks_1 = require("../components/conversation-scroll-hooks");
|
|
46
47
|
const dialog_view_1 = require("../components/dialog-view");
|
|
47
48
|
const earlier_messages_1 = require("../components/earlier-messages");
|
|
48
49
|
const hero_cards_1 = require("../components/hero-cards");
|
|
@@ -55,6 +56,7 @@ const message_menu_1 = require("../components/message-menu");
|
|
|
55
56
|
const run_status_1 = require("../components/run-status");
|
|
56
57
|
const session_settings_1 = require("../components/session-settings");
|
|
57
58
|
const ta_avatar_1 = require("../components/ta-avatar");
|
|
59
|
+
const use_stop_times_1 = require("../components/use-stop-times");
|
|
58
60
|
const voice_button_1 = require("../components/voice-button");
|
|
59
61
|
const workbench_toggle_1 = require("../components/workbench-toggle");
|
|
60
62
|
const extension_view_1 = require("../extension/extension-view");
|
|
@@ -113,9 +115,9 @@ function moodOf({ working, attention, listening, speaking, running, recentlyDone
|
|
|
113
115
|
}
|
|
114
116
|
/** `index`: in the whole conversation, of which `messages` start at `start`. */
|
|
115
117
|
/** What the user said; a task that reports back stays where it comes in. */
|
|
116
|
-
const saidByUser = (message) => {
|
|
118
|
+
const saidByUser = (message, index, messages) => {
|
|
117
119
|
const text = message_1.MessageUtil.text(message_1.MessageUtil.blocks(message)).trim();
|
|
118
|
-
return message
|
|
120
|
+
return (0, earlier_messages_1.isAsk)(message, index, messages) && !TASK_UPDATE.test(text) && !assistant_task_util_1.AssistantTaskUtil.isRenamedNote(text);
|
|
119
121
|
};
|
|
120
122
|
function lastReply(messages, start) {
|
|
121
123
|
for (let index = messages.length - 1; index >= 0; index--) {
|
|
@@ -148,6 +150,7 @@ function DoubleUserMessage({ message, blocks }) {
|
|
|
148
150
|
const { text, copied, skill } = (0, message_list_1.userWords)(blocks);
|
|
149
151
|
const [menu, onContextMenu] = (0, message_menu_1.useMessageMenu)({ kind: 'user', message, text: copied });
|
|
150
152
|
return (React.createElement("div", { className: `ta-msg-user ${conversation_scroll_1.ASK_CLASS}`, onContextMenu: onContextMenu },
|
|
153
|
+
React.createElement(message_list_1.UserMarks, { blocks: blocks }),
|
|
151
154
|
skill && React.createElement(message_list_1.SkillUse, { skill: skill }),
|
|
152
155
|
React.createElement(message_list_1.UserSaid, { blocks: blocks, text: text, bubble: "ta-msg-bubble", timestamp: message.timestamp }),
|
|
153
156
|
React.createElement(message_footer_1.UserFooter, { message: message, text: copied }),
|
|
@@ -221,6 +224,7 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
|
221
224
|
const [workbench, bench] = (0, hooks_1.useWorkbench)();
|
|
222
225
|
const [settingsState, settings] = (0, hooks_1.useSettings)();
|
|
223
226
|
const state = (0, hooks_1.useSessionState)(store);
|
|
227
|
+
const stopTimed = (0, use_stop_times_1.useStopTimes)(store.sessionId, 'double');
|
|
224
228
|
const now = (0, assistant_hooks_1.useNow)(1000);
|
|
225
229
|
const lastActive = (0, assistant_hooks_1.useLastActive)();
|
|
226
230
|
const [listening, setListening] = React.useState(false);
|
|
@@ -273,7 +277,7 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
|
273
277
|
}, [speak, state.working, reply, settingsState.language, voice]);
|
|
274
278
|
// What the user said; a task that reports back stays where it comes in.
|
|
275
279
|
const asked = (0, earlier_messages_1.useAsked)(state, saidByUser);
|
|
276
|
-
const scroller = (0,
|
|
280
|
+
const scroller = (0, conversation_scroll_hooks_1.useConversationScroll)(asked);
|
|
277
281
|
(0, earlier_messages_1.useEarlierMessages)(store, state, scroller);
|
|
278
282
|
const say = (message) => {
|
|
279
283
|
hush();
|
|
@@ -392,7 +396,7 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
|
392
396
|
React.createElement(dialog_view_1.DialogView, { request: request, respond: response => from.respondUi(response).catch(() => undefined) })))),
|
|
393
397
|
React.createElement(connection_bar_1.ConnectionBanner, null),
|
|
394
398
|
addons.above,
|
|
395
|
-
React.createElement(composer_1.Composer, { ref: box, store: store, server: bench.server, workspace: bench.workspace, working: state.working, commands: session.settings.commands, cwd: cwd, placeholder: t('ta.assistant.placeholder'), actions: actions, onSending: hush, onError: fail, after: speaking ? React.createElement(voice_button_1.SpeakingButton, { onStop: hush }) : undefined, voiceSends: true, recentShots: settingsState.settings.recentShots, talkPlace: "double", onTalkSent: () => {
|
|
399
|
+
React.createElement(composer_1.Composer, { ref: box, store: store, server: bench.server, workspace: bench.workspace, working: state.working, commands: session.settings.commands, cwd: cwd, placeholder: t('ta.assistant.placeholder'), actions: actions, onSending: hush, onStopTimed: stopTimed, onError: fail, after: speaking ? React.createElement(voice_button_1.SpeakingButton, { onStop: hush }) : undefined, voiceSends: true, recentShots: settingsState.settings.recentShots, talkPlace: "double", onTalkSent: () => {
|
|
396
400
|
aloud.current = speakTalk;
|
|
397
401
|
}, onListening: on => {
|
|
398
402
|
setListening(on);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type ClientTool, type SessionState, type SessionStore } from '@celljs/ta-client';
|
|
2
2
|
import { type TaPromptInput, type TaServer, type TaSessionInfo } from '@celljs/ta-protocol';
|
|
3
|
+
import { TaWebExtensions } from '../extension/web-extension-protocol';
|
|
3
4
|
import { TaKeptChats } from '../offline/kept-chats-protocol';
|
|
4
5
|
import { type Settings, TaSettings } from '../settings/settings-protocol';
|
|
5
6
|
import { TaState } from '../state/state-protocol';
|
|
6
7
|
import type { ComposerImage } from '../util/composer';
|
|
7
8
|
import { TaWorkbench } from '../workbench-protocol';
|
|
9
|
+
import { AssistantInitiative } from './assistant-initiative';
|
|
8
10
|
import { type AssistantAsk, type AssistantState, type AssistantTask, TaAssistant } from './assistant-protocol';
|
|
9
11
|
import { AssistantTaskBook } from './assistant-task-book';
|
|
10
12
|
/** What the double is to hear of a task that ended (finished), and when it ended. */
|
|
@@ -18,6 +20,9 @@ export declare class TaAssistantImpl implements TaAssistant {
|
|
|
18
20
|
protected readonly persisted: TaState;
|
|
19
21
|
protected readonly settings: TaSettings;
|
|
20
22
|
protected readonly kept: TaKeptChats;
|
|
23
|
+
protected readonly extensions: TaWebExtensions;
|
|
24
|
+
/** Whether it asks before starting a task, kept with the extension of the user's trust. */
|
|
25
|
+
protected readonly initiative: AssistantInitiative;
|
|
21
26
|
protected current: AssistantState;
|
|
22
27
|
protected assistant?: SessionStore;
|
|
23
28
|
/** Until the conversation is open (and while the computer cannot be reached): it as this device kept it. */
|
|
@@ -13,10 +13,13 @@ exports.TaAssistantImpl = void 0;
|
|
|
13
13
|
const core_1 = require("@celljs/core");
|
|
14
14
|
const ta_client_1 = require("@celljs/ta-client");
|
|
15
15
|
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
16
|
+
const web_extension_protocol_1 = require("../extension/web-extension-protocol");
|
|
17
|
+
const messages_1 = require("../i18n/messages");
|
|
16
18
|
const kept_chats_protocol_1 = require("../offline/kept-chats-protocol");
|
|
17
19
|
const settings_protocol_1 = require("../settings/settings-protocol");
|
|
18
20
|
const state_protocol_1 = require("../state/state-protocol");
|
|
19
21
|
const workbench_protocol_1 = require("../workbench-protocol");
|
|
22
|
+
const assistant_initiative_1 = require("./assistant-initiative");
|
|
20
23
|
const assistant_protocol_1 = require("./assistant-protocol");
|
|
21
24
|
const assistant_role_1 = require("./assistant-role");
|
|
22
25
|
const assistant_state_1 = require("./assistant-state");
|
|
@@ -27,6 +30,8 @@ const { FILE, TASKS, PROMPT, ASKING } = assistant_state_1.AssistantStates;
|
|
|
27
30
|
const NOTE_SETTLE_MS = 5000;
|
|
28
31
|
let TaAssistantImpl = class TaAssistantImpl {
|
|
29
32
|
constructor() {
|
|
33
|
+
/** Whether it asks before starting a task, kept with the extension of the user's trust. */
|
|
34
|
+
this.initiative = new assistant_initiative_1.AssistantInitiative(() => this.extensions, () => this.settings);
|
|
30
35
|
this.current = { ready: false, tasks: [], asks: [] };
|
|
31
36
|
this.taskStores = new Map();
|
|
32
37
|
this.followAgain = false;
|
|
@@ -62,6 +67,7 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
62
67
|
start() {
|
|
63
68
|
var _a, _b;
|
|
64
69
|
(_a = this.unwatchSettings) !== null && _a !== void 0 ? _a : (this.unwatchSettings = this.settings.subscribe(state => this.settingsChanged(state.settings)));
|
|
70
|
+
this.initiative.start();
|
|
65
71
|
(_b = this.starting) !== null && _b !== void 0 ? _b : (this.starting = this.open().catch(error => {
|
|
66
72
|
this.starting = undefined;
|
|
67
73
|
if (ta_client_1.TaRemoteError.isConnectionLost(error)) {
|
|
@@ -69,7 +75,11 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
69
75
|
setTimeout(() => void this.workbench.connected().then(() => (this.starting || this.assistant ? undefined : this.start()), () => undefined), 1000);
|
|
70
76
|
return;
|
|
71
77
|
}
|
|
72
|
-
|
|
78
|
+
// One let into another's Ta without starting conversations there: what they may use is said, not an error of the server.
|
|
79
|
+
const forbidden = ta_protocol_1.TaErrorUtil.code(error) === ta_protocol_1.TaErrorCode.FORBIDDEN;
|
|
80
|
+
this.update({
|
|
81
|
+
error: forbidden ? (0, messages_1.message)(this.settings.state.language, 'ta.assistant.forbidden') : error instanceof Error ? error.message : String(error),
|
|
82
|
+
});
|
|
73
83
|
}));
|
|
74
84
|
return this.starting;
|
|
75
85
|
}
|
|
@@ -358,6 +368,7 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
358
368
|
}
|
|
359
369
|
/** Asking first or not is in the role: the conversation opens again with it, once the double is not at work. */
|
|
360
370
|
settingsChanged(settings) {
|
|
371
|
+
this.initiative.settingsChanged(settings);
|
|
361
372
|
const store = this.assistant;
|
|
362
373
|
if (store && settings.assistantModel && settings.assistantModel !== this.model) {
|
|
363
374
|
void this.applyModel(store.sessionId);
|
|
@@ -513,7 +524,7 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
513
524
|
}
|
|
514
525
|
// Its session closed since (idle, or the service restarted): opened again from its file.
|
|
515
526
|
const store = await this.openTask(id);
|
|
516
|
-
await store.prompt(message, { streamingBehavior: 'steer' });
|
|
527
|
+
await store.prompt(ta_protocol_1.TaMessageSource.mark(message, ta_protocol_1.TaMessageSource.DOUBLE), { streamingBehavior: 'steer' });
|
|
517
528
|
return `Sent to task ${id}.`;
|
|
518
529
|
},
|
|
519
530
|
stop_task: async ({ id }) => {
|
|
@@ -534,8 +545,12 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
534
545
|
throw new Error(`${running} tasks run already, as many as the user lets run at once: wait for one to end (a <task_update> comes), or stop one.`);
|
|
535
546
|
}
|
|
536
547
|
const where = cwd || ((_a = this.workbench.state.server) === null || _a === void 0 ? void 0 : _a.cwd) || '.';
|
|
537
|
-
if (confirmTasks
|
|
538
|
-
|
|
548
|
+
if (confirmTasks) {
|
|
549
|
+
const started = await this.ask({ id: `a${++this.asked}`, title, instructions, cwd: where, at: Date.now() });
|
|
550
|
+
this.initiative.record(started ? 'accepted' : 'declined', title);
|
|
551
|
+
if (!started) {
|
|
552
|
+
return `The user did not let task "${title}" start. Ask them what they want instead; do not start it again unasked.`;
|
|
553
|
+
}
|
|
539
554
|
}
|
|
540
555
|
const info = await this.server.openSession({ cwd: where });
|
|
541
556
|
await this.server.setSessionName(info.sessionId, title);
|
|
@@ -546,7 +561,7 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
546
561
|
const task = { id, title, sessionId: info.sessionId, cwd: info.cwd, status: 'running', startedAt: Date.now(), origin: this.sessionFile };
|
|
547
562
|
this.book.add(task);
|
|
548
563
|
const store = await this.follow(task);
|
|
549
|
-
await store.prompt(instructions);
|
|
564
|
+
await store.prompt(ta_protocol_1.TaMessageSource.mark(instructions, ta_protocol_1.TaMessageSource.DOUBLE));
|
|
550
565
|
const { sessionFile } = await this.server.getState(info.sessionId);
|
|
551
566
|
this.book.change(task, { sessionFile });
|
|
552
567
|
return `Started task ${this.book.idOf(task)} "${title}" in ${info.cwd}. A <task_update> comes when it ends.`;
|
|
@@ -675,6 +690,10 @@ __decorate([
|
|
|
675
690
|
(0, core_1.Autowired)(kept_chats_protocol_1.TaKeptChats),
|
|
676
691
|
__metadata("design:type", Object)
|
|
677
692
|
], TaAssistantImpl.prototype, "kept", void 0);
|
|
693
|
+
__decorate([
|
|
694
|
+
(0, core_1.Autowired)({ id: web_extension_protocol_1.TaWebExtensions, detached: true }),
|
|
695
|
+
__metadata("design:type", Object)
|
|
696
|
+
], TaAssistantImpl.prototype, "extensions", void 0);
|
|
678
697
|
exports.TaAssistantImpl = TaAssistantImpl = __decorate([
|
|
679
698
|
(0, core_1.Component)(assistant_protocol_1.TaAssistant)
|
|
680
699
|
], TaAssistantImpl);
|
|
@@ -162,9 +162,8 @@ function ChatView({ widgets, onMenu, back }) {
|
|
|
162
162
|
const menu = React.createElement(icon_1.IconButton, { icon: back ? lucide_react_1.ChevronLeft : icon_1.SidebarLeft, label: t(back ? 'ta.back' : 'ta.sidebar'), className: "ta-narrow-only", onClick: onMenu });
|
|
163
163
|
const around = (placement) => widgets.filter(widget => widget.placement === placement).map(widget => React.createElement(Widget, { key: widget.id, widget: widget }));
|
|
164
164
|
// On a phone, the state of the connection is a row over the message box.
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
around('aboveEditor')));
|
|
165
|
+
const notice = React.createElement(connection_bar_1.ConnectionBanner, null);
|
|
166
|
+
const aboveComposer = around('aboveEditor');
|
|
168
167
|
// The conversation picked shows at once, as it opens: its head and that it is on its way, rather than the one before.
|
|
169
168
|
const coming = pending && pending !== (store === null || store === void 0 ? void 0 : store.sessionId) ? pending : arriving && store && store.sessionId !== before ? store.sessionId : undefined;
|
|
170
169
|
if (coming) {
|
|
@@ -172,7 +171,9 @@ function ChatView({ widgets, onMenu, back }) {
|
|
|
172
171
|
return React.createElement(OpeningView, { info: opening !== null && opening !== void 0 ? opening : (info && { title: info.sessionName, cwd: info.cwd }), menu: menu });
|
|
173
172
|
}
|
|
174
173
|
if (draft) {
|
|
175
|
-
return React.createElement(DraftView, { draft: draft, menu: menu, aboveComposer:
|
|
174
|
+
return (React.createElement(DraftView, { draft: draft, menu: menu, aboveComposer: React.createElement(React.Fragment, null,
|
|
175
|
+
notice,
|
|
176
|
+
aboveComposer), belowComposer: around('belowEditor') }));
|
|
176
177
|
}
|
|
177
178
|
if (!store) {
|
|
178
179
|
return (React.createElement(React.Fragment, null,
|
|
@@ -190,6 +191,6 @@ function ChatView({ widgets, onMenu, back }) {
|
|
|
190
191
|
// The same view while the conversation shown from the device becomes the one attached: nothing drawn again.
|
|
191
192
|
, {
|
|
192
193
|
// The same view while the conversation shown from the device becomes the one attached: nothing drawn again.
|
|
193
|
-
key: view !== null && view !== void 0 ? view : store.sessionId, store: store, server: workbench.server, workspace: workbench.workspace, info: info, onClosed: refresh, onActivity: refresh, leading: menu, trailing: React.createElement(workbench_toggle_1.WorkbenchToggle, null), empty: React.createElement(Hero, { cwd: (_e = info === null || info === void 0 ? void 0 : info.cwd) !== null && _e !== void 0 ? _e : '', onPick: text => store.send(text).catch(() => undefined) }), aboveComposer: aboveComposer, belowComposer: around('belowEditor') }));
|
|
194
|
+
key: view !== null && view !== void 0 ? view : store.sessionId, store: store, server: workbench.server, workspace: workbench.workspace, info: info, onClosed: refresh, onActivity: refresh, leading: menu, trailing: React.createElement(workbench_toggle_1.WorkbenchToggle, null), empty: React.createElement(Hero, { cwd: (_e = info === null || info === void 0 ? void 0 : info.cwd) !== null && _e !== void 0 ? _e : '', onPick: text => store.send(text).catch(() => undefined) }), notice: notice, aboveComposer: aboveComposer, belowComposer: around('belowEditor') }));
|
|
194
195
|
}
|
|
195
196
|
//# sourceMappingURL=chat-view.js.map
|
|
@@ -29,13 +29,15 @@ export interface RailProps {
|
|
|
29
29
|
onSurface(surface: PhoneSurface | undefined): void;
|
|
30
30
|
/** What a held entry does: the double listens, the chats open a new one (entryHold). */
|
|
31
31
|
holds: EntryHolds;
|
|
32
|
+
/** The conversations that wait for the user to decide (ChatAskUtil.count): a count on the entry of the chats. */
|
|
33
|
+
asks?: number;
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
34
36
|
* The navigation on the left, as the tabs of a phone: the logo; the lists of the sidebar; the pages, and Discover
|
|
35
37
|
* once some are under it; the account with the settings at the bottom. A page's menu (a right click) puts it under
|
|
36
38
|
* Discover; that of the double talks to it, and that of the chats opens a new one (entryMenu).
|
|
37
39
|
*/
|
|
38
|
-
export declare function Rail({ lists, list, onList, navigation, current, onPage, onDiscover, onSettings, settingsShown, surfaces, surface, onSurface, holds, }: RailProps): React.JSX.Element;
|
|
40
|
+
export declare function Rail({ lists, list, onList, navigation, current, onPage, onDiscover, onSettings, settingsShown, surfaces, surface, onSurface, holds, asks, }: RailProps): React.JSX.Element;
|
|
39
41
|
/** A sidebar view of a web extension, under its title or its own top bar. */
|
|
40
42
|
export declare function SidebarView({ view }: {
|
|
41
43
|
view: WebViewEntry;
|
|
@@ -48,6 +48,7 @@ const use_t_1 = require("../i18n/use-t");
|
|
|
48
48
|
const agent_settings_1 = require("../settings/agent-settings");
|
|
49
49
|
const navigation_1 = require("../settings/navigation");
|
|
50
50
|
const account_menu_1 = require("./account-menu");
|
|
51
|
+
const asks_badge_1 = require("./asks-badge");
|
|
51
52
|
const connection_bar_1 = require("./connection-bar");
|
|
52
53
|
const context_menu_1 = require("./context-menu");
|
|
53
54
|
const dino_1 = require("./dino");
|
|
@@ -86,7 +87,7 @@ function RailItem({ label, active, onClick, onContextMenu, onPointerDown, 'data-
|
|
|
86
87
|
* once some are under it; the account with the settings at the bottom. A page's menu (a right click) puts it under
|
|
87
88
|
* Discover; that of the double talks to it, and that of the chats opens a new one (entryMenu).
|
|
88
89
|
*/
|
|
89
|
-
function Rail({ lists, list, onList, navigation, current, onPage, onDiscover, onSettings, settingsShown, surfaces, surface, onSurface, holds, }) {
|
|
90
|
+
function Rail({ lists, list, onList, navigation, current, onPage, onDiscover, onSettings, settingsShown, surfaces, surface, onSurface, holds, asks, }) {
|
|
90
91
|
const t = (0, use_t_1.useT)();
|
|
91
92
|
const [{ server }] = (0, hooks_1.useWorkbench)();
|
|
92
93
|
const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
|
|
@@ -106,7 +107,9 @@ function Rail({ lists, list, onList, navigation, current, onPage, onDiscover, on
|
|
|
106
107
|
React.createElement(dino_1.Dino, { size: 26 })),
|
|
107
108
|
React.createElement("div", { className: "ta-rail-items" },
|
|
108
109
|
navigation.home && item(navigation.home, false, true),
|
|
109
|
-
lists.map(entry => (React.createElement(RailItem, { key: entry.id, label: entry.label, active: list === entry.id, onClick: () => onList(entry.id), ...held((0, nav_places_1.entryHold)(entry.id, entry.double, holds)) },
|
|
110
|
+
lists.map(entry => (React.createElement(RailItem, { key: entry.id, label: entry.label, active: list === entry.id, onClick: () => onList(entry.id), ...held((0, nav_places_1.entryHold)(entry.id, entry.double, holds)) },
|
|
111
|
+
entry.double ? React.createElement(ta_avatar_1.DinoFace, { size: 24, className: "ta-nav-face" }) : React.createElement(entry.icon, { size: 20, strokeWidth: 1.6 }),
|
|
112
|
+
entry.id === '' && !!asks && React.createElement(asks_badge_1.AsksBadge, { count: asks })))),
|
|
110
113
|
(navigation.nav.length > 0 || discover) && React.createElement("hr", { className: "ta-rail-divider" }),
|
|
111
114
|
navigation.nav.map(view => item(view)),
|
|
112
115
|
discover && (React.createElement(RailItem, { label: t('ta.discover'), active: !settingsShown && current === nav_places_1.DISCOVER, onClick: onDiscover, onContextMenu: event => openMenu(event, [settingsItem]) },
|
|
@@ -56,6 +56,7 @@ const app_nav_1 = require("./app-nav");
|
|
|
56
56
|
const app_shell_hooks_1 = require("./app-shell-hooks");
|
|
57
57
|
const auth_view_1 = require("./auth-view");
|
|
58
58
|
const board_1 = require("./board");
|
|
59
|
+
const chat_asks_1 = require("./chat-asks");
|
|
59
60
|
const chat_icon_1 = require("./chat-icon");
|
|
60
61
|
const chat_list_1 = require("./chat-list");
|
|
61
62
|
const chat_seen_1 = require("./chat-seen");
|
|
@@ -72,6 +73,7 @@ const kept_pages_1 = require("./kept-pages");
|
|
|
72
73
|
const launcher_surface_1 = require("./launcher-surface");
|
|
73
74
|
const link_1 = require("./link");
|
|
74
75
|
const link_dialog_1 = require("./link-dialog");
|
|
76
|
+
const list_skeleton_1 = require("./list-skeleton");
|
|
75
77
|
const me_view_1 = require("./me-view");
|
|
76
78
|
const media_1 = require("./media");
|
|
77
79
|
const nav_places_1 = require("./nav-places");
|
|
@@ -105,6 +107,7 @@ function AppShell() {
|
|
|
105
107
|
const [chatsByDirectory, setChatsByDirectory] = (0, hooks_1.usePersisted)(chat_list_1.BY_DIRECTORY);
|
|
106
108
|
const [foldedChats, setFoldedChats] = (0, hooks_1.usePersisted)(chat_list_1.FOLDED);
|
|
107
109
|
const [pinnedChats, setPinnedChats] = (0, hooks_1.usePersisted)(chat_list_1.PINNED);
|
|
110
|
+
const [letGoAsks, setLetGoAsks] = (0, hooks_1.usePersisted)(chat_asks_1.LET_GO_ASKS);
|
|
108
111
|
const [navOpen, setNavOpen] = React.useState(false);
|
|
109
112
|
const layout = (0, device_1.useDevice)(device => device.layout);
|
|
110
113
|
const touch = (0, device_1.useDevice)(device => device.touch);
|
|
@@ -197,7 +200,7 @@ function AppShell() {
|
|
|
197
200
|
React.useEffect(() => {
|
|
198
201
|
host.setSessionSwitcher(async (session, opening) => {
|
|
199
202
|
// In front at once, while it opens.
|
|
200
|
-
const shown = chat.show(session, opening);
|
|
203
|
+
const shown = typeof session === 'object' && 'sessionFile' in session ? chat.resume(session.sessionFile) : chat.show(session, opening);
|
|
201
204
|
setNavOpen(false);
|
|
202
205
|
setSurface(undefined);
|
|
203
206
|
setSettings(undefined);
|
|
@@ -247,7 +250,9 @@ function AppShell() {
|
|
|
247
250
|
const view = extensions.views.find(candidate => candidate.id === page && candidate.location === 'page');
|
|
248
251
|
const sideViews = side_lists_1.SideListUtil.sidebarViews(extensions.views);
|
|
249
252
|
const sideView = sideId === app_shell_hooks_1.FIRST_SIDE ? sideViews[0] : sideViews.find(candidate => candidate.id === sideId);
|
|
250
|
-
|
|
253
|
+
// The first start, nothing kept: the double's list may still come, rather than the chats shown a moment before it.
|
|
254
|
+
const sideComing = sideId === app_shell_hooks_1.FIRST_SIDE && !sideView && !extensions.loaded;
|
|
255
|
+
const side = sideView ? sideView.id : sideComing ? app_shell_hooks_1.FIRST_SIDE : '';
|
|
251
256
|
const showPage = (id) => {
|
|
252
257
|
host.showPage(id);
|
|
253
258
|
setNavOpen(false);
|
|
@@ -427,7 +432,14 @@ function AppShell() {
|
|
|
427
432
|
showPage('');
|
|
428
433
|
}
|
|
429
434
|
};
|
|
430
|
-
const chats = (React.createElement(assistant_chat_list_1.AssistantChatList, { sessions: workbench.sessions, saved: workbench.saved, removed: removedChats, archived: workbench.archived, onArchive: readArchived, foldDays: chatSettings.chatFoldDays, archiveDays: chatSettings.chatArchiveDays, selected: view || phone ? undefined : (pending !== null && pending !== void 0 ? pending : store === null || store === void 0 ? void 0 : store.sessionId), chat: chat, byDirectory: chatsByDirectory, onByDirectory: setChatsByDirectory, folded: foldedChats, onFolded: setFoldedChats, pinned: pinnedChats, onPinned: setPinnedChats, looking: looking, seen: seenChats,
|
|
435
|
+
const chats = (React.createElement(assistant_chat_list_1.AssistantChatList, { sessions: workbench.sessions, saved: workbench.saved, removed: removedChats, archived: workbench.archived, onArchive: readArchived, foldDays: chatSettings.chatFoldDays, archiveDays: chatSettings.chatArchiveDays, selected: view || phone ? undefined : (pending !== null && pending !== void 0 ? pending : store === null || store === void 0 ? void 0 : store.sessionId), chat: chat, byDirectory: chatsByDirectory, onByDirectory: setChatsByDirectory, folded: foldedChats, onFolded: setFoldedChats, pinned: pinnedChats, onPinned: setPinnedChats, looking: looking, seen: seenChats, letGo: letGoAsks, onLetGo: entry => {
|
|
436
|
+
var _a;
|
|
437
|
+
const at = (_a = entry.asking) === null || _a === void 0 ? void 0 : _a.at;
|
|
438
|
+
if (at !== undefined) {
|
|
439
|
+
setLetGoAsks(before => chat_asks_1.ChatAskUtil.letGo(before, chat_list_1.ChatListUtil.file(entry), at));
|
|
440
|
+
}
|
|
441
|
+
}, onPicked: picked }));
|
|
442
|
+
const sideList = sideView ? React.createElement(app_nav_1.SidebarView, { view: sideView }) : sideComing ? React.createElement(list_skeleton_1.ListSkeleton, null) : chats;
|
|
431
443
|
const editorArea = (React.createElement(editor_area_1.EditorArea, { editors: extensions.editors, active: activeEditor, views: tools, onShow: id => host.showEditor(id), onClose: ids => void host.closeEditors(ids), onPin: id => host.pinEditor(id), onOpenView: openTool, onHide: editor.toggle, cwd: (_f = web_extension_protocol_1.WebCwdUtil.shown(extensions)) !== null && _f !== void 0 ? _f : (_c = workbench.server) === null || _c === void 0 ? void 0 : _c.cwd, maximized: maximized, onMaximize: () => setMaximized(!maximized) }));
|
|
432
444
|
// A photo of the scan screen to the double: its conversation shows, the photo goes with what to do with it.
|
|
433
445
|
const askDouble = async (text, image) => {
|
|
@@ -508,10 +520,10 @@ function AppShell() {
|
|
|
508
520
|
}
|
|
509
521
|
: {};
|
|
510
522
|
// The chats' tab has the amber dot of their rows while one of them said something unseen, as a messenger's: of
|
|
511
|
-
// those the list shows, so that each dot of the tab has a row to find. Dragged away, all are seen.
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
523
|
+
// those the list shows, so that each dot of the tab has a row to find. Dragged away, all are seen. Those that
|
|
524
|
+
// wait for the user to decide are counted on it, on the rail too, until answered.
|
|
525
|
+
const listedChats = chat_list_1.ChatListUtil.entries(workbench.sessions, workbench.saved, removedChats, undefined, workbench_util_1.WorkbenchUtil.daysAgo(Date.now(), chatSettings.chatArchiveDays), chat_list_1.ChatListUtil.keptFiles(workbench.saved, pinnedChats, letGoAsks), chat_icon_1.ChatIconUtil.archiveSince(extensions.chatIcons, Date.now())).listed;
|
|
526
|
+
const chatsAsking = chat_asks_1.ChatAskUtil.count(listedChats, letGoAsks);
|
|
515
527
|
const inFront = looking ? workbench.sessions.find(session => session.sessionId === looking) : undefined;
|
|
516
528
|
const chatsUnseen = chat_seen_1.ChatSeenUtil.anyUnseen(listedChats, seenChats, inFront && chat_list_1.ChatListUtil.file(inFront));
|
|
517
529
|
const seeAllChats = () => state.set(chat_seen_1.SEEN_CHATS, chat_seen_1.ChatSeenUtil.seeAll(state.get(chat_seen_1.SEEN_CHATS), listedChats, Date.now()));
|
|
@@ -522,7 +534,7 @@ function AppShell() {
|
|
|
522
534
|
fold: t('ta.nav.fold'),
|
|
523
535
|
settings: { label: t('ta.nav.settings'), run: () => openSettings('navigation') },
|
|
524
536
|
holds,
|
|
525
|
-
}).map(item => (item.id === '' && chatsUnseen ? { ...item, unseen:
|
|
537
|
+
}).map(item => (item.id === '' && (chatsUnseen || chatsAsking) ? { ...item, unseen: chatsUnseen, onSeeAll: seeAllChats, asks: chatsAsking } : item))
|
|
526
538
|
: [];
|
|
527
539
|
const tab = tabPage === 'me' ? nav_places_1.ME_TAB : tabPage === 'discover' ? nav_places_1.DISCOVER : ((_g = tabView === null || tabView === void 0 ? void 0 : tabView.id) !== null && _g !== void 0 ? _g : side);
|
|
528
540
|
// The launcher and the board are over the first tab only, as WeChat's over its chats.
|
|
@@ -543,7 +555,7 @@ function AppShell() {
|
|
|
543
555
|
}
|
|
544
556
|
}, home: tabPage === 'me' ? (React.createElement("div", { className: "ta-main" },
|
|
545
557
|
React.createElement(me_view_1.MeView, { onSettings: openSettings }))) : tabPage === 'discover' ? (React.createElement("div", { className: "ta-main" }, discoverView())) : tabView ? (React.createElement("div", { className: "ta-main" },
|
|
546
|
-
React.createElement(app_nav_1.PageView, { view: tabView }))) : (React.createElement("div", { className: "ta-sidebar" },
|
|
558
|
+
React.createElement(app_nav_1.PageView, { view: tabView }))) : (React.createElement("div", { className: "ta-sidebar" }, sideList)), screen: React.createElement(React.Fragment, null,
|
|
547
559
|
React.createElement(kept_pages_1.KeptPages, { views: extensions.views, kept: extensions.kept, shown: screenPage, render: page => (React.createElement(app_nav_1.PageView, { view: page, leading: React.createElement(icon_1.IconButton, { icon: lucide_react_1.ChevronLeft, label: t('ta.back'), className: "ta-narrow-only", onClick: closeScreen }) })) }),
|
|
548
560
|
settings !== undefined ? (React.createElement(settings_view_1.SettingsView, { key: settingsOpened, section: settings || undefined, onClose: closeSettings, onBack: closeSettings })) : screenPage ? null : (React.createElement(chat_view_1.ChatView, { widgets: extensions.widgets, onMenu: closeScreen, back: true }))), screenOpen: screenOpen, onBack: closeScreen, workbench: editors && !settingsShown ? (React.createElement("div", { className: "ta-editors-pane", inert: !showEditors }, editorArea)) : undefined, workbenchOpen: showEditors, onWorkbench: open => (open ? toggleWorkbench() : showEditors && toggleRight()) }, overlays)) : (React.createElement("div", { className: classes.filter(Boolean).join(' '), style: sideWidths },
|
|
549
561
|
navOpen && React.createElement("button", { type: "button", className: "ta-scrim", "aria-label": t('ta.close'), onClick: () => setNavOpen(false) }),
|
|
@@ -552,9 +564,9 @@ function AppShell() {
|
|
|
552
564
|
setSettings(undefined);
|
|
553
565
|
setNavOpen(false);
|
|
554
566
|
setTabPage('discover');
|
|
555
|
-
}, onSettings: openSettings, settingsShown: settings !== undefined, surfaces: surfaces, surface: surface, onSurface: setSurface, holds: holds }),
|
|
567
|
+
}, onSettings: openSettings, settingsShown: settings !== undefined, surfaces: surfaces, surface: surface, onSurface: setSurface, holds: holds, asks: chatsAsking }),
|
|
556
568
|
sideShown && (React.createElement("div", { className: "ta-sidebar", style: (0, split_pane_1.paneStyle)(sidebar) },
|
|
557
|
-
|
|
569
|
+
sideList,
|
|
558
570
|
React.createElement(split_pane_1.Sash, { pane: sidebar, side: "start", label: t('ta.layout.sidebar') })))),
|
|
559
571
|
React.createElement("main", { className: "ta-main" },
|
|
560
572
|
React.createElement(connection_bar_1.ConnectionBar, null),
|
|
@@ -573,7 +585,8 @@ function AppShell() {
|
|
|
573
585
|
React.createElement(extension_view_1.SessionAvatars.Provider, { value: extensions.avatars },
|
|
574
586
|
React.createElement(chat_icon_1.ChatIconsProvider, { entries: extensions.chatIcons },
|
|
575
587
|
React.createElement(extension_view_1.SessionMenus.Provider, { value: extensions.sessionMenus },
|
|
576
|
-
React.createElement(
|
|
588
|
+
React.createElement(extension_view_1.LoadedExtensions.Provider, { value: extensions.extensions },
|
|
589
|
+
React.createElement(workbench_toggle_1.WorkbenchToggleContext.Provider, { value: toggle }, content)))))))))));
|
|
577
590
|
}
|
|
578
591
|
/** The app, with the look the user picked for the double (every ta below draws it) and the picker of that look. */
|
|
579
592
|
function AppView() {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/** How many conversations wait for the user to decide, on the entry of the chats (a tab, the rail): blue, as their ? on the rows. */
|
|
3
|
+
export declare function AsksBadge({ count }: {
|
|
4
|
+
count: number;
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
//# sourceMappingURL=asks-badge.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AsksBadge = AsksBadge;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
const use_t_1 = require("../i18n/use-t");
|
|
39
|
+
/** How many conversations wait for the user to decide, on the entry of the chats (a tab, the rail): blue, as their ? on the rows. */
|
|
40
|
+
function AsksBadge({ count }) {
|
|
41
|
+
const t = (0, use_t_1.useT)();
|
|
42
|
+
return (React.createElement("span", { className: "ta-asks-badge", role: "img", "aria-label": t('ta.chat.asksCount', { count }) }, count > 99 ? '99+' : count));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=asks-badge.js.map
|