@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
|
@@ -94,6 +94,36 @@ var DesktopUtil;
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
DesktopUtil.browserData = browserData;
|
|
97
|
+
/**
|
|
98
|
+
* Hears the tabs the pages of this page's webviews open or close (a link to a new tab, Cmd+T, Cmd+W); hearing tells
|
|
99
|
+
* Ta Desktop the page has tabs, until it loads again. `undefined` elsewhere, and in an older Ta Desktop.
|
|
100
|
+
*/
|
|
101
|
+
function webviewTabs(scope = globalThis) {
|
|
102
|
+
var _a, _b;
|
|
103
|
+
const onEvent = (_b = (_a = scope.taDesktop) === null || _a === void 0 ? void 0 : _a.webviewTabs) === null || _b === void 0 ? void 0 : _b.onEvent;
|
|
104
|
+
if (!has('webviewTabs', scope) || typeof onEvent !== 'function') {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
return listener => onEvent((event) => {
|
|
108
|
+
const tab = webviewTab(event);
|
|
109
|
+
if (tab) {
|
|
110
|
+
listener(tab);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
DesktopUtil.webviewTabs = webviewTabs;
|
|
115
|
+
/** A tab Ta Desktop tells of, as it should be; `undefined` otherwise. */
|
|
116
|
+
function webviewTab(event) {
|
|
117
|
+
const { type, from, url, background } = (event !== null && event !== void 0 ? event : {});
|
|
118
|
+
if (typeof from !== 'number') {
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
121
|
+
if (type === 'open') {
|
|
122
|
+
return typeof url === 'string' ? { type, url, background: background === true, from } : undefined;
|
|
123
|
+
}
|
|
124
|
+
return type === 'new' || type === 'close' ? { type, from } : undefined;
|
|
125
|
+
}
|
|
126
|
+
DesktopUtil.webviewTab = webviewTab;
|
|
97
127
|
/** `debugWebview` of Ta Desktop; `undefined` elsewhere. */
|
|
98
128
|
function debugWebview(scope = globalThis) {
|
|
99
129
|
const desktop = scope.taDesktop;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
}
|
|
22
|
+
//# sourceMappingURL=fresh-rows.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FreshRows = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Which rows of a conversation came in after it was drawn (they come in with a motion): those after the row that was
|
|
6
|
+
* last when it was drawn, by key. Rows put in front (earlier messages, more of the row window) move the indexes of all
|
|
7
|
+
* rows, not which are new; more than MAX at the end at once, or the row they count from gone (a rewind), start again
|
|
8
|
+
* from the end.
|
|
9
|
+
*/
|
|
10
|
+
class FreshRows {
|
|
11
|
+
constructor(items) {
|
|
12
|
+
var _a;
|
|
13
|
+
this.still = this.last = (_a = items.at(-1)) === null || _a === void 0 ? void 0 : _a.key;
|
|
14
|
+
}
|
|
15
|
+
/** From which index `items` (as drawn now) came in after the list was drawn. */
|
|
16
|
+
from(items) {
|
|
17
|
+
var _a;
|
|
18
|
+
const previous = FreshRows.lastIndexOf(items, this.last);
|
|
19
|
+
this.last = (_a = items.at(-1)) === null || _a === void 0 ? void 0 : _a.key;
|
|
20
|
+
let from = FreshRows.lastIndexOf(items, this.still);
|
|
21
|
+
if (previous < 0 || from < 0 || items.length - 1 - previous > FreshRows.MAX) {
|
|
22
|
+
this.still = this.last;
|
|
23
|
+
from = items.length - 1;
|
|
24
|
+
}
|
|
25
|
+
return from + 1;
|
|
26
|
+
}
|
|
27
|
+
/** Searched from the end, where new rows are. */
|
|
28
|
+
static lastIndexOf(items, key) {
|
|
29
|
+
for (let index = items.length - 1; index >= 0; index--) {
|
|
30
|
+
if (items[index].key === key) {
|
|
31
|
+
return index;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return -1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.FreshRows = FreshRows;
|
|
38
|
+
/** More rows than this at the end at once: the conversation loaded again, not messages that came in. */
|
|
39
|
+
FreshRows.MAX = 2;
|
|
40
|
+
//# 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,25 +212,4 @@ 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
|
-
}
|
|
225
215
|
//# sourceMappingURL=process.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ProcessUtil = exports.TIME_BREAK_MS = exports.VISIBLE_STEPS = void 0;
|
|
4
4
|
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
5
5
|
const message_1 = require("./message");
|
|
6
6
|
/** While the agent works, only the latest steps show; the earlier ones fold into one row. */
|
|
@@ -34,7 +34,7 @@ var ProcessUtil;
|
|
|
34
34
|
let index = 0;
|
|
35
35
|
while (index < messages.length) {
|
|
36
36
|
const role = messages[index].role;
|
|
37
|
-
if (!TURN_ROLES.has(role) && !resumed(messages[index])) {
|
|
37
|
+
if (!TURN_ROLES.has(role) && !resumed(messages[index]) && !carried(messages, index)) {
|
|
38
38
|
const item = { kind: 'message', key: `m${offset + index}`, message: messages[index] };
|
|
39
39
|
if (index > 0 && writtenBefore(messages[index], messages[index - 1])) {
|
|
40
40
|
item.queued = true;
|
|
@@ -48,7 +48,9 @@ var ProcessUtil;
|
|
|
48
48
|
(TURN_ROLES.has(messages[index].role) ||
|
|
49
49
|
resumed(messages[index]) ||
|
|
50
50
|
hidden(messages[index], renderers) ||
|
|
51
|
-
steered(messages, index)
|
|
51
|
+
steered(messages, index) ||
|
|
52
|
+
carried(messages, index) ||
|
|
53
|
+
beforeCarried(messages, index))) {
|
|
52
54
|
index++;
|
|
53
55
|
}
|
|
54
56
|
items.push(turn(messages.slice(start, index), offset + start, working && index === messages.length));
|
|
@@ -102,6 +104,43 @@ var ProcessUtil;
|
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* The message at `index` is a notice of a part of Ta (TaMessageSource.notice) that had a turn cut short go on (moved
|
|
109
|
+
* 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.
|
|
110
|
+
* The turn was cut short: its last answer was stopped or failed, or ended on its calls with no answer after them.
|
|
111
|
+
*/
|
|
112
|
+
function carried(messages, index) {
|
|
113
|
+
if (!ta_protocol_1.TaSaid.notice(messages[index])) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
for (let before = index - 1; before >= 0; before--) {
|
|
117
|
+
const message = messages[before];
|
|
118
|
+
if (message.role === 'toolResult') {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
if (message.role === 'assistant') {
|
|
122
|
+
return message.stopReason === 'aborted' || message.stopReason === 'error' || message.stopReason === 'toolUse';
|
|
123
|
+
}
|
|
124
|
+
if (message.role === 'user') {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
ProcessUtil.carried = carried;
|
|
131
|
+
/**
|
|
132
|
+
* 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
|
|
133
|
+
* the cloud, which the notice says, and the system prompt it goes on with): of that turn too, drawing nothing in it.
|
|
134
|
+
*/
|
|
135
|
+
function beforeCarried(messages, index) {
|
|
136
|
+
for (let at = index; at < messages.length; at++) {
|
|
137
|
+
const { role } = messages[at];
|
|
138
|
+
if (role !== 'custom' && role !== 'system') {
|
|
139
|
+
return role === 'user' && carried(messages, at);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
105
144
|
/** The note that Ta restarted in the middle of a run and went on with it (TaSessionResume). */
|
|
106
145
|
function resumed(message) {
|
|
107
146
|
return message.customType === ta_protocol_1.TA_RESUME_MESSAGE;
|
|
@@ -128,7 +167,13 @@ var ProcessUtil;
|
|
|
128
167
|
var _a;
|
|
129
168
|
const { role } = message;
|
|
130
169
|
if (role === 'user') {
|
|
131
|
-
|
|
170
|
+
const text = message_1.MessageUtil.text(message_1.MessageUtil.blocks(message));
|
|
171
|
+
if (ta_protocol_1.TaMessageSource.isNotice(text)) {
|
|
172
|
+
steps.push({ kind: 'resumed', key: `${start + offset}.u`, text: ta_protocol_1.TaSaid.line(ta_protocol_1.TaSaid.words('user', text), { chars: 160 }) });
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
steps.push({ kind: 'said', key: `${start + offset}.u`, message });
|
|
176
|
+
}
|
|
132
177
|
}
|
|
133
178
|
if (resumed(message)) {
|
|
134
179
|
steps.push({ kind: 'resumed', key: `${start + offset}.r`, ...(resumedOnline(message) ? { online: true } : {}) });
|
|
@@ -467,40 +512,4 @@ var ProcessUtil;
|
|
|
467
512
|
}
|
|
468
513
|
ProcessUtil.same = same;
|
|
469
514
|
})(ProcessUtil || (exports.ProcessUtil = ProcessUtil = {}));
|
|
470
|
-
/**
|
|
471
|
-
* Which rows of a conversation came in after it was drawn (they come in with a motion): those after the row that was
|
|
472
|
-
* last when it was drawn, by key. Rows put in front (earlier messages, more of the row window) move the indexes of all
|
|
473
|
-
* rows, not which are new; more than MAX at the end at once, or the row they count from gone (a rewind), start again
|
|
474
|
-
* from the end.
|
|
475
|
-
*/
|
|
476
|
-
class FreshRows {
|
|
477
|
-
constructor(items) {
|
|
478
|
-
var _a;
|
|
479
|
-
this.still = this.last = (_a = items.at(-1)) === null || _a === void 0 ? void 0 : _a.key;
|
|
480
|
-
}
|
|
481
|
-
/** From which index `items` (as drawn now) came in after the list was drawn. */
|
|
482
|
-
from(items) {
|
|
483
|
-
var _a;
|
|
484
|
-
const previous = FreshRows.lastIndexOf(items, this.last);
|
|
485
|
-
this.last = (_a = items.at(-1)) === null || _a === void 0 ? void 0 : _a.key;
|
|
486
|
-
let from = FreshRows.lastIndexOf(items, this.still);
|
|
487
|
-
if (previous < 0 || from < 0 || items.length - 1 - previous > FreshRows.MAX) {
|
|
488
|
-
this.still = this.last;
|
|
489
|
-
from = items.length - 1;
|
|
490
|
-
}
|
|
491
|
-
return from + 1;
|
|
492
|
-
}
|
|
493
|
-
/** Searched from the end, where new rows are. */
|
|
494
|
-
static lastIndexOf(items, key) {
|
|
495
|
-
for (let index = items.length - 1; index >= 0; index--) {
|
|
496
|
-
if (items[index].key === key) {
|
|
497
|
-
return index;
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
return -1;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
exports.FreshRows = FreshRows;
|
|
504
|
-
/** More rows than this at the end at once: the conversation loaded again, not messages that came in. */
|
|
505
|
-
FreshRows.MAX = 2;
|
|
506
515
|
//# sourceMappingURL=process.js.map
|
package/lib/browser/util/tool.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ToolUtil = void 0;
|
|
4
|
+
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
4
5
|
const mcp_words_1 = require("./mcp-words");
|
|
5
6
|
const message_1 = require("./message");
|
|
6
7
|
const shell_words_1 = require("./shell-words");
|
|
@@ -61,6 +62,11 @@ const AGENT_TOOL_VERBS = {
|
|
|
61
62
|
CronDelete: 'ta.tool.verb.deleteScheduled',
|
|
62
63
|
Artifact: 'ta.tool.verb.publish',
|
|
63
64
|
ImageEdit: 'ta.tool.verb.editImage',
|
|
65
|
+
ImageGen: 'ta.tool.verb.generateImage',
|
|
66
|
+
VideoGen: 'ta.tool.verb.generateVideo',
|
|
67
|
+
ToolSearch: 'ta.tool.verb.findTools',
|
|
68
|
+
DeferExecuteTool: 'ta.tool.verb.callTool',
|
|
69
|
+
PushNotification: 'ta.tool.verb.notify',
|
|
64
70
|
};
|
|
65
71
|
const TARGET_CHARS = 160;
|
|
66
72
|
function str(value) {
|
|
@@ -112,7 +118,7 @@ var ToolUtil;
|
|
|
112
118
|
*/
|
|
113
119
|
function summary(name, args, resolvers, input) {
|
|
114
120
|
var _a, _b;
|
|
115
|
-
var _c, _d;
|
|
121
|
+
var _c, _d, _e;
|
|
116
122
|
if (resolvers === null || resolvers === void 0 ? void 0 : resolvers.length) {
|
|
117
123
|
try {
|
|
118
124
|
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);
|
|
@@ -172,14 +178,18 @@ var ToolUtil;
|
|
|
172
178
|
if (kind === 'execute') {
|
|
173
179
|
return { ...command(tool, str(args.target) || str(args.title)), name: tool };
|
|
174
180
|
}
|
|
175
|
-
|
|
176
|
-
|
|
181
|
+
// What it is on, when the agent said it only after the call was shown: from what it was given, a
|
|
182
|
+
// path by its end.
|
|
183
|
+
const given = line((_d = ta_protocol_1.TaAgentToolUtil.target(kind, input !== null && input !== void 0 ? input : {})) !== null && _d !== void 0 ? _d : '');
|
|
184
|
+
const on = target && target !== tool ? target : given.startsWith('/') ? short(given) : given;
|
|
185
|
+
if (str(args.tool) === 'REPL' && on) {
|
|
186
|
+
return { verb: AGENT_TOOL_VERBS.REPL, name: tool, target: on, code: false, titled: true };
|
|
177
187
|
}
|
|
178
188
|
const file = ['read', 'edit', 'delete', 'move'].includes(kind);
|
|
179
189
|
return {
|
|
180
|
-
verb: (
|
|
190
|
+
verb: (_e = AGENT_TOOL_VERBS[str(args.tool)]) !== null && _e !== void 0 ? _e : AGENT_VERBS[kind],
|
|
181
191
|
name: tool,
|
|
182
|
-
target:
|
|
192
|
+
target: file ? short(on) : on,
|
|
183
193
|
code: kind === 'execute' || kind === 'search',
|
|
184
194
|
};
|
|
185
195
|
}
|
|
@@ -63,10 +63,18 @@ var Voice;
|
|
|
63
63
|
'Swift',
|
|
64
64
|
'Cell',
|
|
65
65
|
];
|
|
66
|
+
/**
|
|
67
|
+
* The recognition of the browser. Not in the Ta app on Android: its web-view has Chromium's, with no service behind
|
|
68
|
+
* it, which fails (`audio-capture`, `network`) or waits without end whatever the phone has; Ta listens there.
|
|
69
|
+
*/
|
|
66
70
|
function recognitionClass() {
|
|
67
|
-
var _a;
|
|
71
|
+
var _a, _b;
|
|
72
|
+
var _c;
|
|
73
|
+
if (((_b = (_a = globalThis.Capacitor) === null || _a === void 0 ? void 0 : _a.getPlatform) === null || _b === void 0 ? void 0 : _b.call(_a)) === 'android') {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
68
76
|
const scope = globalThis;
|
|
69
|
-
return (
|
|
77
|
+
return (_c = scope.SpeechRecognition) !== null && _c !== void 0 ? _c : scope.webkitSpeechRecognition;
|
|
70
78
|
}
|
|
71
79
|
/**
|
|
72
80
|
* Apple's recognizer: of the Ta app on iOS, where WebKit's repeats what it heard and leaves out punctuation, and of
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-web",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.45.0",
|
|
4
4
|
"description": "The web client of ta serve: sessions, streaming messages, tool runs with diffs, and dialogs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@celljs/core": "4.
|
|
37
|
-
"@celljs/react": "4.
|
|
38
|
-
"@celljs/ta-client": "4.
|
|
39
|
-
"@celljs/ta-protocol": "4.
|
|
40
|
-
"@celljs/ta-relay": "4.
|
|
41
|
-
"@celljs/widget": "4.
|
|
36
|
+
"@celljs/core": "4.45.0",
|
|
37
|
+
"@celljs/react": "4.45.0",
|
|
38
|
+
"@celljs/ta-client": "4.45.0",
|
|
39
|
+
"@celljs/ta-protocol": "4.45.0",
|
|
40
|
+
"@celljs/ta-relay": "4.45.0",
|
|
41
|
+
"@celljs/widget": "4.45.0",
|
|
42
42
|
"@types/three": "^0.187.0",
|
|
43
43
|
"@xterm/addon-fit": "^0.11.0",
|
|
44
44
|
"@xterm/addon-unicode11": "^0.9.0",
|