@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
|
@@ -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
|
|
@@ -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
|
|
@@ -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,10 +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,
|
|
63
68
|
KeyRound: lucide_react_1.KeyRound,
|
|
69
|
+
Laptop: lucide_react_1.Laptop,
|
|
64
70
|
LayoutDashboard: lucide_react_1.LayoutDashboard,
|
|
65
71
|
Link: lucide_react_1.Link,
|
|
66
72
|
List: lucide_react_1.List,
|
|
@@ -78,6 +84,7 @@ exports.WEB_ICONS = Object.freeze({
|
|
|
78
84
|
MessagesSquare: lucide_react_1.MessagesSquare,
|
|
79
85
|
Mic: lucide_react_1.Mic,
|
|
80
86
|
Minus: lucide_react_1.Minus,
|
|
87
|
+
MonitorSmartphone: lucide_react_1.MonitorSmartphone,
|
|
81
88
|
MousePointerClick: lucide_react_1.MousePointerClick,
|
|
82
89
|
PackageOpen: lucide_react_1.PackageOpen,
|
|
83
90
|
Paperclip: lucide_react_1.Paperclip,
|
|
@@ -89,6 +96,7 @@ exports.WEB_ICONS = Object.freeze({
|
|
|
89
96
|
Power: lucide_react_1.Power,
|
|
90
97
|
Puzzle: lucide_react_1.Puzzle,
|
|
91
98
|
QrCode: lucide_react_1.QrCode,
|
|
99
|
+
Radar: lucide_react_1.Radar,
|
|
92
100
|
RefreshCw: lucide_react_1.RefreshCw,
|
|
93
101
|
Regex: lucide_react_1.Regex,
|
|
94
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;
|
|
@@ -266,8 +266,8 @@ export interface WebComposerProps {
|
|
|
266
266
|
export interface WebComposerAction {
|
|
267
267
|
key: string;
|
|
268
268
|
label: string;
|
|
269
|
-
/** On the left: an icon of 16 pixels, or an avatar. */
|
|
270
|
-
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;
|
|
271
271
|
/** After the label of a setting, quieter: its value now; on a tile, shown on hover. */
|
|
272
272
|
detail?: string;
|
|
273
273
|
disabled?: boolean;
|
|
@@ -25,7 +25,10 @@ export interface WebSettingsSection {
|
|
|
25
25
|
/** A row of the settings of an extension: a label and a description as Ta's rows have, and its control. */
|
|
26
26
|
export interface WebSettingRow {
|
|
27
27
|
key: string;
|
|
28
|
+
/** Empty for a row that is all control (a panel that says what it is itself); still found by `search`. */
|
|
28
29
|
label: WebLabel;
|
|
30
|
+
/** More words the search of the settings finds it by. */
|
|
31
|
+
search?: WebLabel;
|
|
29
32
|
description?: WebLabel;
|
|
30
33
|
/** The control, beside the label; with `stacked`, under it, for a wide one (a model picker, a list). */
|
|
31
34
|
render: React.ComponentType;
|
|
@@ -101,6 +104,11 @@ export interface WebView {
|
|
|
101
104
|
discover?: boolean;
|
|
102
105
|
/** A page: the line a list shows under its name, as a messenger does — the last thing said there, and when. */
|
|
103
106
|
preview?(): WebViewPreview | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* A page under Discover: a small mark at the end of its row, as WeChat shows the face of the friend who posted last
|
|
109
|
+
* by Moments. Nothing to count; nothing, when there is nothing new.
|
|
110
|
+
*/
|
|
111
|
+
mark?: React.ComponentType;
|
|
104
112
|
/** A page: whoever is there answers now; a list that shows it marks it so, as a conversation answering. */
|
|
105
113
|
busy?(): boolean;
|
|
106
114
|
/** What `preview` or `busy` gives changed: the lists read it again. */
|
|
@@ -130,6 +138,36 @@ export interface WebShareTarget {
|
|
|
130
138
|
/** Of a package of this computer (listPackages, or one of its web extensions), handed on through the relay. */
|
|
131
139
|
packageId?: string;
|
|
132
140
|
}
|
|
141
|
+
/** How far something goes on its own: `act` does it, the rest asks the user first (WebInitiative). */
|
|
142
|
+
export type WebInitiativeLevel = 'off' | 'digest' | 'ask' | 'act';
|
|
143
|
+
/** A kind of thing the page does for the user that may need their go (the double starting a task). */
|
|
144
|
+
export interface WebInitiativeKind {
|
|
145
|
+
/** `<area>.<verb>`: `double.start-task`. */
|
|
146
|
+
id: string;
|
|
147
|
+
title: {
|
|
148
|
+
en: string;
|
|
149
|
+
zh: string;
|
|
150
|
+
};
|
|
151
|
+
/** What it does can be taken back: one that cannot never goes past `ask`. */
|
|
152
|
+
reversible: boolean;
|
|
153
|
+
/** Where it starts. */
|
|
154
|
+
level: WebInitiativeLevel;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* How far the page goes on its own with what it does for the user, as an extension that keeps the user's trust
|
|
158
|
+
* answers (WebExtensionAPI.registerInitiative): asked first or not, from what the user answered before. Without one,
|
|
159
|
+
* the settings of the page say.
|
|
160
|
+
*/
|
|
161
|
+
export interface WebInitiative {
|
|
162
|
+
/** Where the kind is now; it is defined the first time. */
|
|
163
|
+
level(kind: WebInitiativeKind): Promise<WebInitiativeLevel>;
|
|
164
|
+
/** The user chose, in a setting of the page: kept there; `null` gives it back. */
|
|
165
|
+
setLevel(kind: WebInitiativeKind, level: WebInitiativeLevel | null): Promise<void>;
|
|
166
|
+
/** What the user answered when asked: it moves the level. */
|
|
167
|
+
record(kind: WebInitiativeKind, outcome: 'accepted' | 'declined', title: string): Promise<void>;
|
|
168
|
+
/** A level may have changed. */
|
|
169
|
+
subscribe?(listener: () => void): () => void;
|
|
170
|
+
}
|
|
133
171
|
/** A conversation of the lists, as a {@link WebChatIconSource} reads it: open, or saved in its file. */
|
|
134
172
|
export interface WebChat {
|
|
135
173
|
/** Its file; none for a new one that has said nothing yet. */
|
|
@@ -302,6 +340,23 @@ export interface WebToolRenderer {
|
|
|
302
340
|
* `next()` is what the resolvers after it would use, so `next() ?? mine` only fills in.
|
|
303
341
|
*/
|
|
304
342
|
export type WebToolRendererResolver = (toolName: string, next: () => WebToolRenderer | undefined) => WebToolRenderer | undefined;
|
|
343
|
+
/**
|
|
344
|
+
* A conversation that waits for the user to decide (ui.useAsks): its last turn asked and they did not answer or let it
|
|
345
|
+
* go, or a dialog of it waits for an answer.
|
|
346
|
+
*/
|
|
347
|
+
export interface WebAsk {
|
|
348
|
+
/** Its session file: `openChat` shows it; the id of its session before it has one. */
|
|
349
|
+
sessionFile: string;
|
|
350
|
+
/** Its session, while it is open. */
|
|
351
|
+
sessionId?: string;
|
|
352
|
+
cwd: string;
|
|
353
|
+
/** As the list of chats names it. */
|
|
354
|
+
title: string;
|
|
355
|
+
/** What it asks, on one line (TaSessionInfo.asking); none for a dialog that waits, whose words are in it. */
|
|
356
|
+
question?: string;
|
|
357
|
+
/** When it asked: the latest first. */
|
|
358
|
+
at: number;
|
|
359
|
+
}
|
|
305
360
|
/**
|
|
306
361
|
* A piece of work handed out on the user's behalf. `waiting`: it cannot go on without the user (a question,
|
|
307
362
|
* its turn in a channel); what has ended is `done`, `failed` or `stopped`.
|
|
@@ -356,6 +411,18 @@ export interface WebCodeRendererProps {
|
|
|
356
411
|
language: string;
|
|
357
412
|
/** False while the reply still streams it: the code may stop anywhere. */
|
|
358
413
|
closed: boolean;
|
|
414
|
+
/**
|
|
415
|
+
* Sends words as the user to the conversation the block is in (after its turn, if it works): a choice in it
|
|
416
|
+
* answered with a tap. None where no conversation holds the block (`ui.Markdown` of a page). Newer than some
|
|
417
|
+
* Ta apps, whose props have no `send`: there `pi.sendUserMessage` reaches the conversation shown.
|
|
418
|
+
*/
|
|
419
|
+
send?: (text: string) => Promise<void>;
|
|
420
|
+
/**
|
|
421
|
+
* What the user said after the reply the block is in, once they did: a choice it offers was made (the words sent
|
|
422
|
+
* by `send`, or typed). None while they did not answer, and where no conversation holds the block. Newer than
|
|
423
|
+
* some Ta apps.
|
|
424
|
+
*/
|
|
425
|
+
answer?: string;
|
|
359
426
|
}
|
|
360
427
|
export interface WebCustomMessage {
|
|
361
428
|
role: 'custom';
|
|
@@ -391,5 +458,57 @@ export interface WebSessionNotice {
|
|
|
391
458
|
label: string;
|
|
392
459
|
run(): void;
|
|
393
460
|
}[];
|
|
461
|
+
/** What it is about when it is no conversation's (a room asks for a permission): in place of a conversation's name. */
|
|
462
|
+
title?: string;
|
|
463
|
+
/**
|
|
464
|
+
* A view a tap opens (`<extension name>/<view name>`), for news of an extension that is no conversation's: the
|
|
465
|
+
* extension shows it on the page itself, so the page tells of it only by a notice of the system while away.
|
|
466
|
+
*/
|
|
467
|
+
view?: string;
|
|
468
|
+
}
|
|
469
|
+
/** Lines and columns of a file, from 1: a line, a place in it, or a range. */
|
|
470
|
+
export interface TextSelection {
|
|
471
|
+
startLine: number;
|
|
472
|
+
startColumn?: number;
|
|
473
|
+
endLine?: number;
|
|
474
|
+
endColumn?: number;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* What a link of a reply points to, once the page knows it is there: a file or a directory of `cwd`
|
|
478
|
+
* (`path` relative to it, `''` for `cwd` itself), or a page of the web, opened inside Ta.
|
|
479
|
+
*/
|
|
480
|
+
export type WebLink = {
|
|
481
|
+
type: 'file';
|
|
482
|
+
cwd: string;
|
|
483
|
+
path: string;
|
|
484
|
+
selection?: TextSelection;
|
|
485
|
+
} | {
|
|
486
|
+
type: 'directory';
|
|
487
|
+
cwd: string;
|
|
488
|
+
path: string;
|
|
489
|
+
} | {
|
|
490
|
+
type: 'url';
|
|
491
|
+
url: string;
|
|
492
|
+
};
|
|
493
|
+
/** True when it opened the link; false leaves it to the next opener. */
|
|
494
|
+
export type WebOpener = (link: WebLink) => boolean | Promise<boolean>;
|
|
495
|
+
export interface WebOpenerOptions {
|
|
496
|
+
/**
|
|
497
|
+
* It opens some links only, of its own (a link of a share): it is asked before the others, and for links that
|
|
498
|
+
* go out of Ta too (one scanned, opened with Cmd or Ctrl, pasted in Quick open), which the others are not.
|
|
499
|
+
*/
|
|
500
|
+
specific?: boolean;
|
|
501
|
+
}
|
|
502
|
+
/** A conversation as a list shows it: an open one has its session, one kept on the disk its file only. */
|
|
503
|
+
export interface WebSessionRef {
|
|
504
|
+
sessionId?: string;
|
|
505
|
+
sessionFile?: string;
|
|
506
|
+
cwd: string;
|
|
507
|
+
/** As the list names it. */
|
|
508
|
+
title: string;
|
|
509
|
+
/** TaSessionInfo.group. */
|
|
510
|
+
group?: string;
|
|
394
511
|
}
|
|
512
|
+
/** The entries an extension adds to the menu of a conversation of a list (registerSessionMenu); none for some. */
|
|
513
|
+
export type WebSessionMenu = (session: WebSessionRef) => WebMenuItem[];
|
|
395
514
|
//# sourceMappingURL=web-api-contributions.d.ts.map
|