@celljs/ta-web 4.43.0 → 4.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/browser/apps/app-window.js +2 -2
- package/esm/browser/assistant/assistant-chat-list.js +2 -1
- package/esm/browser/assistant/assistant-extension.js +16 -2
- package/esm/browser/assistant/assistant-protocol.d.ts +6 -0
- package/esm/browser/assistant/assistant-task-source.js +3 -0
- package/esm/browser/assistant/assistant-task-util.d.ts +2 -0
- package/esm/browser/assistant/assistant-task-util.js +5 -0
- package/esm/browser/assistant/assistant.d.ts +3 -0
- package/esm/browser/assistant/assistant.js +26 -2
- package/esm/browser/components/app-shell-hooks.d.ts +2 -1
- package/esm/browser/components/app-shell-hooks.js +4 -3
- package/esm/browser/components/app-shell-state.js +2 -2
- package/esm/browser/components/chat-list-row.js +4 -4
- package/esm/browser/components/chat-list-util.d.ts +2 -2
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/custom-host.d.ts +4 -1
- package/esm/browser/components/custom-host.js +8 -2
- package/esm/browser/components/earlier-messages.d.ts +4 -1
- package/esm/browser/components/earlier-messages.js +5 -2
- package/esm/browser/components/hearing-host.d.ts +2 -1
- package/esm/browser/components/hearing-host.js +10 -7
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/message-list.js +2 -1
- package/esm/browser/components/message-steps.js +8 -5
- package/esm/browser/components/settings-choices.d.ts +2 -1
- package/esm/browser/components/settings-choices.js +2 -1
- package/esm/browser/components/settings-parts.js +23 -3
- package/esm/browser/components/share-dialog.js +1 -1
- package/esm/browser/components/share-friends.d.ts +18 -2
- package/esm/browser/components/share-friends.js +62 -4
- package/esm/browser/components/share-sheet.d.ts +4 -3
- package/esm/browser/components/share-sheet.js +11 -3
- package/esm/browser/extension/web-api-chats.d.ts +23 -0
- package/esm/browser/extension/web-api-desktop.d.ts +14 -0
- package/esm/browser/extension/web-api-skins.d.ts +95 -0
- package/esm/browser/extension/web-api-skins.js +2 -0
- package/esm/browser/extension/web-api-spec.js +3 -0
- package/esm/browser/extension/web-extension-api.d.ts +11 -26
- package/esm/browser/extension/web-extension-context.js +4 -0
- package/esm/browser/extension/web-extension-protocol.d.ts +3 -1
- package/esm/browser/extension/web-extension-protocol.js +1 -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-share-ui.js +6 -1
- package/esm/browser/i18n/en/assistant.d.ts +4 -0
- package/esm/browser/i18n/en/assistant.js +4 -0
- package/esm/browser/i18n/en/chat.d.ts +1 -0
- package/esm/browser/i18n/en/chat.js +1 -0
- package/esm/browser/i18n/en/common.d.ts +0 -3
- package/esm/browser/i18n/en/common.js +0 -3
- package/esm/browser/i18n/en/discover.d.ts +4 -1
- package/esm/browser/i18n/en/discover.js +4 -1
- package/esm/browser/i18n/en/service.js +1 -1
- package/esm/browser/i18n/en/settings.d.ts +8 -0
- package/esm/browser/i18n/en/settings.js +8 -0
- package/esm/browser/i18n/en/tools.d.ts +5 -0
- package/esm/browser/i18n/en/tools.js +5 -0
- package/esm/browser/i18n/ja/assistant.js +4 -0
- package/esm/browser/i18n/ja/chat.js +1 -0
- package/esm/browser/i18n/ja/common.js +0 -3
- package/esm/browser/i18n/ja/discover.js +4 -1
- package/esm/browser/i18n/ja/service.js +1 -1
- package/esm/browser/i18n/ja/settings.js +8 -0
- package/esm/browser/i18n/ja/tools.js +5 -0
- package/esm/browser/i18n/locales.d.ts +23 -5
- package/esm/browser/i18n/messages.d.ts +22 -4
- package/esm/browser/i18n/zh/assistant.js +4 -0
- package/esm/browser/i18n/zh/chat.js +1 -0
- package/esm/browser/i18n/zh/common.js +0 -3
- package/esm/browser/i18n/zh/discover.js +4 -1
- package/esm/browser/i18n/zh/service.js +1 -1
- package/esm/browser/i18n/zh/settings.js +8 -0
- package/esm/browser/i18n/zh/tools.js +5 -0
- package/esm/browser/i18n/zh-tw/assistant.js +4 -0
- package/esm/browser/i18n/zh-tw/chat.js +1 -0
- package/esm/browser/i18n/zh-tw/common.js +0 -3
- package/esm/browser/i18n/zh-tw/discover.js +4 -1
- package/esm/browser/i18n/zh-tw/service.js +1 -1
- package/esm/browser/i18n/zh-tw/settings.js +8 -0
- package/esm/browser/i18n/zh-tw/tools.js +5 -0
- package/esm/browser/links/clipboard-links.d.ts +4 -8
- package/esm/browser/links/clipboard-links.js +9 -51
- package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/esm/browser/settings/settings-protocol.d.ts +24 -0
- package/esm/browser/settings/settings-protocol.js +9 -0
- package/esm/browser/settings/settings.d.ts +4 -1
- package/esm/browser/settings/settings.js +16 -3
- package/esm/browser/skin/skin-layer.d.ts +8 -0
- package/esm/browser/skin/skin-layer.js +118 -0
- package/esm/browser/skin/skin-util.d.ts +40 -0
- package/esm/browser/skin/skin-util.js +120 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +3 -2
- package/esm/browser/style/skins.d.ts +9 -0
- package/esm/browser/style/skins.js +107 -0
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +8 -0
- package/esm/browser/style.js +2 -0
- package/esm/browser/util/desktop.d.ts +11 -1
- package/esm/browser/util/desktop.js +30 -0
- package/esm/browser/util/fresh-rows.d.ts +21 -0
- package/esm/browser/util/fresh-rows.js +36 -0
- package/esm/browser/util/process.d.ts +12 -22
- package/esm/browser/util/process.js +49 -39
- package/esm/browser/util/tool.js +15 -5
- package/esm/browser/util/voice.js +10 -2
- package/lib/browser/apps/app-window.js +2 -2
- package/lib/browser/assistant/assistant-chat-list.js +2 -1
- package/lib/browser/assistant/assistant-extension.js +15 -1
- package/lib/browser/assistant/assistant-protocol.d.ts +6 -0
- package/lib/browser/assistant/assistant-task-source.js +3 -0
- package/lib/browser/assistant/assistant-task-util.d.ts +2 -0
- package/lib/browser/assistant/assistant-task-util.js +5 -0
- package/lib/browser/assistant/assistant.d.ts +3 -0
- package/lib/browser/assistant/assistant.js +26 -2
- package/lib/browser/components/app-shell-hooks.d.ts +2 -1
- package/lib/browser/components/app-shell-hooks.js +4 -3
- package/lib/browser/components/app-shell-state.js +2 -2
- package/lib/browser/components/chat-list-row.js +4 -4
- package/lib/browser/components/chat-list-util.d.ts +2 -2
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/custom-host.d.ts +4 -1
- package/lib/browser/components/custom-host.js +8 -2
- package/lib/browser/components/earlier-messages.d.ts +4 -1
- package/lib/browser/components/earlier-messages.js +5 -2
- package/lib/browser/components/hearing-host.d.ts +2 -1
- package/lib/browser/components/hearing-host.js +9 -6
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/message-list.js +2 -1
- package/lib/browser/components/message-steps.js +8 -5
- package/lib/browser/components/settings-choices.d.ts +2 -1
- package/lib/browser/components/settings-choices.js +2 -1
- package/lib/browser/components/settings-parts.js +21 -1
- package/lib/browser/components/share-dialog.js +1 -1
- package/lib/browser/components/share-friends.d.ts +18 -2
- package/lib/browser/components/share-friends.js +65 -4
- package/lib/browser/components/share-sheet.d.ts +4 -3
- package/lib/browser/components/share-sheet.js +10 -2
- package/lib/browser/extension/web-api-chats.d.ts +23 -0
- package/lib/browser/extension/web-api-desktop.d.ts +14 -0
- package/lib/browser/extension/web-api-skins.d.ts +96 -0
- package/lib/browser/extension/web-api-skins.js +3 -0
- package/lib/browser/extension/web-api-spec.js +3 -0
- package/lib/browser/extension/web-extension-api.d.ts +11 -26
- package/lib/browser/extension/web-extension-context.js +4 -0
- package/lib/browser/extension/web-extension-protocol.d.ts +3 -1
- package/lib/browser/extension/web-extension-protocol.js +1 -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-share-ui.js +6 -1
- package/lib/browser/i18n/en/assistant.d.ts +4 -0
- package/lib/browser/i18n/en/assistant.js +4 -0
- package/lib/browser/i18n/en/chat.d.ts +1 -0
- package/lib/browser/i18n/en/chat.js +1 -0
- package/lib/browser/i18n/en/common.d.ts +0 -3
- package/lib/browser/i18n/en/common.js +0 -3
- package/lib/browser/i18n/en/discover.d.ts +4 -1
- package/lib/browser/i18n/en/discover.js +4 -1
- package/lib/browser/i18n/en/service.js +1 -1
- package/lib/browser/i18n/en/settings.d.ts +8 -0
- package/lib/browser/i18n/en/settings.js +8 -0
- package/lib/browser/i18n/en/tools.d.ts +5 -0
- package/lib/browser/i18n/en/tools.js +5 -0
- package/lib/browser/i18n/ja/assistant.js +4 -0
- package/lib/browser/i18n/ja/chat.js +1 -0
- package/lib/browser/i18n/ja/common.js +0 -3
- package/lib/browser/i18n/ja/discover.js +4 -1
- package/lib/browser/i18n/ja/service.js +1 -1
- package/lib/browser/i18n/ja/settings.js +8 -0
- package/lib/browser/i18n/ja/tools.js +5 -0
- package/lib/browser/i18n/locales.d.ts +23 -5
- package/lib/browser/i18n/messages.d.ts +22 -4
- package/lib/browser/i18n/zh/assistant.js +4 -0
- package/lib/browser/i18n/zh/chat.js +1 -0
- package/lib/browser/i18n/zh/common.js +0 -3
- package/lib/browser/i18n/zh/discover.js +4 -1
- package/lib/browser/i18n/zh/service.js +1 -1
- package/lib/browser/i18n/zh/settings.js +8 -0
- package/lib/browser/i18n/zh/tools.js +5 -0
- package/lib/browser/i18n/zh-tw/assistant.js +4 -0
- package/lib/browser/i18n/zh-tw/chat.js +1 -0
- package/lib/browser/i18n/zh-tw/common.js +0 -3
- package/lib/browser/i18n/zh-tw/discover.js +4 -1
- package/lib/browser/i18n/zh-tw/service.js +1 -1
- package/lib/browser/i18n/zh-tw/settings.js +8 -0
- package/lib/browser/i18n/zh-tw/tools.js +5 -0
- package/lib/browser/links/clipboard-links.d.ts +4 -8
- package/lib/browser/links/clipboard-links.js +10 -52
- package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/lib/browser/settings/settings-protocol.d.ts +24 -0
- package/lib/browser/settings/settings-protocol.js +10 -1
- package/lib/browser/settings/settings.d.ts +4 -1
- package/lib/browser/settings/settings.js +16 -3
- package/lib/browser/skin/skin-layer.d.ts +9 -0
- package/lib/browser/skin/skin-layer.js +154 -0
- package/lib/browser/skin/skin-util.d.ts +41 -0
- package/lib/browser/skin/skin-util.js +123 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +3 -2
- package/lib/browser/style/skins.d.ts +10 -0
- package/lib/browser/style/skins.js +110 -0
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +8 -0
- package/lib/browser/style.js +2 -0
- package/lib/browser/util/desktop.d.ts +11 -1
- package/lib/browser/util/desktop.js +30 -0
- package/lib/browser/util/fresh-rows.d.ts +22 -0
- package/lib/browser/util/fresh-rows.js +40 -0
- package/lib/browser/util/process.d.ts +12 -22
- package/lib/browser/util/process.js +49 -40
- package/lib/browser/util/tool.js +15 -5
- package/lib/browser/util/voice.js +10 -2
- package/package.json +7 -7
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which rows of a conversation came in after it was drawn (they come in with a motion): those after the row that was
|
|
3
|
+
* last when it was drawn, by key. Rows put in front (earlier messages, more of the row window) move the indexes of all
|
|
4
|
+
* rows, not which are new; more than MAX at the end at once, or the row they count from gone (a rewind), start again
|
|
5
|
+
* from the end.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FreshRows {
|
|
8
|
+
/** More rows than this at the end at once: the conversation loaded again, not messages that came in. */
|
|
9
|
+
static readonly MAX = 2;
|
|
10
|
+
private still;
|
|
11
|
+
private last;
|
|
12
|
+
constructor(items: readonly {
|
|
13
|
+
key: string;
|
|
14
|
+
}[]);
|
|
15
|
+
/** From which index `items` (as drawn now) came in after the list was drawn. */
|
|
16
|
+
from(items: readonly {
|
|
17
|
+
key: string;
|
|
18
|
+
}[]): number;
|
|
19
|
+
/** Searched from the end, where new rows are. */
|
|
20
|
+
private static lastIndexOf;
|
|
21
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which rows of a conversation came in after it was drawn (they come in with a motion): those after the row that was
|
|
3
|
+
* last when it was drawn, by key. Rows put in front (earlier messages, more of the row window) move the indexes of all
|
|
4
|
+
* rows, not which are new; more than MAX at the end at once, or the row they count from gone (a rewind), start again
|
|
5
|
+
* from the end.
|
|
6
|
+
*/
|
|
7
|
+
export class FreshRows {
|
|
8
|
+
constructor(items) {
|
|
9
|
+
var _a;
|
|
10
|
+
this.still = this.last = (_a = items.at(-1)) === null || _a === void 0 ? void 0 : _a.key;
|
|
11
|
+
}
|
|
12
|
+
/** From which index `items` (as drawn now) came in after the list was drawn. */
|
|
13
|
+
from(items) {
|
|
14
|
+
var _a;
|
|
15
|
+
const previous = FreshRows.lastIndexOf(items, this.last);
|
|
16
|
+
this.last = (_a = items.at(-1)) === null || _a === void 0 ? void 0 : _a.key;
|
|
17
|
+
let from = FreshRows.lastIndexOf(items, this.still);
|
|
18
|
+
if (previous < 0 || from < 0 || items.length - 1 - previous > FreshRows.MAX) {
|
|
19
|
+
this.still = this.last;
|
|
20
|
+
from = items.length - 1;
|
|
21
|
+
}
|
|
22
|
+
return from + 1;
|
|
23
|
+
}
|
|
24
|
+
/** Searched from the end, where new rows are. */
|
|
25
|
+
static lastIndexOf(items, key) {
|
|
26
|
+
for (let index = items.length - 1; index >= 0; index--) {
|
|
27
|
+
if (items[index].key === key) {
|
|
28
|
+
return index;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return -1;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** More rows than this at the end at once: the conversation loaded again, not messages that came in. */
|
|
35
|
+
FreshRows.MAX = 2;
|
|
36
|
+
//# sourceMappingURL=fresh-rows.js.map
|
|
@@ -39,11 +39,16 @@ export type ProcessStep = {
|
|
|
39
39
|
key: string;
|
|
40
40
|
message: SessionMessage;
|
|
41
41
|
}
|
|
42
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Ta restarted in the middle of the work and it went on from there (TA_RESUME_MESSAGE), or a part of Ta told it
|
|
44
|
+
* something on the way and it went on (a notice, TaMessageSource.notice: moved to the cloud and back, a time limit),
|
|
45
|
+
* `text` its line.
|
|
46
|
+
*/
|
|
43
47
|
| {
|
|
44
48
|
kind: 'resumed';
|
|
45
49
|
key: string;
|
|
46
50
|
online?: boolean;
|
|
51
|
+
text?: string;
|
|
47
52
|
};
|
|
48
53
|
/**
|
|
49
54
|
* A thing ta did, as one line of the work: a call of a tool, with the thoughts that led to it and, for a script of
|
|
@@ -128,6 +133,12 @@ export declare namespace ProcessUtil {
|
|
|
128
133
|
* that did (written at once) did too. A message of the user that steered is a step of its turn, not an ask.
|
|
129
134
|
*/
|
|
130
135
|
function steered(messages: readonly SessionMessage[], index: number): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* The message at `index` is a notice of a part of Ta (TaMessageSource.notice) that had a turn cut short go on (moved
|
|
138
|
+
* to the cloud as it worked, a grant it waited for): a step of that turn, as a restart of Ta is, not a row of its own.
|
|
139
|
+
* The turn was cut short: its last answer was stopped or failed, or ended on its calls with no answer after them.
|
|
140
|
+
*/
|
|
141
|
+
function carried(messages: readonly SessionMessage[], index: number): boolean;
|
|
131
142
|
/**
|
|
132
143
|
* Words on the way with a fenced block a web extension draws (WebExtensionAPI.registerCodeRenderer,
|
|
133
144
|
* `renderers` by language in lower case): a card for the user, as a choice to make, stays in sight when
|
|
@@ -201,24 +212,3 @@ export declare namespace ProcessUtil {
|
|
|
201
212
|
/** The two items show the same: their messages are the same objects, and so is whether it works. */
|
|
202
213
|
function same(a: ThreadItem, b: ThreadItem): boolean;
|
|
203
214
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Which rows of a conversation came in after it was drawn (they come in with a motion): those after the row that was
|
|
206
|
-
* last when it was drawn, by key. Rows put in front (earlier messages, more of the row window) move the indexes of all
|
|
207
|
-
* rows, not which are new; more than MAX at the end at once, or the row they count from gone (a rewind), start again
|
|
208
|
-
* from the end.
|
|
209
|
-
*/
|
|
210
|
-
export declare class FreshRows {
|
|
211
|
-
/** More rows than this at the end at once: the conversation loaded again, not messages that came in. */
|
|
212
|
-
static readonly MAX = 2;
|
|
213
|
-
private still;
|
|
214
|
-
private last;
|
|
215
|
-
constructor(items: readonly {
|
|
216
|
-
key: string;
|
|
217
|
-
}[]);
|
|
218
|
-
/** From which index `items` (as drawn now) came in after the list was drawn. */
|
|
219
|
-
from(items: readonly {
|
|
220
|
-
key: string;
|
|
221
|
-
}[]): number;
|
|
222
|
-
/** Searched from the end, where new rows are. */
|
|
223
|
-
private static lastIndexOf;
|
|
224
|
-
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TA_RESUME_MESSAGE, TaAgentSummary, TaPictureNote } from '@celljs/ta-protocol';
|
|
1
|
+
import { TA_RESUME_MESSAGE, TaAgentSummary, TaMessageSource, TaPictureNote, TaSaid } from '@celljs/ta-protocol';
|
|
2
2
|
import { MessageUtil } from './message.js';
|
|
3
3
|
/** While the agent works, only the latest steps show; the earlier ones fold into one row. */
|
|
4
4
|
export const VISIBLE_STEPS = 8;
|
|
@@ -31,7 +31,7 @@ export var ProcessUtil;
|
|
|
31
31
|
let index = 0;
|
|
32
32
|
while (index < messages.length) {
|
|
33
33
|
const role = messages[index].role;
|
|
34
|
-
if (!TURN_ROLES.has(role) && !resumed(messages[index])) {
|
|
34
|
+
if (!TURN_ROLES.has(role) && !resumed(messages[index]) && !carried(messages, index)) {
|
|
35
35
|
const item = { kind: 'message', key: `m${offset + index}`, message: messages[index] };
|
|
36
36
|
if (index > 0 && writtenBefore(messages[index], messages[index - 1])) {
|
|
37
37
|
item.queued = true;
|
|
@@ -45,7 +45,9 @@ export var ProcessUtil;
|
|
|
45
45
|
(TURN_ROLES.has(messages[index].role) ||
|
|
46
46
|
resumed(messages[index]) ||
|
|
47
47
|
hidden(messages[index], renderers) ||
|
|
48
|
-
steered(messages, index)
|
|
48
|
+
steered(messages, index) ||
|
|
49
|
+
carried(messages, index) ||
|
|
50
|
+
beforeCarried(messages, index))) {
|
|
49
51
|
index++;
|
|
50
52
|
}
|
|
51
53
|
items.push(turn(messages.slice(start, index), offset + start, working && index === messages.length));
|
|
@@ -99,6 +101,43 @@ export var ProcessUtil;
|
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* The message at `index` is a notice of a part of Ta (TaMessageSource.notice) that had a turn cut short go on (moved
|
|
106
|
+
* to the cloud as it worked, a grant it waited for): a step of that turn, as a restart of Ta is, not a row of its own.
|
|
107
|
+
* The turn was cut short: its last answer was stopped or failed, or ended on its calls with no answer after them.
|
|
108
|
+
*/
|
|
109
|
+
function carried(messages, index) {
|
|
110
|
+
if (!TaSaid.notice(messages[index])) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
for (let before = index - 1; before >= 0; before--) {
|
|
114
|
+
const message = messages[before];
|
|
115
|
+
if (message.role === 'toolResult') {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
if (message.role === 'assistant') {
|
|
119
|
+
return message.stopReason === 'aborted' || message.stopReason === 'error' || message.stopReason === 'toolUse';
|
|
120
|
+
}
|
|
121
|
+
if (message.role === 'user') {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
ProcessUtil.carried = carried;
|
|
128
|
+
/**
|
|
129
|
+
* A message of a package or of pi between a turn cut short and the notice that had it go on (the note of a move to
|
|
130
|
+
* the cloud, which the notice says, and the system prompt it goes on with): of that turn too, drawing nothing in it.
|
|
131
|
+
*/
|
|
132
|
+
function beforeCarried(messages, index) {
|
|
133
|
+
for (let at = index; at < messages.length; at++) {
|
|
134
|
+
const { role } = messages[at];
|
|
135
|
+
if (role !== 'custom' && role !== 'system') {
|
|
136
|
+
return role === 'user' && carried(messages, at);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
102
141
|
/** The note that Ta restarted in the middle of a run and went on with it (TaSessionResume). */
|
|
103
142
|
function resumed(message) {
|
|
104
143
|
return message.customType === TA_RESUME_MESSAGE;
|
|
@@ -125,7 +164,13 @@ export var ProcessUtil;
|
|
|
125
164
|
var _a;
|
|
126
165
|
const { role } = message;
|
|
127
166
|
if (role === 'user') {
|
|
128
|
-
|
|
167
|
+
const text = MessageUtil.text(MessageUtil.blocks(message));
|
|
168
|
+
if (TaMessageSource.isNotice(text)) {
|
|
169
|
+
steps.push({ kind: 'resumed', key: `${start + offset}.u`, text: TaSaid.line(TaSaid.words('user', text), { chars: 160 }) });
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
steps.push({ kind: 'said', key: `${start + offset}.u`, message });
|
|
173
|
+
}
|
|
129
174
|
}
|
|
130
175
|
if (resumed(message)) {
|
|
131
176
|
steps.push({ kind: 'resumed', key: `${start + offset}.r`, ...(resumedOnline(message) ? { online: true } : {}) });
|
|
@@ -464,39 +509,4 @@ export var ProcessUtil;
|
|
|
464
509
|
}
|
|
465
510
|
ProcessUtil.same = same;
|
|
466
511
|
})(ProcessUtil || (ProcessUtil = {}));
|
|
467
|
-
/**
|
|
468
|
-
* Which rows of a conversation came in after it was drawn (they come in with a motion): those after the row that was
|
|
469
|
-
* last when it was drawn, by key. Rows put in front (earlier messages, more of the row window) move the indexes of all
|
|
470
|
-
* rows, not which are new; more than MAX at the end at once, or the row they count from gone (a rewind), start again
|
|
471
|
-
* from the end.
|
|
472
|
-
*/
|
|
473
|
-
export class FreshRows {
|
|
474
|
-
constructor(items) {
|
|
475
|
-
var _a;
|
|
476
|
-
this.still = this.last = (_a = items.at(-1)) === null || _a === void 0 ? void 0 : _a.key;
|
|
477
|
-
}
|
|
478
|
-
/** From which index `items` (as drawn now) came in after the list was drawn. */
|
|
479
|
-
from(items) {
|
|
480
|
-
var _a;
|
|
481
|
-
const previous = FreshRows.lastIndexOf(items, this.last);
|
|
482
|
-
this.last = (_a = items.at(-1)) === null || _a === void 0 ? void 0 : _a.key;
|
|
483
|
-
let from = FreshRows.lastIndexOf(items, this.still);
|
|
484
|
-
if (previous < 0 || from < 0 || items.length - 1 - previous > FreshRows.MAX) {
|
|
485
|
-
this.still = this.last;
|
|
486
|
-
from = items.length - 1;
|
|
487
|
-
}
|
|
488
|
-
return from + 1;
|
|
489
|
-
}
|
|
490
|
-
/** Searched from the end, where new rows are. */
|
|
491
|
-
static lastIndexOf(items, key) {
|
|
492
|
-
for (let index = items.length - 1; index >= 0; index--) {
|
|
493
|
-
if (items[index].key === key) {
|
|
494
|
-
return index;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
return -1;
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
/** More rows than this at the end at once: the conversation loaded again, not messages that came in. */
|
|
501
|
-
FreshRows.MAX = 2;
|
|
502
512
|
//# sourceMappingURL=process.js.map
|
package/esm/browser/util/tool.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TaAgentToolUtil } from '@celljs/ta-protocol';
|
|
1
2
|
import { McpWords } from './mcp-words.js';
|
|
2
3
|
import { MessageUtil } from './message.js';
|
|
3
4
|
import { ShellWords } from './shell-words.js';
|
|
@@ -58,6 +59,11 @@ const AGENT_TOOL_VERBS = {
|
|
|
58
59
|
CronDelete: 'ta.tool.verb.deleteScheduled',
|
|
59
60
|
Artifact: 'ta.tool.verb.publish',
|
|
60
61
|
ImageEdit: 'ta.tool.verb.editImage',
|
|
62
|
+
ImageGen: 'ta.tool.verb.generateImage',
|
|
63
|
+
VideoGen: 'ta.tool.verb.generateVideo',
|
|
64
|
+
ToolSearch: 'ta.tool.verb.findTools',
|
|
65
|
+
DeferExecuteTool: 'ta.tool.verb.callTool',
|
|
66
|
+
PushNotification: 'ta.tool.verb.notify',
|
|
61
67
|
};
|
|
62
68
|
const TARGET_CHARS = 160;
|
|
63
69
|
function str(value) {
|
|
@@ -109,7 +115,7 @@ export var ToolUtil;
|
|
|
109
115
|
*/
|
|
110
116
|
function summary(name, args, resolvers, input) {
|
|
111
117
|
var _a, _b;
|
|
112
|
-
var _c, _d;
|
|
118
|
+
var _c, _d, _e;
|
|
113
119
|
if (resolvers === null || resolvers === void 0 ? void 0 : resolvers.length) {
|
|
114
120
|
try {
|
|
115
121
|
const drawn = (_b = (_a = renderer(resolvers, name)) === null || _a === void 0 ? void 0 : _a.renderCall) === null || _b === void 0 ? void 0 : _b.call(_a, args);
|
|
@@ -169,14 +175,18 @@ export var ToolUtil;
|
|
|
169
175
|
if (kind === 'execute') {
|
|
170
176
|
return { ...command(tool, str(args.target) || str(args.title)), name: tool };
|
|
171
177
|
}
|
|
172
|
-
|
|
173
|
-
|
|
178
|
+
// What it is on, when the agent said it only after the call was shown: from what it was given, a
|
|
179
|
+
// path by its end.
|
|
180
|
+
const given = line((_d = TaAgentToolUtil.target(kind, input !== null && input !== void 0 ? input : {})) !== null && _d !== void 0 ? _d : '');
|
|
181
|
+
const on = target && target !== tool ? target : given.startsWith('/') ? short(given) : given;
|
|
182
|
+
if (str(args.tool) === 'REPL' && on) {
|
|
183
|
+
return { verb: AGENT_TOOL_VERBS.REPL, name: tool, target: on, code: false, titled: true };
|
|
174
184
|
}
|
|
175
185
|
const file = ['read', 'edit', 'delete', 'move'].includes(kind);
|
|
176
186
|
return {
|
|
177
|
-
verb: (
|
|
187
|
+
verb: (_e = AGENT_TOOL_VERBS[str(args.tool)]) !== null && _e !== void 0 ? _e : AGENT_VERBS[kind],
|
|
178
188
|
name: tool,
|
|
179
|
-
target:
|
|
189
|
+
target: file ? short(on) : on,
|
|
180
190
|
code: kind === 'execute' || kind === 'search',
|
|
181
191
|
};
|
|
182
192
|
}
|
|
@@ -60,10 +60,18 @@ export var Voice;
|
|
|
60
60
|
'Swift',
|
|
61
61
|
'Cell',
|
|
62
62
|
];
|
|
63
|
+
/**
|
|
64
|
+
* The recognition of the browser. Not in the Ta app on Android: its web-view has Chromium's, with no service behind
|
|
65
|
+
* it, which fails (`audio-capture`, `network`) or waits without end whatever the phone has; Ta listens there.
|
|
66
|
+
*/
|
|
63
67
|
function recognitionClass() {
|
|
64
|
-
var _a;
|
|
68
|
+
var _a, _b;
|
|
69
|
+
var _c;
|
|
70
|
+
if (((_b = (_a = globalThis.Capacitor) === null || _a === void 0 ? void 0 : _a.getPlatform) === null || _b === void 0 ? void 0 : _b.call(_a)) === 'android') {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
65
73
|
const scope = globalThis;
|
|
66
|
-
return (
|
|
74
|
+
return (_c = scope.SpeechRecognition) !== null && _c !== void 0 ? _c : scope.webkitSpeechRecognition;
|
|
67
75
|
}
|
|
68
76
|
/**
|
|
69
77
|
* Apple's recognizer: of the Ta app on iOS, where WebKit's repeats what it heard and leaves out punctuation, and of
|
|
@@ -62,7 +62,7 @@ function AppWindow({ id }) {
|
|
|
62
62
|
const t = (0, use_t_1.useT)();
|
|
63
63
|
const [workbench, bench] = (0, hooks_1.useWorkbench)();
|
|
64
64
|
const [extensions, host] = (0, hooks_1.useWebExtensions)();
|
|
65
|
-
const [{ theme }] = (0, hooks_1.useSettings)();
|
|
65
|
+
const [{ theme, skinColor }] = (0, hooks_1.useSettings)();
|
|
66
66
|
const files = (0, react_1.useInject)(files_protocol_1.TaFiles);
|
|
67
67
|
const fileUrl = React.useCallback(async (path, box) => files.loadable(thumbnail_1.ThumbnailUtil.boxed(await bench.workspace.fileUrl(path), box)), [bench, files]);
|
|
68
68
|
const openLink = (0, hooks_1.useOpenLink)(undefined);
|
|
@@ -71,7 +71,7 @@ function AppWindow({ id }) {
|
|
|
71
71
|
const reachable = online || workbench.status === 'offline';
|
|
72
72
|
(0, workbench_view_1.useDocument)();
|
|
73
73
|
(0, app_shell_hooks_1.useRefresh)(online);
|
|
74
|
-
(0, app_shell_hooks_1.useTitlebarColor)(workbench.status !== 'signed-out', theme);
|
|
74
|
+
(0, app_shell_hooks_1.useTitlebarColor)(workbench.status !== 'signed-out', theme, skinColor);
|
|
75
75
|
React.useEffect(() => {
|
|
76
76
|
void bench.start();
|
|
77
77
|
}, [bench]);
|
|
@@ -139,7 +139,8 @@ function AssistantChatList(props) {
|
|
|
139
139
|
// By the id of its session, and by its file: a task's conversation is marked once saved too.
|
|
140
140
|
tasks: new Map(tasks
|
|
141
141
|
.filter(task => !task.takenOver)
|
|
142
|
-
.
|
|
142
|
+
.map(task => [task, task.paused && task.status !== 'running' ? 'paused' : task.status])
|
|
143
|
+
.flatMap(([task, status]) => [[task.sessionId, status], ...(task.sessionFile ? [[task.sessionFile, status]] : [])])),
|
|
143
144
|
session,
|
|
144
145
|
sessionFile,
|
|
145
146
|
name,
|
|
@@ -343,6 +343,14 @@ let AssistantWebExtension = class AssistantWebExtension {
|
|
|
343
343
|
.catch(error => pi.ui.notify(error instanceof Error ? error.message : String(error), 'error'));
|
|
344
344
|
};
|
|
345
345
|
const stop = act(() => this.assistant.stop());
|
|
346
|
+
const { tasks } = this.assistant.state;
|
|
347
|
+
const running = tasks.filter(task => task.status === 'running' && !task.takenOver).length;
|
|
348
|
+
const paused = tasks.filter(task => task.paused && !task.takenOver).length;
|
|
349
|
+
const pauseTasks = act(async () => {
|
|
350
|
+
const count = await this.assistant.pauseTasks();
|
|
351
|
+
pi.ui.notify(t('ta.assistant.pausedTasks').replace('{count}', String(count)), 'info');
|
|
352
|
+
});
|
|
353
|
+
const resumeTasks = act(() => this.assistant.resumeTasks());
|
|
346
354
|
const restart = act(async () => {
|
|
347
355
|
if (await pi.ui.confirm(t('ta.assistant.restartTitle'), t('ta.assistant.restartHint'))) {
|
|
348
356
|
await this.assistant.restart();
|
|
@@ -392,6 +400,12 @@ let AssistantWebExtension = class AssistantWebExtension {
|
|
|
392
400
|
{ key: 'stop', label: t('ta.assistant.stop'), icon: lucide_react_1.Square, disabled: !(store === null || store === void 0 ? void 0 : store.state.working), run: stop },
|
|
393
401
|
{ key: 'restart', label: t('ta.assistant.restart'), icon: lucide_react_1.RotateCcw, disabled: !store, run: restart },
|
|
394
402
|
],
|
|
403
|
+
[
|
|
404
|
+
...(running ? [{ key: 'pauseTasks', label: t('ta.assistant.pauseTasks'), icon: lucide_react_1.Pause, run: pauseTasks }] : []),
|
|
405
|
+
...(paused
|
|
406
|
+
? [{ key: 'resumeTasks', label: t('ta.assistant.resumeTasks').replace('{count}', String(paused)), icon: lucide_react_1.Play, run: resumeTasks }]
|
|
407
|
+
: []),
|
|
408
|
+
],
|
|
395
409
|
[
|
|
396
410
|
{ key: 'rename', label: t('ta.assistant.rename'), icon: lucide_react_1.Pencil, run: rename },
|
|
397
411
|
{ key: 'look', label: t('ta.assistant.look'), icon: lucide_react_1.Sparkles, run: () => dino_look_picker_1.DinoLookPicker.open() },
|
|
@@ -399,7 +413,7 @@ let AssistantWebExtension = class AssistantWebExtension {
|
|
|
399
413
|
{ key: 'copyCwd', label: t('ta.assistant.copyCwd'), icon: lucide_react_1.Copy, disabled: !cwd, run: copyCwd },
|
|
400
414
|
],
|
|
401
415
|
[{ key: 'export', label: t('ta.assistant.export'), icon: lucide_react_1.Download, run: exportMarkdown }],
|
|
402
|
-
];
|
|
416
|
+
].filter(section => section.length > 0);
|
|
403
417
|
}
|
|
404
418
|
};
|
|
405
419
|
exports.AssistantWebExtension = AssistantWebExtension;
|
|
@@ -17,6 +17,8 @@ export interface AssistantTask {
|
|
|
17
17
|
origin?: string;
|
|
18
18
|
/** The user took it over: the double no longer follows it. */
|
|
19
19
|
takenOver?: boolean;
|
|
20
|
+
/** The user paused it (pauseTasks): stopped until they resume it (resumeTasks). */
|
|
21
|
+
paused?: boolean;
|
|
20
22
|
/** It works in a git worktree of its own (start_task's isolate): where, on which branch, from which commit. */
|
|
21
23
|
worktree?: {
|
|
22
24
|
path: string;
|
|
@@ -91,6 +93,10 @@ export interface TaAssistant {
|
|
|
91
93
|
/** Says something to ta: a new message, or, while it works, one it reads at its next step. */
|
|
92
94
|
say(text: string, images?: ComposerImage[]): Promise<void>;
|
|
93
95
|
stopTask(taskId: string): Promise<void>;
|
|
96
|
+
/** Stops every task that runs, marked paused; how many. */
|
|
97
|
+
pauseTasks(): Promise<number>;
|
|
98
|
+
/** Has every paused task go on where it stopped; how many. */
|
|
99
|
+
resumeTasks(): Promise<number>;
|
|
94
100
|
/** The user lets the task start, or not. */
|
|
95
101
|
answer(askId: string, start: boolean): void;
|
|
96
102
|
/** The user takes the task over: the double stops following it; its session, opened again if it closed since, is what to show. */
|
|
@@ -15,6 +15,9 @@ function activity(task, state, t) {
|
|
|
15
15
|
// A check's words follow its verdict, which the list says in words of the user's language.
|
|
16
16
|
const said = task.verifies ? assistant_task_util_1.AssistantTaskUtil.verdictReason(task.result) : task.result;
|
|
17
17
|
// A card of its reply (ta-glance) is drawn in its conversation, not read out here.
|
|
18
|
+
if (task.paused && task.status !== 'running') {
|
|
19
|
+
return t('ta.task.paused');
|
|
20
|
+
}
|
|
18
21
|
return task.status === 'running' ? t('ta.task.running') : ta_protocol_1.TaSaid.line(said !== null && said !== void 0 ? said : '', { chars: 80 }) || t(`ta.task.${task.status}`);
|
|
19
22
|
}
|
|
20
23
|
/** How a task came out of a check: its own verdict for a check that ended, else the verdict of the check of it. */
|
|
@@ -12,6 +12,8 @@ export declare const MAX_TASKS = 50;
|
|
|
12
12
|
export declare namespace AssistantTaskUtil {
|
|
13
13
|
/** What a task whose session is gone ended with: the Ta service closed it, or restarted. */
|
|
14
14
|
const CLOSED_RESULT = "Its session closed while nobody watched (the Ta service restarted, or closed it).";
|
|
15
|
+
/** What a paused task is told as the user resumes it. */
|
|
16
|
+
const RESUME_MESSAGE = "The user paused this task and now resumes it: go on where you left off.";
|
|
15
17
|
/**
|
|
16
18
|
* The tasks of both lists, each in its newer copy (the higher `rev`; the server's, `theirs`, when
|
|
17
19
|
* both are as new, so that the pages end with the same), in the order of their ids; the last MAX_TASKS.
|
|
@@ -16,6 +16,8 @@ var AssistantTaskUtil;
|
|
|
16
16
|
(function (AssistantTaskUtil) {
|
|
17
17
|
/** What a task whose session is gone ended with: the Ta service closed it, or restarted. */
|
|
18
18
|
AssistantTaskUtil.CLOSED_RESULT = 'Its session closed while nobody watched (the Ta service restarted, or closed it).';
|
|
19
|
+
/** What a paused task is told as the user resumes it. */
|
|
20
|
+
AssistantTaskUtil.RESUME_MESSAGE = 'The user paused this task and now resumes it: go on where you left off.';
|
|
19
21
|
/**
|
|
20
22
|
* The tasks of both lists, each in its newer copy (the higher `rev`; the server's, `theirs`, when
|
|
21
23
|
* both are as new, so that the pages end with the same), in the order of their ids; the last MAX_TASKS.
|
|
@@ -120,6 +122,9 @@ var AssistantTaskUtil;
|
|
|
120
122
|
function updateNote(task) {
|
|
121
123
|
var _a, _b;
|
|
122
124
|
const lines = [((_a = task.result) !== null && _a !== void 0 ? _a : '').slice(0, RESULT_CHARS)];
|
|
125
|
+
if (task.paused) {
|
|
126
|
+
lines.push('The user paused it, with the other tasks that ran: leave it until they resume it.');
|
|
127
|
+
}
|
|
123
128
|
if (task.worktree) {
|
|
124
129
|
lines.push(`It worked in the git worktree ${task.worktree.path}, on the branch ${task.worktree.branch} (from ${task.worktree.base.slice(0, 12)}).`);
|
|
125
130
|
}
|
|
@@ -29,6 +29,9 @@ export declare class TaAssistantImpl extends AssistantConversation implements Ta
|
|
|
29
29
|
* does not run (it ended unseen, or closed) stops here: an abort would change nothing.
|
|
30
30
|
*/
|
|
31
31
|
stopTask(taskId: string): Promise<void>;
|
|
32
|
+
pauseTasks(): Promise<number>;
|
|
33
|
+
/** Each paused task told to go on, in its conversation opened again if it closed since; one that fails stays paused. */
|
|
34
|
+
resumeTasks(): Promise<number>;
|
|
32
35
|
/**
|
|
33
36
|
* The user lets a task the double asked for start, or not: started here, and the double told, as a message of its
|
|
34
37
|
* conversation; its turn ended when it asked (deferred, docs/design/ta-always-on.md 3.10).
|
|
@@ -130,6 +130,24 @@ let TaAssistantImpl = class TaAssistantImpl extends assistant_conversation_1.Ass
|
|
|
130
130
|
this.book.change(task, { status: 'stopped', endedAt: Date.now() });
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
+
async pauseTasks() {
|
|
134
|
+
const running = this.current.tasks.filter(task => task.status === 'running' && !task.takenOver);
|
|
135
|
+
for (const task of running) {
|
|
136
|
+
this.book.change(task, { paused: true });
|
|
137
|
+
}
|
|
138
|
+
await Promise.all(running.map(task => this.stopTask(task.id)));
|
|
139
|
+
return running.length;
|
|
140
|
+
}
|
|
141
|
+
/** Each paused task told to go on, in its conversation opened again if it closed since; one that fails stays paused. */
|
|
142
|
+
async resumeTasks() {
|
|
143
|
+
const paused = this.current.tasks.filter(task => task.paused && !task.takenOver);
|
|
144
|
+
const resumed = await Promise.allSettled(paused.map(async (task) => {
|
|
145
|
+
const store = await this.openTask(task.id);
|
|
146
|
+
await store.prompt(ta_protocol_1.TaMessageSource.mark(assistant_task_util_1.AssistantTaskUtil.RESUME_MESSAGE, ta_protocol_1.TaMessageSource.DOUBLE));
|
|
147
|
+
this.book.change(task.id, { paused: undefined });
|
|
148
|
+
}));
|
|
149
|
+
return resumed.filter(result => result.status === 'fulfilled').length;
|
|
150
|
+
}
|
|
133
151
|
/**
|
|
134
152
|
* The user lets a task the double asked for start, or not: started here, and the double told, as a message of its
|
|
135
153
|
* conversation; its turn ended when it asked (deferred, docs/design/ta-always-on.md 3.10).
|
|
@@ -256,11 +274,12 @@ let TaAssistantImpl = class TaAssistantImpl extends assistant_conversation_1.Ass
|
|
|
256
274
|
const run = {
|
|
257
275
|
start_task: (input, request) => this.startTask(input, request.id),
|
|
258
276
|
list_tasks: () => JSON.stringify({
|
|
259
|
-
tasks: this.current.tasks.map(({ id, title, status, result, takenOver }) => ({
|
|
277
|
+
tasks: this.current.tasks.map(({ id, title, status, result, takenOver, paused }) => ({
|
|
260
278
|
id,
|
|
261
279
|
title,
|
|
262
280
|
status,
|
|
263
281
|
takenOver,
|
|
282
|
+
paused,
|
|
264
283
|
result: result === null || result === void 0 ? void 0 : result.slice(0, 200),
|
|
265
284
|
})),
|
|
266
285
|
conversations: this.conversationsGoingOn(),
|
|
@@ -278,6 +297,10 @@ let TaAssistantImpl = class TaAssistantImpl extends assistant_conversation_1.Ass
|
|
|
278
297
|
}
|
|
279
298
|
// Its session closed since (idle, or the service restarted): opened again from its file.
|
|
280
299
|
const store = await this.openTask(id);
|
|
300
|
+
// The double goes on with one the user paused: it is no longer waiting for them.
|
|
301
|
+
if (task.paused) {
|
|
302
|
+
this.book.change(task, { paused: undefined });
|
|
303
|
+
}
|
|
281
304
|
await store.prompt(ta_protocol_1.TaMessageSource.mark(message, ta_protocol_1.TaMessageSource.DOUBLE), { streamingBehavior: 'steer' });
|
|
282
305
|
return `Sent to task ${id}.`;
|
|
283
306
|
},
|
|
@@ -423,7 +446,8 @@ let TaAssistantImpl = class TaAssistantImpl extends assistant_conversation_1.Ass
|
|
|
423
446
|
// Not ended after all: the double hears of it when it ends again.
|
|
424
447
|
this.notes.delete(id);
|
|
425
448
|
if (task.status !== 'running') {
|
|
426
|
-
|
|
449
|
+
// Going on again, whoever said so: no longer paused.
|
|
450
|
+
this.book.change(id, { status: 'running', endedAt: undefined, result: undefined, paused: undefined });
|
|
427
451
|
}
|
|
428
452
|
}
|
|
429
453
|
else if (task.status === 'running' && assistant_task_util_1.AssistantTaskUtil.ended(state)) {
|
|
@@ -39,8 +39,9 @@ export declare function useKeys(toggle: () => void, openSettings: () => void, to
|
|
|
39
39
|
* paints the corners of the window's buttons with theme-color: the traffic lights at the left over the
|
|
40
40
|
* side columns, its own buttons at the right. So the bar is the colour of the side columns throughout, the
|
|
41
41
|
* conversation below it too. Otherwise the whole title bar has the conversation's colour, as the sign-in page.
|
|
42
|
+
* Under a skin, both are the colour of the skin (SettingsState.skinColor).
|
|
42
43
|
*/
|
|
43
|
-
export declare function useTitlebarColor(signedIn: boolean, theme: Theme): void;
|
|
44
|
+
export declare function useTitlebarColor(signedIn: boolean, theme: Theme, skinColor?: string): void;
|
|
44
45
|
/** Reads the open sessions and the web extensions again while the tab is visible: other clients change them too. */
|
|
45
46
|
export declare function useRefresh(online: boolean): void;
|
|
46
47
|
/** The drawer of a compact layout comes out from the left edge under the finger, and goes the same way. */
|
|
@@ -144,20 +144,21 @@ function useKeys(toggle, openSettings, toggleWorkbench, reopen) {
|
|
|
144
144
|
* paints the corners of the window's buttons with theme-color: the traffic lights at the left over the
|
|
145
145
|
* side columns, its own buttons at the right. So the bar is the colour of the side columns throughout, the
|
|
146
146
|
* conversation below it too. Otherwise the whole title bar has the conversation's colour, as the sign-in page.
|
|
147
|
+
* Under a skin, both are the colour of the skin (SettingsState.skinColor).
|
|
147
148
|
*/
|
|
148
|
-
function useTitlebarColor(signedIn, theme) {
|
|
149
|
+
function useTitlebarColor(signedIn, theme, skinColor) {
|
|
149
150
|
React.useEffect(() => {
|
|
150
151
|
const overlay = matchMedia('(display-mode: window-controls-overlay)');
|
|
151
152
|
const apply = () => {
|
|
152
153
|
const meta = document.querySelector('meta[name="theme-color"]');
|
|
153
154
|
if (meta) {
|
|
154
|
-
meta.content = settings_1.THEME_COLORS[theme][overlay.matches && signedIn ? 'side' : 'main'];
|
|
155
|
+
meta.content = skinColor !== null && skinColor !== void 0 ? skinColor : settings_1.THEME_COLORS[theme][overlay.matches && signedIn ? 'side' : 'main'];
|
|
155
156
|
}
|
|
156
157
|
};
|
|
157
158
|
apply();
|
|
158
159
|
overlay.addEventListener('change', apply);
|
|
159
160
|
return () => overlay.removeEventListener('change', apply);
|
|
160
|
-
}, [signedIn, theme]);
|
|
161
|
+
}, [signedIn, theme, skinColor]);
|
|
161
162
|
}
|
|
162
163
|
/** Reads the open sessions and the web extensions again while the tab is visible: other clients change them too. */
|
|
163
164
|
function useRefresh(online) {
|
|
@@ -111,7 +111,7 @@ function useAppShell() {
|
|
|
111
111
|
const settingsShown = settings !== undefined && (!phone || screenOpen);
|
|
112
112
|
const [rightOpen, toggleRight, revealRight, uncoverRight] = (0, app_shell_hooks_1.useRight)();
|
|
113
113
|
const [maximized, setMaximized] = (0, hooks_1.usePersisted)(app_shell_hooks_1.WORKBENCH_MAX);
|
|
114
|
-
const [{ theme, language, settings: chatSettings }] = (0, hooks_1.useSettings)();
|
|
114
|
+
const [{ theme, language, settings: chatSettings, skinColor }] = (0, hooks_1.useSettings)();
|
|
115
115
|
const readArchived = React.useCallback(() => void bench.readArchived().catch(() => undefined), [bench]);
|
|
116
116
|
React.useEffect(() => bench.setArchiveDays(chatSettings.chatArchiveDays), [bench, chatSettings.chatArchiveDays]);
|
|
117
117
|
const sidebar = (0, split_pane_1.usePane)(app_shell_hooks_1.SIDEBAR);
|
|
@@ -450,7 +450,7 @@ function useAppShell() {
|
|
|
450
450
|
}
|
|
451
451
|
}, [removedChats, chat]);
|
|
452
452
|
(0, app_shell_hooks_1.useKeys)(toggleSide, openSettings, () => editors && toggleWorkbench(), reopenChat);
|
|
453
|
-
(0, app_shell_hooks_1.useTitlebarColor)(workbench.status !== 'signed-out', theme);
|
|
453
|
+
(0, app_shell_hooks_1.useTitlebarColor)(workbench.status !== 'signed-out', theme, skinColor);
|
|
454
454
|
return {
|
|
455
455
|
t,
|
|
456
456
|
workbench,
|
|
@@ -92,10 +92,10 @@ function ChatState({ streaming, waiting, waitingFor, task }) {
|
|
|
92
92
|
return (React.createElement("span", { className: "ta-chat-state" },
|
|
93
93
|
React.createElement("span", { className: "ta-spinner" })));
|
|
94
94
|
}
|
|
95
|
-
if (task === 'failed' || task === 'stopped') {
|
|
95
|
+
if (task === 'failed' || task === 'stopped' || task === 'paused') {
|
|
96
96
|
return (React.createElement("span", { className: `ta-chat-state ta-${task}` },
|
|
97
97
|
React.createElement("span", { className: `ta-status ${task === 'failed' ? 'ta-status-error' : 'ta-status-cancelled'}` }),
|
|
98
|
-
t(
|
|
98
|
+
t(`ta.task.${task}`)));
|
|
99
99
|
}
|
|
100
100
|
return null;
|
|
101
101
|
}
|
|
@@ -212,7 +212,7 @@ exports.ChatItem = React.memo(function ChatItem({ session, source, selected, tim
|
|
|
212
212
|
const said = shown && secret_text_1.SecretTextUtil.plain(t, shown);
|
|
213
213
|
// Its directory too for one of a package's group, as a run of a scheduled task, not the package's name.
|
|
214
214
|
const place = who || session.group ? message_1.MessageUtil.basename(session.cwd) : source.label;
|
|
215
|
-
const ended = task === 'failed' || task === 'stopped' ? task : undefined;
|
|
215
|
+
const ended = task === 'failed' || task === 'stopped' || task === 'paused' ? task : undefined;
|
|
216
216
|
return (React.createElement(swipe_row_1.SwipeRow, { as: "li", className: `ta-chat-row${selected ? ' ta-selected' : ''}${who ? ` ta-chat-${who.kind}` : ''}`, "data-row": chat_list_util_1.ChatListUtil.key(session), "data-unseen": unseen && !asks ? '' : undefined, "data-asks": asks ? '' : undefined, actions: swipe, overlay: menu, onContextMenu: onContextMenu },
|
|
217
217
|
React.createElement("button", { type: "button", className: `ta-chat-item${compact ? ' ta-compact' : ''}${removing ? ' ta-pending' : ''}`, title: `${title}\n${source.title}`, "aria-current": selected ? 'true' : undefined, onClick: onSelect, ...screen_protocol_1.ScreenUtil.item(chat_list_util_1.ChatListUtil.file(session)) }, compact ? (React.createElement("span", { className: "ta-chat-text" },
|
|
218
218
|
React.createElement("span", { className: "ta-chat-line" },
|
|
@@ -250,7 +250,7 @@ exports.ChatItem = React.memo(function ChatItem({ session, source, selected, tim
|
|
|
250
250
|
replying,
|
|
251
251
|
ended && !streaming && !asks && draft === undefined && (React.createElement("span", { className: `ta-chat-flag ta-${ended}` },
|
|
252
252
|
"[",
|
|
253
|
-
t(
|
|
253
|
+
t(`ta.task.${ended}`),
|
|
254
254
|
"]")),
|
|
255
255
|
asks || draft === undefined ? null : React.createElement("span", { className: "ta-chat-flag ta-draft" },
|
|
256
256
|
"[",
|
|
@@ -193,8 +193,8 @@ export declare namespace ChatListUtil {
|
|
|
193
193
|
/** The first letter of a name, for its avatar. */
|
|
194
194
|
function initial(name: string): string;
|
|
195
195
|
}
|
|
196
|
-
/** What a task of the double came to, as the list says it beside the conversation. */
|
|
197
|
-
export type ChatTaskStatus = 'running' | 'done' | 'failed' | 'stopped';
|
|
196
|
+
/** What a task of the double came to, as the list says it beside the conversation: `paused` stopped by the user, to go on later. */
|
|
197
|
+
export type ChatTaskStatus = 'running' | 'done' | 'failed' | 'stopped' | 'paused';
|
|
198
198
|
/** The double, for the list: which conversations are its tasks, and how to hand it one. */
|
|
199
199
|
export interface ChatListDouble {
|
|
200
200
|
/** The sessions of its tasks (by the id of each, and by its file), and where each is. */
|