@celljs/ta-web 4.15.0 → 4.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/browser/components/access-view.d.ts +6 -0
- package/esm/browser/components/access-view.js +4 -4
- package/esm/browser/components/account-menu.js +8 -1
- package/esm/browser/components/app-view.js +8 -1
- package/esm/browser/components/environment-view.js +9 -2
- package/esm/browser/components/face.js +7 -2
- package/esm/browser/components/gallery.d.ts +9 -0
- package/esm/browser/components/gallery.js +57 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/lightbox.d.ts +8 -1
- package/esm/browser/components/lightbox.js +4 -1
- package/esm/browser/components/markdown.js +6 -1
- package/esm/browser/components/media.d.ts +12 -2
- package/esm/browser/components/media.js +55 -13
- package/esm/browser/components/message-list.js +3 -2
- package/esm/browser/components/notice-center.js +6 -2
- package/esm/browser/components/serve-restart.d.ts +26 -0
- package/esm/browser/components/serve-restart.js +91 -0
- package/esm/browser/components/session-view.js +19 -11
- package/esm/browser/components/settings-parts.js +18 -6
- package/esm/browser/extension/icons.js +3 -1
- package/esm/browser/extension/web-extension-protocol.d.ts +6 -0
- package/esm/browser/extension/web-extensions.d.ts +3 -0
- package/esm/browser/extension/web-extensions.js +7 -0
- package/esm/browser/gateway/console-extension.d.ts +20 -0
- package/esm/browser/gateway/console-extension.js +75 -0
- package/esm/browser/gateway/console-parts.d.ts +62 -0
- package/esm/browser/gateway/console-parts.js +271 -0
- package/esm/browser/gateway/console-tenant.d.ts +22 -0
- package/esm/browser/gateway/console-tenant.js +286 -0
- package/esm/browser/gateway/console-util.d.ts +59 -0
- package/esm/browser/gateway/console-util.js +187 -0
- package/esm/browser/gateway/console-view.d.ts +2 -0
- package/esm/browser/gateway/console-view.js +218 -0
- package/esm/browser/i18n/locales.d.ts +186 -3
- package/esm/browser/i18n/messages-ja.js +183 -0
- package/esm/browser/i18n/messages-zh-tw.js +183 -0
- package/esm/browser/i18n/messages.d.ts +183 -0
- package/esm/browser/i18n/messages.js +366 -0
- package/esm/browser/index.d.ts +3 -0
- package/esm/browser/index.js +3 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +18 -0
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +2 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +140 -0
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +2 -0
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +1 -0
- package/esm/browser/util/desktop.d.ts +6 -1
- package/esm/browser/util/desktop.js +10 -0
- package/esm/browser/util/gallery.d.ts +18 -0
- package/esm/browser/util/gallery.js +123 -0
- package/esm/browser/util/link.d.ts +8 -0
- package/esm/browser/util/link.js +14 -0
- package/esm/browser/util/markdown.d.ts +11 -0
- package/esm/browser/util/markdown.js +4 -0
- package/esm/browser/util/thumbnail.d.ts +18 -0
- package/esm/browser/util/thumbnail.js +26 -0
- package/esm/browser/workbench-protocol.d.ts +8 -0
- package/esm/browser/workbench.d.ts +16 -0
- package/esm/browser/workbench.js +67 -0
- package/lib/browser/components/access-view.d.ts +6 -0
- package/lib/browser/components/access-view.js +5 -4
- package/lib/browser/components/account-menu.js +7 -0
- package/lib/browser/components/app-view.js +8 -1
- package/lib/browser/components/environment-view.js +9 -2
- package/lib/browser/components/face.js +7 -2
- package/lib/browser/components/gallery.d.ts +10 -0
- package/lib/browser/components/gallery.js +93 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/lightbox.d.ts +8 -1
- package/lib/browser/components/lightbox.js +4 -1
- package/lib/browser/components/markdown.js +6 -1
- package/lib/browser/components/media.d.ts +12 -2
- package/lib/browser/components/media.js +57 -13
- package/lib/browser/components/message-list.js +3 -2
- package/lib/browser/components/notice-center.js +6 -2
- package/lib/browser/components/serve-restart.d.ts +27 -0
- package/lib/browser/components/serve-restart.js +129 -0
- package/lib/browser/components/session-view.js +21 -13
- package/lib/browser/components/settings-parts.js +17 -5
- package/lib/browser/extension/icons.js +2 -0
- package/lib/browser/extension/web-extension-protocol.d.ts +6 -0
- package/lib/browser/extension/web-extensions.d.ts +3 -0
- package/lib/browser/extension/web-extensions.js +7 -0
- package/lib/browser/gateway/console-extension.d.ts +21 -0
- package/lib/browser/gateway/console-extension.js +111 -0
- package/lib/browser/gateway/console-parts.d.ts +63 -0
- package/lib/browser/gateway/console-parts.js +315 -0
- package/lib/browser/gateway/console-tenant.d.ts +23 -0
- package/lib/browser/gateway/console-tenant.js +327 -0
- package/lib/browser/gateway/console-util.d.ts +60 -0
- package/lib/browser/gateway/console-util.js +190 -0
- package/lib/browser/gateway/console-view.d.ts +3 -0
- package/lib/browser/gateway/console-view.js +254 -0
- package/lib/browser/i18n/locales.d.ts +186 -3
- package/lib/browser/i18n/messages-ja.js +183 -0
- package/lib/browser/i18n/messages-zh-tw.js +183 -0
- package/lib/browser/i18n/messages.d.ts +183 -0
- package/lib/browser/i18n/messages.js +366 -0
- package/lib/browser/index.d.ts +3 -0
- package/lib/browser/index.js +3 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +18 -0
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +2 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +140 -0
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +2 -0
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +1 -0
- package/lib/browser/util/desktop.d.ts +6 -1
- package/lib/browser/util/desktop.js +10 -0
- package/lib/browser/util/gallery.d.ts +19 -0
- package/lib/browser/util/gallery.js +126 -0
- package/lib/browser/util/link.d.ts +8 -0
- package/lib/browser/util/link.js +14 -0
- package/lib/browser/util/markdown.d.ts +11 -0
- package/lib/browser/util/markdown.js +4 -0
- package/lib/browser/util/thumbnail.d.ts +19 -0
- package/lib/browser/util/thumbnail.js +29 -0
- package/lib/browser/workbench-protocol.d.ts +8 -0
- package/lib/browser/workbench.d.ts +16 -0
- package/lib/browser/workbench.js +67 -0
- package/package.json +7 -7
|
@@ -110,6 +110,7 @@ function SessionToast({ notice, leaving, leave, hold, }) {
|
|
|
110
110
|
React.createElement(icon_1.IconButton, { icon: lucide_react_1.X, label: t('ta.dismiss'), className: "ta-toast-close", onClick: leave })));
|
|
111
111
|
}
|
|
112
112
|
function Toast({ notice, notices }) {
|
|
113
|
+
var _a;
|
|
113
114
|
const t = (0, use_t_1.useT)();
|
|
114
115
|
const [leaving, setLeaving] = React.useState(false);
|
|
115
116
|
const leave = React.useCallback(() => {
|
|
@@ -130,11 +131,14 @@ function Toast({ notice, notices }) {
|
|
|
130
131
|
notice.count)),
|
|
131
132
|
notice.detail && React.createElement("div", { className: "ta-toast-detail" }, notice.detail),
|
|
132
133
|
notice.art && React.createElement(terminal_art_1.TerminalArt, { art: notice.art, className: "ta-toast-art", label: t('ta.notice.picture') }),
|
|
133
|
-
notice.action
|
|
134
|
+
((_a = notice.actions) === null || _a === void 0 ? void 0 : _a.length) ? (React.createElement("div", { className: "ta-toast-actions" }, [...notice.actions, ...(notice.action ? [notice.action] : [])].map(action => (React.createElement("button", { key: action.label, type: "button", className: "ta-toast-action", onClick: () => {
|
|
135
|
+
action.run();
|
|
136
|
+
leave();
|
|
137
|
+
} }, action.label))))) : (notice.action && (React.createElement("button", { type: "button", className: "ta-toast-action", onClick: () => {
|
|
134
138
|
var _a;
|
|
135
139
|
(_a = notice.action) === null || _a === void 0 ? void 0 : _a.run();
|
|
136
140
|
leave();
|
|
137
|
-
} }, notice.action.label))),
|
|
141
|
+
} }, notice.action.label)))),
|
|
138
142
|
React.createElement(icon_1.IconButton, { icon: lucide_react_1.X, label: t('ta.dismiss'), className: "ta-toast-close", onClick: leave })));
|
|
139
143
|
}
|
|
140
144
|
function ConfirmDialog({ request, notices }) {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TaServerInfo, TaServerUpdate } from '@celljs/ta-protocol';
|
|
2
|
+
export declare namespace ServeRestartUtil {
|
|
3
|
+
/** `v4.16.0`, with the commit of a build of the development channel: `v4.16.0 (695fbe1)`. */
|
|
4
|
+
function label(build: {
|
|
5
|
+
version: string;
|
|
6
|
+
build?: string;
|
|
7
|
+
}): string;
|
|
8
|
+
function key(update: TaServerUpdate): string;
|
|
9
|
+
/** Whether the page may restart Ta: the owner, of a Ta service that can restart itself. */
|
|
10
|
+
function restartable(server: TaServerInfo | undefined): boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface RestartTa {
|
|
13
|
+
/** The page may restart Ta. */
|
|
14
|
+
can: boolean;
|
|
15
|
+
restarting: boolean;
|
|
16
|
+
/** Another build installed, which a restart runs. */
|
|
17
|
+
update?: TaServerUpdate;
|
|
18
|
+
/** Asks the user first, unless they already said so (the button of the notice of an update). */
|
|
19
|
+
restart(ask?: boolean): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export declare function useRestartTa(): RestartTa;
|
|
22
|
+
/**
|
|
23
|
+
* Tells of what restarting Ta is about, in a corner: another build installed (an update of Ta Desktop, `npm i -g`, a
|
|
24
|
+
* build of the repository), with Restart and Later, once for each build; Ta restarting, then back with its version.
|
|
25
|
+
*/
|
|
26
|
+
export declare function ServeRestartNotices(): null;
|
|
27
|
+
//# sourceMappingURL=serve-restart.d.ts.map
|
|
@@ -0,0 +1,129 @@
|
|
|
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.ServeRestartUtil = void 0;
|
|
37
|
+
exports.useRestartTa = useRestartTa;
|
|
38
|
+
exports.ServeRestartNotices = ServeRestartNotices;
|
|
39
|
+
const React = __importStar(require("react"));
|
|
40
|
+
const hooks_1 = require("../hooks");
|
|
41
|
+
const use_t_1 = require("../i18n/use-t");
|
|
42
|
+
const workbench_util_1 = require("../workbench-util");
|
|
43
|
+
/** The build installed that the user put off restarting for (Later): not asked about again on this device. */
|
|
44
|
+
const LATER_KEY = 'ta.update.later';
|
|
45
|
+
var ServeRestartUtil;
|
|
46
|
+
(function (ServeRestartUtil) {
|
|
47
|
+
/** `v4.16.0`, with the commit of a build of the development channel: `v4.16.0 (695fbe1)`. */
|
|
48
|
+
function label(build) {
|
|
49
|
+
return `v${build.version}${build.build ? ` (${build.build})` : ''}`;
|
|
50
|
+
}
|
|
51
|
+
ServeRestartUtil.label = label;
|
|
52
|
+
function key(update) {
|
|
53
|
+
var _a;
|
|
54
|
+
return `${update.version}+${(_a = update.build) !== null && _a !== void 0 ? _a : ''}`;
|
|
55
|
+
}
|
|
56
|
+
ServeRestartUtil.key = key;
|
|
57
|
+
/** Whether the page may restart Ta: the owner, of a Ta service that can restart itself. */
|
|
58
|
+
function restartable(server) {
|
|
59
|
+
return !!server && !server.member && server.restartable === true;
|
|
60
|
+
}
|
|
61
|
+
ServeRestartUtil.restartable = restartable;
|
|
62
|
+
})(ServeRestartUtil || (exports.ServeRestartUtil = ServeRestartUtil = {}));
|
|
63
|
+
function useRestartTa() {
|
|
64
|
+
const t = (0, use_t_1.useT)();
|
|
65
|
+
const [{ server, restarting }, workbench] = (0, hooks_1.useWorkbench)();
|
|
66
|
+
const [, notices] = (0, hooks_1.useNotices)();
|
|
67
|
+
const restart = React.useCallback(async (ask = true) => {
|
|
68
|
+
if (ask && !(await notices.confirm({ title: t('ta.restart.confirm'), message: t('ta.restart.detail'), confirmLabel: t('ta.restart') }))) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
await workbench.restartServer().catch(error => notices.error(error));
|
|
72
|
+
}, [t, notices, workbench]);
|
|
73
|
+
const can = ServeRestartUtil.restartable(server);
|
|
74
|
+
return { can, restarting: !!restarting, update: can ? server === null || server === void 0 ? void 0 : server.update : undefined, restart };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Tells of what restarting Ta is about, in a corner: another build installed (an update of Ta Desktop, `npm i -g`, a
|
|
78
|
+
* build of the repository), with Restart and Later, once for each build; Ta restarting, then back with its version.
|
|
79
|
+
*/
|
|
80
|
+
function ServeRestartNotices() {
|
|
81
|
+
const t = (0, use_t_1.useT)();
|
|
82
|
+
const [{ server }] = (0, hooks_1.useWorkbench)();
|
|
83
|
+
const [, notices] = (0, hooks_1.useNotices)();
|
|
84
|
+
const { update, restarting, restart } = useRestartTa();
|
|
85
|
+
const told = React.useRef(undefined);
|
|
86
|
+
const key = update && ServeRestartUtil.key(update);
|
|
87
|
+
React.useEffect(() => {
|
|
88
|
+
var _a, _b;
|
|
89
|
+
if (!update || !key || restarting || ((_a = told.current) === null || _a === void 0 ? void 0 : _a.key) === key || ((_b = (0, workbench_util_1.storage)()) === null || _b === void 0 ? void 0 : _b.getItem(LATER_KEY)) === key) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
told.current = {
|
|
93
|
+
key,
|
|
94
|
+
id: notices.notify(t('ta.update.ready', { version: ServeRestartUtil.label(update) }), {
|
|
95
|
+
detail: t('ta.update.readyDetail'),
|
|
96
|
+
key: 'ta-serve-update',
|
|
97
|
+
sticky: true,
|
|
98
|
+
actions: [{ label: t('ta.update.later'), run: () => { var _a; return (_a = (0, workbench_util_1.storage)()) === null || _a === void 0 ? void 0 : _a.setItem(LATER_KEY, key); } }],
|
|
99
|
+
action: { label: t('ta.restart'), run: () => void restart(false) },
|
|
100
|
+
}),
|
|
101
|
+
};
|
|
102
|
+
}, [update, key, restarting, notices, restart, t]);
|
|
103
|
+
React.useEffect(() => {
|
|
104
|
+
// Restarted, or put in place some other way: nothing to restart for any more.
|
|
105
|
+
if (!key && told.current) {
|
|
106
|
+
notices.dismiss(told.current.id);
|
|
107
|
+
told.current = undefined;
|
|
108
|
+
}
|
|
109
|
+
}, [key, notices]);
|
|
110
|
+
const restartingId = React.useRef(undefined);
|
|
111
|
+
// Read once the restart ended: a server read again meanwhile says nothing.
|
|
112
|
+
const serverNow = React.useRef(server);
|
|
113
|
+
serverNow.current = server;
|
|
114
|
+
React.useEffect(() => {
|
|
115
|
+
if (restarting) {
|
|
116
|
+
restartingId.current = notices.notify(t('ta.restart.restarting'), { key: 'ta-serve-restart', sticky: true });
|
|
117
|
+
}
|
|
118
|
+
else if (restartingId.current !== undefined) {
|
|
119
|
+
notices.dismiss(restartingId.current);
|
|
120
|
+
restartingId.current = undefined;
|
|
121
|
+
const back = serverNow.current;
|
|
122
|
+
if (back) {
|
|
123
|
+
notices.notify(t('ta.restart.done', { version: ServeRestartUtil.label(back) }), { level: 'success', key: 'ta-serve-restart' });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}, [restarting, notices, t]);
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=serve-restart.js.map
|
|
@@ -43,8 +43,10 @@ const files_protocol_1 = require("../files/files-protocol");
|
|
|
43
43
|
const hooks_1 = require("../hooks");
|
|
44
44
|
const use_t_1 = require("../i18n/use-t");
|
|
45
45
|
const code_renderers_1 = require("../markdown/code-renderers");
|
|
46
|
+
const link_1 = require("../util/link");
|
|
46
47
|
const message_1 = require("../util/message");
|
|
47
48
|
const terminal_text_1 = require("../util/terminal-text");
|
|
49
|
+
const thumbnail_1 = require("../util/thumbnail");
|
|
48
50
|
const workbench_protocol_1 = require("../workbench-protocol");
|
|
49
51
|
const chat_asks_1 = require("./chat-asks");
|
|
50
52
|
const composer_1 = require("./composer");
|
|
@@ -54,7 +56,7 @@ const conversation_scroll_hooks_1 = require("./conversation-scroll-hooks");
|
|
|
54
56
|
const dialog_view_1 = require("./dialog-view");
|
|
55
57
|
const earlier_messages_1 = require("./earlier-messages");
|
|
56
58
|
const grow_box_1 = require("./grow-box");
|
|
57
|
-
const
|
|
59
|
+
const link_2 = require("./link");
|
|
58
60
|
const media_1 = require("./media");
|
|
59
61
|
const message_actions_1 = require("./message-actions");
|
|
60
62
|
const message_footer_1 = require("./message-footer");
|
|
@@ -65,14 +67,17 @@ const terminal_art_1 = require("./terminal-art");
|
|
|
65
67
|
const use_stop_times_1 = require("./use-stop-times");
|
|
66
68
|
/**
|
|
67
69
|
* What the extensions of the session say with `notify` goes to the notices of the page; what was said before it
|
|
68
|
-
* opened stays quiet. A picture in it (a QR code to sign in) is drawn,
|
|
69
|
-
* session, which says how it went or
|
|
70
|
+
* opened stays quiet. A picture in it (a QR code to sign in) is drawn, a web address in it (a page to sign in on)
|
|
71
|
+
* is a button that opens it, and either stays until the next notice of the session, which says how it went or
|
|
72
|
+
* brings a new one.
|
|
70
73
|
*/
|
|
71
74
|
function useSessionNotices(store, notices) {
|
|
75
|
+
const t = (0, use_t_1.useT)();
|
|
72
76
|
const [, center] = (0, hooks_1.useNotices)();
|
|
77
|
+
const openLink = (0, hooks_1.useOpenLink)(undefined);
|
|
73
78
|
// Of the store shown: one that took the place of another (attached for what the device showed) starts quiet too.
|
|
74
79
|
const seen = React.useRef(undefined);
|
|
75
|
-
const
|
|
80
|
+
const lasting = React.useRef(undefined);
|
|
76
81
|
React.useEffect(() => {
|
|
77
82
|
var _a;
|
|
78
83
|
if (((_a = seen.current) === null || _a === void 0 ? void 0 : _a.store) !== store) {
|
|
@@ -82,16 +87,19 @@ function useSessionNotices(store, notices) {
|
|
|
82
87
|
for (const notice of notices) {
|
|
83
88
|
if (!seen.current.ids.has(notice.id)) {
|
|
84
89
|
seen.current.ids.add(notice.id);
|
|
85
|
-
if (
|
|
86
|
-
center.dismiss(
|
|
87
|
-
|
|
90
|
+
if (lasting.current !== undefined) {
|
|
91
|
+
center.dismiss(lasting.current);
|
|
92
|
+
lasting.current = undefined;
|
|
88
93
|
}
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
|
|
94
|
+
const art = terminal_text_1.TerminalText.art(notice.message);
|
|
95
|
+
const { text, url } = link_1.LinkUtil.noticeLink(art.text);
|
|
96
|
+
const action = url ? { label: t('ta.notice.openLink'), run: () => openLink({ type: 'url', url }, false) } : undefined;
|
|
97
|
+
const keep = art.art !== undefined || url !== undefined;
|
|
98
|
+
const id = center.notify(text, { level: notice.type, art: art.art, action, sticky: keep });
|
|
99
|
+
lasting.current = keep ? id : undefined;
|
|
92
100
|
}
|
|
93
101
|
}
|
|
94
|
-
}, [store, notices, center]);
|
|
102
|
+
}, [store, notices, center, t, openLink]);
|
|
95
103
|
}
|
|
96
104
|
/** What an extension shows above or below the message box (`setWidget`): its lines as a terminal draws them, a picture in them drawn. */
|
|
97
105
|
function WidgetView({ lines }) {
|
|
@@ -159,7 +167,7 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
|
|
|
159
167
|
}
|
|
160
168
|
}, [draftText]);
|
|
161
169
|
const files = (0, react_1.useInject)(files_protocol_1.TaFiles);
|
|
162
|
-
const fileUrl = React.useCallback(async (path) => files.loadable(await workspace.fileUrl(path, cwd)), [workspace, cwd, files]);
|
|
170
|
+
const fileUrl = React.useCallback(async (path, box) => files.loadable(thumbnail_1.ThumbnailUtil.boxed(await workspace.fileUrl(path, cwd), box)), [workspace, cwd, files]);
|
|
163
171
|
const namedPaths = React.useCallback(() => message_1.MessageUtil.namedPaths(store.state.messages), [store]);
|
|
164
172
|
const openLink = (0, hooks_1.useOpenLink)(cwd, namedPaths);
|
|
165
173
|
// biome-ignore lint/correctness/useExhaustiveDependencies: runs when a run starts or settles
|
|
@@ -202,7 +210,7 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
|
|
|
202
210
|
React.createElement(message_list_1.ConversationSession.Provider, { value: info },
|
|
203
211
|
React.createElement(message_footer_1.MessageActions.Provider, { value: messageActions },
|
|
204
212
|
React.createElement(media_1.FileUrls.Provider, { value: fileUrl },
|
|
205
|
-
React.createElement(
|
|
213
|
+
React.createElement(link_2.OpenLink.Provider, { value: openLink },
|
|
206
214
|
React.createElement(message_list_1.MessageImages.Provider, { value: images },
|
|
207
215
|
React.createElement(code_renderers_1.CodeReply.Provider, { value: reply },
|
|
208
216
|
React.createElement(message_list_1.MessageList, { state: state, outbox: outbox, rows: rows }))))))))),
|
|
@@ -55,6 +55,7 @@ const launch_settings_1 = require("./launch-settings");
|
|
|
55
55
|
const model_picker_1 = require("./model-picker");
|
|
56
56
|
const relay_services_1 = require("./relay-services");
|
|
57
57
|
const remote_hosts_1 = require("./remote-hosts");
|
|
58
|
+
const serve_restart_1 = require("./serve-restart");
|
|
58
59
|
const settings_controls_1 = require("./settings-controls");
|
|
59
60
|
const sign_in_setup_1 = require("./sign-in-setup");
|
|
60
61
|
const trusted_domains_1 = require("./trusted-domains");
|
|
@@ -77,6 +78,7 @@ function useParts(scope, onScope, onClose, onDialog) {
|
|
|
77
78
|
const access = (0, access_view_1.useAccess)();
|
|
78
79
|
const signInConfig = (0, sign_in_setup_1.useSignInConfig)();
|
|
79
80
|
const gateway = (0, environment_view_1.useGateway)();
|
|
81
|
+
const restartTa = (0, serve_restart_1.useRestartTa)();
|
|
80
82
|
// As the menu of the account (useAccountEntries): a finger has no keys to learn; a phone is not the computer
|
|
81
83
|
// that pairs phones, and signs out at the foot of Me.
|
|
82
84
|
const touch = (0, device_1.useDevice)(device => device.touch);
|
|
@@ -274,7 +276,10 @@ function useParts(scope, onScope, onClose, onDialog) {
|
|
|
274
276
|
title: t('ta.packages.builtinTitle'),
|
|
275
277
|
icon: lucide_react_1.Blocks,
|
|
276
278
|
rows: [
|
|
277
|
-
|
|
279
|
+
// The console only for administrators of a gateway, where it shows.
|
|
280
|
+
...host.builtins
|
|
281
|
+
.filter(builtin => { var _a; return !builtin.gatewayAdmin || ((_a = gateway.info) === null || _a === void 0 ? void 0 : _a.admin); })
|
|
282
|
+
.map(builtin => { var _a; return (0, settings_controls_1.row)(`web:${builtin.name}`, [t(builtin.title), t(builtin.description), t('ta.packages.builtinTitle')], React.createElement(settings_controls_1.Row, { icon: (_a = builtin.icon) !== null && _a !== void 0 ? _a : lucide_react_1.Puzzle, label: t(builtin.title), description: t(builtin.description) },
|
|
278
283
|
React.createElement(settings_controls_1.Switch, { label: t(builtin.title), checked: !settings.builtinsOff.includes(builtin.name), onChange: on => toggleBuiltin(builtin.name, on) }))); }),
|
|
279
284
|
...builtinPackages.map(info => {
|
|
280
285
|
const { title, summary, icon } = (0, settings_choices_1.packageLabel)(info, language);
|
|
@@ -353,10 +358,17 @@ function useParts(scope, onScope, onClose, onDialog) {
|
|
|
353
358
|
icon: lucide_react_1.Info,
|
|
354
359
|
rows: workbench.server
|
|
355
360
|
? [
|
|
356
|
-
(0, settings_controls_1.row)('version', [t('ta.settings.version'), 'version'], React.createElement(settings_controls_1.Row, { label: t('ta.settings.version') },
|
|
357
|
-
React.createElement("span", { className: "ta-path" },
|
|
358
|
-
|
|
359
|
-
|
|
361
|
+
(0, settings_controls_1.row)('version', [t('ta.settings.version'), 'version'], React.createElement(settings_controls_1.Row, { label: t('ta.settings.version'), description: restartTa.update && t('ta.update.ready', { version: serve_restart_1.ServeRestartUtil.label(restartTa.update) }) },
|
|
362
|
+
React.createElement("span", { className: "ta-path" }, serve_restart_1.ServeRestartUtil.label(workbench.server)))),
|
|
363
|
+
...(restartTa.can
|
|
364
|
+
? [
|
|
365
|
+
(0, settings_controls_1.row)('restart', [t('ta.restart'), t('ta.restart.description'), 'restart', 'update'], React.createElement(settings_controls_1.Row, { label: t('ta.restart'), description: t('ta.restart.description') },
|
|
366
|
+
React.createElement("button", { type: "button", className: `ta-button${restartTa.update ? ' ta-primary' : ''}`, disabled: restartTa.restarting, onClick: () => void restartTa.restart() },
|
|
367
|
+
restartTa.restarting ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(icon_1.Icon, { icon: lucide_react_1.RotateCw, size: 15 }),
|
|
368
|
+
' ',
|
|
369
|
+
t('ta.restart.button')))),
|
|
370
|
+
]
|
|
371
|
+
: []),
|
|
360
372
|
(0, settings_controls_1.row)('cwd', [t('ta.settings.cwd'), workbench.server.cwd], React.createElement(settings_controls_1.Row, { label: t('ta.settings.cwd'), description: t('ta.settings.cwdDescription', { path: workbench.server.cwd }) },
|
|
361
373
|
React.createElement("button", { type: "button", className: "ta-button", onClick: () => onDialog('directory') },
|
|
362
374
|
React.createElement(icon_1.Icon, { icon: lucide_react_1.FolderOpen, size: 15 }),
|
|
@@ -15,8 +15,10 @@ exports.WEB_ICONS = Object.freeze({
|
|
|
15
15
|
BellOff: lucide_react_1.BellOff,
|
|
16
16
|
BookOpen: lucide_react_1.BookOpen,
|
|
17
17
|
Bot: lucide_react_1.Bot,
|
|
18
|
+
Box: lucide_react_1.Box,
|
|
18
19
|
Building2: lucide_react_1.Building2,
|
|
19
20
|
CaseSensitive: lucide_react_1.CaseSensitive,
|
|
21
|
+
ChartSpline: lucide_react_1.ChartSpline,
|
|
20
22
|
Check: lucide_react_1.Check,
|
|
21
23
|
ChevronDown: lucide_react_1.ChevronDown,
|
|
22
24
|
ChevronRight: lucide_react_1.ChevronRight,
|
|
@@ -15,6 +15,8 @@ export interface BuiltinWebExtension {
|
|
|
15
15
|
readonly description: MessageId;
|
|
16
16
|
/** Shown before its title in the settings. */
|
|
17
17
|
readonly icon?: WebIcon;
|
|
18
|
+
/** Only for administrators of a gateway (`ta gateway`): listed in the settings there alone. */
|
|
19
|
+
readonly gatewayAdmin?: boolean;
|
|
18
20
|
readonly activate: WebExtensionFactory;
|
|
19
21
|
}
|
|
20
22
|
export interface LoadedWebExtension {
|
|
@@ -271,5 +273,9 @@ export interface TaWebExtensions {
|
|
|
271
273
|
setSessionSwitcher(switcher: WebSessionSwitcher | undefined): void;
|
|
272
274
|
/** How the page shows a session as the conversation, once it said (setSessionSwitcher). */
|
|
273
275
|
sessionSwitcher(): WebSessionSwitcher | undefined;
|
|
276
|
+
/** What `openSettings` does: the shell opens the settings at a section; `undefined` until it can. */
|
|
277
|
+
setSettingsOpener(opener: ((section?: string) => void) | undefined): void;
|
|
278
|
+
/** The settings, at a section (`access`) of them, from a page of the page's own (the console). */
|
|
279
|
+
openSettings(section?: string): void;
|
|
274
280
|
}
|
|
275
281
|
//# sourceMappingURL=web-extension-protocol.d.ts.map
|
|
@@ -39,6 +39,7 @@ export declare class TaWebExtensionsImpl implements TaWebExtensions {
|
|
|
39
39
|
protected readonly listeners: Set<(state: WebExtensionsState) => void>;
|
|
40
40
|
protected conversation?: WebExtensionConversation;
|
|
41
41
|
protected switcher?: WebSessionSwitcher;
|
|
42
|
+
protected settingsOpener?: (section?: string) => void;
|
|
42
43
|
protected refreshing: Promise<boolean>;
|
|
43
44
|
/** The extensions of the list of the last time have started (startKept), once. */
|
|
44
45
|
protected keptStarted: boolean;
|
|
@@ -92,6 +93,8 @@ export declare class TaWebExtensionsImpl implements TaWebExtensions {
|
|
|
92
93
|
connect(conversation: WebExtensionConversation | undefined): void;
|
|
93
94
|
setConversationShown(shown: boolean): void;
|
|
94
95
|
setSessionSwitcher(switcher: WebSessionSwitcher | undefined): void;
|
|
96
|
+
setSettingsOpener(opener: ((section?: string) => void) | undefined): void;
|
|
97
|
+
openSettings(section?: string): void;
|
|
95
98
|
sessionSwitcher(): WebSessionSwitcher | undefined;
|
|
96
99
|
emit(event: TaEvent): void;
|
|
97
100
|
protected reconcile(): Promise<boolean>;
|
|
@@ -287,6 +287,13 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl {
|
|
|
287
287
|
setSessionSwitcher(switcher) {
|
|
288
288
|
this.switcher = switcher;
|
|
289
289
|
}
|
|
290
|
+
setSettingsOpener(opener) {
|
|
291
|
+
this.settingsOpener = opener;
|
|
292
|
+
}
|
|
293
|
+
openSettings(section) {
|
|
294
|
+
var _a;
|
|
295
|
+
(_a = this.settingsOpener) === null || _a === void 0 ? void 0 : _a.call(this, section);
|
|
296
|
+
}
|
|
290
297
|
sessionSwitcher() {
|
|
291
298
|
return this.switcher;
|
|
292
299
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { WebExtensionAPI } from '../extension/web-extension-api';
|
|
2
|
+
import { BuiltinWebExtension } from '../extension/web-extension-protocol';
|
|
3
|
+
import { TaWorkbench } from '../workbench-protocol';
|
|
4
|
+
export declare const CONSOLE_EXTENSION = "gateway";
|
|
5
|
+
export declare const CONSOLE_VIEW = "console";
|
|
6
|
+
/** The page of the console, as `openView` takes it. */
|
|
7
|
+
export declare const CONSOLE_VIEW_ID = "gateway/console";
|
|
8
|
+
/**
|
|
9
|
+
* The console of a gateway (`ta gateway`), as a built-in web extension: a page for its administrators alone,
|
|
10
|
+
* of everyone's Ta on it. Behind no gateway, or for anyone else, it adds nothing.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ConsoleWebExtension implements BuiltinWebExtension {
|
|
13
|
+
readonly name = "gateway";
|
|
14
|
+
readonly title = "ta.console.title";
|
|
15
|
+
readonly description = "ta.console.hint";
|
|
16
|
+
readonly icon: import("lucide-react").LucideIcon;
|
|
17
|
+
readonly gatewayAdmin = true;
|
|
18
|
+
protected readonly workbench: TaWorkbench;
|
|
19
|
+
readonly activate: (pi: WebExtensionAPI) => () => void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=console-extension.d.ts.map
|
|
@@ -0,0 +1,111 @@
|
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.ConsoleWebExtension = exports.CONSOLE_VIEW_ID = exports.CONSOLE_VIEW = exports.CONSOLE_EXTENSION = void 0;
|
|
46
|
+
const core_1 = require("@celljs/core");
|
|
47
|
+
const lucide_react_1 = require("lucide-react");
|
|
48
|
+
const React = __importStar(require("react"));
|
|
49
|
+
const web_extension_protocol_1 = require("../extension/web-extension-protocol");
|
|
50
|
+
const messages_1 = require("../i18n/messages");
|
|
51
|
+
const workbench_protocol_1 = require("../workbench-protocol");
|
|
52
|
+
const console_view_1 = require("./console-view");
|
|
53
|
+
exports.CONSOLE_EXTENSION = 'gateway';
|
|
54
|
+
exports.CONSOLE_VIEW = 'console';
|
|
55
|
+
/** The page of the console, as `openView` takes it. */
|
|
56
|
+
exports.CONSOLE_VIEW_ID = `${exports.CONSOLE_EXTENSION}/${exports.CONSOLE_VIEW}`;
|
|
57
|
+
/**
|
|
58
|
+
* The console of a gateway (`ta gateway`), as a built-in web extension: a page for its administrators alone,
|
|
59
|
+
* of everyone's Ta on it. Behind no gateway, or for anyone else, it adds nothing.
|
|
60
|
+
*/
|
|
61
|
+
let ConsoleWebExtension = class ConsoleWebExtension {
|
|
62
|
+
constructor() {
|
|
63
|
+
this.name = exports.CONSOLE_EXTENSION;
|
|
64
|
+
this.title = 'ta.console.title';
|
|
65
|
+
this.description = 'ta.console.hint';
|
|
66
|
+
this.icon = lucide_react_1.Gauge;
|
|
67
|
+
this.gatewayAdmin = true;
|
|
68
|
+
this.activate = (pi) => {
|
|
69
|
+
let registered = false;
|
|
70
|
+
let asking = false;
|
|
71
|
+
let online = false;
|
|
72
|
+
const check = () => {
|
|
73
|
+
const now = this.workbench.state.status === 'online';
|
|
74
|
+
// Asked again on each connection: the gateway, or the account, may be another since.
|
|
75
|
+
if (now && !online && !registered && !asking) {
|
|
76
|
+
asking = true;
|
|
77
|
+
this.workbench.gateway.getGateway().then(info => {
|
|
78
|
+
asking = false;
|
|
79
|
+
if (info.admin && !registered) {
|
|
80
|
+
registered = true;
|
|
81
|
+
pi.registerView(exports.CONSOLE_VIEW, {
|
|
82
|
+
title: () => (0, messages_1.message)(pi.ui.language, 'ta.console.title'),
|
|
83
|
+
icon: lucide_react_1.Gauge,
|
|
84
|
+
render: () => React.createElement(console_view_1.ConsolePage),
|
|
85
|
+
order: 90,
|
|
86
|
+
discover: true,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
// A Ta service without a gateway has no TaGatewayServer.
|
|
91
|
+
() => {
|
|
92
|
+
asking = false;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
online = now;
|
|
96
|
+
};
|
|
97
|
+
const stop = this.workbench.subscribe(check);
|
|
98
|
+
check();
|
|
99
|
+
return stop;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
exports.ConsoleWebExtension = ConsoleWebExtension;
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, core_1.Autowired)(workbench_protocol_1.TaWorkbench),
|
|
106
|
+
__metadata("design:type", Object)
|
|
107
|
+
], ConsoleWebExtension.prototype, "workbench", void 0);
|
|
108
|
+
exports.ConsoleWebExtension = ConsoleWebExtension = __decorate([
|
|
109
|
+
(0, core_1.Component)(web_extension_protocol_1.BuiltinWebExtension)
|
|
110
|
+
], ConsoleWebExtension);
|
|
111
|
+
//# sourceMappingURL=console-extension.js.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { TaGatewayLimits, TaGatewayTenant, TaQuotaState } from '@celljs/ta-protocol';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
/** How often what the console shows is read again while it is seen. */
|
|
4
|
+
export declare const REFRESH_MS = 10000;
|
|
5
|
+
/** Reads `load` now and every `every` ms while the page is seen; again when `key` changes. */
|
|
6
|
+
export declare function usePolled<T>(load: () => Promise<T>, key: unknown, every?: number): {
|
|
7
|
+
value: T | undefined;
|
|
8
|
+
error: string | undefined;
|
|
9
|
+
read: () => Promise<void>;
|
|
10
|
+
readAt: number | undefined;
|
|
11
|
+
};
|
|
12
|
+
export declare function SectionTitle({ children, action }: {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
action?: React.ReactNode;
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
/** A bar that fills: of a limit (amber, then red, as it nears it), or a `part` of a whole, in one color. */
|
|
17
|
+
export declare function Bar({ share, small, part }: {
|
|
18
|
+
share: number;
|
|
19
|
+
small?: boolean;
|
|
20
|
+
part?: boolean;
|
|
21
|
+
}): React.JSX.Element;
|
|
22
|
+
export declare function Meter({ label, value, share, hint }: {
|
|
23
|
+
label: string;
|
|
24
|
+
value: string;
|
|
25
|
+
share?: number;
|
|
26
|
+
hint?: string;
|
|
27
|
+
}): React.JSX.Element;
|
|
28
|
+
export declare function Stat({ value, label, tone, onClick, title, }: {
|
|
29
|
+
value: React.ReactNode;
|
|
30
|
+
label: string;
|
|
31
|
+
tone?: 'good' | 'warn' | 'bad';
|
|
32
|
+
onClick?(): void;
|
|
33
|
+
title?: string;
|
|
34
|
+
}): React.JSX.Element;
|
|
35
|
+
/** This month's minutes and tokens of an account, as bars; the limits of messages and pages in a line. */
|
|
36
|
+
export declare function QuotaMeters({ quota }: {
|
|
37
|
+
quota: TaQuotaState;
|
|
38
|
+
}): React.JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* What agents took over time, of the gateway or of one account: tokens or dollars by hour (a day) or by day (a week,
|
|
41
|
+
* a month), the totals, and the models and accounts that took most.
|
|
42
|
+
*/
|
|
43
|
+
export declare function TrendCard({ tenantId, tenants, onTenant }: {
|
|
44
|
+
tenantId?: string;
|
|
45
|
+
tenants?: TaGatewayTenant[];
|
|
46
|
+
onTenant?(id: string): void;
|
|
47
|
+
}): React.JSX.Element;
|
|
48
|
+
/**
|
|
49
|
+
* Limits to change: the gateway's defaults (`nullable` false: a limit is a number or none), or an account's over them
|
|
50
|
+
* (each the default's, none, or its own). Saved as a whole.
|
|
51
|
+
*/
|
|
52
|
+
export declare function LimitsForm({ value, defaults, providers, nullable, readOnly, onSave, }: {
|
|
53
|
+
value: TaGatewayLimits;
|
|
54
|
+
defaults?: TaGatewayLimits;
|
|
55
|
+
providers: {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
}[];
|
|
59
|
+
nullable: boolean;
|
|
60
|
+
readOnly?: boolean;
|
|
61
|
+
onSave(limits: TaGatewayLimits): Promise<unknown>;
|
|
62
|
+
}): React.JSX.Element;
|
|
63
|
+
//# sourceMappingURL=console-parts.d.ts.map
|