@celljs/ta-web 4.11.0 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/assistant/assistant-extension.js +14 -0
- package/esm/browser/assistant/assistant-initiative.d.ts +27 -0
- package/esm/browser/assistant/assistant-initiative.js +76 -0
- package/esm/browser/assistant/assistant-task-source.d.ts +7 -0
- package/esm/browser/assistant/assistant-task-source.js +12 -2
- package/esm/browser/assistant/assistant-view.js +10 -6
- package/esm/browser/assistant/assistant.d.ts +5 -0
- package/esm/browser/assistant/assistant.js +25 -6
- package/esm/browser/chat/chat-view.js +6 -5
- package/esm/browser/components/app-nav.d.ts +3 -1
- package/esm/browser/components/app-nav.js +5 -2
- package/esm/browser/components/app-view.js +26 -13
- package/esm/browser/components/asks-badge.d.ts +5 -0
- package/esm/browser/components/asks-badge.js +8 -0
- package/esm/browser/components/chat-asks.d.ts +46 -0
- package/esm/browser/components/chat-asks.js +101 -0
- package/esm/browser/components/chat-list.d.ts +7 -1
- package/esm/browser/components/chat-list.js +46 -17
- package/esm/browser/components/composer-addon-util.d.ts +11 -0
- package/esm/browser/components/composer-addon-util.js +40 -0
- package/esm/browser/components/composer-addons.d.ts +1 -7
- package/esm/browser/components/composer-addons.js +1 -27
- package/esm/browser/components/composer-box.d.ts +1 -0
- package/esm/browser/components/composer-box.js +50 -28
- package/esm/browser/components/composer.d.ts +10 -1
- package/esm/browser/components/composer.js +61 -22
- package/esm/browser/components/connection-bar.js +31 -12
- package/esm/browser/components/conversation-scroll-hooks.d.ts +16 -0
- package/esm/browser/components/conversation-scroll-hooks.js +98 -0
- package/esm/browser/components/conversation-scroll-util.d.ts +35 -0
- package/esm/browser/components/conversation-scroll-util.js +74 -0
- package/esm/browser/components/conversation-scroll.d.ts +57 -33
- package/esm/browser/components/conversation-scroll.js +188 -123
- package/esm/browser/components/discover-view.js +5 -1
- package/esm/browser/components/earlier-messages.d.ts +10 -3
- package/esm/browser/components/earlier-messages.js +14 -8
- package/esm/browser/components/face.d.ts +24 -0
- package/esm/browser/components/face.js +42 -0
- package/esm/browser/components/folder-picker.d.ts +2 -0
- package/esm/browser/components/folder-picker.js +7 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/markdown.js +4 -2
- package/esm/browser/components/media.js +25 -11
- package/esm/browser/components/mermaid-view.js +45 -3
- package/esm/browser/components/message-actions.js +1 -0
- package/esm/browser/components/message-footer.d.ts +4 -0
- package/esm/browser/components/message-footer.js +8 -1
- package/esm/browser/components/message-list.d.ts +15 -1
- package/esm/browser/components/message-list.js +204 -41
- package/esm/browser/components/phone-shell.d.ts +7 -2
- package/esm/browser/components/phone-shell.js +9 -3
- package/esm/browser/components/relay-services.d.ts +24 -0
- package/esm/browser/components/relay-services.js +249 -0
- package/esm/browser/components/relay-view.js +17 -1
- package/esm/browser/components/remote-hosts.js +1 -1
- package/esm/browser/components/session-view.d.ts +3 -1
- package/esm/browser/components/session-view.js +23 -7
- package/esm/browser/components/settings-controls.js +3 -3
- package/esm/browser/components/settings-parts.js +13 -1
- package/esm/browser/components/stop-times.d.ts +47 -0
- package/esm/browser/components/stop-times.js +81 -0
- package/esm/browser/components/ta-avatar.js +6 -0
- package/esm/browser/components/tool-result.d.ts +13 -0
- package/esm/browser/components/tool-result.js +138 -0
- package/esm/browser/components/tool-view.js +5 -15
- package/esm/browser/components/use-stop-times.d.ts +3 -0
- package/esm/browser/components/use-stop-times.js +17 -0
- package/esm/browser/components/web-composer.js +2 -1
- package/esm/browser/device/photo-picker.d.ts +14 -0
- package/esm/browser/device/photo-picker.js +48 -0
- package/esm/browser/device/row-swipe.d.ts +2 -0
- package/esm/browser/device/row-swipe.js +8 -2
- package/esm/browser/device/sheet-swipe.d.ts +1 -1
- package/esm/browser/device/sheet-swipe.js +17 -3
- package/esm/browser/extension/extension-view.d.ts +3 -1
- package/esm/browser/extension/extension-view.js +7 -0
- package/esm/browser/extension/icons.js +10 -1
- package/esm/browser/extension/web-api-components.d.ts +21 -3
- package/esm/browser/extension/web-api-contributions.d.ts +128 -0
- package/esm/browser/extension/web-extension-api.d.ts +45 -48
- package/esm/browser/extension/web-extension-context.d.ts +6 -1
- package/esm/browser/extension/web-extension-context.js +72 -7
- package/esm/browser/extension/web-extension-protocol.d.ts +18 -2
- package/esm/browser/extension/web-extension-protocol.js +2 -0
- package/esm/browser/extension/web-extension-run.d.ts +3 -2
- package/esm/browser/extension/web-extension-run.js +3 -0
- package/esm/browser/extension/web-extensions.d.ts +2 -8
- package/esm/browser/extension/web-extensions.js +12 -35
- package/esm/browser/extension/web-page-list.d.ts +25 -0
- package/esm/browser/extension/web-page-list.js +35 -0
- package/esm/browser/extension/web-session-notices.d.ts +6 -1
- package/esm/browser/extension/web-session-notices.js +30 -4
- package/esm/browser/extension/web-sharing.d.ts +5 -2
- package/esm/browser/extension/web-sharing.js +10 -1
- package/esm/browser/i18n/locales.d.ts +77 -1
- package/esm/browser/i18n/messages.d.ts +76 -0
- package/esm/browser/i18n/messages.js +154 -2
- package/esm/browser/links/links-protocol.d.ts +2 -0
- package/esm/browser/links/links.d.ts +7 -2
- package/esm/browser/links/links.js +16 -9
- package/esm/browser/markdown/code-renderers.d.ts +4 -0
- package/esm/browser/markdown/code-renderers.js +4 -0
- package/esm/browser/markdown/lazy.d.ts +8 -0
- package/esm/browser/markdown/lazy.js +35 -0
- package/esm/browser/markdown/mermaid.d.ts +15 -3
- package/esm/browser/markdown/mermaid.js +45 -6
- package/esm/browser/notices/notices-protocol.d.ts +5 -0
- package/esm/browser/notices/notices.d.ts +19 -0
- package/esm/browser/notices/notices.js +85 -2
- package/esm/browser/notices/session-notices.d.ts +5 -2
- package/esm/browser/notices/session-notices.js +10 -1
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +2 -1
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +53 -0
- package/esm/browser/style/device.js +3 -0
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +27 -9
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +5 -0
- package/esm/browser/style/phone.d.ts +1 -1
- package/esm/browser/style/phone.js +2 -0
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +16 -3
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +19 -0
- package/esm/browser/util/desktop.d.ts +18 -1
- package/esm/browser/util/desktop.js +13 -0
- package/esm/browser/util/frame.d.ts +2 -0
- package/esm/browser/util/frame.js +2 -0
- package/esm/browser/util/process.d.ts +69 -2
- package/esm/browser/util/process.js +163 -8
- package/esm/browser/util/progress.d.ts +6 -1
- package/esm/browser/util/progress.js +11 -2
- package/esm/browser/util/scroll-rest.d.ts +10 -0
- package/esm/browser/util/scroll-rest.js +44 -0
- package/esm/browser/util/tool-result.d.ts +32 -0
- package/esm/browser/util/tool-result.js +85 -0
- package/esm/browser/util/tool.js +7 -0
- package/lib/browser/assistant/assistant-extension.js +14 -0
- package/lib/browser/assistant/assistant-initiative.d.ts +28 -0
- package/lib/browser/assistant/assistant-initiative.js +80 -0
- package/lib/browser/assistant/assistant-task-source.d.ts +7 -0
- package/lib/browser/assistant/assistant-task-source.js +12 -2
- package/lib/browser/assistant/assistant-view.js +8 -4
- package/lib/browser/assistant/assistant.d.ts +5 -0
- package/lib/browser/assistant/assistant.js +24 -5
- package/lib/browser/chat/chat-view.js +6 -5
- package/lib/browser/components/app-nav.d.ts +3 -1
- package/lib/browser/components/app-nav.js +5 -2
- package/lib/browser/components/app-view.js +25 -12
- package/lib/browser/components/asks-badge.d.ts +6 -0
- package/lib/browser/components/asks-badge.js +44 -0
- package/lib/browser/components/chat-asks.d.ts +47 -0
- package/lib/browser/components/chat-asks.js +104 -0
- package/lib/browser/components/chat-list.d.ts +7 -1
- package/lib/browser/components/chat-list.js +46 -17
- package/lib/browser/components/composer-addon-util.d.ts +12 -0
- package/lib/browser/components/composer-addon-util.js +76 -0
- package/lib/browser/components/composer-addons.d.ts +1 -7
- package/lib/browser/components/composer-addons.js +2 -29
- package/lib/browser/components/composer-box.d.ts +1 -0
- package/lib/browser/components/composer-box.js +48 -26
- package/lib/browser/components/composer.d.ts +10 -1
- package/lib/browser/components/composer.js +61 -21
- package/lib/browser/components/connection-bar.js +30 -11
- package/lib/browser/components/conversation-scroll-hooks.d.ts +17 -0
- package/lib/browser/components/conversation-scroll-hooks.js +135 -0
- package/lib/browser/components/conversation-scroll-util.d.ts +36 -0
- package/lib/browser/components/conversation-scroll-util.js +78 -0
- package/lib/browser/components/conversation-scroll.d.ts +57 -33
- package/lib/browser/components/conversation-scroll.js +189 -158
- package/lib/browser/components/discover-view.js +5 -1
- package/lib/browser/components/earlier-messages.d.ts +10 -3
- package/lib/browser/components/earlier-messages.js +16 -9
- package/lib/browser/components/face.d.ts +25 -0
- package/lib/browser/components/face.js +79 -0
- package/lib/browser/components/folder-picker.d.ts +2 -0
- package/lib/browser/components/folder-picker.js +7 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/markdown.js +3 -1
- package/lib/browser/components/media.js +24 -10
- package/lib/browser/components/mermaid-view.js +45 -3
- package/lib/browser/components/message-actions.js +1 -0
- package/lib/browser/components/message-footer.d.ts +4 -0
- package/lib/browser/components/message-footer.js +8 -0
- package/lib/browser/components/message-list.d.ts +15 -1
- package/lib/browser/components/message-list.js +200 -35
- package/lib/browser/components/phone-shell.d.ts +7 -2
- package/lib/browser/components/phone-shell.js +9 -3
- package/lib/browser/components/relay-services.d.ts +25 -0
- package/lib/browser/components/relay-services.js +286 -0
- package/lib/browser/components/relay-view.js +17 -1
- package/lib/browser/components/remote-hosts.js +1 -1
- package/lib/browser/components/session-view.d.ts +3 -1
- package/lib/browser/components/session-view.js +23 -7
- package/lib/browser/components/settings-controls.js +3 -3
- package/lib/browser/components/settings-parts.js +13 -1
- package/lib/browser/components/stop-times.d.ts +48 -0
- package/lib/browser/components/stop-times.js +85 -0
- package/lib/browser/components/ta-avatar.js +6 -0
- package/lib/browser/components/tool-result.d.ts +14 -0
- package/lib/browser/components/tool-result.js +175 -0
- package/lib/browser/components/tool-view.js +10 -20
- package/lib/browser/components/use-stop-times.d.ts +4 -0
- package/lib/browser/components/use-stop-times.js +53 -0
- package/lib/browser/components/web-composer.js +2 -1
- package/lib/browser/device/photo-picker.d.ts +15 -0
- package/lib/browser/device/photo-picker.js +51 -0
- package/lib/browser/device/row-swipe.d.ts +2 -0
- package/lib/browser/device/row-swipe.js +8 -2
- package/lib/browser/device/sheet-swipe.d.ts +1 -1
- package/lib/browser/device/sheet-swipe.js +17 -3
- package/lib/browser/extension/extension-view.d.ts +3 -1
- package/lib/browser/extension/extension-view.js +8 -1
- package/lib/browser/extension/icons.js +9 -0
- package/lib/browser/extension/web-api-components.d.ts +21 -3
- package/lib/browser/extension/web-api-contributions.d.ts +128 -0
- package/lib/browser/extension/web-extension-api.d.ts +45 -48
- package/lib/browser/extension/web-extension-context.d.ts +6 -1
- package/lib/browser/extension/web-extension-context.js +73 -8
- package/lib/browser/extension/web-extension-protocol.d.ts +18 -2
- package/lib/browser/extension/web-extension-protocol.js +2 -0
- package/lib/browser/extension/web-extension-run.d.ts +3 -2
- package/lib/browser/extension/web-extension-run.js +3 -0
- package/lib/browser/extension/web-extensions.d.ts +2 -8
- package/lib/browser/extension/web-extensions.js +12 -35
- package/lib/browser/extension/web-page-list.d.ts +26 -0
- package/lib/browser/extension/web-page-list.js +39 -0
- package/lib/browser/extension/web-session-notices.d.ts +6 -1
- package/lib/browser/extension/web-session-notices.js +30 -4
- package/lib/browser/extension/web-sharing.d.ts +5 -2
- package/lib/browser/extension/web-sharing.js +10 -1
- package/lib/browser/i18n/locales.d.ts +77 -1
- package/lib/browser/i18n/messages.d.ts +76 -0
- package/lib/browser/i18n/messages.js +154 -2
- package/lib/browser/links/links-protocol.d.ts +2 -0
- package/lib/browser/links/links.d.ts +7 -2
- package/lib/browser/links/links.js +16 -9
- package/lib/browser/markdown/code-renderers.d.ts +4 -0
- package/lib/browser/markdown/code-renderers.js +5 -1
- package/lib/browser/markdown/lazy.d.ts +8 -0
- package/lib/browser/markdown/lazy.js +37 -1
- package/lib/browser/markdown/mermaid.d.ts +15 -3
- package/lib/browser/markdown/mermaid.js +44 -5
- package/lib/browser/notices/notices-protocol.d.ts +5 -0
- package/lib/browser/notices/notices.d.ts +19 -0
- package/lib/browser/notices/notices.js +84 -1
- package/lib/browser/notices/session-notices.d.ts +5 -2
- package/lib/browser/notices/session-notices.js +10 -1
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +2 -1
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +53 -0
- package/lib/browser/style/device.js +3 -0
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +27 -9
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +5 -0
- package/lib/browser/style/phone.d.ts +1 -1
- package/lib/browser/style/phone.js +2 -0
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +16 -3
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +19 -0
- package/lib/browser/util/desktop.d.ts +18 -1
- package/lib/browser/util/desktop.js +13 -0
- package/lib/browser/util/frame.d.ts +2 -0
- package/lib/browser/util/frame.js +2 -0
- package/lib/browser/util/process.d.ts +69 -2
- package/lib/browser/util/process.js +165 -9
- package/lib/browser/util/progress.d.ts +6 -1
- package/lib/browser/util/progress.js +11 -2
- package/lib/browser/util/scroll-rest.d.ts +11 -0
- package/lib/browser/util/scroll-rest.js +47 -0
- package/lib/browser/util/tool-result.d.ts +33 -0
- package/lib/browser/util/tool-result.js +88 -0
- package/lib/browser/util/tool.js +7 -0
- package/package.json +7 -7
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ToolOutput } from '../util/message';
|
|
3
|
+
/** What a command printed, its last lines; the earlier ones open from above. */
|
|
4
|
+
export declare function Output({ text, className }: {
|
|
5
|
+
text: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* What a call of another agent's tool did, under its line (`agent_tool` of @celljs/ta-agents): the whole command,
|
|
10
|
+
* what it returned read as a person reads it, and the script of a code mode call behind a button. None: nothing to show,
|
|
11
|
+
* and the line does not open (the calls of a script return to the script).
|
|
12
|
+
*/
|
|
13
|
+
export declare function agentToolDetails(args: Record<string, unknown>, output: ToolOutput | undefined): React.ReactNode;
|
|
14
|
+
//# sourceMappingURL=tool-result.d.ts.map
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Output = Output;
|
|
37
|
+
exports.agentToolDetails = agentToolDetails;
|
|
38
|
+
const lucide_react_1 = require("lucide-react");
|
|
39
|
+
const React = __importStar(require("react"));
|
|
40
|
+
const use_t_1 = require("../i18n/use-t");
|
|
41
|
+
const message_1 = require("../util/message");
|
|
42
|
+
const tool_result_1 = require("../util/tool-result");
|
|
43
|
+
const fold_text_1 = require("./fold-text");
|
|
44
|
+
const icon_1 = require("./icon");
|
|
45
|
+
const markdown_1 = require("./markdown");
|
|
46
|
+
const OUTPUT_LINES = 12;
|
|
47
|
+
/** The entries of an object shown before the rest wait for Show more. */
|
|
48
|
+
const ENTRIES = 30;
|
|
49
|
+
/** How deep objects open; deeper ones show as JSON. */
|
|
50
|
+
const DEPTH = 4;
|
|
51
|
+
/** What a command printed, its last lines; the earlier ones open from above. */
|
|
52
|
+
function Output({ text, className }) {
|
|
53
|
+
const t = (0, use_t_1.useT)();
|
|
54
|
+
const [open, setOpen] = React.useState(false);
|
|
55
|
+
// The new line at the end of an output is not a line to show.
|
|
56
|
+
const trimmed = text.replace(/\n+$/, '');
|
|
57
|
+
const { text: shown, hidden } = open ? { text: trimmed, hidden: 0 } : message_1.MessageUtil.tail(trimmed, OUTPUT_LINES);
|
|
58
|
+
return (React.createElement("div", { className: className ? `ta-output ${className}` : 'ta-output' },
|
|
59
|
+
hidden > 0 && (React.createElement("button", { type: "button", className: "ta-link ta-more", onClick: () => setOpen(true) },
|
|
60
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.ChevronUp, size: 13 }),
|
|
61
|
+
" ",
|
|
62
|
+
t('ta.tool.earlier', { count: hidden }))),
|
|
63
|
+
React.createElement("pre", null, shown)));
|
|
64
|
+
}
|
|
65
|
+
/** A text a tool returned, its first lines; the rest open under it. */
|
|
66
|
+
function TextView({ text }) {
|
|
67
|
+
return (React.createElement("div", { className: "ta-result-block" },
|
|
68
|
+
React.createElement(fold_text_1.FoldText, { text: text, className: "ta-result-text" })));
|
|
69
|
+
}
|
|
70
|
+
/** A value a tool returned: JSON in strings opened, objects as their keys and values, what a command printed as such. */
|
|
71
|
+
function ValueView({ value, depth = 0 }) {
|
|
72
|
+
if (typeof value === 'string') {
|
|
73
|
+
const json = depth < DEPTH ? tool_result_1.ResultUtil.json(value) : undefined;
|
|
74
|
+
return json ? React.createElement(ValueView, { value: json, depth: depth + 1 }) : React.createElement(TextView, { text: tool_result_1.ResultUtil.clean(value) });
|
|
75
|
+
}
|
|
76
|
+
if (tool_result_1.ResultUtil.inline(value)) {
|
|
77
|
+
return React.createElement("span", { className: "ta-result-atom" }, tool_result_1.ResultUtil.atom(value));
|
|
78
|
+
}
|
|
79
|
+
const shell = tool_result_1.ResultUtil.shell(value);
|
|
80
|
+
if (shell) {
|
|
81
|
+
return React.createElement(ShellView, { ...shell });
|
|
82
|
+
}
|
|
83
|
+
if (depth >= DEPTH) {
|
|
84
|
+
return React.createElement(TextView, { text: JSON.stringify(value, undefined, 2) });
|
|
85
|
+
}
|
|
86
|
+
if (Array.isArray(value) && value.every(item => tool_result_1.ResultUtil.inline(item))) {
|
|
87
|
+
return (React.createElement("div", { className: "ta-result-chips" }, value.map((item, index) => (React.createElement("span", { key: index, className: "ta-result-atom" }, tool_result_1.ResultUtil.atom(item))))));
|
|
88
|
+
}
|
|
89
|
+
return React.createElement(Entries, { value: value, depth: depth });
|
|
90
|
+
}
|
|
91
|
+
function Entries({ value, depth }) {
|
|
92
|
+
const t = (0, use_t_1.useT)();
|
|
93
|
+
const [all, setAll] = React.useState(false);
|
|
94
|
+
const entries = Array.isArray(value) ? value.map((item, index) => [String(index + 1), item]) : Object.entries(value);
|
|
95
|
+
const shown = all ? entries : entries.slice(0, ENTRIES);
|
|
96
|
+
return (React.createElement("div", { className: "ta-result-entries" },
|
|
97
|
+
shown.map(([key, item]) => (React.createElement(Entry, { key: key, label: key, inline: tool_result_1.ResultUtil.inline(item) },
|
|
98
|
+
React.createElement(ValueView, { value: item, depth: depth + 1 })))),
|
|
99
|
+
entries.length > shown.length && (React.createElement("button", { type: "button", className: "ta-fold-toggle", onClick: () => setAll(true) },
|
|
100
|
+
t('ta.tool.moreEntries', { count: entries.length - shown.length }),
|
|
101
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.ChevronDown, size: 14 })))));
|
|
102
|
+
}
|
|
103
|
+
function Entry({ label, inline, children }) {
|
|
104
|
+
return (React.createElement("div", { className: inline ? 'ta-result-entry ta-result-inline' : 'ta-result-entry' },
|
|
105
|
+
React.createElement("span", { className: "ta-result-key" }, label),
|
|
106
|
+
children));
|
|
107
|
+
}
|
|
108
|
+
function ShellView({ stdout, stderr, exitCode }) {
|
|
109
|
+
const t = (0, use_t_1.useT)();
|
|
110
|
+
return (React.createElement("div", { className: "ta-result-shell" },
|
|
111
|
+
stdout && React.createElement(Output, { text: stdout }),
|
|
112
|
+
stderr && React.createElement(Output, { text: stderr, className: "ta-result-stderr" }),
|
|
113
|
+
!!exitCode && React.createElement("span", { className: "ta-result-badge" }, t('ta.tool.exitCode', { code: exitCode })),
|
|
114
|
+
!stdout && !stderr && !exitCode && React.createElement("span", { className: "ta-result-empty" }, t('ta.tool.noOutput'))));
|
|
115
|
+
}
|
|
116
|
+
/** What a script returned, what it printed, and the calls in it that failed. */
|
|
117
|
+
function ScriptView({ result, stdout, stderr, failures }) {
|
|
118
|
+
const t = (0, use_t_1.useT)();
|
|
119
|
+
const returned = result !== undefined && result !== null && result !== '';
|
|
120
|
+
return (React.createElement(React.Fragment, null,
|
|
121
|
+
returned && React.createElement(ValueView, { value: result }),
|
|
122
|
+
stdout && (React.createElement(Entry, { label: t('ta.tool.printed') },
|
|
123
|
+
React.createElement(Output, { text: stdout }))),
|
|
124
|
+
stderr && React.createElement(Output, { text: stderr, className: "ta-result-stderr" }),
|
|
125
|
+
failures.length > 0 && (React.createElement(Entry, { label: t('ta.tool.failedCalls', { count: failures.length }) }, failures.map((failure, index) => (React.createElement("div", { key: index, className: "ta-result-failure" },
|
|
126
|
+
failure.tool && React.createElement("span", { className: "ta-result-atom" }, failure.tool),
|
|
127
|
+
React.createElement("span", null, failure.error.split('\n').slice(0, 3).join('\n'))))))),
|
|
128
|
+
!returned && !stdout && !stderr && !failures.length && React.createElement("span", { className: "ta-result-empty" }, t('ta.tool.noOutput'))));
|
|
129
|
+
}
|
|
130
|
+
/** The output of a tool: a script's answer, JSON as keys and values, else the text, as a terminal prints it when `terminal`. */
|
|
131
|
+
function ResultView({ text, terminal }) {
|
|
132
|
+
const json = tool_result_1.ResultUtil.json(text);
|
|
133
|
+
if (!json) {
|
|
134
|
+
return terminal ? React.createElement(Output, { text: text }) : React.createElement(TextView, { text: text });
|
|
135
|
+
}
|
|
136
|
+
const script = tool_result_1.ResultUtil.script(json);
|
|
137
|
+
return script ? React.createElement(ScriptView, { ...script }) : React.createElement(ValueView, { value: json });
|
|
138
|
+
}
|
|
139
|
+
function ScriptToggle({ code }) {
|
|
140
|
+
const t = (0, use_t_1.useT)();
|
|
141
|
+
const [open, setOpen] = React.useState(false);
|
|
142
|
+
return (React.createElement(React.Fragment, null,
|
|
143
|
+
React.createElement("button", { type: "button", className: "ta-fold-toggle ta-result-script", "aria-expanded": open, onClick: () => setOpen(!open) },
|
|
144
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.FileCode2, size: 13 }),
|
|
145
|
+
t(open ? 'ta.tool.hideScript' : 'ta.tool.showScript')),
|
|
146
|
+
open && React.createElement(markdown_1.CodeBlock, { code: code, language: "js" })));
|
|
147
|
+
}
|
|
148
|
+
function str(value) {
|
|
149
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* What a call of another agent's tool did, under its line (`agent_tool` of @celljs/ta-agents): the whole command,
|
|
153
|
+
* what it returned read as a person reads it, and the script of a code mode call behind a button. None: nothing to show,
|
|
154
|
+
* and the line does not open (the calls of a script return to the script).
|
|
155
|
+
*/
|
|
156
|
+
function agentToolDetails(args, output) {
|
|
157
|
+
var _a;
|
|
158
|
+
var _b;
|
|
159
|
+
const input = ((_b = (_a = output === null || output === void 0 ? void 0 : output.details) === null || _a === void 0 ? void 0 : _a.input) !== null && _b !== void 0 ? _b : {});
|
|
160
|
+
const text = tool_result_1.ResultUtil.clean(message_1.MessageUtil.text(output === null || output === void 0 ? void 0 : output.content));
|
|
161
|
+
const shown = text.trim() === tool_result_1.NO_OUTPUT ? '' : text;
|
|
162
|
+
const terminal = args.kind === 'execute';
|
|
163
|
+
const command = terminal ? str(input.command) : '';
|
|
164
|
+
const code = str(input.code);
|
|
165
|
+
if (!shown && !command && !code) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
return (React.createElement(React.Fragment, null,
|
|
169
|
+
command && (React.createElement("div", { className: "ta-result-command" },
|
|
170
|
+
React.createElement(markdown_1.CodeBlock, { code: command, language: "bash" }))),
|
|
171
|
+
shown && (React.createElement("div", { className: "ta-output ta-result" },
|
|
172
|
+
React.createElement(ResultView, { text: shown, terminal: terminal }))),
|
|
173
|
+
code && React.createElement(ScriptToggle, { code: code })));
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=tool-result.js.map
|
|
@@ -43,24 +43,11 @@ const tool_1 = require("../util/tool");
|
|
|
43
43
|
const diff_view_1 = require("./diff-view");
|
|
44
44
|
const icon_1 = require("./icon");
|
|
45
45
|
const markdown_1 = require("./markdown");
|
|
46
|
-
const
|
|
46
|
+
const tool_result_1 = require("./tool-result");
|
|
47
47
|
/** The state of a call as the color of a dot: it pulses while the call runs. */
|
|
48
48
|
function StatusDot({ status }) {
|
|
49
49
|
return React.createElement("span", { className: `ta-status ta-status-${status}` });
|
|
50
50
|
}
|
|
51
|
-
function Output({ text }) {
|
|
52
|
-
const t = (0, use_t_1.useT)();
|
|
53
|
-
const [open, setOpen] = React.useState(false);
|
|
54
|
-
// The new line at the end of an output is not a line to show.
|
|
55
|
-
const trimmed = text.replace(/\n+$/, '');
|
|
56
|
-
const { text: shown, hidden } = open ? { text: trimmed, hidden: 0 } : message_1.MessageUtil.tail(trimmed, OUTPUT_LINES);
|
|
57
|
-
return (React.createElement("div", { className: "ta-output" },
|
|
58
|
-
hidden > 0 && (React.createElement("button", { type: "button", className: "ta-link ta-more", onClick: () => setOpen(true) },
|
|
59
|
-
React.createElement(icon_1.Icon, { icon: lucide_react_1.ChevronUp, size: 13 }),
|
|
60
|
-
" ",
|
|
61
|
-
t('ta.tool.earlier', { count: hidden }))),
|
|
62
|
-
React.createElement("pre", null, shown)));
|
|
63
|
-
}
|
|
64
51
|
/** One step in one line: a dot for its state and what it does; a click opens what it did. */
|
|
65
52
|
function ToolRow({ name, args, status, trailing, details }) {
|
|
66
53
|
const t = (0, use_t_1.useT)();
|
|
@@ -84,9 +71,12 @@ function ToolRow({ name, args, status, trailing, details }) {
|
|
|
84
71
|
/** What a call of a tool did, under its line once opened: the output, the diff, the file it wrote. */
|
|
85
72
|
function details(name, args, output, status) {
|
|
86
73
|
var _a;
|
|
74
|
+
if (name === 'agent_tool') {
|
|
75
|
+
return (0, tool_result_1.agentToolDetails)(args, output);
|
|
76
|
+
}
|
|
87
77
|
const text = message_1.MessageUtil.text(output === null || output === void 0 ? void 0 : output.content);
|
|
88
78
|
if (status === 'error') {
|
|
89
|
-
return text && React.createElement(Output, { text: text });
|
|
79
|
+
return text && React.createElement(tool_result_1.Output, { text: text });
|
|
90
80
|
}
|
|
91
81
|
switch (name) {
|
|
92
82
|
case 'edit': {
|
|
@@ -94,9 +84,9 @@ function details(name, args, output, status) {
|
|
|
94
84
|
return diff && React.createElement(diff_view_1.DiffView, { diff: diff });
|
|
95
85
|
}
|
|
96
86
|
case 'write':
|
|
97
|
-
return typeof args.content === 'string' && args.content && React.createElement(Output, { text: args.content });
|
|
87
|
+
return typeof args.content === 'string' && args.content && React.createElement(tool_result_1.Output, { text: args.content });
|
|
98
88
|
default:
|
|
99
|
-
return text && React.createElement(Output, { text: text });
|
|
89
|
+
return text && React.createElement(tool_result_1.Output, { text: text });
|
|
100
90
|
}
|
|
101
91
|
}
|
|
102
92
|
/** One call of a tool, in one line that opens to what it did. */
|
|
@@ -128,7 +118,7 @@ function CodemodeView({ id, args, output, status, runs }) {
|
|
|
128
118
|
const calls = tool_1.ToolUtil.nestedCalls(id, output, runs);
|
|
129
119
|
const script = (React.createElement(React.Fragment, null,
|
|
130
120
|
React.createElement(markdown_1.CodeBlock, { code: code, language: "js" }),
|
|
131
|
-
result && React.createElement(Output, { text: result })));
|
|
121
|
+
result && React.createElement(tool_result_1.Output, { text: result })));
|
|
132
122
|
const label = t(showScript ? 'ta.tool.hideScript' : 'ta.tool.showScript');
|
|
133
123
|
const toggle = calls.length > 0 && (React.createElement("button", { type: "button", className: `ta-tool-script ${showScript ? 'ta-on' : ''}`, title: label, "aria-label": label, "aria-pressed": showScript, onClick: () => setShowScript(!showScript) },
|
|
134
124
|
React.createElement(icon_1.Icon, { icon: lucide_react_1.FileCode2, size: 13 })));
|
|
@@ -138,7 +128,7 @@ function CodemodeView({ id, args, output, status, runs }) {
|
|
|
138
128
|
const rows = calls.length ? calls.map(nestedRow) : [{ name: 'codemode', args, status, details: script }];
|
|
139
129
|
// A script that failed after its calls went well: one more step, the script, whose output says what went wrong.
|
|
140
130
|
if (calls.length && status === 'error' && !calls.some(call => call.status === 'error')) {
|
|
141
|
-
rows.push({ name: 'codemode', args: { code }, status: 'error', details: result ? React.createElement(Output, { text: result }) : undefined });
|
|
131
|
+
rows.push({ name: 'codemode', args: { code }, status: 'error', details: result ? React.createElement(tool_result_1.Output, { text: result }) : undefined });
|
|
142
132
|
}
|
|
143
133
|
return (React.createElement("div", { className: "ta-tool-group" },
|
|
144
134
|
rows.map((row, index) => (React.createElement(ToolRow, { key: index, ...row, trailing: index === 0 ? toggle || undefined : undefined }))),
|
|
@@ -147,7 +137,7 @@ function CodemodeView({ id, args, output, status, runs }) {
|
|
|
147
137
|
function nestedRow(call) {
|
|
148
138
|
var _a;
|
|
149
139
|
const shown = details(call.name, call.args, (_a = call.run) === null || _a === void 0 ? void 0 : _a.result, call.status);
|
|
150
|
-
const error = call.status === 'error' && call.error ? React.createElement(Output, { text: call.error }) : undefined;
|
|
140
|
+
const error = call.status === 'error' && call.error ? React.createElement(tool_result_1.Output, { text: call.error }) : undefined;
|
|
151
141
|
return { name: call.name, args: call.args, status: call.status, details: shown || error || undefined };
|
|
152
142
|
}
|
|
153
143
|
//# sourceMappingURL=tool-view.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type StopTime, type StopTiming } from './stop-times';
|
|
2
|
+
/** What keeps the timing of a stop pressed in the box of `sessionId`, shown in `view`. */
|
|
3
|
+
export declare function useStopTimes(sessionId: string, view: StopTime['view']): (timing: StopTiming) => void;
|
|
4
|
+
//# sourceMappingURL=use-stop-times.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.useStopTimes = useStopTimes;
|
|
37
|
+
const react_1 = require("@celljs/react");
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const device_1 = require("../device/device");
|
|
40
|
+
const hooks_1 = require("../hooks");
|
|
41
|
+
const state_protocol_1 = require("../state/state-protocol");
|
|
42
|
+
const stop_times_1 = require("./stop-times");
|
|
43
|
+
/** What keeps the timing of a stop pressed in the box of `sessionId`, shown in `view`. */
|
|
44
|
+
function useStopTimes(sessionId, view) {
|
|
45
|
+
var _a;
|
|
46
|
+
const state = (0, react_1.useInject)(state_protocol_1.TaState);
|
|
47
|
+
const device = (0, device_1.useDevice)(device => (device.handheld ? 'phone' : device.touch ? 'tablet' : 'desktop'));
|
|
48
|
+
const [{ hosts, host }] = (0, hooks_1.useWorkbench)();
|
|
49
|
+
const credential = (_a = hosts.find(saved => saved.id === host)) === null || _a === void 0 ? void 0 : _a.credential;
|
|
50
|
+
const link = credential && 'pairing' in credential ? 'relay' : 'direct';
|
|
51
|
+
return React.useCallback((timing) => state.set(stop_times_1.STOP_TIMES, stop_times_1.StopTimeUtil.add(state.get(stop_times_1.STOP_TIMES), { ...timing, session: sessionId.slice(0, 8), view, device, link })), [state, sessionId, view, device, link]);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=use-stop-times.js.map
|
|
@@ -37,6 +37,7 @@ exports.WebComposer = WebComposer;
|
|
|
37
37
|
const React = __importStar(require("react"));
|
|
38
38
|
const use_t_1 = require("../i18n/use-t");
|
|
39
39
|
const composer_1 = require("../util/composer");
|
|
40
|
+
const composer_addon_util_1 = require("./composer-addon-util");
|
|
40
41
|
const composer_box_1 = require("./composer-box");
|
|
41
42
|
const directory_commands_1 = require("./directory-commands");
|
|
42
43
|
const folder_picker_1 = require("./folder-picker");
|
|
@@ -57,6 +58,6 @@ function WebComposer({ notices, placeholder, onSend, mentions, mentionLabel, act
|
|
|
57
58
|
detail: mention.detail,
|
|
58
59
|
})),
|
|
59
60
|
}
|
|
60
|
-
: undefined, mentionLabel: mentions ? mentionLabel : undefined, actions: actions, head: onPickCwd && listDirectory && React.createElement(folder_picker_1.DirectoryButton, { cwd: cwd || serverCwd || '', list: listDirectory, remote: remote, onPick: onPickCwd }), cwd: cwd || serverCwd, working: working, onStop: onStop, voiceSends: voiceSends, onTalkSent: onTalkSent, onListening: onListening, after: after, onError: cause => notices.error(cause) }));
|
|
61
|
+
: undefined, mentionLabel: mentions ? mentionLabel : undefined, actions: actions === null || actions === void 0 ? void 0 : actions.map(section => section.map(composer_addon_util_1.ComposerAddonUtil.action)), head: onPickCwd && listDirectory && React.createElement(folder_picker_1.DirectoryButton, { cwd: cwd || serverCwd || '', list: listDirectory, remote: remote, onPick: onPickCwd }), cwd: cwd || serverCwd, working: working, onStop: onStop, voiceSends: voiceSends, onTalkSent: onTalkSent, onListening: onListening, after: after, onError: cause => notices.error(cause) }));
|
|
61
62
|
}
|
|
62
63
|
//# sourceMappingURL=web-composer.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The photos of the device, picked in the library itself as WeChat's Album does: the Ta app on iOS opens it at once
|
|
3
|
+
* (PHPicker, which asks for no permission), where a file field shows a menu first (Photo Library, Take Photo,
|
|
4
|
+
* Choose File). A browser has no such picker: the message box uses its file field there.
|
|
5
|
+
*/
|
|
6
|
+
export declare namespace PhotoPicker {
|
|
7
|
+
/** Whether the library opens at once here. */
|
|
8
|
+
function available(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Up to `limit` photos, in the order picked; none when the user cancels. Not timed out: the user takes the time
|
|
11
|
+
* they need, and a pick started again ends the one before with none.
|
|
12
|
+
*/
|
|
13
|
+
function pick(limit: number): Promise<File[]>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=photo-picker.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PhotoPicker = void 0;
|
|
4
|
+
const recent_shots_1 = require("./recent-shots");
|
|
5
|
+
/**
|
|
6
|
+
* The photos of the device, picked in the library itself as WeChat's Album does: the Ta app on iOS opens it at once
|
|
7
|
+
* (PHPicker, which asks for no permission), where a file field shows a menu first (Photo Library, Take Photo,
|
|
8
|
+
* Choose File). A browser has no such picker: the message box uses its file field there.
|
|
9
|
+
*/
|
|
10
|
+
var PhotoPicker;
|
|
11
|
+
(function (PhotoPicker) {
|
|
12
|
+
let next = 0;
|
|
13
|
+
function native() {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
return (_b = (_a = globalThis.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers) === null || _b === void 0 ? void 0 : _b.taShots;
|
|
16
|
+
}
|
|
17
|
+
/** Whether the library opens at once here. */
|
|
18
|
+
function available() {
|
|
19
|
+
return native() !== undefined;
|
|
20
|
+
}
|
|
21
|
+
PhotoPicker.available = available;
|
|
22
|
+
/**
|
|
23
|
+
* Up to `limit` photos, in the order picked; none when the user cancels. Not timed out: the user takes the time
|
|
24
|
+
* they need, and a pick started again ends the one before with none.
|
|
25
|
+
*/
|
|
26
|
+
function pick(limit) {
|
|
27
|
+
const photos = native();
|
|
28
|
+
if (!photos) {
|
|
29
|
+
return Promise.resolve([]);
|
|
30
|
+
}
|
|
31
|
+
const id = `p${++next}`;
|
|
32
|
+
return new Promise(resolve => {
|
|
33
|
+
const onEvent = (event) => {
|
|
34
|
+
const detail = event.detail;
|
|
35
|
+
if ((detail === null || detail === void 0 ? void 0 : detail.id) !== id) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
globalThis.removeEventListener(recent_shots_1.RecentShots.EVENT, onEvent);
|
|
39
|
+
const images = Array.isArray(detail.images) ? detail.images : [];
|
|
40
|
+
resolve(images
|
|
41
|
+
.filter((image) => typeof image === 'string')
|
|
42
|
+
.map((image, index) => recent_shots_1.RecentShots.file(image, `photo-${index + 1}`))
|
|
43
|
+
.filter((file) => file !== undefined));
|
|
44
|
+
};
|
|
45
|
+
globalThis.addEventListener(recent_shots_1.RecentShots.EVENT, onEvent);
|
|
46
|
+
photos.postMessage({ id, action: 'pick', limit: Math.max(1, limit) });
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
PhotoPicker.pick = pick;
|
|
50
|
+
})(PhotoPicker || (exports.PhotoPicker = PhotoPicker = {}));
|
|
51
|
+
//# sourceMappingURL=photo-picker.js.map
|
|
@@ -33,6 +33,8 @@ export declare namespace RowSwipeUtil {
|
|
|
33
33
|
* of how many there are: 1 for the first, less for those after).
|
|
34
34
|
*/
|
|
35
35
|
function shift(offset: number, width: number, share: number): number;
|
|
36
|
+
/** Whether a touch at `x`, on a screen `width` wide, is at an edge a sheet comes from (`sides`: the root's `data-edge-swipe`), which rows leave to it. */
|
|
37
|
+
function atSheetEdge(sides: string | undefined, x: number, width: number): boolean;
|
|
36
38
|
/** Whether the move so far is the row's (more sideways than down, to the left unless open); undefined until it is told. */
|
|
37
39
|
function claims(dx: number, dy: number, open: boolean): boolean | undefined;
|
|
38
40
|
}
|
|
@@ -103,6 +103,13 @@ var RowSwipeUtil;
|
|
|
103
103
|
return (width + offset) * share;
|
|
104
104
|
}
|
|
105
105
|
RowSwipeUtil.shift = shift;
|
|
106
|
+
/** Whether a touch at `x`, on a screen `width` wide, is at an edge a sheet comes from (`sides`: the root's `data-edge-swipe`), which rows leave to it. */
|
|
107
|
+
function atSheetEdge(sides, x, width) {
|
|
108
|
+
var _a;
|
|
109
|
+
const list = (_a = sides === null || sides === void 0 ? void 0 : sides.split(' ')) !== null && _a !== void 0 ? _a : [];
|
|
110
|
+
return (list.includes('right') && x >= width - sheet_swipe_1.SwipeUtil.EDGE_PX) || (list.includes('left') && x <= sheet_swipe_1.SwipeUtil.EDGE_PX);
|
|
111
|
+
}
|
|
112
|
+
RowSwipeUtil.atSheetEdge = atSheetEdge;
|
|
106
113
|
/** Whether the move so far is the row's (more sideways than down, to the left unless open); undefined until it is told. */
|
|
107
114
|
function claims(dx, dy, open) {
|
|
108
115
|
if (Math.hypot(dx, dy) < sheet_swipe_1.SwipeUtil.SLOP_PX) {
|
|
@@ -245,8 +252,7 @@ function useRowSwipe(ref, enabled) {
|
|
|
245
252
|
const touch = event.touches[0];
|
|
246
253
|
claimed = undefined;
|
|
247
254
|
// A swipe from the edge a sheet comes from is the sheet's (useSheetSwipe's edgeOver), not the row's.
|
|
248
|
-
const
|
|
249
|
-
const edge = !!touch && (side === 'right' ? touch.clientX >= window.innerWidth - sheet_swipe_1.SwipeUtil.EDGE_PX : side === 'left' && touch.clientX <= sheet_swipe_1.SwipeUtil.EDGE_PX);
|
|
255
|
+
const edge = !!touch && RowSwipeUtil.atSheetEdge(document.documentElement.dataset.edgeSwipe, touch.clientX, window.innerWidth);
|
|
250
256
|
// A game in the row slides for itself (OwnGestures).
|
|
251
257
|
start =
|
|
252
258
|
touch && !edge && !own_gestures_1.OwnGestures.within(event.target) && finger.follow(event, row)
|
|
@@ -191,7 +191,7 @@ export interface SheetSwipeOptions extends SheetSwipe {
|
|
|
191
191
|
scrim?: string;
|
|
192
192
|
/**
|
|
193
193
|
* Over these (rows a finger swipes, SwipeRow), a sheet that opens from anywhere opens only from the edge:
|
|
194
|
-
* the row has the swipe. The root then carries `data-edge-swipe` (the
|
|
194
|
+
* the row has the swipe. The root then carries `data-edge-swipe` (the sides, as a list), whose edges rows leave to it.
|
|
195
195
|
*/
|
|
196
196
|
edgeOver?: string;
|
|
197
197
|
/** What the root's `data-sheet-drag` says while the finger moves it, for styles that tell one sheet from another. */
|
|
@@ -706,13 +706,27 @@ function useSheetSwipe(options) {
|
|
|
706
706
|
from.doc.addEventListener('touchstart', begin, { passive: true });
|
|
707
707
|
return () => from.doc.removeEventListener('touchstart', begin);
|
|
708
708
|
});
|
|
709
|
-
|
|
709
|
+
// Of the sheets of both sides (the board, the workbench), each says its own.
|
|
710
|
+
const edge = latest.current.edgeOver ? latest.current.side : undefined;
|
|
711
|
+
const sides = (change) => {
|
|
712
|
+
var _a;
|
|
713
|
+
const next = change(((_a = root.dataset.edgeSwipe) !== null && _a !== void 0 ? _a : '').split(' ').filter(Boolean));
|
|
714
|
+
if (next.length) {
|
|
715
|
+
root.dataset.edgeSwipe = next.join(' ');
|
|
716
|
+
}
|
|
717
|
+
else {
|
|
718
|
+
delete root.dataset.edgeSwipe;
|
|
719
|
+
}
|
|
720
|
+
};
|
|
710
721
|
if (edge) {
|
|
711
|
-
|
|
722
|
+
sides(list => [...list, edge]);
|
|
712
723
|
}
|
|
713
724
|
return () => {
|
|
714
725
|
if (edge) {
|
|
715
|
-
|
|
726
|
+
sides(list => {
|
|
727
|
+
const at = list.indexOf(edge);
|
|
728
|
+
return at < 0 ? list : [...list.slice(0, at), ...list.slice(at + 1)];
|
|
729
|
+
});
|
|
716
730
|
}
|
|
717
731
|
sources.dispose();
|
|
718
732
|
finger.stop();
|
|
@@ -15,7 +15,9 @@ export declare const ChatIcons: React.Context<{
|
|
|
15
15
|
/** The avatars that web extensions registered for the sessions of their groups. */
|
|
16
16
|
export declare const SessionAvatars: React.Context<Record<string, React.ComponentType<import("./web-extension-api").WebAvatarProps>>>;
|
|
17
17
|
/** What web extensions add to the menu of a conversation of a list (WebExtensionAPI.registerSessionMenu). */
|
|
18
|
-
export declare const SessionMenus: React.Context<import("./web-
|
|
18
|
+
export declare const SessionMenus: React.Context<import("./web-api-contributions").WebSessionMenu[]>;
|
|
19
|
+
/** The web extensions loaded: what a message one of their packages sent as the user calls it (TaMessageSource). */
|
|
20
|
+
export declare const LoadedExtensions: React.Context<import("./web-extension-protocol").LoadedWebExtension[]>;
|
|
19
21
|
interface BoundaryProps {
|
|
20
22
|
name: string;
|
|
21
23
|
/** A new value (a new component) tries again after a failure. */
|
|
@@ -33,11 +33,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.ExtensionBoundary = exports.SessionMenus = exports.SessionAvatars = exports.ChatIcons = exports.ToolRenderers = exports.MessageRenderers = void 0;
|
|
36
|
+
exports.ExtensionBoundary = exports.LoadedExtensions = exports.SessionMenus = exports.SessionAvatars = exports.ChatIcons = exports.ToolRenderers = exports.MessageRenderers = void 0;
|
|
37
37
|
exports.CustomMessage = CustomMessage;
|
|
38
|
+
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
38
39
|
const React = __importStar(require("react"));
|
|
39
40
|
const callout_1 = require("../components/callout");
|
|
40
41
|
const markdown_1 = require("../components/markdown");
|
|
42
|
+
const message_footer_1 = require("../components/message-footer");
|
|
41
43
|
const use_t_1 = require("../i18n/use-t");
|
|
42
44
|
const message_1 = require("../util/message");
|
|
43
45
|
/** The renderers of custom messages that web extensions registered. */
|
|
@@ -50,6 +52,8 @@ exports.ChatIcons = React.createContext({ entries: [], version: 0 });
|
|
|
50
52
|
exports.SessionAvatars = React.createContext({});
|
|
51
53
|
/** What web extensions add to the menu of a conversation of a list (WebExtensionAPI.registerSessionMenu). */
|
|
52
54
|
exports.SessionMenus = React.createContext([]);
|
|
55
|
+
/** The web extensions loaded: what a message one of their packages sent as the user calls it (TaMessageSource). */
|
|
56
|
+
exports.LoadedExtensions = React.createContext([]);
|
|
53
57
|
/** What a web extension draws: when it throws, it says so in its place and the page goes on. */
|
|
54
58
|
class ExtensionBoundary extends React.Component {
|
|
55
59
|
constructor() {
|
|
@@ -83,6 +87,9 @@ function ExtensionError({ name, error }) {
|
|
|
83
87
|
/** A custom message of pi: with the renderer of its type, or as text when it is to be shown. */
|
|
84
88
|
function CustomMessage({ message }) {
|
|
85
89
|
const Renderer = React.useContext(exports.MessageRenderers)[message.customType];
|
|
90
|
+
if (message.customType === ta_protocol_1.TA_RESUME_MESSAGE) {
|
|
91
|
+
return React.createElement(message_footer_1.ResumeBreak, null);
|
|
92
|
+
}
|
|
86
93
|
if (Renderer) {
|
|
87
94
|
return (React.createElement(ExtensionBoundary, { name: message.customType, resetKey: Renderer },
|
|
88
95
|
React.createElement(Renderer, { message: message })));
|
|
@@ -5,6 +5,7 @@ const lucide_react_1 = require("lucide-react");
|
|
|
5
5
|
/** The icons a web extension gets as `pi.ui.icons`; names are lucide's. Only add: removing one breaks extensions. */
|
|
6
6
|
exports.WEB_ICONS = Object.freeze({
|
|
7
7
|
AlarmClock: lucide_react_1.AlarmClock,
|
|
8
|
+
Aperture: lucide_react_1.Aperture,
|
|
8
9
|
ArrowDown: lucide_react_1.ArrowDown,
|
|
9
10
|
ArrowLeft: lucide_react_1.ArrowLeft,
|
|
10
11
|
ArrowRight: lucide_react_1.ArrowRight,
|
|
@@ -23,6 +24,7 @@ exports.WEB_ICONS = Object.freeze({
|
|
|
23
24
|
ChevronsUpDown: lucide_react_1.ChevronsUpDown,
|
|
24
25
|
CircleAlert: lucide_react_1.CircleAlert,
|
|
25
26
|
CircleHelp: lucide_react_1.CircleHelp,
|
|
27
|
+
Cloud: lucide_react_1.Cloud,
|
|
26
28
|
Clipboard: lucide_react_1.Clipboard,
|
|
27
29
|
Clock: lucide_react_1.Clock,
|
|
28
30
|
Code: lucide_react_1.Code,
|
|
@@ -33,6 +35,7 @@ exports.WEB_ICONS = Object.freeze({
|
|
|
33
35
|
CornerDownRight: lucide_react_1.CornerDownRight,
|
|
34
36
|
CornerUpLeft: lucide_react_1.CornerUpLeft,
|
|
35
37
|
Crown: lucide_react_1.Crown,
|
|
38
|
+
Database: lucide_react_1.Database,
|
|
36
39
|
Download: lucide_react_1.Download,
|
|
37
40
|
Ellipsis: lucide_react_1.Ellipsis,
|
|
38
41
|
ExternalLink: lucide_react_1.ExternalLink,
|
|
@@ -57,9 +60,13 @@ exports.WEB_ICONS = Object.freeze({
|
|
|
57
60
|
Globe: lucide_react_1.Globe,
|
|
58
61
|
Grip: lucide_react_1.Grip,
|
|
59
62
|
Hash: lucide_react_1.Hash,
|
|
63
|
+
Heart: lucide_react_1.Heart,
|
|
60
64
|
House: lucide_react_1.House,
|
|
61
65
|
Image: lucide_react_1.Image,
|
|
66
|
+
ImagePlus: lucide_react_1.ImagePlus,
|
|
62
67
|
Info: lucide_react_1.Info,
|
|
68
|
+
KeyRound: lucide_react_1.KeyRound,
|
|
69
|
+
Laptop: lucide_react_1.Laptop,
|
|
63
70
|
LayoutDashboard: lucide_react_1.LayoutDashboard,
|
|
64
71
|
Link: lucide_react_1.Link,
|
|
65
72
|
List: lucide_react_1.List,
|
|
@@ -77,6 +84,7 @@ exports.WEB_ICONS = Object.freeze({
|
|
|
77
84
|
MessagesSquare: lucide_react_1.MessagesSquare,
|
|
78
85
|
Mic: lucide_react_1.Mic,
|
|
79
86
|
Minus: lucide_react_1.Minus,
|
|
87
|
+
MonitorSmartphone: lucide_react_1.MonitorSmartphone,
|
|
80
88
|
MousePointerClick: lucide_react_1.MousePointerClick,
|
|
81
89
|
PackageOpen: lucide_react_1.PackageOpen,
|
|
82
90
|
Paperclip: lucide_react_1.Paperclip,
|
|
@@ -88,6 +96,7 @@ exports.WEB_ICONS = Object.freeze({
|
|
|
88
96
|
Power: lucide_react_1.Power,
|
|
89
97
|
Puzzle: lucide_react_1.Puzzle,
|
|
90
98
|
QrCode: lucide_react_1.QrCode,
|
|
99
|
+
Radar: lucide_react_1.Radar,
|
|
91
100
|
RefreshCw: lucide_react_1.RefreshCw,
|
|
92
101
|
Regex: lucide_react_1.Regex,
|
|
93
102
|
Replace: lucide_react_1.Replace,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Part of the web extension API (web-extension-api.ts, which exports it all): the props of the components of `ui`. */
|
|
2
2
|
import type * as React from 'react';
|
|
3
|
-
import type { TextSelection } from './web-extension-api';
|
|
3
|
+
import type { TextSelection, WebIcon } from './web-extension-api';
|
|
4
4
|
export interface WebModelPickerProps {
|
|
5
5
|
/** The directory whose settings give the models and the default; default: that of ta serve. */
|
|
6
6
|
cwd?: string;
|
|
@@ -175,6 +175,24 @@ export interface WebDialogProps {
|
|
|
175
175
|
onClose(): void;
|
|
176
176
|
children?: React.ReactNode;
|
|
177
177
|
}
|
|
178
|
+
export interface WebFaceProps {
|
|
179
|
+
/** One of the 16 faces; else that of `seed`. */
|
|
180
|
+
face?: number;
|
|
181
|
+
seed?: string;
|
|
182
|
+
size: number;
|
|
183
|
+
/** At work: the eyes look about. */
|
|
184
|
+
working?: boolean;
|
|
185
|
+
/** A dot at its corner: green online, grey not; none without. Its ring is `--ta-face-ring` (the page's colour). */
|
|
186
|
+
online?: boolean;
|
|
187
|
+
}
|
|
188
|
+
export interface WebGroupFaceProps {
|
|
189
|
+
members: readonly {
|
|
190
|
+
face?: number;
|
|
191
|
+
seed?: string;
|
|
192
|
+
working?: boolean;
|
|
193
|
+
}[];
|
|
194
|
+
size: number;
|
|
195
|
+
}
|
|
178
196
|
export interface WebStackProps {
|
|
179
197
|
/** The page under it. */
|
|
180
198
|
base: React.ReactNode;
|
|
@@ -248,8 +266,8 @@ export interface WebComposerProps {
|
|
|
248
266
|
export interface WebComposerAction {
|
|
249
267
|
key: string;
|
|
250
268
|
label: string;
|
|
251
|
-
/** On the left: an icon of 16 pixels, or an avatar. */
|
|
252
|
-
icon?: React.ReactNode;
|
|
269
|
+
/** On the left: an icon of 16 pixels, or an avatar; an icon of `ui.icons` as it is is drawn at 16 pixels. */
|
|
270
|
+
icon?: React.ReactNode | WebIcon;
|
|
253
271
|
/** After the label of a setting, quieter: its value now; on a tile, shown on hover. */
|
|
254
272
|
detail?: string;
|
|
255
273
|
disabled?: boolean;
|