@celljs/ta-web 4.12.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 +5 -4
- package/esm/browser/assistant/assistant.d.ts +5 -0
- package/esm/browser/assistant/assistant.js +25 -6
- 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 +18 -9
- 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.d.ts +7 -1
- package/esm/browser/components/composer.js +33 -20
- package/esm/browser/components/connection-bar.js +31 -12
- package/esm/browser/components/conversation-scroll-util.d.ts +5 -0
- package/esm/browser/components/conversation-scroll-util.js +18 -0
- package/esm/browser/components/conversation-scroll.d.ts +12 -2
- package/esm/browser/components/conversation-scroll.js +68 -5
- 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/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 +4 -39
- package/esm/browser/components/mermaid-view.js +45 -3
- package/esm/browser/components/message-footer.d.ts +2 -0
- package/esm/browser/components/message-footer.js +8 -1
- package/esm/browser/components/message-list.d.ts +12 -0
- package/esm/browser/components/message-list.js +156 -25
- package/esm/browser/components/phone-shell.d.ts +7 -2
- package/esm/browser/components/phone-shell.js +7 -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.js +16 -4
- package/esm/browser/components/settings-controls.js +3 -3
- package/esm/browser/components/settings-parts.js +13 -1
- 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/web-composer.js +2 -1
- 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 +9 -1
- package/esm/browser/extension/web-api-components.d.ts +3 -3
- package/esm/browser/extension/web-api-contributions.d.ts +119 -0
- package/esm/browser/extension/web-extension-api.d.ts +23 -46
- package/esm/browser/extension/web-extension-context.d.ts +6 -1
- package/esm/browser/extension/web-extension-context.js +63 -6
- package/esm/browser/extension/web-extension-protocol.d.ts +5 -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-extensions.d.ts +2 -8
- package/esm/browser/extension/web-extensions.js +9 -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 +69 -3
- package/esm/browser/i18n/messages.d.ts +68 -2
- package/esm/browser/i18n/messages.js +138 -6
- 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 +51 -0
- package/esm/browser/style/device.js +3 -0
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +24 -9
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +2 -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 +14 -3
- package/esm/browser/util/desktop.d.ts +18 -1
- package/esm/browser/util/desktop.js +13 -0
- package/esm/browser/util/process.d.ts +26 -1
- package/esm/browser/util/process.js +79 -5
- 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 +3 -2
- package/lib/browser/assistant/assistant.d.ts +5 -0
- package/lib/browser/assistant/assistant.js +24 -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 +17 -8
- 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.d.ts +7 -1
- package/lib/browser/components/composer.js +33 -19
- package/lib/browser/components/connection-bar.js +30 -11
- package/lib/browser/components/conversation-scroll-util.d.ts +5 -0
- package/lib/browser/components/conversation-scroll-util.js +18 -0
- package/lib/browser/components/conversation-scroll.d.ts +12 -2
- package/lib/browser/components/conversation-scroll.js +68 -5
- 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/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 +3 -38
- package/lib/browser/components/mermaid-view.js +45 -3
- package/lib/browser/components/message-footer.d.ts +2 -0
- package/lib/browser/components/message-footer.js +8 -0
- package/lib/browser/components/message-list.d.ts +12 -0
- package/lib/browser/components/message-list.js +153 -20
- package/lib/browser/components/phone-shell.d.ts +7 -2
- package/lib/browser/components/phone-shell.js +7 -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.js +15 -3
- package/lib/browser/components/settings-controls.js +3 -3
- package/lib/browser/components/settings-parts.js +13 -1
- 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/web-composer.js +2 -1
- 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 +8 -0
- package/lib/browser/extension/web-api-components.d.ts +3 -3
- package/lib/browser/extension/web-api-contributions.d.ts +119 -0
- package/lib/browser/extension/web-extension-api.d.ts +23 -46
- package/lib/browser/extension/web-extension-context.d.ts +6 -1
- package/lib/browser/extension/web-extension-context.js +63 -6
- package/lib/browser/extension/web-extension-protocol.d.ts +5 -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-extensions.d.ts +2 -8
- package/lib/browser/extension/web-extensions.js +9 -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 +69 -3
- package/lib/browser/i18n/messages.d.ts +68 -2
- package/lib/browser/i18n/messages.js +138 -6
- 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 +51 -0
- package/lib/browser/style/device.js +3 -0
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +24 -9
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +2 -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 +14 -3
- package/lib/browser/util/desktop.d.ts +18 -1
- package/lib/browser/util/desktop.js +13 -0
- package/lib/browser/util/process.d.ts +26 -1
- package/lib/browser/util/process.js +79 -5
- 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
|
@@ -41,7 +41,8 @@ var ProgressUtil;
|
|
|
41
41
|
case 'compacting':
|
|
42
42
|
return t('ta.progress.compacting');
|
|
43
43
|
case 'retrying': {
|
|
44
|
-
const
|
|
44
|
+
const error = phase.reason === 'error' ? ProgressUtil.brief(phase.error) : '';
|
|
45
|
+
const reason = error || t(`ta.progress.retry.${phase.reason}`);
|
|
45
46
|
const seconds = (_b = options.secondsLeft) !== null && _b !== void 0 ? _b : phase.seconds;
|
|
46
47
|
return seconds > 0
|
|
47
48
|
? t('ta.progress.retrying', { reason, seconds, attempt: phase.attempt, max: phase.maxAttempts })
|
|
@@ -61,7 +62,9 @@ var ProgressUtil;
|
|
|
61
62
|
}
|
|
62
63
|
if (state.retry) {
|
|
63
64
|
const { attempt, maxAttempts, delayMs, errorMessage } = state.retry;
|
|
64
|
-
|
|
65
|
+
const reason = retryReason(errorMessage);
|
|
66
|
+
const seconds = Math.max(1, Math.round(delayMs / 1000));
|
|
67
|
+
return { kind: 'retrying', attempt, maxAttempts, seconds, reason, ...(reason === 'error' && errorMessage ? { error: errorMessage } : {}) };
|
|
65
68
|
}
|
|
66
69
|
const [request] = state.pendingClientTools;
|
|
67
70
|
if (request) {
|
|
@@ -90,6 +93,12 @@ var ProgressUtil;
|
|
|
90
93
|
}
|
|
91
94
|
}
|
|
92
95
|
ProgressUtil.phase = phase;
|
|
96
|
+
/** The first line of an error, short enough for the loading line. */
|
|
97
|
+
function brief(error, length = 60) {
|
|
98
|
+
const line = (error !== null && error !== void 0 ? error : '').trim().split('\n')[0].trim();
|
|
99
|
+
return line.length > length ? `${line.slice(0, length - 1)}…` : line;
|
|
100
|
+
}
|
|
101
|
+
ProgressUtil.brief = brief;
|
|
93
102
|
/** Why a request failed, as the provider said it: a rate limit, a model too busy, the network, or another error. */
|
|
94
103
|
function retryReason(errorMessage) {
|
|
95
104
|
const message = errorMessage !== null && errorMessage !== void 0 ? errorMessage : '';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the user scrolls the page, anywhere in it: what costs a frame and need not happen now (a diagram drawn,
|
|
3
|
+
* the avatars moving) waits for it to rest, QUIET_MS without a scroll and no finger on it, for a fling not to stutter.
|
|
4
|
+
*/
|
|
5
|
+
export declare namespace ScrollRest {
|
|
6
|
+
/** Whether the page scrolls now (or a finger holds it). */
|
|
7
|
+
function moving(now?: number): boolean;
|
|
8
|
+
/** Once the page rests, or WAIT_MS at most. */
|
|
9
|
+
function wait(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=scroll-rest.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScrollRest = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Whether the user scrolls the page, anywhere in it: what costs a frame and need not happen now (a diagram drawn,
|
|
6
|
+
* the avatars moving) waits for it to rest, QUIET_MS without a scroll and no finger on it, for a fling not to stutter.
|
|
7
|
+
*/
|
|
8
|
+
var ScrollRest;
|
|
9
|
+
(function (ScrollRest) {
|
|
10
|
+
const QUIET_MS = 150;
|
|
11
|
+
/** At most this long: what follows a reply streaming scrolls on and on. */
|
|
12
|
+
const WAIT_MS = 1000;
|
|
13
|
+
let last = Number.NEGATIVE_INFINITY;
|
|
14
|
+
let touching = false;
|
|
15
|
+
let listening = false;
|
|
16
|
+
function listen() {
|
|
17
|
+
if (listening || typeof document === 'undefined') {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
listening = true;
|
|
21
|
+
const passive = { capture: true, passive: true };
|
|
22
|
+
document.addEventListener('scroll', () => (last = performance.now()), passive);
|
|
23
|
+
document.addEventListener('touchstart', () => (touching = true), passive);
|
|
24
|
+
const lifted = (event) => {
|
|
25
|
+
touching = event.touches.length > 0;
|
|
26
|
+
last = performance.now();
|
|
27
|
+
};
|
|
28
|
+
document.addEventListener('touchend', lifted, passive);
|
|
29
|
+
document.addEventListener('touchcancel', lifted, passive);
|
|
30
|
+
}
|
|
31
|
+
/** Whether the page scrolls now (or a finger holds it). */
|
|
32
|
+
function moving(now = performance.now()) {
|
|
33
|
+
listen();
|
|
34
|
+
return touching || now - last < QUIET_MS;
|
|
35
|
+
}
|
|
36
|
+
ScrollRest.moving = moving;
|
|
37
|
+
/** Once the page rests, or WAIT_MS at most. */
|
|
38
|
+
async function wait() {
|
|
39
|
+
listen();
|
|
40
|
+
const until = performance.now() + WAIT_MS;
|
|
41
|
+
for (let now = performance.now(); now < until && moving(now); now = performance.now()) {
|
|
42
|
+
await new Promise(resolve => setTimeout(resolve, Math.max(16, QUIET_MS - (now - last))));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
ScrollRest.wait = wait;
|
|
46
|
+
})(ScrollRest || (exports.ScrollRest = ScrollRest = {}));
|
|
47
|
+
//# sourceMappingURL=scroll-rest.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** What an external agent's tool wrote when it returned nothing (`AgentTool` of @celljs/ta-agents). */
|
|
2
|
+
export declare const NO_OUTPUT = "(no output)";
|
|
3
|
+
/** What a script returned, the shape code mode scripts of agents answer with. */
|
|
4
|
+
export interface ScriptResult {
|
|
5
|
+
result: unknown;
|
|
6
|
+
stdout: string;
|
|
7
|
+
stderr: string;
|
|
8
|
+
failures: {
|
|
9
|
+
tool: string;
|
|
10
|
+
error: string;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
/** What a command printed. */
|
|
14
|
+
export interface ShellResult {
|
|
15
|
+
stdout: string;
|
|
16
|
+
stderr: string;
|
|
17
|
+
exitCode?: number;
|
|
18
|
+
}
|
|
19
|
+
/** The output of a tool as a person reads it: JSON opened, the colors of a terminal left out. */
|
|
20
|
+
export declare namespace ResultUtil {
|
|
21
|
+
function clean(text: string): string;
|
|
22
|
+
/** The object or array a text holds, when the whole text is JSON of one. */
|
|
23
|
+
function json(text: string): object | undefined;
|
|
24
|
+
/** A script's answer: `{ result, stdout, stderr, toolFailures }`, the result being what it returned. */
|
|
25
|
+
function script(value: unknown): ScriptResult | undefined;
|
|
26
|
+
/** What a command printed: `{ stdout, stderr, exitCode }`. */
|
|
27
|
+
function shell(value: unknown): ShellResult | undefined;
|
|
28
|
+
/** Whether a value shows in the line of its key: a number, a word, a short line. */
|
|
29
|
+
function inline(value: unknown): boolean;
|
|
30
|
+
/** How a value that shows in a line reads. */
|
|
31
|
+
function atom(value: unknown): string;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=tool-result.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResultUtil = exports.NO_OUTPUT = void 0;
|
|
4
|
+
/** What an external agent's tool wrote when it returned nothing (`AgentTool` of @celljs/ta-agents). */
|
|
5
|
+
exports.NO_OUTPUT = '(no output)';
|
|
6
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: the escape that starts a color of a terminal
|
|
7
|
+
const ANSI = /\u001b\[[0-9;?]*[ -/]*[@-~]/g;
|
|
8
|
+
const SCRIPT_KEYS = new Set(['result', 'stdout', 'stderr', 'toolFailures', 'toolFailureNotice']);
|
|
9
|
+
const SHELL_KEYS = new Set(['stdout', 'stderr', 'exitCode', 'signal', 'interrupted', 'denied', 'sandboxHint']);
|
|
10
|
+
/** The longest string shown in a line beside its key. */
|
|
11
|
+
const INLINE_CHARS = 72;
|
|
12
|
+
function str(value) {
|
|
13
|
+
return typeof value === 'string' ? value : '';
|
|
14
|
+
}
|
|
15
|
+
function record(value) {
|
|
16
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
|
|
17
|
+
}
|
|
18
|
+
/** The output of a tool as a person reads it: JSON opened, the colors of a terminal left out. */
|
|
19
|
+
var ResultUtil;
|
|
20
|
+
(function (ResultUtil) {
|
|
21
|
+
function clean(text) {
|
|
22
|
+
return text.replace(ANSI, '').replace(/\n+$/, '');
|
|
23
|
+
}
|
|
24
|
+
ResultUtil.clean = clean;
|
|
25
|
+
/** The object or array a text holds, when the whole text is JSON of one. */
|
|
26
|
+
function json(text) {
|
|
27
|
+
const trimmed = text.trim();
|
|
28
|
+
if (!/^[[{]/.test(trimmed)) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const value = JSON.parse(trimmed);
|
|
33
|
+
return value && typeof value === 'object' ? value : undefined;
|
|
34
|
+
}
|
|
35
|
+
catch (_a) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
ResultUtil.json = json;
|
|
40
|
+
/** A script's answer: `{ result, stdout, stderr, toolFailures }`, the result being what it returned. */
|
|
41
|
+
function script(value) {
|
|
42
|
+
var _a;
|
|
43
|
+
const object = record(value);
|
|
44
|
+
if (!object || !('result' in object) || !Object.keys(object).every(key => SCRIPT_KEYS.has(key))) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const calls = (_a = record(object.toolFailures)) === null || _a === void 0 ? void 0 : _a.calls;
|
|
48
|
+
const failures = (Array.isArray(calls) ? calls : []).map(call => { var _a, _b; return ({
|
|
49
|
+
tool: str((_a = record(call)) === null || _a === void 0 ? void 0 : _a.tool),
|
|
50
|
+
error: clean(str((_b = record(call)) === null || _b === void 0 ? void 0 : _b.error)),
|
|
51
|
+
}); });
|
|
52
|
+
return { result: object.result, stdout: clean(str(object.stdout)), stderr: clean(str(object.stderr)), failures };
|
|
53
|
+
}
|
|
54
|
+
ResultUtil.script = script;
|
|
55
|
+
/** What a command printed: `{ stdout, stderr, exitCode }`. */
|
|
56
|
+
function shell(value) {
|
|
57
|
+
const object = record(value);
|
|
58
|
+
if (!object || typeof object.stdout !== 'string' || !('stderr' in object || 'exitCode' in object)) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
if (!Object.keys(object).every(key => SHELL_KEYS.has(key))) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
const exitCode = typeof object.exitCode === 'number' ? object.exitCode : undefined;
|
|
65
|
+
return { stdout: clean(object.stdout), stderr: clean(str(object.stderr)), exitCode };
|
|
66
|
+
}
|
|
67
|
+
ResultUtil.shell = shell;
|
|
68
|
+
/** Whether a value shows in the line of its key: a number, a word, a short line. */
|
|
69
|
+
function inline(value) {
|
|
70
|
+
if (typeof value === 'string') {
|
|
71
|
+
return value.length <= INLINE_CHARS && !value.includes('\n') && !json(value);
|
|
72
|
+
}
|
|
73
|
+
return value === null || typeof value !== 'object' || (Array.isArray(value) ? value.length === 0 : Object.keys(value).length === 0);
|
|
74
|
+
}
|
|
75
|
+
ResultUtil.inline = inline;
|
|
76
|
+
/** How a value that shows in a line reads. */
|
|
77
|
+
function atom(value) {
|
|
78
|
+
if (Array.isArray(value)) {
|
|
79
|
+
return '[]';
|
|
80
|
+
}
|
|
81
|
+
if (value && typeof value === 'object') {
|
|
82
|
+
return '{}';
|
|
83
|
+
}
|
|
84
|
+
return typeof value === 'string' ? value || '""' : String(value);
|
|
85
|
+
}
|
|
86
|
+
ResultUtil.atom = atom;
|
|
87
|
+
})(ResultUtil || (exports.ResultUtil = ResultUtil = {}));
|
|
88
|
+
//# sourceMappingURL=tool-result.js.map
|
package/lib/browser/util/tool.js
CHANGED
|
@@ -52,6 +52,13 @@ const AGENT_TOOL_VERBS = {
|
|
|
52
52
|
TaskOutput: 'ta.tool.verb.getTask',
|
|
53
53
|
TaskStop: 'ta.tool.verb.stopTask',
|
|
54
54
|
Skill: 'ta.tool.verb.skill',
|
|
55
|
+
SendMessage: 'ta.tool.verb.sendMessage',
|
|
56
|
+
TeamDelete: 'ta.tool.verb.deleteTeam',
|
|
57
|
+
CronCreate: 'ta.tool.verb.scheduleTask',
|
|
58
|
+
CronList: 'ta.tool.verb.listScheduled',
|
|
59
|
+
CronDelete: 'ta.tool.verb.deleteScheduled',
|
|
60
|
+
Artifact: 'ta.tool.verb.publish',
|
|
61
|
+
ImageEdit: 'ta.tool.verb.editImage',
|
|
55
62
|
};
|
|
56
63
|
const TARGET_CHARS = 160;
|
|
57
64
|
function str(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-web",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.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.13.0",
|
|
37
|
+
"@celljs/react": "4.13.0",
|
|
38
|
+
"@celljs/ta-client": "4.13.0",
|
|
39
|
+
"@celljs/ta-protocol": "4.13.0",
|
|
40
|
+
"@celljs/ta-relay": "4.13.0",
|
|
41
|
+
"@celljs/widget": "4.13.0",
|
|
42
42
|
"@types/three": "^0.187.0",
|
|
43
43
|
"@xterm/addon-fit": "^0.11.0",
|
|
44
44
|
"@xterm/addon-unicode11": "^0.9.0",
|