Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Merge origin/dev into feat/deep-view-core

Fei2411a52a123fa341
diff --cc ds-bot/client.js
index f24a3d08,6d5969a5..cd7fe413
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@@ -1423,8 -1440,8 +1441,8 @@@ function bodyOf(def, paint, flat = fals
return "";
}
}
- var eyeMarkup = ([cx, cy, w, h46, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><rect class="bt-eye" x="${-w / 2}" y="${-h46 / 2}" width="${w}" height="${h46}" rx="${w / 2}"/></g>`;
- var happyEyeMarkup = ([cx, cy, w, h46, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><path class="bt-eye-happy" opacity="0" d="M${-w * 0.62} ${h46 * 0.14}Q0 ${-h46 * 0.42} ${w * 0.62} ${h46 * 0.14}" fill="none" stroke="#000" stroke-width="${w * 0.5}" stroke-linecap="round"/></g>`;
-var eyeMarkup = ([cx, cy, w, h45, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><rect class="bt-eye" x="${-w / 2}" y="${-h45 / 2}" width="${w}" height="${h45}" rx="${w / 2}"/></g>`;
-var happyEyeMarkup = ([cx, cy, w, h45, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><path class="bt-eye-happy" opacity="0" d="M${-w * 0.62} ${h45 * 0.14}Q0 ${-h45 * 0.42} ${w * 0.62} ${h45 * 0.14}" fill="none" stroke="#000" stroke-width="${w * 0.5}" stroke-linecap="round"/></g>`;
++var eyeMarkup = ([cx, cy, w, h47, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><rect class="bt-eye" x="${-w / 2}" y="${-h47 / 2}" width="${w}" height="${h47}" rx="${w / 2}"/></g>`;
++var happyEyeMarkup = ([cx, cy, w, h47, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><path class="bt-eye-happy" opacity="0" d="M${-w * 0.62} ${h47 * 0.14}Q0 ${-h47 * 0.42} ${w * 0.62} ${h47 * 0.14}" fill="none" stroke="#000" stroke-width="${w * 0.5}" stroke-linecap="round"/></g>`;
var maskBox = (size) => `maskUnits="userSpaceOnUse" x="${-size}" y="${-size}" width="${size * 3}" height="${size * 3}"`;
var holes = (def, eyes) => `<rect x="${-def.size}" y="${-def.size}" width="${def.size * 3}" height="${def.size * 3}" fill="#fff"/>${eyes}`;
var MASK_ID = "%MASK%";
@@@ -2166,12 -2188,12 +2189,12 @@@ function liveSprings(apply2)
const dt = Math.min(0.5, Math.max(1e-3, (now - last) / 1e3));
last = now;
const steps = Math.ceil(dt * 240);
- const h46 = dt / steps;
- const h45 = dt / steps;
++ const h47 = dt / steps;
let moving = false;
for (const value of values.values()) {
for (let index = 0; index < steps; index += 1) {
- value.v += (-value.k * (value.x - value.to) - value.c * value.v) * h46;
- value.x += value.v * h46;
- value.v += (-value.k * (value.x - value.to) - value.c * value.v) * h45;
- value.x += value.v * h45;
++ value.v += (-value.k * (value.x - value.to) - value.c * value.v) * h47;
++ value.x += value.v * h47;
}
if (Math.abs(value.x - value.to) < 0.05 && Math.abs(value.v) < 1) {
value.x = value.to;
@@@ -7486,9 -7143,10 +7500,10 @@@ function stampOf(card)
const time = Number.isFinite(card.finishedAt) ? card.finishedAt : card.createdAt;
return Number.isFinite(time) ? time : void 0;
}
- function BtwCardView({ card, compact: compact2 = false }) {
+ function BtwCardView({ card, compact: compact2 = false, sessionId, actions, onDeleted }) {
- const [open, setOpen] = (0, import_react12.useState)(card?.status !== "answering");
- const [deleting, setDeleting] = (0, import_react12.useState)(false);
- (0, import_react12.useEffect)(() => {
+ const [open, setOpen] = (0, import_react15.useState)(card?.status !== "answering");
++ const [deleting, setDeleting] = (0, import_react15.useState)(false);
+ (0, import_react15.useEffect)(() => {
if (card?.status && card.status !== "answering") setOpen(true);
}, [card?.status]);
if (!card) return null;
@@@ -7496,19 -7154,31 +7511,31 @@@
const answer = typeof card.answer === "string" ? card.answer : "";
const when3 = stampOf(card);
const answering = card.status === "answering";
+ const remove = async () => {
+ if (deleting) return;
+ setDeleting(true);
+ try {
+ const result = await actions.deleteBtw(card.partId ?? sessionId, card.id);
+ if (result?.deleted) onDeleted?.(card.id);
+ else setDeleting(false);
+ } catch (error) {
+ actions.reportError(error, "btw-delete");
+ setDeleting(false);
+ }
+ };
- return (0, import_react12.createElement)(
+ return (0, import_react15.createElement)(
"div",
{
className: compact2 ? "bt-btw bt-btw-compact" : "bt-btw",
"data-open": open || void 0,
"data-status": card.status,
role: "region",
- "aria-label": t("Side question")
+ "aria-label": t("Side chat")
},
- (0, import_react12.createElement)(
+ (0, import_react15.createElement)(
"div",
{ className: "bt-btw-head" },
- (0, import_react12.createElement)(
+ (0, import_react15.createElement)(
"button",
{
type: "button",
@@@ -7516,19 -7186,29 +7543,29 @@@
"aria-expanded": open,
onClick: () => setOpen((value) => !value)
},
- (0, import_react12.createElement)("span", { className: "bt-btw-chevron", "aria-hidden": true }),
- (0, import_react12.createElement)("span", { className: "bt-btw-q" }, question)
+ (0, import_react15.createElement)("span", { className: "bt-btw-chevron", "aria-hidden": true }),
+ (0, import_react15.createElement)("span", { className: "bt-btw-q" }, question)
),
- when3 !== void 0 ? (0, import_react12.createElement)("time", { className: "bt-btw-time", dateTime: new Date(when3).toISOString() }, messageClock(when3)) : null,
- answering ? (0, import_react12.createElement)("span", { className: "bt-shimmer" }, t("Answering…")) : null,
- card.status === "cancelled" ? (0, import_react12.createElement)("span", { className: "bt-btw-status" }, t("Cancelled")) : null,
- (0, import_react12.createElement)("button", {
+ when3 !== void 0 ? (0, import_react15.createElement)("time", { className: "bt-btw-time", dateTime: new Date(when3).toISOString() }, messageClock(when3)) : null,
+ answering ? (0, import_react15.createElement)("span", { className: "bt-shimmer" }, t("Answering…")) : null,
- card.status === "cancelled" ? (0, import_react15.createElement)("span", { className: "bt-btw-status" }, t("Cancelled")) : null
++ card.status === "cancelled" ? (0, import_react15.createElement)("span", { className: "bt-btw-status" }, t("Cancelled")) : null,
++ (0, import_react15.createElement)("button", {
+ type: "button",
+ className: "bt-icon-btn bt-btw-delete",
+ disabled: deleting,
+ "aria-label": t("Delete side chat"),
+ title: t("Delete side chat"),
+ onClick: () => {
+ void remove();
+ }
- }, (0, import_react12.createElement)(CloseIcon))
++ }, (0, import_react15.createElement)(CloseIcon))
),
- (0, import_react12.createElement)("p", { className: "bt-btw-note" }, t("Answered from progress so far; nothing was run")),
- open ? (0, import_react12.createElement)(
+ (0, import_react15.createElement)("p", { className: "bt-btw-note" }, t("Answered from progress so far; nothing was run")),
+ open ? (0, import_react15.createElement)(
"div",
{ className: "bt-btw-body" },
- card.status === "failed" ? (0, import_react12.createElement)("p", { className: "bt-btw-fail" }, failureText(card)) : null,
- answer !== "" ? (0, import_react12.createElement)("div", { className: "bt-btw-answer" }, (0, import_react12.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: answer, labels: mdLabels2(), variant: "compact" })) : null
+ card.status === "failed" ? (0, import_react15.createElement)("p", { className: "bt-btw-fail" }, failureText(card)) : null,
+ answer !== "" ? (0, import_react15.createElement)("div", { className: "bt-btw-answer" }, (0, import_react15.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: answer, labels: mdLabels2(), variant: "compact" })) : null
) : null
);
}
@@@ -7555,14 -7235,14 +7592,14 @@@ function BtwDock({ sessionId, useRoster
const facts = useTurnFacts(sessionId, actions);
const cards = dockCards(sessionCards(roster, sessionId), facts);
if (cards.length === 0) return null;
- return (0, import_react15.createElement)("div", { className: "bt-btw-dock" }, cards.map((card) => (0, import_react15.createElement)(BtwCardView, { key: card.id, card, compact: true })));
- return (0, import_react12.createElement)("div", { className: "bt-btw-dock" }, cards.map((card) => (0, import_react12.createElement)(BtwCardView, { key: card.id, card, compact: true, sessionId, actions })));
++ return (0, import_react15.createElement)("div", { className: "bt-btw-dock" }, cards.map((card) => (0, import_react15.createElement)(BtwCardView, { key: card.id, card, compact: true, sessionId, actions })));
}
function BtwTurnTail({ turn, sessionId, useRoster, actions }) {
const roster = useRoster((value) => value);
const facts = useTurnFacts(sessionId, actions);
const cards = tailCards(sessionCards(roster, sessionId), turn, facts?.turns);
if (cards.length === 0) return null;
- return (0, import_react15.createElement)("div", { className: "bt-btw-stack" }, cards.map((card) => (0, import_react15.createElement)(BtwCardView, { key: card.id, card })));
- return (0, import_react12.createElement)("div", { className: "bt-btw-stack" }, cards.map((card) => (0, import_react12.createElement)(BtwCardView, { key: card.id, card, sessionId, actions })));
++ return (0, import_react15.createElement)("div", { className: "bt-btw-stack" }, cards.map((card) => (0, import_react15.createElement)(BtwCardView, { key: card.id, card, sessionId, actions })));
}
// src/client/cells.js
@@@ -8054,21 -7734,25 +8091,25 @@@ function EarlierParts({ sessionId, rost
observer.observe(node);
return () => observer.disconnect();
}, [view.cursor, view.loading, view.failed]);
+ const removeBtw = (cardId) => setView((current) => ({
+ ...current,
+ pages: current.pages.map((page) => ({ ...page, btw: page.btw.filter((card) => card?.id !== cardId) }))
+ }));
const items = [];
for (const page of view.pages) items.push(...withBtwRows(page.items, page.btw));
- return (0, import_react13.createElement)(
+ return (0, import_react16.createElement)(
"div",
{ className: "bt-earlier", role: "feed", "aria-label": t("Earlier messages"), "aria-busy": view.loading },
- (0, import_react13.createElement)(
+ (0, import_react16.createElement)(
"div",
{ ref: top, className: "bt-earlier-top" },
- view.loading ? (0, import_react13.createElement)(Shimmer, null, t("Loading earlier messages…")) : view.failed ? (0, import_react13.createElement)("button", { type: "button", className: "bt-soft", onClick: () => load(view.cursor) }, t("Couldn’t load earlier messages · Retry")) : view.cursor ? (0, import_react13.createElement)("button", { type: "button", className: "bt-soft", onClick: () => load(view.cursor) }, t("Load earlier")) : null
+ view.loading ? (0, import_react16.createElement)(Shimmer, null, t("Loading earlier messages…")) : view.failed ? (0, import_react16.createElement)("button", { type: "button", className: "bt-soft", onClick: () => load(view.cursor) }, t("Couldn’t load earlier messages · Retry")) : view.cursor ? (0, import_react16.createElement)("button", { type: "button", className: "bt-soft", onClick: () => load(view.cursor) }, t("Load earlier")) : null
),
- (0, import_react16.createElement)(ChatRows, { items, sessionId, roster, actions }),
- (0, import_react13.createElement)(ChatRows, { items, sessionId, roster, actions, onBtwDelete: removeBtw }),
- (0, import_react13.createElement)(PartLine, { time: view.startedAt })
++ (0, import_react16.createElement)(ChatRows, { items, sessionId, roster, actions, onBtwDelete: removeBtw }),
+ (0, import_react16.createElement)(PartLine, { time: view.startedAt })
);
}
- function ChatRows({ items, sessionId, roster, actions, useUi, clock: clock4 = false }) {
+ function ChatRows({ items, sessionId, roster, actions, useUi, clock: clock4 = false, onBtwDelete }) {
const selfId = roster.byId[sessionId]?.id;
const rows2 = [];
for (const item of items) {
@@@ -8088,32 -7772,32 +8129,32 @@@
}
const pause = clock4 && Number.isFinite(row.time) && (before === void 0 || row.time - before >= SEPARATOR_GAP_MS);
if (Number.isFinite(row.end ?? row.time)) before = row.end ?? row.time;
- return pause ? [(0, import_react13.createElement)("div", { key: `${key}:clock`, className: "bt-time-sep", role: "separator" }, clockLabel(row.time)), shown] : [shown];
+ return pause ? [(0, import_react16.createElement)("div", { key: `${key}:clock`, className: "bt-time-sep", role: "separator" }, clockLabel(row.time)), shown] : [shown];
});
}
- function chatRow(row, key, { sessionId, selfId, roster, actions, useUi }) {
+ function chatRow(row, key, { sessionId, selfId, roster, actions, useUi, onBtwDelete }) {
switch (row.kind) {
case "divider":
- return (0, import_react13.createElement)(PartLine, { key, time: row.time });
+ return (0, import_react16.createElement)(PartLine, { key, time: row.time });
case "user":
- return (0, import_react13.createElement)(EarlierUser, { key, row });
+ return (0, import_react16.createElement)(EarlierUser, { key, row });
case "answer":
- return (0, import_react13.createElement)(AnsweredReply, { key, node: { data: row } });
+ return (0, import_react16.createElement)(AnsweredReply, { key, node: { data: row } });
// A display-only view replays from the blueprint the host kept on the call.
case "view":
- return (0, import_react13.createElement)(WidgetCell, { key, sessionId, callId: row.callId, args: { text: (name) => name === "title" ? row.title : void 0, value: (name) => name === "view" ? row.view : void 0 }, done: true, isError: false, roster, actions });
+ return (0, import_react16.createElement)(WidgetCell, { key, sessionId, callId: row.callId, args: { text: (name) => name === "title" ? row.title : void 0, value: (name) => name === "view" ? row.view : void 0 }, done: true, isError: false, roster, actions });
case "bot": {
- const bubbles = (0, import_react13.createElement)(Bubbles, { key, texts: row.texts, roster, selfId, actions, sessionId: useUi ? sessionId : void 0, msgKey: useUi ? `${sessionId}:${row.time}` : void 0, useUi, fold: FOLD_HUGE });
+ const bubbles = (0, import_react16.createElement)(Bubbles, { key, texts: row.texts, roster, selfId, actions, sessionId: useUi ? sessionId : void 0, msgKey: useUi ? `${sessionId}:${row.time}` : void 0, useUi, fold: FOLD_HUGE });
const speaker = layoutOf(roster.prefs) === "flat" ? roster.byId[selfId] : void 0;
- return speaker ? (0, import_react13.createElement)(import_react13.Fragment, { key }, (0, import_react13.createElement)(SpeakerHead, { bot: speaker, time: row.time }), bubbles) : bubbles;
+ return speaker ? (0, import_react16.createElement)(import_react16.Fragment, { key }, (0, import_react16.createElement)(SpeakerHead, { bot: speaker, time: row.time }), bubbles) : bubbles;
}
case "btw":
- return (0, import_react16.createElement)(BtwCardView, { key, card: row.card, actions });
- return (0, import_react13.createElement)(BtwCardView, { key, card: row.card, sessionId, actions, onDeleted: onBtwDelete });
++ return (0, import_react16.createElement)(BtwCardView, { key, card: row.card, sessionId, actions, onDeleted: onBtwDelete });
case "event": {
- if (row.role === "report") return (0, import_react13.createElement)(GroupEvent, { key, prefix: t("Replies from"), room: roster.roomsById[row.roomId], name: t("a group chat"), roster, actions });
+ if (row.role === "report") return (0, import_react16.createElement)(GroupEvent, { key, prefix: t("Replies from"), room: roster.roomsById[row.roomId], name: t("a group chat"), roster, actions });
const other = roster.byId[row.botId] ?? { id: row.botId, name: row.name ?? t("a Bot"), color: "gray" };
const prefix = { stopped: t("Stopped by"), reply: t("Reply from") }[row.role] ?? t("Message from");
- return (0, import_react13.createElement)(EventLine, { key, prefix, bots: [other], onOpen: () => {
+ return (0, import_react16.createElement)(EventLine, { key, prefix, bots: [other], onOpen: () => {
if (selfId && other.id) actions.openExchange(selfId, other.id);
}, whole: true });
}
@@@ -8481,14 -8165,21 +8522,21 @@@ function GroupReplies({ sessionId, call
);
}
if (reply.kind === "missed") {
- return (0, import_react13.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("{name} didn't answer in time", { name: bot.name }));
+ return (0, import_react16.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("{name} didn't answer in time", { name: bot.name }));
}
+ if (reply.kind === "admin-passed") {
- return (0, import_react13.createElement)(
++ return (0, import_react16.createElement)(
+ "div",
+ { key: `${reply.botId}-${index}`, className: "bt-event" },
+ t("{name} did not answer or call anyone; call a member with @Name", { name: bot.name })
+ );
+ }
if (reply.kind === "paused") {
- return (0, import_react13.createElement)(
+ return (0, import_react16.createElement)(
"div",
{ key: `paused-${index}`, className: "bt-event" },
- (0, import_react13.createElement)("span", null, t("Paused after {count} Bot relays. Waiting: {names}", { count: reply.count, names: (reply.names ?? []).join(t(" and ")) })),
- room2?.paused?.length > 0 ? (0, import_react13.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.continueRoom(sessionId) }, t("Continue")) : null
+ (0, import_react16.createElement)("span", null, t("Paused after {count} Bot relays. Waiting: {names}", { count: reply.count, names: (reply.names ?? []).join(t(" and ")) })),
+ room2?.paused?.length > 0 ? (0, import_react16.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.continueRoom(sessionId) }, t("Continue")) : null
);
}
if (reply.kind === "resumed") {
@@@ -9318,29 -9009,12 +9366,12 @@@ function UpdateButton({ useUpdate, acti
), document.body) : null
);
}
- function ConnectPlugins({ wide, actions }) {
- if (!wide) return null;
- return (0, import_react18.createElement)(
- "span",
- { className: "bt-connect-wrap" },
- (0, import_react18.createElement)(
- "button",
- {
- type: "button",
- className: "bt-connect bt-connect-foot",
- onClick: () => actions.selectPanel("plugins")
- },
- (0, import_react18.createElement)(PlugIcon),
- t("Connect plugins")
- )
- );
- }
function YouAvatar() {
- return (0, import_react15.createElement)(
+ return (0, import_react18.createElement)(
"span",
{ className: "bt-you-wrap" },
- (0, import_react15.createElement)("span", { className: "bt-you", "aria-hidden": true }, (0, import_react15.createElement)(BotMark, { look: MAIN_LOOK, size: 24 })),
- (0, import_react15.createElement)("span", { style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clip: "rect(0 0 0 0)" } }, t("Settings"))
+ (0, import_react18.createElement)("span", { className: "bt-you", "aria-hidden": true }, (0, import_react18.createElement)(BotMark, { look: MAIN_LOOK, size: 24 })),
+ (0, import_react18.createElement)("span", { style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clip: "rect(0 0 0 0)" } }, t("Settings"))
);
}
var openShellSettings = null;
@@@ -12102,8 -11775,183 +12132,183 @@@ function BotCapabilitiesCard({ bot, ros
);
}
- // src/client/memory-panel.js
+ // src/client/avatar-library.js
-var import_react25 = require("react");
+var import_react28 = require("react");
+ var CHUNK = 20;
+ var PAGE = 24;
+ async function avatarImage(file) {
+ if (!/^image\/(png|jpeg|webp|gif)$/.test(file.type)) throw new Error(t("Choose a PNG, JPEG, WebP, or GIF image"));
+ if (file.size > 25 * 1024 * 1024) throw new Error(t("Choose an image smaller than 25 MB"));
+ const bitmap = await createImageBitmap(file);
+ const side = 160;
+ const canvas = document.createElement("canvas");
+ canvas.width = side;
+ canvas.height = side;
+ const context = canvas.getContext("2d");
+ context.imageSmoothingQuality = "high";
+ const crop = Math.min(bitmap.width, bitmap.height);
+ context.drawImage(bitmap, (bitmap.width - crop) / 2, (bitmap.height - crop) / 2, crop, crop, 0, 0, side, side);
+ bitmap.close?.();
+ for (const quality of [0.9, 0.75, 0.6]) {
+ const url = canvas.toDataURL("image/webp", quality);
+ if (url.startsWith("data:image/webp") && url.length < 15e4) return url;
+ }
+ const png = canvas.toDataURL("image/png");
+ if (png.length < 15e4) return png;
+ throw new Error(t("That image is too large"));
+ }
+ async function importPhotos(photos, actions) {
+ const imported = [];
+ const duplicates = [];
+ const failed = [];
+ for (let index = 0; index < photos.length; index += CHUNK) {
+ const chunk = photos.slice(index, index + CHUNK);
+ try {
+ const result = await actions.importAvatars(chunk);
+ imported.push(...result?.imported ?? []);
+ duplicates.push(...result?.duplicates ?? []);
+ failed.push(...result?.failed ?? []);
+ } catch (failure) {
+ failed.push(...chunk.map((photo) => ({ name: photo.name, message: failure?.message ?? String(failure) })));
+ }
+ }
+ return { imported, duplicates, failed };
+ }
+ async function loadLibrary(actions, { offset = 0, limit = PAGE } = {}) {
+ const value = await actions.avatarLibrary({ offset, limit });
+ const items = value?.items ?? [];
+ return { items, total: value?.total ?? items.length, next: value?.next ?? offset + items.length };
+ }
+ function AvatarLibraryPanel({ actions, onPick }) {
- const [items, setItems] = (0, import_react25.useState)(null);
- const [total, setTotal] = (0, import_react25.useState)(0);
- const [offset, setOffset] = (0, import_react25.useState)(0);
- const [busy, setBusy] = (0, import_react25.useState)(false);
- const [error, setError] = (0, import_react25.useState)("");
- const [report, setReport] = (0, import_react25.useState)(null);
- const fileRef = (0, import_react25.useRef)(null);
- const load = (0, import_react25.useCallback)(async (from = 0, append = false) => {
++ const [items, setItems] = (0, import_react28.useState)(null);
++ const [total, setTotal] = (0, import_react28.useState)(0);
++ const [offset, setOffset] = (0, import_react28.useState)(0);
++ const [busy, setBusy] = (0, import_react28.useState)(false);
++ const [error, setError] = (0, import_react28.useState)("");
++ const [report, setReport] = (0, import_react28.useState)(null);
++ const fileRef = (0, import_react28.useRef)(null);
++ const load = (0, import_react28.useCallback)(async (from = 0, append = false) => {
+ try {
+ const page = await loadLibrary(actions, { offset: from });
+ setItems((previous) => append ? [...previous ?? [], ...page.items] : page.items);
+ setTotal(page.total);
+ setOffset(page.next);
+ } catch (failure) {
+ setError(failure?.message ?? String(failure));
+ }
+ }, [actions]);
- (0, import_react25.useEffect)(() => {
++ (0, import_react28.useEffect)(() => {
+ void load();
+ }, [load]);
+ const importFiles = async (files) => {
+ if (files.length === 0) return;
+ setBusy(true);
+ setError("");
+ setReport(null);
+ const photos = [];
+ const failed = [];
+ for (const file of files) {
+ try {
+ photos.push({ name: file.name, image: await avatarImage(file) });
+ } catch (failure) {
+ failed.push({ name: file.name, message: failure?.message ?? String(failure) });
+ }
+ }
+ const result = await importPhotos(photos, actions);
+ setReport({ imported: result.imported, duplicates: result.duplicates, failed: [...failed, ...result.failed] });
+ await load();
+ setBusy(false);
+ };
+ const remove = async (entry) => {
+ setBusy(true);
+ setError("");
+ try {
+ await actions.deleteAvatar(entry.id);
+ await load();
+ } catch (failure) {
+ setError(failure?.message ?? String(failure));
+ } finally {
+ setBusy(false);
+ }
+ };
+ const shown = items?.length ?? 0;
- return (0, import_react25.createElement)(
++ return (0, import_react28.createElement)(
+ "div",
+ { className: "bt-lib" },
- (0, import_react25.createElement)(
++ (0, import_react28.createElement)(
+ "div",
+ { className: "bt-lib-bar" },
- (0, import_react25.createElement)(
++ (0, import_react28.createElement)(
+ "button",
+ { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => fileRef.current?.click() },
+ busy ? t("Importing photos…") : t("Import photos")
+ ),
- (0, import_react25.createElement)("input", {
++ (0, import_react28.createElement)("input", {
+ ref: fileRef,
+ type: "file",
+ accept: "image/png,image/jpeg,image/webp,image/gif",
+ multiple: true,
+ hidden: true,
+ onChange: (event) => {
+ const files = [...event.target.files ?? []];
+ event.target.value = "";
+ void importFiles(files);
+ }
+ })
+ ),
- error ? (0, import_react25.createElement)("div", { className: "bt-error", role: "alert" }, error) : null,
- items === null ? (0, import_react25.createElement)("div", { className: "bt-note" }, t("Loading…")) : null,
- items?.length === 0 && !error ? (0, import_react25.createElement)("div", { className: "bt-note" }, t("No photos in the library yet.")) : null,
- items?.length ? (0, import_react25.createElement)("div", { className: "bt-lib-grid" }, items.map((entry) => (0, import_react25.createElement)(
++ error ? (0, import_react28.createElement)("div", { className: "bt-error", role: "alert" }, error) : null,
++ items === null ? (0, import_react28.createElement)("div", { className: "bt-note" }, t("Loading…")) : null,
++ items?.length === 0 && !error ? (0, import_react28.createElement)("div", { className: "bt-note" }, t("No photos in the library yet.")) : null,
++ items?.length ? (0, import_react28.createElement)("div", { className: "bt-lib-grid" }, items.map((entry) => (0, import_react28.createElement)(
+ "div",
+ { key: entry.id, className: "bt-lib-cell" },
- (0, import_react25.createElement)(
++ (0, import_react28.createElement)(
+ "button",
+ { type: "button", className: "bt-lib-pick", title: entry.name, "aria-label": t("Use this photo"), onClick: () => onPick(entry) },
- (0, import_react25.createElement)("img", { src: entry.image, alt: "" })
++ (0, import_react28.createElement)("img", { src: entry.image, alt: "" })
+ ),
- (0, import_react25.createElement)(
++ (0, import_react28.createElement)(
+ "button",
+ { type: "button", className: "bt-lib-del", "aria-label": t("Remove photo from the library"), onClick: () => void remove(entry) },
- (0, import_react25.createElement)(TrashIcon)
++ (0, import_react28.createElement)(TrashIcon)
+ )
+ ))) : null,
- shown < total ? (0, import_react25.createElement)(
++ shown < total ? (0, import_react28.createElement)(
+ "div",
+ { className: "bt-lib-more" },
- (0, import_react25.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => void load(offset, true) }, t("Show more photos")),
- (0, import_react25.createElement)("span", { className: "bt-note" }, t("Showing {shown} of {total} photos", { shown, total }))
++ (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => void load(offset, true) }, t("Show more photos")),
++ (0, import_react28.createElement)("span", { className: "bt-note" }, t("Showing {shown} of {total} photos", { shown, total }))
+ ) : null,
- report ? (0, import_react25.createElement)(
++ report ? (0, import_react28.createElement)(
+ "div",
+ { className: "bt-lib-report" },
- report.imported.length ? (0, import_react25.createElement)("div", { className: "bt-note" }, report.imported.length === 1 ? t("1 photo imported") : t("{count} photos imported", { count: report.imported.length })) : null,
- report.duplicates.length ? (0, import_react25.createElement)("div", { className: "bt-note" }, report.duplicates.length === 1 ? t("1 photo was already in the library") : t("{count} photos were already in the library", { count: report.duplicates.length })) : null,
- report.failed.map((item, index) => (0, import_react25.createElement)(
++ report.imported.length ? (0, import_react28.createElement)("div", { className: "bt-note" }, report.imported.length === 1 ? t("1 photo imported") : t("{count} photos imported", { count: report.imported.length })) : null,
++ report.duplicates.length ? (0, import_react28.createElement)("div", { className: "bt-note" }, report.duplicates.length === 1 ? t("1 photo was already in the library") : t("{count} photos were already in the library", { count: report.duplicates.length })) : null,
++ report.failed.map((item, index) => (0, import_react28.createElement)(
+ "div",
+ { key: index, className: "bt-note bt-danger" },
+ t("{name}: {reason}", { name: item.name || t("photo"), reason: hostText(item.message) })
+ ))
+ ) : null
+ );
+ }
+ var AVATAR_LIBRARY_CSS = `
+ .bt-lib{display:flex;flex-direction:column;gap:8px;width:100%}
+ .bt-lib-bar{display:flex;align-items:center;gap:8px}
+ .bt-lib-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;max-height:210px;overflow-y:auto}
+ .bt-lib-cell{position:relative}
+ .bt-lib-pick{display:block;width:100%;aspect-ratio:1;padding:0;border:1px solid var(--bt-line);border-radius:12px;background:var(--bt-hover);cursor:pointer;overflow:hidden}
+ .bt-lib-pick:hover{background:var(--bt-active)}
+ .bt-lib-pick img{display:block;width:100%;height:100%;object-fit:cover}
+ .bt-lib-del{position:absolute;right:0;top:0;width:28px;height:28px;padding:0;border:1px solid var(--bt-line-2);border-radius:50%;background:var(--bt-main);color:var(--bt-ink-2);display:flex;align-items:center;justify-content:center;cursor:pointer}
+ .bt-lib-del:hover{color:var(--bt-ink)}
+ .bt-lib-del svg{width:14px;height:14px}
+ .bt-lib-more{display:flex;align-items:center;gap:8px}
+ .bt-lib-report{display:flex;flex-direction:column;gap:4px}
+ `;
+
+ // src/client/memory-panel.js
-var import_react26 = require("react");
++var import_react29 = require("react");
var POLL_MS2 = 1500;
var MENU_EXIT_MS2 = 120;
var counts = /* @__PURE__ */ new Map();
@@@ -12114,8 -11962,8 +12319,8 @@@ function noteCount(id, count)
for (const listener of countListeners) listener();
}
function useMemoryCount(id, actions) {
- const [count, setCount] = (0, import_react28.useState)(counts.get(id) ?? null);
- (0, import_react28.useEffect)(() => {
- const [count, setCount] = (0, import_react26.useState)(counts.get(id) ?? null);
- (0, import_react26.useEffect)(() => {
++ const [count, setCount] = (0, import_react29.useState)(counts.get(id) ?? null);
++ (0, import_react29.useEffect)(() => {
const listener = () => setCount(counts.get(id) ?? null);
countListeners.add(listener);
listener();
@@@ -12134,16 -11982,16 +12339,16 @@@
function MemoryRow({ owner, actions }) {
const count = useMemoryCount(owner.id, actions);
const label = count === null ? t("Loading…") : count === 0 ? t("Nothing saved yet") : count === 1 ? t("1 entry") : t("{count} entries", { count });
- return (0, import_react28.createElement)(
- return (0, import_react26.createElement)(
++ return (0, import_react29.createElement)(
"div",
null,
- (0, import_react28.createElement)("div", { className: "bt-section-title" }, t("Memory")),
- (0, import_react28.createElement)(
- (0, import_react26.createElement)("div", { className: "bt-section-title" }, t("Memory")),
- (0, import_react26.createElement)(
++ (0, import_react29.createElement)("div", { className: "bt-section-title" }, t("Memory")),
++ (0, import_react29.createElement)(
"button",
{ type: "button", className: "bt-mem-row", "aria-label": t("Manage {name}'s memory", { name: owner.name }), onClick: () => actions.openMemory(owner.id) },
- (0, import_react28.createElement)(MemoryIcon),
- (0, import_react28.createElement)("span", { className: "bt-mem-row-copy" }, label),
- (0, import_react28.createElement)("span", { className: "bt-mem-row-go" }, t("Manage"), (0, import_react28.createElement)(ChevronRightIcon))
- (0, import_react26.createElement)(MemoryIcon),
- (0, import_react26.createElement)("span", { className: "bt-mem-row-copy" }, label),
- (0, import_react26.createElement)("span", { className: "bt-mem-row-go" }, t("Manage"), (0, import_react26.createElement)(ChevronRightIcon))
++ (0, import_react29.createElement)(MemoryIcon),
++ (0, import_react29.createElement)("span", { className: "bt-mem-row-copy" }, label),
++ (0, import_react29.createElement)("span", { className: "bt-mem-row-go" }, t("Manage"), (0, import_react29.createElement)(ChevronRightIcon))
)
);
}
@@@ -12158,45 -12006,45 +12363,45 @@@ function ago(at, now)
return format.format(-Math.round(hours / 24), "day");
}
function Skeleton({ label }) {
- return (0, import_react28.createElement)(
- return (0, import_react26.createElement)(
++ return (0, import_react29.createElement)(
"div",
{ className: "bt-mem-skel", "aria-busy": true },
- [0, 1].map((block) => (0, import_react28.createElement)(
- [0, 1].map((block) => (0, import_react26.createElement)(
++ [0, 1].map((block) => (0, import_react29.createElement)(
"div",
{ key: block, className: "bt-mem-skel-block" },
- (0, import_react28.createElement)("span", { className: "bt-mem-skel-head" }),
- (0, import_react28.createElement)("span", null),
- (0, import_react28.createElement)("span", null),
- (0, import_react28.createElement)("span", { style: { width: block === 0 ? "62%" : "48%" } })
- (0, import_react26.createElement)("span", { className: "bt-mem-skel-head" }),
- (0, import_react26.createElement)("span", null),
- (0, import_react26.createElement)("span", null),
- (0, import_react26.createElement)("span", { style: { width: block === 0 ? "62%" : "48%" } })
++ (0, import_react29.createElement)("span", { className: "bt-mem-skel-head" }),
++ (0, import_react29.createElement)("span", null),
++ (0, import_react29.createElement)("span", null),
++ (0, import_react29.createElement)("span", { style: { width: block === 0 ? "62%" : "48%" } })
)),
- label ? (0, import_react28.createElement)("div", { className: "bt-mem-skel-label" }, label) : null
- label ? (0, import_react26.createElement)("div", { className: "bt-mem-skel-label" }, label) : null
++ label ? (0, import_react29.createElement)("div", { className: "bt-mem-skel-label" }, label) : null
);
}
function Summary({ owner, view, regenerate }) {
if (view.entries.length === 0) {
- return (0, import_react28.createElement)(
- return (0, import_react26.createElement)(
++ return (0, import_react29.createElement)(
"div",
{ className: "bt-mem-empty" },
- (0, import_react28.createElement)("div", { className: "bt-mem-empty-mark" }, (0, import_react28.createElement)(MemoryIcon)),
- (0, import_react28.createElement)("div", { className: "bt-mem-empty-title" }, owner.group ? t("Nothing is saved for this group yet") : t("{name} has not saved anything yet", { name: owner.name })),
- (0, import_react28.createElement)("div", { className: "bt-mem-empty-text" }, owner.group ? t("A group keeps the decisions, rules, and facts its work needs, for its members to read here. Tell it below, or in the group.") : t("Bots keep lasting preferences, decisions, and what you ask them to remember. Tell {name} below, or in its chat.", { name: owner.name }))
- (0, import_react26.createElement)("div", { className: "bt-mem-empty-mark" }, (0, import_react26.createElement)(MemoryIcon)),
- (0, import_react26.createElement)("div", { className: "bt-mem-empty-title" }, owner.group ? t("Nothing is saved for this group yet") : t("{name} has not saved anything yet", { name: owner.name })),
- (0, import_react26.createElement)("div", { className: "bt-mem-empty-text" }, owner.group ? t("A group keeps the decisions, rules, and facts its work needs, for its members to read here. Tell it below, or in the group.") : t("Bots keep lasting preferences, decisions, and what you ask them to remember. Tell {name} below, or in its chat.", { name: owner.name }))
++ (0, import_react29.createElement)("div", { className: "bt-mem-empty-mark" }, (0, import_react29.createElement)(MemoryIcon)),
++ (0, import_react29.createElement)("div", { className: "bt-mem-empty-title" }, owner.group ? t("Nothing is saved for this group yet") : t("{name} has not saved anything yet", { name: owner.name })),
++ (0, import_react29.createElement)("div", { className: "bt-mem-empty-text" }, owner.group ? t("A group keeps the decisions, rules, and facts its work needs, for its members to read here. Tell it below, or in the group.") : t("Bots keep lasting preferences, decisions, and what you ask them to remember. Tell {name} below, or in its chat.", { name: owner.name }))
);
}
- const failed = view.error && !view.summarizing ? (0, import_react28.createElement)(
- const failed = view.error && !view.summarizing ? (0, import_react26.createElement)(
++ const failed = view.error && !view.summarizing ? (0, import_react29.createElement)(
"div",
{ className: "bt-mem-failed", role: "alert" },
- (0, import_react28.createElement)("span", null, view.summary ? t("The summary is out of date: {reason}", { reason: hostText(view.error) }) : t("The summary could not be written: {reason}", { reason: hostText(view.error) })),
- (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: regenerate }, t("Try again"))
- (0, import_react26.createElement)("span", null, view.summary ? t("The summary is out of date: {reason}", { reason: hostText(view.error) }) : t("The summary could not be written: {reason}", { reason: hostText(view.error) })),
- (0, import_react26.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: regenerate }, t("Try again"))
++ (0, import_react29.createElement)("span", null, view.summary ? t("The summary is out of date: {reason}", { reason: hostText(view.error) }) : t("The summary could not be written: {reason}", { reason: hostText(view.error) })),
++ (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: regenerate }, t("Try again"))
) : null;
- if (!view.summary) return (0, import_react28.createElement)(import_react28.Fragment, null, failed, failed ? null : (0, import_react28.createElement)(Skeleton, { label: t("Writing the summary…") }));
- return (0, import_react28.createElement)(
- import_react28.Fragment,
- if (!view.summary) return (0, import_react26.createElement)(import_react26.Fragment, null, failed, failed ? null : (0, import_react26.createElement)(Skeleton, { label: t("Writing the summary…") }));
- return (0, import_react26.createElement)(
- import_react26.Fragment,
++ if (!view.summary) return (0, import_react29.createElement)(import_react29.Fragment, null, failed, failed ? null : (0, import_react29.createElement)(Skeleton, { label: t("Writing the summary…") }));
++ return (0, import_react29.createElement)(
++ import_react29.Fragment,
null,
failed,
- (0, import_react28.createElement)(
- (0, import_react26.createElement)(
++ (0, import_react29.createElement)(
"div",
{ key: view.summary.at, className: "bt-mem-summary", "data-stale": !view.fresh || void 0 },
- summaryBlocks(view.summary.text).map((block, index) => block.kind === "h" ? (0, import_react28.createElement)("h3", { key: index }, block.text) : (0, import_react28.createElement)("p", { key: index }, block.text))
- summaryBlocks(view.summary.text).map((block, index) => block.kind === "h" ? (0, import_react26.createElement)("h3", { key: index }, block.text) : (0, import_react26.createElement)("p", { key: index }, block.text))
++ summaryBlocks(view.summary.text).map((block, index) => block.kind === "h" ? (0, import_react29.createElement)("h3", { key: index }, block.text) : (0, import_react29.createElement)("p", { key: index }, block.text))
)
);
}
@@@ -12208,9 -12056,9 +12413,9 @@@ var groupEntries = (entries2) => entrie
return groups;
}, []);
function EntryRow({ entry, remove }) {
- const [confirming, setConfirming] = (0, import_react28.useState)(false);
- const [busy, setBusy] = (0, import_react28.useState)(false);
- (0, import_react28.useEffect)(() => {
- const [confirming, setConfirming] = (0, import_react26.useState)(false);
- const [busy, setBusy] = (0, import_react26.useState)(false);
- (0, import_react26.useEffect)(() => {
++ const [confirming, setConfirming] = (0, import_react29.useState)(false);
++ const [busy, setBusy] = (0, import_react29.useState)(false);
++ (0, import_react29.useEffect)(() => {
if (!confirming) return void 0;
const timer = setTimeout(() => setConfirming(false), 3e3);
return () => clearTimeout(timer);
@@@ -12225,16 -12073,16 +12430,16 @@@
setBusy(true);
if (!await remove(entry)) setBusy(false);
};
- return (0, import_react28.createElement)(
- return (0, import_react26.createElement)(
++ return (0, import_react29.createElement)(
"li",
{ className: "bt-mem-entry", "data-busy": busy || void 0 },
- (0, import_react28.createElement)(
- (0, import_react26.createElement)(
++ (0, import_react29.createElement)(
"div",
{ className: "bt-mem-entry-copy" },
- (0, import_react28.createElement)("span", { className: "bt-mem-entry-text" }, entry.text),
- meta ? (0, import_react28.createElement)("span", { className: "bt-mem-entry-meta" }, meta) : null
- (0, import_react26.createElement)("span", { className: "bt-mem-entry-text" }, entry.text),
- meta ? (0, import_react26.createElement)("span", { className: "bt-mem-entry-meta" }, meta) : null
++ (0, import_react29.createElement)("span", { className: "bt-mem-entry-text" }, entry.text),
++ meta ? (0, import_react29.createElement)("span", { className: "bt-mem-entry-meta" }, meta) : null
),
- (0, import_react28.createElement)("button", {
- (0, import_react26.createElement)("button", {
++ (0, import_react29.createElement)("button", {
type: "button",
className: "bt-mem-remove",
"data-confirm": confirming || void 0,
@@@ -12242,7 -12090,7 +12447,7 @@@
"aria-label": confirming ? t("Click again to remove") : t("Remove from memory"),
title: confirming ? void 0 : t("Remove from memory"),
onClick: click
- }, confirming ? t("Remove") : (0, import_react28.createElement)(TrashIcon))
- }, confirming ? t("Remove") : (0, import_react26.createElement)(TrashIcon))
++ }, confirming ? t("Remove") : (0, import_react29.createElement)(TrashIcon))
);
}
function Entries({ owner, view, remove }) {
@@@ -12251,25 -12099,25 +12456,25 @@@
{ scope: "own", title: t("{name}'s memory", { name: owner.name }), size: view.sizes.own },
{ scope: "team", title: t("Team memory"), hint: t("Every Bot reads it"), size: view.sizes.team }
];
- return (0, import_react28.createElement)(
- return (0, import_react26.createElement)(
++ return (0, import_react29.createElement)(
"div",
{ className: "bt-mem-entries" },
- sections.map((section) => (0, import_react28.createElement)(
- sections.map((section) => (0, import_react26.createElement)(
++ sections.map((section) => (0, import_react29.createElement)(
"section",
{ key: section.scope, className: "bt-mem-section" },
- (0, import_react28.createElement)(
- (0, import_react26.createElement)(
++ (0, import_react29.createElement)(
"div",
{ className: "bt-mem-section-head" },
- (0, import_react28.createElement)("h3", null, section.title),
- section.hint ? (0, import_react28.createElement)("span", null, section.hint) : null,
- (0, import_react28.createElement)("span", { className: "bt-mem-size", title: t("MEMORY.md, which every conversation reads") }, t("{used} of {limit} characters", { used: section.size.toLocaleString(dateLocale()), limit: view.limits.main.toLocaleString(dateLocale()) }))
- (0, import_react26.createElement)("h3", null, section.title),
- section.hint ? (0, import_react26.createElement)("span", null, section.hint) : null,
- (0, import_react26.createElement)("span", { className: "bt-mem-size", title: t("MEMORY.md, which every conversation reads") }, t("{used} of {limit} characters", { used: section.size.toLocaleString(dateLocale()), limit: view.limits.main.toLocaleString(dateLocale()) }))
++ (0, import_react29.createElement)("h3", null, section.title),
++ section.hint ? (0, import_react29.createElement)("span", null, section.hint) : null,
++ (0, import_react29.createElement)("span", { className: "bt-mem-size", title: t("MEMORY.md, which every conversation reads") }, t("{used} of {limit} characters", { used: section.size.toLocaleString(dateLocale()), limit: view.limits.main.toLocaleString(dateLocale()) }))
),
- groups.some((group) => group.scope === section.scope) ? groups.filter((group) => group.scope === section.scope).map((group) => (0, import_react28.createElement)(
- import_react28.Fragment,
- groups.some((group) => group.scope === section.scope) ? groups.filter((group) => group.scope === section.scope).map((group) => (0, import_react26.createElement)(
- import_react26.Fragment,
++ groups.some((group) => group.scope === section.scope) ? groups.filter((group) => group.scope === section.scope).map((group) => (0, import_react29.createElement)(
++ import_react29.Fragment,
{ key: group.key },
- group.topic ? (0, import_react28.createElement)("div", { className: "bt-mem-topic" }, group.topic) : null,
- (0, import_react28.createElement)("ul", { className: "bt-mem-list" }, group.entries.map((entry) => (0, import_react28.createElement)(EntryRow, { key: `${entry.topic ?? ""}:${entry.text}`, entry, remove })))
- )) : (0, import_react28.createElement)("div", { className: "bt-mem-none" }, t("Nothing saved yet"))
- group.topic ? (0, import_react26.createElement)("div", { className: "bt-mem-topic" }, group.topic) : null,
- (0, import_react26.createElement)("ul", { className: "bt-mem-list" }, group.entries.map((entry) => (0, import_react26.createElement)(EntryRow, { key: `${entry.topic ?? ""}:${entry.text}`, entry, remove })))
- )) : (0, import_react26.createElement)("div", { className: "bt-mem-none" }, t("Nothing saved yet"))
++ group.topic ? (0, import_react29.createElement)("div", { className: "bt-mem-topic" }, group.topic) : null,
++ (0, import_react29.createElement)("ul", { className: "bt-mem-list" }, group.entries.map((entry) => (0, import_react29.createElement)(EntryRow, { key: `${entry.topic ?? ""}:${entry.text}`, entry, remove })))
++ )) : (0, import_react29.createElement)("div", { className: "bt-mem-none" }, t("Nothing saved yet"))
))
);
}
@@@ -12281,40 -12129,40 +12486,40 @@@ function changeLine(change)
return change.scope === "team" ? t("Added to team memory: {text}", { text }) : t("Added: {text}", { text });
}
function Reply({ answer, dismiss }) {
- return (0, import_react28.createElement)(
- return (0, import_react26.createElement)(
++ return (0, import_react29.createElement)(
"div",
{ className: "bt-mem-reply", role: "status" },
- (0, import_react28.createElement)(
- (0, import_react26.createElement)(
++ (0, import_react29.createElement)(
"div",
{ className: "bt-mem-reply-head" },
- (0, import_react28.createElement)("span", { className: "bt-mem-reply-asked" }, answer.asked),
- answer.pending ? null : (0, import_react28.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Dismiss"), onClick: dismiss }, (0, import_react28.createElement)(CloseIcon))
- (0, import_react26.createElement)("span", { className: "bt-mem-reply-asked" }, answer.asked),
- answer.pending ? null : (0, import_react26.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Dismiss"), onClick: dismiss }, (0, import_react26.createElement)(CloseIcon))
++ (0, import_react29.createElement)("span", { className: "bt-mem-reply-asked" }, answer.asked),
++ answer.pending ? null : (0, import_react29.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Dismiss"), onClick: dismiss }, (0, import_react29.createElement)(CloseIcon))
),
- answer.pending ? (0, import_react28.createElement)("div", { className: "bt-mem-reply-text bt-shimmer" }, t("Thinking…")) : answer.error ? (0, import_react28.createElement)("div", { className: "bt-mem-reply-text bt-danger" }, hostText(answer.error)) : (0, import_react28.createElement)(
- import_react28.Fragment,
- answer.pending ? (0, import_react26.createElement)("div", { className: "bt-mem-reply-text bt-shimmer" }, t("Thinking…")) : answer.error ? (0, import_react26.createElement)("div", { className: "bt-mem-reply-text bt-danger" }, hostText(answer.error)) : (0, import_react26.createElement)(
- import_react26.Fragment,
++ answer.pending ? (0, import_react29.createElement)("div", { className: "bt-mem-reply-text bt-shimmer" }, t("Thinking…")) : answer.error ? (0, import_react29.createElement)("div", { className: "bt-mem-reply-text bt-danger" }, hostText(answer.error)) : (0, import_react29.createElement)(
++ import_react29.Fragment,
null,
- answer.reply ? (0, import_react28.createElement)("div", { className: "bt-mem-reply-text" }, answer.reply) : null,
- answer.changes.length > 0 ? (0, import_react28.createElement)("ul", { className: "bt-mem-changes" }, answer.changes.map((change, index) => (0, import_react28.createElement)(
- answer.reply ? (0, import_react26.createElement)("div", { className: "bt-mem-reply-text" }, answer.reply) : null,
- answer.changes.length > 0 ? (0, import_react26.createElement)("ul", { className: "bt-mem-changes" }, answer.changes.map((change, index) => (0, import_react26.createElement)(
++ answer.reply ? (0, import_react29.createElement)("div", { className: "bt-mem-reply-text" }, answer.reply) : null,
++ answer.changes.length > 0 ? (0, import_react29.createElement)("ul", { className: "bt-mem-changes" }, answer.changes.map((change, index) => (0, import_react29.createElement)(
"li",
{ key: index, "data-ok": change.ok || void 0 },
- change.ok ? (0, import_react28.createElement)(CheckIcon) : (0, import_react28.createElement)(CloseIcon),
- (0, import_react28.createElement)("span", null, changeLine(change))
- change.ok ? (0, import_react26.createElement)(CheckIcon) : (0, import_react26.createElement)(CloseIcon),
- (0, import_react26.createElement)("span", null, changeLine(change))
++ change.ok ? (0, import_react29.createElement)(CheckIcon) : (0, import_react29.createElement)(CloseIcon),
++ (0, import_react29.createElement)("span", null, changeLine(change))
))) : null
)
);
}
function useMemoryView(id, actions) {
- const [view, setView] = (0, import_react28.useState)(null);
- const [error, setError] = (0, import_react28.useState)("");
- const timer = (0, import_react28.useRef)(0);
- const latest = (0, import_react28.useRef)(0);
- const alive = (0, import_react28.useRef)(true);
- const show2 = (0, import_react28.useCallback)((next) => {
- const [view, setView] = (0, import_react26.useState)(null);
- const [error, setError] = (0, import_react26.useState)("");
- const timer = (0, import_react26.useRef)(0);
- const latest = (0, import_react26.useRef)(0);
- const alive = (0, import_react26.useRef)(true);
- const show2 = (0, import_react26.useCallback)((next) => {
++ const [view, setView] = (0, import_react29.useState)(null);
++ const [error, setError] = (0, import_react29.useState)("");
++ const timer = (0, import_react29.useRef)(0);
++ const latest = (0, import_react29.useRef)(0);
++ const alive = (0, import_react29.useRef)(true);
++ const show2 = (0, import_react29.useCallback)((next) => {
setView(next);
setError("");
noteCount(id, next.entries.length);
}, [id]);
- const load = (0, import_react28.useCallback)(async (flags = {}) => {
- const load = (0, import_react26.useCallback)(async (flags = {}) => {
++ const load = (0, import_react29.useCallback)(async (flags = {}) => {
clearTimeout(timer.current);
const ticket = ++latest.current;
try {
@@@ -12326,7 -12174,7 +12531,7 @@@
if (alive.current && ticket === latest.current) setError(failure?.message ?? String(failure));
}
}, [id]);
- (0, import_react28.useEffect)(() => {
- (0, import_react26.useEffect)(() => {
++ (0, import_react29.useEffect)(() => {
alive.current = true;
void load({ summarize: true });
return () => {
@@@ -12337,8 -12185,8 +12542,8 @@@
return { view, error, load, show: show2 };
}
function useNow(every) {
- const [now, setNow] = (0, import_react28.useState)(Date.now());
- (0, import_react28.useEffect)(() => {
- const [now, setNow] = (0, import_react26.useState)(Date.now());
- (0, import_react26.useEffect)(() => {
++ const [now, setNow] = (0, import_react29.useState)(Date.now());
++ (0, import_react29.useEffect)(() => {
const id = setInterval(() => setNow(Date.now()), every);
return () => clearInterval(id);
}, [every]);
@@@ -12346,18 -12194,18 +12551,18 @@@
}
function MemoryDialog({ owner, actions, leaving = false }) {
const { view, error, load, show: show2 } = useMemoryView(owner.id, actions);
- const [page, setPage] = (0, import_react28.useState)("summary");
- const [menu, setMenu] = (0, import_react28.useState)(false);
- const [page, setPage] = (0, import_react26.useState)("summary");
- const [menu, setMenu] = (0, import_react26.useState)(false);
++ const [page, setPage] = (0, import_react29.useState)("summary");
++ const [menu, setMenu] = (0, import_react29.useState)(false);
const [menuShown, menuLeaving] = useLinger(menu, MENU_EXIT_MS2);
- const [text, setText] = (0, import_react28.useState)("");
- const [answer, setAnswer] = (0, import_react28.useState)(null);
- const menuRef = (0, import_react28.useRef)(null);
- const dotsRef = (0, import_react28.useRef)(null);
- const inputRef = (0, import_react28.useRef)(null);
- const [text, setText] = (0, import_react26.useState)("");
- const [answer, setAnswer] = (0, import_react26.useState)(null);
- const menuRef = (0, import_react26.useRef)(null);
- const dotsRef = (0, import_react26.useRef)(null);
- const inputRef = (0, import_react26.useRef)(null);
++ const [text, setText] = (0, import_react29.useState)("");
++ const [answer, setAnswer] = (0, import_react29.useState)(null);
++ const menuRef = (0, import_react29.useRef)(null);
++ const dotsRef = (0, import_react29.useRef)(null);
++ const inputRef = (0, import_react29.useRef)(null);
const now = useNow(3e4);
- const close = (0, import_react28.useCallback)(() => actions.closeMemory(), []);
- const close = (0, import_react26.useCallback)(() => actions.closeMemory(), []);
++ const close = (0, import_react29.useCallback)(() => actions.closeMemory(), []);
useEscape(close);
- (0, import_react28.useEffect)(() => {
- (0, import_react26.useEffect)(() => {
++ (0, import_react29.useEffect)(() => {
if (!menu) return void 0;
const onDown = (event) => {
if (menuRef.current?.contains(event.target) || dotsRef.current?.contains(event.target)) return;
@@@ -12419,52 -12267,52 +12624,52 @@@
const when3 = view?.summary ? ago(view.summary.at, now) : null;
const status = view === null ? "" : page === "entries" ? count === 1 ? t("1 entry") : t("{count} entries", { count }) : view.summarizing && view.summary ? t("Updating…") : view.summary && view.fresh ? when3 ? t("Updated {time}", { time: when3 }) : t("Updated just now") : "";
const busy = answer?.pending === true;
- return (0, import_react28.createElement)(
- return (0, import_react26.createElement)(
++ return (0, import_react29.createElement)(
"div",
{ className: "bt-mem-layer", "data-leaving": leaving || void 0 },
- (0, import_react28.createElement)("div", { className: "bt-scrim bt-mem-scrim", onMouseDown: close }),
- (0, import_react28.createElement)(
- (0, import_react26.createElement)("div", { className: "bt-scrim bt-mem-scrim", onMouseDown: close }),
- (0, import_react26.createElement)(
++ (0, import_react29.createElement)("div", { className: "bt-scrim bt-mem-scrim", onMouseDown: close }),
++ (0, import_react29.createElement)(
"div",
{ className: "bt-mem", role: "dialog", "aria-modal": true, "aria-label": t("{name}'s memory", { name: owner.name }) },
- (0, import_react28.createElement)(
- (0, import_react26.createElement)(
++ (0, import_react29.createElement)(
"div",
{ className: "bt-mem-head" },
- page === "entries" ? (0, import_react28.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to the summary"), onClick: backToSummary }, (0, import_react28.createElement)(ChevronLeftIcon)) : null,
- (0, import_react28.createElement)("h2", null, page === "entries" ? t("All entries") : t("Memory summary")),
- (0, import_react28.createElement)("span", { className: "bt-mem-status" }, page === "summary" ? [owner.name, status].filter(Boolean).join(" · ") : status),
- (0, import_react28.createElement)("span", { className: "bt-mem-head-gap" }),
- (0, import_react28.createElement)("button", { ref: dotsRef, type: "button", className: "bt-icon-btn", "aria-label": t("Memory options"), "aria-haspopup": "menu", "aria-expanded": menu, onClick: () => setMenu((value) => !value) }, (0, import_react28.createElement)(DotsIcon)),
- (0, import_react28.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close memory"), onClick: close }, (0, import_react28.createElement)(CloseIcon)),
- menuShown ? (0, import_react28.createElement)(
- page === "entries" ? (0, import_react26.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to the summary"), onClick: backToSummary }, (0, import_react26.createElement)(ChevronLeftIcon)) : null,
- (0, import_react26.createElement)("h2", null, page === "entries" ? t("All entries") : t("Memory summary")),
- (0, import_react26.createElement)("span", { className: "bt-mem-status" }, page === "summary" ? [owner.name, status].filter(Boolean).join(" · ") : status),
- (0, import_react26.createElement)("span", { className: "bt-mem-head-gap" }),
- (0, import_react26.createElement)("button", { ref: dotsRef, type: "button", className: "bt-icon-btn", "aria-label": t("Memory options"), "aria-haspopup": "menu", "aria-expanded": menu, onClick: () => setMenu((value) => !value) }, (0, import_react26.createElement)(DotsIcon)),
- (0, import_react26.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close memory"), onClick: close }, (0, import_react26.createElement)(CloseIcon)),
- menuShown ? (0, import_react26.createElement)(
++ page === "entries" ? (0, import_react29.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to the summary"), onClick: backToSummary }, (0, import_react29.createElement)(ChevronLeftIcon)) : null,
++ (0, import_react29.createElement)("h2", null, page === "entries" ? t("All entries") : t("Memory summary")),
++ (0, import_react29.createElement)("span", { className: "bt-mem-status" }, page === "summary" ? [owner.name, status].filter(Boolean).join(" · ") : status),
++ (0, import_react29.createElement)("span", { className: "bt-mem-head-gap" }),
++ (0, import_react29.createElement)("button", { ref: dotsRef, type: "button", className: "bt-icon-btn", "aria-label": t("Memory options"), "aria-haspopup": "menu", "aria-expanded": menu, onClick: () => setMenu((value) => !value) }, (0, import_react29.createElement)(DotsIcon)),
++ (0, import_react29.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close memory"), onClick: close }, (0, import_react29.createElement)(CloseIcon)),
++ menuShown ? (0, import_react29.createElement)(
"div",
{ ref: menuRef, className: "bt-menu bt-mem-menu", role: "menu", "aria-label": t("Memory options"), "data-leaving": menuLeaving || void 0 },
- (0, import_react28.createElement)(
- (0, import_react26.createElement)(
++ (0, import_react29.createElement)(
"button",
{ type: "button", role: "menuitem", onClick: openEntries },
- (0, import_react28.createElement)("span", { className: "bt-menu-label" }, t("All entries")),
- (0, import_react28.createElement)("span", { className: "bt-menu-hint" }, String(count))
- (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("All entries")),
- (0, import_react26.createElement)("span", { className: "bt-menu-hint" }, String(count))
++ (0, import_react29.createElement)("span", { className: "bt-menu-label" }, t("All entries")),
++ (0, import_react29.createElement)("span", { className: "bt-menu-hint" }, String(count))
),
- (0, import_react28.createElement)(
- (0, import_react26.createElement)(
++ (0, import_react29.createElement)(
"button",
{ type: "button", role: "menuitem", disabled: count === 0 || view?.summarizing, onClick: regenerate },
- (0, import_react28.createElement)("span", { className: "bt-menu-label" }, t("Regenerate summary"))
- (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("Regenerate summary"))
++ (0, import_react29.createElement)("span", { className: "bt-menu-label" }, t("Regenerate summary"))
)
) : null
),
- (0, import_react28.createElement)(
- (0, import_react26.createElement)(
++ (0, import_react29.createElement)(
"div",
{ className: "bt-mem-body" },
- error ? (0, import_react28.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, hostText(error)) : null,
- view === null ? error ? null : (0, import_react28.createElement)(Skeleton) : page === "entries" ? (0, import_react28.createElement)(Entries, { owner, view, remove }) : (0, import_react28.createElement)(Summary, { owner, view, regenerate })
- error ? (0, import_react26.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, hostText(error)) : null,
- view === null ? error ? null : (0, import_react26.createElement)(Skeleton) : page === "entries" ? (0, import_react26.createElement)(Entries, { owner, view, remove }) : (0, import_react26.createElement)(Summary, { owner, view, regenerate })
++ error ? (0, import_react29.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, hostText(error)) : null,
++ view === null ? error ? null : (0, import_react29.createElement)(Skeleton) : page === "entries" ? (0, import_react29.createElement)(Entries, { owner, view, remove }) : (0, import_react29.createElement)(Summary, { owner, view, regenerate })
),
- (0, import_react28.createElement)(
- (0, import_react26.createElement)(
++ (0, import_react29.createElement)(
"div",
{ className: "bt-mem-foot" },
- answer ? (0, import_react28.createElement)(Reply, { answer, dismiss: () => setAnswer(null) }) : null,
- (0, import_react28.createElement)(
- answer ? (0, import_react26.createElement)(Reply, { answer, dismiss: () => setAnswer(null) }) : null,
- (0, import_react26.createElement)(
++ answer ? (0, import_react29.createElement)(Reply, { answer, dismiss: () => setAnswer(null) }) : null,
++ (0, import_react29.createElement)(
"form",
{ className: "bt-mem-ask", onSubmit: ask },
- (0, import_react28.createElement)("input", {
- (0, import_react26.createElement)("input", {
++ (0, import_react29.createElement)("input", {
ref: inputRef,
className: "bt-mem-input",
value: text,
@@@ -12474,10 -12322,10 +12679,10 @@@
"aria-label": t("Ask about or update {name}'s memory", { name: owner.name }),
onChange: (event) => setText(event.target.value)
}),
- (0, import_react28.createElement)(
- (0, import_react26.createElement)(
++ (0, import_react29.createElement)(
"button",
{ type: "submit", className: "bt-mem-send", disabled: busy || text.trim() === "", "aria-label": t("Send") },
- busy ? (0, import_react28.createElement)("span", { className: "bt-mem-spin", "aria-hidden": true }) : (0, import_react28.createElement)(ArrowUpIcon)
- busy ? (0, import_react26.createElement)("span", { className: "bt-mem-spin", "aria-hidden": true }) : (0, import_react26.createElement)(ArrowUpIcon)
++ busy ? (0, import_react29.createElement)("span", { className: "bt-mem-spin", "aria-hidden": true }) : (0, import_react29.createElement)(ArrowUpIcon)
)
)
)
@@@ -12486,32 -12334,11 +12691,11 @@@
}
// src/client/bot-settings.js
- var import_react29 = require("react");
-var import_react27 = require("react");
++var import_react30 = require("react");
var capitalize = (word) => word[0].toUpperCase() + word.slice(1);
- async function avatarImage(file) {
- if (!/^image\/(png|jpeg|webp|gif)$/.test(file.type)) throw new Error(t("Choose a PNG, JPEG, WebP, or GIF image"));
- if (file.size > 25 * 1024 * 1024) throw new Error(t("Choose an image smaller than 25 MB"));
- const bitmap = await createImageBitmap(file);
- const side = 160;
- const canvas = document.createElement("canvas");
- canvas.width = side;
- canvas.height = side;
- const context = canvas.getContext("2d");
- context.imageSmoothingQuality = "high";
- const crop = Math.min(bitmap.width, bitmap.height);
- context.drawImage(bitmap, (bitmap.width - crop) / 2, (bitmap.height - crop) / 2, crop, crop, 0, 0, side, side);
- bitmap.close?.();
- for (const quality of [0.9, 0.75, 0.6]) {
- const url = canvas.toDataURL("image/webp", quality);
- if (url.startsWith("data:image/webp") && url.length < 15e4) return url;
- }
- const png = canvas.toDataURL("image/png");
- if (png.length < 15e4) return png;
- throw new Error(t("That image is too large"));
- }
function InlineText({ label, value, placeholder, required = false, maxLength, multiline = false, onSave }) {
- const [draft, setDraft] = (0, import_react29.useState)(null);
- const reverting = (0, import_react29.useRef)(false);
- const [draft, setDraft] = (0, import_react27.useState)(null);
- const reverting = (0, import_react27.useRef)(false);
++ const [draft, setDraft] = (0, import_react30.useState)(null);
++ const reverting = (0, import_react30.useRef)(false);
const commit = () => {
const next = draft?.trim();
setDraft(null);
@@@ -12522,7 -12349,7 +12706,7 @@@
if (next === void 0 || next === (value ?? "") || required && next === "") return;
void onSave(next);
};
- return (0, import_react29.createElement)(multiline ? "textarea" : "input", {
- return (0, import_react27.createElement)(multiline ? "textarea" : "input", {
++ return (0, import_react30.createElement)(multiline ? "textarea" : "input", {
className: multiline ? "bt-bs-input bt-bs-area" : "bt-bs-input",
value: draft ?? value ?? "",
placeholder,
@@@ -12543,29 -12370,29 +12727,29 @@@
});
}
function Row({ label, hint, stack = false, children }) {
- return (0, import_react29.createElement)(
- return (0, import_react27.createElement)(
++ return (0, import_react30.createElement)(
"label",
{ className: stack ? "bt-set-row bt-bs-row bt-bs-stack" : "bt-set-row bt-bs-row" },
- (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-bs-label" }, label), hint ? (0, import_react29.createElement)("span", { className: "bt-set-hint" }, hint) : null),
- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, label), hint ? (0, import_react27.createElement)("span", { className: "bt-set-hint" }, hint) : null),
++ (0, import_react30.createElement)("span", { className: "bt-set-copy" }, (0, import_react30.createElement)("span", { className: "bt-bs-label" }, label), hint ? (0, import_react30.createElement)("span", { className: "bt-set-hint" }, hint) : null),
children
);
}
-function Card({ title, children }) {
- return (0, import_react27.createElement)("section", { className: "bt-set-section" }, title ? (0, import_react27.createElement)("h3", null, title) : null, (0, import_react27.createElement)("div", { className: "bt-set-card" }, children));
+function Card2({ title, children }) {
- return (0, import_react29.createElement)("section", { className: "bt-set-section" }, title ? (0, import_react29.createElement)("h3", null, title) : null, (0, import_react29.createElement)("div", { className: "bt-set-card" }, children));
++ return (0, import_react30.createElement)("section", { className: "bt-set-section" }, title ? (0, import_react30.createElement)("h3", null, title) : null, (0, import_react30.createElement)("div", { className: "bt-set-card" }, children));
}
function Switch({ on, label, disabled, onChange }) {
- return (0, import_react29.createElement)(
- return (0, import_react27.createElement)(
++ return (0, import_react30.createElement)(
"button",
{ type: "button", role: "switch", className: "bt-switch", "aria-checked": on, "aria-label": label, disabled, onClick: () => onChange(!on) },
- (0, import_react29.createElement)("span", { className: "bt-switch-knob", "aria-hidden": true })
- (0, import_react27.createElement)("span", { className: "bt-switch-knob", "aria-hidden": true })
++ (0, import_react30.createElement)("span", { className: "bt-switch-knob", "aria-hidden": true })
);
}
function SwitchRow({ label, hint, on, disabled, onChange }) {
- return (0, import_react29.createElement)(
- return (0, import_react27.createElement)(
++ return (0, import_react30.createElement)(
"div",
{ className: "bt-set-row bt-bs-row" },
- (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-bs-label" }, label), hint ? (0, import_react29.createElement)("span", { className: "bt-set-hint" }, hint) : null),
- (0, import_react29.createElement)(Switch, { on, label, disabled, onChange })
- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, label), hint ? (0, import_react27.createElement)("span", { className: "bt-set-hint" }, hint) : null),
- (0, import_react27.createElement)(Switch, { on, label, disabled, onChange })
++ (0, import_react30.createElement)("span", { className: "bt-set-copy" }, (0, import_react30.createElement)("span", { className: "bt-bs-label" }, label), hint ? (0, import_react30.createElement)("span", { className: "bt-set-hint" }, hint) : null),
++ (0, import_react30.createElement)(Switch, { on, label, disabled, onChange })
);
}
function modelHint(bot, roster) {
@@@ -12576,22 -12403,22 +12760,22 @@@
return t("Applies from the next message.");
}
function ShapeRing({ shape, size }) {
- const maskId = (0, import_react29.useRef)("");
- const maskId = (0, import_react27.useRef)("");
++ const maskId = (0, import_react30.useRef)("");
if (maskId.current === "") maskId.current = `bt-ring-${nextMarkSerial()}`;
const def = shapeOf(shape);
const unit = def.size / size;
const markup = `<defs><mask id="${maskId.current}" ${maskBox(def.size)}>${holes(def, `<g stroke="#000" stroke-width="${6 * unit}" stroke-linejoin="round">${bodyOf(def, "#000", true)}</g>`)}</mask></defs><g mask="url(#${maskId.current})" stroke="currentColor" stroke-width="${8 * unit}" stroke-linejoin="round">${bodyOf(def, "currentColor", true)}</g>`;
- return (0, import_react29.createElement)("svg", { className: "bt-ring", viewBox: `0 0 ${def.size} ${def.size}`, "aria-hidden": true, dangerouslySetInnerHTML: { __html: markup } });
- return (0, import_react27.createElement)("svg", { className: "bt-ring", viewBox: `0 0 ${def.size} ${def.size}`, "aria-hidden": true, dangerouslySetInnerHTML: { __html: markup } });
++ return (0, import_react30.createElement)("svg", { className: "bt-ring", viewBox: `0 0 ${def.size} ${def.size}`, "aria-hidden": true, dangerouslySetInnerHTML: { __html: markup } });
}
function CharacterGrid({ look, hasPhoto = false, onShape, onColor }) {
const shapes = [...PICKER_SHAPES, ...Object.keys(SHAPES).filter((id) => !Object.hasOwn(CHARACTERS, id))];
if (!shapes.includes(look.shape)) shapes.push(look.shape);
const rows2 = [];
for (let index = 0; index < shapes.length; index += PICKER_COLUMNS) rows2.push(shapes.slice(index, index + PICKER_COLUMNS));
- return (0, import_react29.createElement)(
- import_react29.Fragment,
- return (0, import_react27.createElement)(
- import_react27.Fragment,
++ return (0, import_react30.createElement)(
++ import_react30.Fragment,
null,
- (0, import_react29.createElement)("div", { className: "bt-shapes", role: "group", "aria-label": t("Character shape") }, rows2.map((row, index) => (0, import_react29.createElement)("div", { key: index, className: "bt-shape-row" }, row.map((id) => (0, import_react29.createElement)("button", {
- (0, import_react27.createElement)("div", { className: "bt-shapes", role: "group", "aria-label": t("Character shape") }, rows2.map((row, index) => (0, import_react27.createElement)("div", { key: index, className: "bt-shape-row" }, row.map((id) => (0, import_react27.createElement)("button", {
++ (0, import_react30.createElement)("div", { className: "bt-shapes", role: "group", "aria-label": t("Character shape") }, rows2.map((row, index) => (0, import_react30.createElement)("div", { key: index, className: "bt-shape-row" }, row.map((id) => (0, import_react30.createElement)("button", {
key: id,
type: "button",
className: "bt-shape",
@@@ -12599,8 -12426,8 +12783,8 @@@
title: t(shapeOf(id).label),
"aria-pressed": !hasPhoto && look.shape === id,
onClick: () => onShape(id)
- }, (0, import_react29.createElement)(ShapeRing, { shape: id, size: 36 }), (0, import_react29.createElement)(BotMark, { look: { shape: id, color: look.color }, size: 36 })))))),
- (0, import_react29.createElement)("div", { className: "bt-colors", role: "group", "aria-label": t("Character color") }, CHARACTER_COLORS.map((color) => (0, import_react29.createElement)("button", {
- }, (0, import_react27.createElement)(ShapeRing, { shape: id, size: 36 }), (0, import_react27.createElement)(BotMark, { look: { shape: id, color: look.color }, size: 36 })))))),
- (0, import_react27.createElement)("div", { className: "bt-colors", role: "group", "aria-label": t("Character color") }, CHARACTER_COLORS.map((color) => (0, import_react27.createElement)("button", {
++ }, (0, import_react30.createElement)(ShapeRing, { shape: id, size: 36 }), (0, import_react30.createElement)(BotMark, { look: { shape: id, color: look.color }, size: 36 })))))),
++ (0, import_react30.createElement)("div", { className: "bt-colors", role: "group", "aria-label": t("Character color") }, CHARACTER_COLORS.map((color) => (0, import_react30.createElement)("button", {
key: color,
type: "button",
className: "bt-color",
@@@ -12608,19 -12435,19 +12792,19 @@@
title: t(capitalize(color)),
"aria-pressed": look.color === color,
onClick: () => onColor(color)
- }, (0, import_react29.createElement)("span", { style: { background: paintCss(color) } }))))
- }, (0, import_react27.createElement)("span", { style: { background: paintCss(color) } }))))
++ }, (0, import_react30.createElement)("span", { style: { background: paintCss(color) } }))))
);
}
function AvatarEditor({ bot, actions, run: run2, onClose }) {
const look = lookOf(bot);
- const [tab, setTab] = (0, import_react29.useState)(look.image ? "upload" : "bot");
- const [over, setOver] = (0, import_react29.useState)(false);
- const ref = (0, import_react29.useRef)(null);
- const fileRef = (0, import_react29.useRef)(null);
- const [tab, setTab] = (0, import_react27.useState)(look.image ? "upload" : "bot");
- const [over, setOver] = (0, import_react27.useState)(false);
- const ref = (0, import_react27.useRef)(null);
- const fileRef = (0, import_react27.useRef)(null);
++ const [tab, setTab] = (0, import_react30.useState)(look.image ? "upload" : "bot");
++ const [over, setOver] = (0, import_react30.useState)(false);
++ const ref = (0, import_react30.useRef)(null);
++ const fileRef = (0, import_react30.useRef)(null);
const upload = (file) => {
if (file) void run2(avatarImage(file).then((image) => actions.updateBot(bot.id, { avatar: { ...bot.avatar ?? {}, image } })));
};
- (0, import_react29.useEffect)(() => {
- (0, import_react27.useEffect)(() => {
++ (0, import_react30.useEffect)(() => {
const onDown = (event) => {
if (!(event.target instanceof Element) || ref.current?.contains(event.target) || event.target.closest(".bt-avatar-trigger")) return;
onClose();
@@@ -12638,7 -12465,7 +12822,7 @@@
window.removeEventListener("keydown", onKey, true);
};
}, [onClose]);
- (0, import_react29.useEffect)(() => {
- (0, import_react27.useEffect)(() => {
++ (0, import_react30.useEffect)(() => {
if (tab !== "upload") return void 0;
const onPaste = (event) => {
const file = [...event.clipboardData?.files ?? []].find((item) => item.type.startsWith("image/"));
@@@ -12652,32 -12479,32 +12836,32 @@@
}, [tab, bot]);
const hasPhoto = Boolean(look.image);
const glide = useGlide(tab);
- return (0, import_react29.createElement)(
- return (0, import_react27.createElement)(
++ return (0, import_react30.createElement)(
"div",
{ ref, className: "bt-avedit", role: "dialog", "aria-label": t("Avatar editor") },
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
++ (0, import_react30.createElement)(
"div",
{ className: "bt-avedit-top" },
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
++ (0, import_react30.createElement)(
"div",
{ ref: glide.box, role: "tablist", "aria-label": t("Avatar source"), className: "bt-avedit-tabs" },
- (0, import_react29.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
- [["bot", "Bot"], ["upload", "Upload"]].map(([id, label]) => (0, import_react29.createElement)("button", { key: id, type: "button", role: "tab", className: "bt-avedit-tab", "aria-selected": tab === id, onClick: () => setTab(id) }, t(label)))
- (0, import_react27.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
- [["bot", "Bot"], ["upload", "Upload"], ["library", "Library"]].map(([id, label]) => (0, import_react27.createElement)("button", { key: id, type: "button", role: "tab", className: "bt-avedit-tab", "aria-selected": tab === id, onClick: () => setTab(id) }, t(label)))
++ (0, import_react30.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
++ [["bot", "Bot"], ["upload", "Upload"], ["library", "Library"]].map(([id, label]) => (0, import_react30.createElement)("button", { key: id, type: "button", role: "tab", className: "bt-avedit-tab", "aria-selected": tab === id, onClick: () => setTab(id) }, t(label)))
),
- (0, import_react29.createElement)("button", {
- (0, import_react27.createElement)("button", {
++ (0, import_react30.createElement)("button", {
type: "button",
className: "bt-avedit-tab bt-avedit-reset",
title: t("Reset character to default"),
onClick: () => run2(actions.updateBot(bot.id, { avatar: null, color: null }))
}, t("Reset"))
),
- tab === "bot" ? (0, import_react29.createElement)(CharacterGrid, {
- tab === "bot" ? (0, import_react27.createElement)(CharacterGrid, {
++ tab === "bot" ? (0, import_react30.createElement)(CharacterGrid, {
look,
hasPhoto,
onShape: (shape) => run2(actions.updateBot(bot.id, { avatar: { shape } })),
onColor: (color) => run2(actions.updateBot(bot.id, { color }))
}) : null,
- tab === "upload" ? (0, import_react29.createElement)(
- tab === "upload" ? (0, import_react27.createElement)(
++ tab === "upload" ? (0, import_react30.createElement)(
"div",
{
className: "bt-dropzone",
@@@ -12693,41 -12520,47 +12877,47 @@@
upload(event.dataTransfer.files?.[0]);
}
},
- hasPhoto ? (0, import_react29.createElement)("img", { src: look.image, alt: "" }) : null,
- (0, import_react29.createElement)("div", null, t("Drag, drop, or paste an image")),
- (0, import_react29.createElement)(
- hasPhoto ? (0, import_react27.createElement)("img", { src: look.image, alt: "" }) : null,
- (0, import_react27.createElement)("div", null, t("Drag, drop, or paste an image")),
- (0, import_react27.createElement)(
++ hasPhoto ? (0, import_react30.createElement)("img", { src: look.image, alt: "" }) : null,
++ (0, import_react30.createElement)("div", null, t("Drag, drop, or paste an image")),
++ (0, import_react30.createElement)(
"div",
{ className: "bt-actions", style: { justifyContent: "center" } },
- (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => fileRef.current?.click() }, hasPhoto ? t("Replace") : t("Browse files")),
- hasPhoto ? (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.updateBot(bot.id, { avatar: hasShape(bot.avatar?.shape) ? { shape: bot.avatar.shape } : null })) }, t("Remove photo")) : null
- (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => fileRef.current?.click() }, hasPhoto ? t("Replace") : t("Browse files")),
- hasPhoto ? (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.updateBot(bot.id, { avatar: hasShape(bot.avatar?.shape) ? { shape: bot.avatar.shape } : null })) }, t("Remove photo")) : null
++ (0, import_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => fileRef.current?.click() }, hasPhoto ? t("Replace") : t("Browse files")),
++ hasPhoto ? (0, import_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.updateBot(bot.id, { avatar: hasShape(bot.avatar?.shape) ? { shape: bot.avatar.shape } : null })) }, t("Remove photo")) : null
),
- (0, import_react29.createElement)("input", { ref: fileRef, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", hidden: true, onChange: (event) => {
- (0, import_react27.createElement)("input", { ref: fileRef, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", hidden: true, onChange: (event) => {
++ (0, import_react30.createElement)("input", { ref: fileRef, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", hidden: true, onChange: (event) => {
const file = event.target.files?.[0];
event.target.value = "";
upload(file);
} })
- ) : null
+ ) : null,
+ // A photo from the library is the same photo the user uploaded before: the Bot
+ // keeps its own copy, and the library keeps its entry.
- tab === "library" ? (0, import_react27.createElement)(AvatarLibraryPanel, {
++ tab === "library" ? (0, import_react30.createElement)(AvatarLibraryPanel, {
+ actions,
+ onPick: (entry) => run2(actions.updateBot(bot.id, { avatar: { ...bot.avatar, image: entry.image } }))
+ }) : null
);
}
function MemoryCard({ bot, actions }) {
const count = useMemoryCount(bot.id, actions);
const label = count === null ? t("Loading…") : count === 0 ? t("Nothing saved yet") : count === 1 ? t("1 entry") : t("{count} entries", { count });
- return (0, import_react29.createElement)(
- return (0, import_react27.createElement)(
- Card,
++ return (0, import_react30.createElement)(
+ Card2,
{ title: t("Memory") },
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
++ (0, import_react30.createElement)(
"button",
{ type: "button", className: "bt-set-row bt-bs-row", "aria-label": t("Manage {name}'s memory", { name: bot.name }), onClick: () => actions.openMemory(bot.id) },
- (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-bs-label" }, label)),
- (0, import_react29.createElement)("span", { className: "bt-mem-row-go" }, t("Manage"), (0, import_react29.createElement)(ChevronRightIcon))
- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, label)),
- (0, import_react27.createElement)("span", { className: "bt-mem-row-go" }, t("Manage"), (0, import_react27.createElement)(ChevronRightIcon))
++ (0, import_react30.createElement)("span", { className: "bt-set-copy" }, (0, import_react30.createElement)("span", { className: "bt-bs-label" }, label)),
++ (0, import_react30.createElement)("span", { className: "bt-mem-row-go" }, t("Manage"), (0, import_react30.createElement)(ChevronRightIcon))
)
);
}
function BotSettingsForm({ bot, roster, actions, run: run2 }) {
- const [editing, setEditing] = (0, import_react29.useState)(false);
- const [confirming, setConfirming] = (0, import_react29.useState)(false);
- const closeEditor = (0, import_react29.useCallback)(() => setEditing(false), []);
- (0, import_react29.useEffect)(() => {
- const [editing, setEditing] = (0, import_react27.useState)(false);
- const [confirming, setConfirming] = (0, import_react27.useState)(false);
- const closeEditor = (0, import_react27.useCallback)(() => setEditing(false), []);
- (0, import_react27.useEffect)(() => {
++ const [editing, setEditing] = (0, import_react30.useState)(false);
++ const [confirming, setConfirming] = (0, import_react30.useState)(false);
++ const closeEditor = (0, import_react30.useCallback)(() => setEditing(false), []);
++ (0, import_react30.useEffect)(() => {
if (!confirming) return void 0;
const timer = setTimeout(() => setConfirming(false), 4e3);
return () => clearTimeout(timer);
@@@ -12741,112 -12574,112 +12931,112 @@@
if (confirming) void run2(actions.deleteBot(bot.id));
else setConfirming(true);
};
- (0, import_react29.useEffect)(() => {
- (0, import_react27.useEffect)(() => {
++ (0, import_react30.useEffect)(() => {
void actions.refreshModels?.();
}, [bot.id]);
- return (0, import_react29.createElement)(
- return (0, import_react27.createElement)(
++ return (0, import_react30.createElement)(
"div",
{ className: "bt-bs" },
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
++ (0, import_react30.createElement)(
"div",
{ className: "bt-bs-hero" },
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
++ (0, import_react30.createElement)(
"div",
{ className: "bt-avatar-anchor" },
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
++ (0, import_react30.createElement)(
"button",
{ type: "button", className: "bt-avatar-trigger", "aria-label": t("Edit Bot avatar"), "aria-expanded": editing, onClick: () => setEditing((value) => !value) },
- (0, import_react29.createElement)(BotMark, { bot, size: 64, live: true }),
- (0, import_react29.createElement)("span", { className: "bt-avatar-pencil", "aria-hidden": true }, (0, import_react29.createElement)(PencilIcon))
- (0, import_react27.createElement)(BotMark, { bot, size: 64, live: true }),
- (0, import_react27.createElement)("span", { className: "bt-avatar-pencil", "aria-hidden": true }, (0, import_react27.createElement)(PencilIcon))
++ (0, import_react30.createElement)(BotMark, { bot, size: 64, live: true }),
++ (0, import_react30.createElement)("span", { className: "bt-avatar-pencil", "aria-hidden": true }, (0, import_react30.createElement)(PencilIcon))
),
- editing ? (0, import_react29.createElement)(AvatarEditor, { bot, actions, run: run2, onClose: closeEditor }) : null
- editing ? (0, import_react27.createElement)(AvatarEditor, { bot, actions, run: run2, onClose: closeEditor }) : null
++ editing ? (0, import_react30.createElement)(AvatarEditor, { bot, actions, run: run2, onClose: closeEditor }) : null
),
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
++ (0, import_react30.createElement)(
"div",
{ className: "bt-bs-who" },
- (0, import_react29.createElement)("span", { className: "bt-bs-name" }, bot.name),
- (0, import_react29.createElement)("span", { className: "bt-bs-sub" }, [bot.role, isMainBot ? t("Main Bot") : ""].filter(Boolean).join(" · ") || t("Bot"))
- (0, import_react27.createElement)("span", { className: "bt-bs-name" }, bot.name),
- (0, import_react27.createElement)("span", { className: "bt-bs-sub" }, [bot.role, isMainBot ? t("Main Bot") : ""].filter(Boolean).join(" · ") || t("Bot"))
++ (0, import_react30.createElement)("span", { className: "bt-bs-name" }, bot.name),
++ (0, import_react30.createElement)("span", { className: "bt-bs-sub" }, [bot.role, isMainBot ? t("Main Bot") : ""].filter(Boolean).join(" · ") || t("Bot"))
)
),
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
- Card,
++ (0, import_react30.createElement)(
+ Card2,
{ title: t("Profile") },
- (0, import_react29.createElement)(Row, { label: t("Name") }, (0, import_react29.createElement)(InlineText, { label: t("Name"), value: bot.name, placeholder: "Bob", required: true, maxLength: 40, onSave: (name) => save({ name }) })),
- (0, import_react29.createElement)(Row, { label: t("Label"), hint: t("Optional. Shown under the name.") }, (0, import_react29.createElement)(InlineText, { label: t("Label"), value: bot.role, placeholder: t("Research, admin…"), maxLength: 24, onSave: (role) => save({ role }) }))
- (0, import_react27.createElement)(Row, { label: t("Name") }, (0, import_react27.createElement)(InlineText, { label: t("Name"), value: bot.name, placeholder: "Bob", required: true, maxLength: 40, onSave: (name) => save({ name }) })),
- (0, import_react27.createElement)(Row, { label: t("Label"), hint: t("Optional. Shown under the name.") }, (0, import_react27.createElement)(InlineText, { label: t("Label"), value: bot.role, placeholder: t("Research, admin…"), maxLength: 24, onSave: (role) => save({ role }) }))
++ (0, import_react30.createElement)(Row, { label: t("Name") }, (0, import_react30.createElement)(InlineText, { label: t("Name"), value: bot.name, placeholder: "Bob", required: true, maxLength: 40, onSave: (name) => save({ name }) })),
++ (0, import_react30.createElement)(Row, { label: t("Label"), hint: t("Optional. Shown under the name.") }, (0, import_react30.createElement)(InlineText, { label: t("Label"), value: bot.role, placeholder: t("Research, admin…"), maxLength: 24, onSave: (role) => save({ role }) }))
),
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
- Card,
++ (0, import_react30.createElement)(
+ Card2,
{ title: t("Model") },
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
++ (0, import_react30.createElement)(
"div",
{ className: "bt-set-row bt-bs-row" },
- (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-bs-label" }, t("Model")), (0, import_react29.createElement)("span", { className: "bt-set-hint" }, modelHint(bot, roster))),
- (0, import_react29.createElement)(ModelMenu, { bot, roster, actions, run: run2 })
- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t("Model")), (0, import_react27.createElement)("span", { className: "bt-set-hint" }, modelHint(bot, roster))),
- (0, import_react27.createElement)(ModelMenu, { bot, roster, actions, run: run2 })
++ (0, import_react30.createElement)("span", { className: "bt-set-copy" }, (0, import_react30.createElement)("span", { className: "bt-bs-label" }, t("Model")), (0, import_react30.createElement)("span", { className: "bt-set-hint" }, modelHint(bot, roster))),
++ (0, import_react30.createElement)(ModelMenu, { bot, roster, actions, run: run2 })
)
),
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
- Card,
++ (0, import_react30.createElement)(
+ Card2,
{ title: t("Working folder") },
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
++ (0, import_react30.createElement)(
"div",
{ className: "bt-set-row bt-bs-row" },
- (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-bs-label" }, t("Folder"))),
- (0, import_react29.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, onPick: (workDir) => save({ workDir }) })
- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t("Folder"))),
- (0, import_react27.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, onPick: (workDir) => save({ workDir }) })
++ (0, import_react30.createElement)("span", { className: "bt-set-copy" }, (0, import_react30.createElement)("span", { className: "bt-bs-label" }, t("Folder"))),
++ (0, import_react30.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, onPick: (workDir) => save({ workDir }) })
)
),
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
- Card,
++ (0, import_react30.createElement)(
+ Card2,
{ title: t("Instructions") },
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
++ (0, import_react30.createElement)(
Row,
{ label: t("What this Bot does"), hint: t("Its job on the team. Part of the Bot's system prompt."), stack: true },
- (0, import_react29.createElement)(InlineText, { label: t("Instructions"), value: bot.instructions, multiline: true, placeholder: t("What this Bot is responsible for…"), onSave: (instructions) => save({ instructions }) })
- (0, import_react27.createElement)(InlineText, { label: t("Instructions"), value: bot.instructions, multiline: true, placeholder: t("What this Bot is responsible for…"), onSave: (instructions) => save({ instructions }) })
++ (0, import_react30.createElement)(InlineText, { label: t("Instructions"), value: bot.instructions, multiline: true, placeholder: t("What this Bot is responsible for…"), onSave: (instructions) => save({ instructions }) })
)
),
- (0, import_react29.createElement)(BotCapabilitiesCard, { bot, roster, actions, run: run2, Card: Card2, SwitchRow }),
- roster.memory === false ? null : (0, import_react29.createElement)(MemoryCard, { bot, actions }),
- (0, import_react29.createElement)(BotSchedules, { bot, roster, actions }),
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(BotCapabilitiesCard, { bot, roster, actions, run: run2, Card, SwitchRow }),
- roster.memory === false ? null : (0, import_react27.createElement)(MemoryCard, { bot, actions }),
- (0, import_react27.createElement)(BotSchedules, { bot, roster, actions }),
- (0, import_react27.createElement)(
- Card,
++ (0, import_react30.createElement)(BotCapabilitiesCard, { bot, roster, actions, run: run2, Card: Card2, SwitchRow }),
++ roster.memory === false ? null : (0, import_react30.createElement)(MemoryCard, { bot, actions }),
++ (0, import_react30.createElement)(BotSchedules, { bot, roster, actions }),
++ (0, import_react30.createElement)(
+ Card2,
{ title: t("Main Bot") },
- onlyMain ? (0, import_react29.createElement)(
- onlyMain ? (0, import_react27.createElement)(
++ onlyMain ? (0, import_react30.createElement)(
"div",
{ className: "bt-set-row bt-bs-row" },
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
++ (0, import_react30.createElement)(
"span",
{ className: "bt-set-copy" },
- (0, import_react29.createElement)("span", { className: "bt-bs-label" }, t("Main Bot")),
- (0, import_react29.createElement)("span", { className: "bt-set-hint" }, t("The only Main Bot. To hand the role to another Bot, use Main Bot on the Bots page."))
- (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t("Main Bot")),
- (0, import_react27.createElement)("span", { className: "bt-set-hint" }, t("The only Main Bot. To hand the role to another Bot, use Main Bot on the Bots page."))
++ (0, import_react30.createElement)("span", { className: "bt-bs-label" }, t("Main Bot")),
++ (0, import_react30.createElement)("span", { className: "bt-set-hint" }, t("The only Main Bot. To hand the role to another Bot, use Main Bot on the Bots page."))
),
- (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("bots") }, t("Change"))
- ) : (0, import_react29.createElement)(SwitchRow, { label: t("Main Bot"), hint: t("Can create and change Bots, and runs every group chat."), on: isMainBot, onChange: (on) => run2(actions.setMain(bot.id, on)) })
- (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("bots") }, t("Change"))
- ) : (0, import_react27.createElement)(SwitchRow, { label: t("Main Bot"), hint: t("Can create and change Bots, and runs every group chat."), on: isMainBot, onChange: (on) => run2(actions.setMain(bot.id, on)) })
++ (0, import_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("bots") }, t("Change"))
++ ) : (0, import_react30.createElement)(SwitchRow, { label: t("Main Bot"), hint: t("Can create and change Bots, and runs every group chat."), on: isMainBot, onChange: (on) => run2(actions.setMain(bot.id, on)) })
),
// The Main Bot tile is always first and always shown, like in the context menu.
- isTile ? null : (0, import_react29.createElement)(
- isTile ? null : (0, import_react27.createElement)(
- Card,
++ isTile ? null : (0, import_react30.createElement)(
+ Card2,
{ title: t("Sidebar") },
- (0, import_react29.createElement)(SwitchRow, { label: t("Pin"), hint: t("Kept above the other chats."), on: bot.pinned === true, onChange: (pinned) => run2(actions.setFlags(bot.id, { pinned })) }),
- isMainBot ? null : (0, import_react29.createElement)(SwitchRow, { label: t("Hide from sidebar"), hint: t("Search still finds it."), on: bot.hidden === true, onChange: (hidden) => run2(actions.setFlags(bot.id, { hidden })) })
- (0, import_react27.createElement)(SwitchRow, { label: t("Pin"), hint: t("Kept above the other chats."), on: bot.pinned === true, onChange: (pinned) => run2(actions.setFlags(bot.id, { pinned })) }),
- isMainBot ? null : (0, import_react27.createElement)(SwitchRow, { label: t("Hide from sidebar"), hint: t("Search still finds it."), on: bot.hidden === true, onChange: (hidden) => run2(actions.setFlags(bot.id, { hidden })) })
++ (0, import_react30.createElement)(SwitchRow, { label: t("Pin"), hint: t("Kept above the other chats."), on: bot.pinned === true, onChange: (pinned) => run2(actions.setFlags(bot.id, { pinned })) }),
++ isMainBot ? null : (0, import_react30.createElement)(SwitchRow, { label: t("Hide from sidebar"), hint: t("Search still finds it."), on: bot.hidden === true, onChange: (hidden) => run2(actions.setFlags(bot.id, { hidden })) })
),
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
- Card,
++ (0, import_react30.createElement)(
+ Card2,
{ title: t("Manage") },
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
++ (0, import_react30.createElement)(
"button",
{ type: "button", className: "bt-set-row bt-bs-row", onClick: duplicate },
- (0, import_react29.createElement)("span", { className: "bt-set-copy" }, (0, import_react29.createElement)("span", { className: "bt-bs-label" }, t("Duplicate")), (0, import_react29.createElement)("span", { className: "bt-set-hint" }, t("A copy with the same job and model, and fresh memory."))),
- (0, import_react29.createElement)("span", { className: "bt-chevron" }, (0, import_react29.createElement)(ChevronRightIcon))
- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t("Duplicate")), (0, import_react27.createElement)("span", { className: "bt-set-hint" }, t("A copy with the same job and model, and fresh memory."))),
- (0, import_react27.createElement)("span", { className: "bt-chevron" }, (0, import_react27.createElement)(ChevronRightIcon))
++ (0, import_react30.createElement)("span", { className: "bt-set-copy" }, (0, import_react30.createElement)("span", { className: "bt-bs-label" }, t("Duplicate")), (0, import_react30.createElement)("span", { className: "bt-set-hint" }, t("A copy with the same job and model, and fresh memory."))),
++ (0, import_react30.createElement)("span", { className: "bt-chevron" }, (0, import_react30.createElement)(ChevronRightIcon))
),
- isMainBot ? null : (0, import_react29.createElement)(
- isMainBot ? null : (0, import_react27.createElement)(
++ isMainBot ? null : (0, import_react30.createElement)(
"button",
{ type: "button", className: "bt-set-row bt-bs-row bt-bs-danger", "data-confirm": confirming || void 0, onClick: remove },
- (0, import_react29.createElement)(
- (0, import_react27.createElement)(
++ (0, import_react30.createElement)(
"span",
{ className: "bt-set-copy" },
- (0, import_react29.createElement)("span", { className: "bt-bs-label" }, confirming ? t("Delete {name}?", { name: bot.name }) : t("Delete Bot")),
- (0, import_react29.createElement)("span", { className: "bt-set-hint" }, confirming ? t("Click again to delete. Its chats are archived.") : t("Removes the Bot from the team."))
- (0, import_react27.createElement)("span", { className: "bt-bs-label" }, confirming ? t("Delete {name}?", { name: bot.name }) : t("Delete Bot")),
- (0, import_react27.createElement)("span", { className: "bt-set-hint" }, confirming ? t("Click again to delete. Its chats are archived.") : t("Removes the Bot from the team."))
++ (0, import_react30.createElement)("span", { className: "bt-bs-label" }, confirming ? t("Delete {name}?", { name: bot.name }) : t("Delete Bot")),
++ (0, import_react30.createElement)("span", { className: "bt-set-hint" }, confirming ? t("Click again to delete. Its chats are archived.") : t("Removes the Bot from the team."))
),
- (0, import_react29.createElement)("span", { className: "bt-chevron" }, (0, import_react29.createElement)(ChevronRightIcon))
- (0, import_react27.createElement)("span", { className: "bt-chevron" }, (0, import_react27.createElement)(ChevronRightIcon))
++ (0, import_react30.createElement)("span", { className: "bt-chevron" }, (0, import_react30.createElement)(ChevronRightIcon))
)
)
);
@@@ -12907,7 -12740,7 +13097,7 @@@ function createPayload({ name, look, im
}
// src/client/create-bot.js
- var import_react30 = require("react");
-var import_react28 = require("react");
++var import_react31 = require("react");
var pick = (list) => list[Math.floor(Math.random() * list.length)];
var randomLook = (avoid = {}) => {
const shapes = DEFAULT_SHAPES.filter((shape) => shape !== avoid.shape);
@@@ -12915,17 -12748,18 +13105,18 @@@
return { shape: pick(shapes), color: pick(colors) };
};
function CreateBot({ roster, actions, start, brief = "", onBack, canGoBack, onCreated, inline = false }) {
- const [look, setLook] = (0, import_react30.useState)(() => randomLook());
- const [image, setImage] = (0, import_react30.useState)(null);
- const [name, setName] = (0, import_react30.useState)(start?.name ?? "");
- const [model, setModel] = (0, import_react30.useState)(() => startModel(roster));
- const [effort, setEffort] = (0, import_react30.useState)(void 0);
- const [busy, setBusy] = (0, import_react30.useState)(false);
- const [error, setError] = (0, import_react30.useState)("");
- const fileRef = (0, import_react30.useRef)(null);
- const frame = (0, import_react30.useRef)(null);
- const [look, setLook] = (0, import_react28.useState)(() => randomLook());
- const [image, setImage] = (0, import_react28.useState)(null);
- const [library, setLibrary] = (0, import_react28.useState)(false);
- const [name, setName] = (0, import_react28.useState)(start?.name ?? "");
- const [model, setModel] = (0, import_react28.useState)(() => startModel(roster));
- const [effort, setEffort] = (0, import_react28.useState)(void 0);
- const [busy, setBusy] = (0, import_react28.useState)(false);
- const [error, setError] = (0, import_react28.useState)("");
- const fileRef = (0, import_react28.useRef)(null);
- const frame = (0, import_react28.useRef)(null);
++ const [look, setLook] = (0, import_react31.useState)(() => randomLook());
++ const [image, setImage] = (0, import_react31.useState)(null);
++ const [library, setLibrary] = (0, import_react31.useState)(false);
++ const [name, setName] = (0, import_react31.useState)(start?.name ?? "");
++ const [model, setModel] = (0, import_react31.useState)(() => startModel(roster));
++ const [effort, setEffort] = (0, import_react31.useState)(void 0);
++ const [busy, setBusy] = (0, import_react31.useState)(false);
++ const [error, setError] = (0, import_react31.useState)("");
++ const fileRef = (0, import_react31.useRef)(null);
++ const frame = (0, import_react31.useRef)(null);
useEscape(onBack);
- (0, import_react30.useEffect)(() => {
- (0, import_react28.useEffect)(() => {
++ (0, import_react31.useEffect)(() => {
if (inline) frame.current?.scrollIntoView({ block: "start", behavior: "smooth" });
}, []);
const fallbackName = freshBotName(roster, t("New Bot"));
@@@ -12950,25 -12784,25 +13141,25 @@@
avatarImage(file).then(setImage, (failure) => setError(failure?.message ?? String(failure)));
};
const previewLook = image ? { ...look, image } : look;
- const card = (0, import_react30.createElement)(
- const card = (0, import_react28.createElement)(
++ const card = (0, import_react31.createElement)(
"div",
{ className: "bt-create-card" },
- (0, import_react30.createElement)(
- (0, import_react28.createElement)(
++ (0, import_react31.createElement)(
"div",
{ className: "bt-create-preview" },
// The key remounts the mark, so every new pick plays the pop.
- (0, import_react30.createElement)(
- (0, import_react28.createElement)(
++ (0, import_react31.createElement)(
"span",
{ key: `${look.shape}:${look.color}:${image ? "photo" : ""}`, className: "bt-create-pop" },
- (0, import_react30.createElement)(BotMark, { look: previewLook, bot: { id: "new-bot" }, size: 88, live: true, gaze: true, pokeable: true })
- (0, import_react28.createElement)(BotMark, { look: previewLook, bot: { id: "new-bot" }, size: 88, live: true, gaze: true, pokeable: true })
++ (0, import_react31.createElement)(BotMark, { look: previewLook, bot: { id: "new-bot" }, size: 88, live: true, gaze: true, pokeable: true })
),
- (0, import_react30.createElement)("span", { className: "bt-create-name" }, finalName)
- (0, import_react28.createElement)("span", { className: "bt-create-name" }, finalName)
++ (0, import_react31.createElement)("span", { className: "bt-create-name" }, finalName)
),
- (0, import_react30.createElement)("div", { className: "bt-create-step" }, t("Look")),
- (0, import_react30.createElement)(
- (0, import_react28.createElement)("div", { className: "bt-create-step" }, t("Look")),
- (0, import_react28.createElement)(
++ (0, import_react31.createElement)("div", { className: "bt-create-step" }, t("Look")),
++ (0, import_react31.createElement)(
"div",
{ className: "bt-create-looks" },
- (0, import_react30.createElement)(CharacterGrid, {
- (0, import_react28.createElement)(CharacterGrid, {
++ (0, import_react31.createElement)(CharacterGrid, {
look,
hasPhoto: Boolean(image),
onShape: (shape) => {
@@@ -12980,27 -12814,33 +13171,33 @@@
setLook((current) => ({ ...current, color }));
}
}),
- (0, import_react30.createElement)(
- (0, import_react28.createElement)(
++ (0, import_react31.createElement)(
"div",
{ className: "bt-actions bt-create-lookbar" },
- (0, import_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => {
- (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => {
++ (0, import_react31.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => {
setImage(null);
setLook((current) => randomLook(current));
} }, t("Shuffle")),
- (0, import_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => fileRef.current?.click() }, image ? t("Replace photo") : t("Upload photo")),
- image ? (0, import_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setImage(null) }, t("Remove photo")) : null,
- (0, import_react30.createElement)("input", { ref: fileRef, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", hidden: true, onChange: (event) => {
- (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => fileRef.current?.click() }, image ? t("Replace photo") : t("Upload photo")),
- (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", "aria-expanded": library, onClick: () => setLibrary((value) => !value) }, t("Library")),
- image ? (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setImage(null) }, t("Remove photo")) : null,
- (0, import_react28.createElement)("input", { ref: fileRef, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", hidden: true, onChange: (event) => {
++ (0, import_react31.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => fileRef.current?.click() }, image ? t("Replace photo") : t("Upload photo")),
++ (0, import_react31.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", "aria-expanded": library, onClick: () => setLibrary((value) => !value) }, t("Library")),
++ image ? (0, import_react31.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setImage(null) }, t("Remove photo")) : null,
++ (0, import_react31.createElement)("input", { ref: fileRef, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", hidden: true, onChange: (event) => {
const file = event.target.files?.[0];
event.target.value = "";
upload(file);
} })
)
),
- (0, import_react30.createElement)(
+ // The library is a block of its own under the look, not a part of the button row.
- library ? (0, import_react28.createElement)(AvatarLibraryPanel, { actions, onPick: (entry) => {
++ library ? (0, import_react31.createElement)(AvatarLibraryPanel, { actions, onPick: (entry) => {
+ setImage(entry.image);
+ setLibrary(false);
+ } }) : null,
- (0, import_react28.createElement)(
++ (0, import_react31.createElement)(
"label",
{ className: "bt-field" },
- (0, import_react30.createElement)("span", { className: "bt-field-label" }, t("Name")),
- (0, import_react30.createElement)("input", {
- (0, import_react28.createElement)("span", { className: "bt-field-label" }, t("Name")),
- (0, import_react28.createElement)("input", {
++ (0, import_react31.createElement)("span", { className: "bt-field-label" }, t("Name")),
++ (0, import_react31.createElement)("input", {
className: "bt-input",
autoFocus: !inline,
value: name,
@@@ -13015,54 -12855,54 +13212,54 @@@
}
}
}),
- problem ? (0, import_react30.createElement)("span", { className: "bt-note bt-danger" }, hostText(problem)) : clash ? (0, import_react30.createElement)("span", { className: "bt-note bt-danger" }, t("A Bot named {name} already exists", { name: finalName })) : null
- problem ? (0, import_react28.createElement)("span", { className: "bt-note bt-danger" }, hostText(problem)) : clash ? (0, import_react28.createElement)("span", { className: "bt-note bt-danger" }, t("A Bot named {name} already exists", { name: finalName })) : null
++ problem ? (0, import_react31.createElement)("span", { className: "bt-note bt-danger" }, hostText(problem)) : clash ? (0, import_react31.createElement)("span", { className: "bt-note bt-danger" }, t("A Bot named {name} already exists", { name: finalName })) : null
),
- (0, import_react30.createElement)(
- (0, import_react28.createElement)(
++ (0, import_react31.createElement)(
"div",
{ className: "bt-field" },
- (0, import_react30.createElement)("span", { className: "bt-field-label" }, t("Model")),
- (0, import_react30.createElement)(ModelMenu, { bot: { id: "new-bot", name: finalName, model: model || void 0, effort }, roster, actions, wide: true, onPick: (ref) => {
- (0, import_react28.createElement)("span", { className: "bt-field-label" }, t("Model")),
- (0, import_react28.createElement)(ModelMenu, { bot: { id: "new-bot", name: finalName, model: model || void 0, effort }, roster, actions, wide: true, onPick: (ref) => {
++ (0, import_react31.createElement)("span", { className: "bt-field-label" }, t("Model")),
++ (0, import_react31.createElement)(ModelMenu, { bot: { id: "new-bot", name: finalName, model: model || void 0, effort }, roster, actions, wide: true, onPick: (ref) => {
setModel(ref);
setEffort(void 0);
}, onPickEffort: (picked) => setEffort(picked ?? null) }),
- (0, import_react30.createElement)("span", { className: "bt-note" }, (roster.models ?? []).length > 0 ? t("The Bot runs on this model. You can change it later in its details.") : t("Add a provider and a model in DeepSeek Harness first, or pick one in the Bot's chat later."))
- (0, import_react28.createElement)("span", { className: "bt-note" }, (roster.models ?? []).length > 0 ? t("The Bot runs on this model. You can change it later in its details.") : t("Add a provider and a model in DeepSeek Harness first, or pick one in the Bot's chat later."))
++ (0, import_react31.createElement)("span", { className: "bt-note" }, (roster.models ?? []).length > 0 ? t("The Bot runs on this model. You can change it later in its details.") : t("Add a provider and a model in DeepSeek Harness first, or pick one in the Bot's chat later."))
),
- error ? (0, import_react30.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,
- (0, import_react30.createElement)(
- error ? (0, import_react28.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,
- (0, import_react28.createElement)(
++ error ? (0, import_react31.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,
++ (0, import_react31.createElement)(
"div",
{ className: "bt-create-foot" },
- (0, import_react30.createElement)("button", { type: "button", className: "bt-soft", onClick: onBack }, canGoBack ? t("Back") : t("Cancel")),
- (0, import_react30.createElement)("button", { type: "button", className: "bt-send bt-create-go", disabled: busy || clash || Boolean(problem), onClick: () => void create() }, busy ? t("Creating…") : t("Create"))
- (0, import_react28.createElement)("button", { type: "button", className: "bt-soft", onClick: onBack }, canGoBack ? t("Back") : t("Cancel")),
- (0, import_react28.createElement)("button", { type: "button", className: "bt-send bt-create-go", disabled: busy || clash || Boolean(problem), onClick: () => void create() }, busy ? t("Creating…") : t("Create"))
++ (0, import_react31.createElement)("button", { type: "button", className: "bt-soft", onClick: onBack }, canGoBack ? t("Back") : t("Cancel")),
++ (0, import_react31.createElement)("button", { type: "button", className: "bt-send bt-create-go", disabled: busy || clash || Boolean(problem), onClick: () => void create() }, busy ? t("Creating…") : t("Create"))
)
);
- if (inline) return (0, import_react30.createElement)("div", { ref: frame, className: "bt-create-inline", role: "group", "aria-label": t("Create Bot") }, card);
- return (0, import_react30.createElement)(
- if (inline) return (0, import_react28.createElement)("div", { ref: frame, className: "bt-create-inline", role: "group", "aria-label": t("Create Bot") }, card);
- return (0, import_react28.createElement)(
++ if (inline) return (0, import_react31.createElement)("div", { ref: frame, className: "bt-create-inline", role: "group", "aria-label": t("Create Bot") }, card);
++ return (0, import_react31.createElement)(
"div",
{ className: "bt-create", role: "dialog", "aria-label": t("Create Bot") },
- (0, import_react30.createElement)(
- (0, import_react28.createElement)(
++ (0, import_react31.createElement)(
"div",
{ className: "bt-create-head" },
- canGoBack ? (0, import_react30.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to new chat"), onClick: onBack }, (0, import_react30.createElement)(ChevronLeftIcon)) : (0, import_react30.createElement)("span", { className: "bt-create-gap" }),
- (0, import_react30.createElement)("span", { className: "bt-create-title" }, t("Create Bot")),
- (0, import_react30.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close"), onClick: () => actions.closeOverlay() }, (0, import_react30.createElement)(CloseIcon))
- canGoBack ? (0, import_react28.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to new chat"), onClick: onBack }, (0, import_react28.createElement)(ChevronLeftIcon)) : (0, import_react28.createElement)("span", { className: "bt-create-gap" }),
- (0, import_react28.createElement)("span", { className: "bt-create-title" }, t("Create Bot")),
- (0, import_react28.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close"), onClick: () => actions.closeOverlay() }, (0, import_react28.createElement)(CloseIcon))
++ canGoBack ? (0, import_react31.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to new chat"), onClick: onBack }, (0, import_react31.createElement)(ChevronLeftIcon)) : (0, import_react31.createElement)("span", { className: "bt-create-gap" }),
++ (0, import_react31.createElement)("span", { className: "bt-create-title" }, t("Create Bot")),
++ (0, import_react31.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close"), onClick: () => actions.closeOverlay() }, (0, import_react31.createElement)(CloseIcon))
),
- (0, import_react30.createElement)("div", { className: "bt-create-body" }, card)
- (0, import_react28.createElement)("div", { className: "bt-create-body" }, card)
++ (0, import_react31.createElement)("div", { className: "bt-create-body" }, card)
);
}
// src/client/new-chat.js
- var import_react31 = require("react");
-var import_react29 = require("react");
++var import_react32 = require("react");
function NewChat({ mode, roster, actions }) {
- const [query, setQuery] = (0, import_react31.useState)("");
- const [picked, setPicked] = (0, import_react31.useState)([]);
- const [group, setGroup] = (0, import_react31.useState)(mode === "group");
- const [admin, setAdmin] = (0, import_react31.useState)(null);
- const [message, setMessage] = (0, import_react31.useState)("");
- const [busy, setBusy] = (0, import_react31.useState)(false);
- const [error, setError] = (0, import_react31.useState)("");
- const [cursor, setCursor] = (0, import_react31.useState)(0);
- const [draft, setDraft] = (0, import_react31.useState)(mode === "create" ? { name: "", fromList: false } : null);
- const inputRef = (0, import_react31.useRef)(null);
- const [query, setQuery] = (0, import_react29.useState)("");
- const [picked, setPicked] = (0, import_react29.useState)([]);
- const [group, setGroup] = (0, import_react29.useState)(mode === "group");
- const [admin, setAdmin] = (0, import_react29.useState)(null);
- const [message, setMessage] = (0, import_react29.useState)("");
- const [busy, setBusy] = (0, import_react29.useState)(false);
- const [error, setError] = (0, import_react29.useState)("");
- const [cursor, setCursor] = (0, import_react29.useState)(0);
- const [draft, setDraft] = (0, import_react29.useState)(mode === "create" ? { name: "", fromList: false } : null);
- const inputRef = (0, import_react29.useRef)(null);
++ const [query, setQuery] = (0, import_react32.useState)("");
++ const [picked, setPicked] = (0, import_react32.useState)([]);
++ const [group, setGroup] = (0, import_react32.useState)(mode === "group");
++ const [admin, setAdmin] = (0, import_react32.useState)(null);
++ const [message, setMessage] = (0, import_react32.useState)("");
++ const [busy, setBusy] = (0, import_react32.useState)(false);
++ const [error, setError] = (0, import_react32.useState)("");
++ const [cursor, setCursor] = (0, import_react32.useState)(0);
++ const [draft, setDraft] = (0, import_react32.useState)(mode === "create" ? { name: "", fromList: false } : null);
++ const inputRef = (0, import_react32.useRef)(null);
const close = () => actions.closeOverlay();
useEscape(close);
const paneLeft = usePaneLeft();
@@@ -13148,14 -12988,14 +13345,14 @@@
});
const options = [];
if (!group && picked.length === 0 && mode !== "search" && wanted === "") {
- options.push({ key: "new", icon: (0, import_react31.createElement)(PlusIcon), label: t("Create new Bot"), run: createBot });
- options.push({ key: "group", icon: (0, import_react31.createElement)(PeopleIcon), label: t("Create group chat"), run: () => {
- options.push({ key: "new", icon: (0, import_react29.createElement)(PlusIcon), label: t("Create new Bot"), run: createBot });
- options.push({ key: "group", icon: (0, import_react29.createElement)(PeopleIcon), label: t("Create group chat"), run: () => {
++ options.push({ key: "new", icon: (0, import_react32.createElement)(PlusIcon), label: t("Create new Bot"), run: createBot });
++ options.push({ key: "group", icon: (0, import_react32.createElement)(PeopleIcon), label: t("Create group chat"), run: () => {
setGroup(true);
setCursor(0);
inputRef.current?.focus();
} });
if ((roster.agents ?? []).length === 0 && actions.addAgent) {
- options.push({ key: "agent", icon: (0, import_react31.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: 16 }), label: t("Add DSH Agent"), run: () => run2(async () => {
- options.push({ key: "agent", icon: (0, import_react29.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: 16 }), label: t("Add DSH Agent"), run: () => run2(async () => {
++ options.push({ key: "agent", icon: (0, import_react32.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: 16 }), label: t("Add DSH Agent"), run: () => run2(async () => {
await actions.addAgent();
close();
}) });
@@@ -13164,19 -13004,19 +13361,19 @@@
for (const bot of matches) {
options.push({ key: bot.id, bot, label: bot.name, hint: choosingAdmin ? t("Make admin") : group || picked.length > 0 ? t("Add to group chat") : void 0, run: () => openBot(bot) });
}
- if (wanted !== "" && !exact && mode !== "search") options.push({ key: "create", icon: (0, import_react31.createElement)(PlusIcon), label: t("Create new Bot “{name}”", { name: query.trim() }), run: createBot });
- if (wanted !== "" && !exact && mode !== "search") options.push({ key: "create", icon: (0, import_react29.createElement)(PlusIcon), label: t("Create new Bot “{name}”", { name: query.trim() }), run: createBot });
++ if (wanted !== "" && !exact && mode !== "search") options.push({ key: "create", icon: (0, import_react32.createElement)(PlusIcon), label: t("Create new Bot “{name}”", { name: query.trim() }), run: createBot });
const active = Math.min(cursor, Math.max(options.length - 1, 0));
const listed = options.map((option) => option.key).join("\n");
const glide = useGlide(`${active}
${listed}`, { axis: "y", ...QUICK_EDGES });
useFlip(glide.box, listed, "[data-flip]");
- const drop = (0, import_react31.useRef)(null);
- const drop = (0, import_react29.useRef)(null);
++ const drop = (0, import_react32.useRef)(null);
useMorph(drop, listed);
if (draft) {
- return (0, import_react31.createElement)(
- return (0, import_react29.createElement)(
++ return (0, import_react32.createElement)(
"div",
{ className: "bt-pane", style: { left: paneLeft } },
- (0, import_react31.createElement)(CreateBot, {
- (0, import_react29.createElement)(CreateBot, {
++ (0, import_react32.createElement)(CreateBot, {
roster,
actions,
start: draft,
@@@ -13197,33 -13037,33 +13394,33 @@@
if (picked.length > 0) setPicked((current) => current.slice(0, -1));
else if (admin !== null) setAdmin(null);
};
- return (0, import_react31.createElement)(
- return (0, import_react29.createElement)(
++ return (0, import_react32.createElement)(
"div",
{ className: "bt-pane", style: { left: paneLeft } },
- (0, import_react31.createElement)(
- (0, import_react29.createElement)(
++ (0, import_react32.createElement)(
"div",
{ className: "bt-newchat", role: "dialog", "aria-label": mode === "search" ? t("Search") : t("New chat") },
- (0, import_react31.createElement)(
- (0, import_react29.createElement)(
++ (0, import_react32.createElement)(
"div",
{ className: "bt-to" },
- (0, import_react31.createElement)("span", { className: "bt-to-label" }, t("To:")),
- adminBot ? (0, import_react31.createElement)(
- (0, import_react29.createElement)("span", { className: "bt-to-label" }, t("To:")),
- adminBot ? (0, import_react29.createElement)(
++ (0, import_react32.createElement)("span", { className: "bt-to-label" }, t("To:")),
++ adminBot ? (0, import_react32.createElement)(
"span",
{ key: adminBot.id, className: "bt-token bt-token-admin", title: t("Admin") },
- (0, import_react31.createElement)(BotMark, { bot: adminBot, size: 16 }),
- (0, import_react29.createElement)(BotMark, { bot: adminBot, size: 16 }),
++ (0, import_react32.createElement)(BotMark, { bot: adminBot, size: 16 }),
adminBot.name,
- (0, import_react31.createElement)(AdminStar),
- (0, import_react31.createElement)("button", { type: "button", "aria-label": t("Remove {name}", { name: adminBot.name }), onClick: () => setAdmin(null) }, "×")
- (0, import_react29.createElement)(AdminStar),
- (0, import_react29.createElement)("button", { type: "button", "aria-label": t("Remove {name}", { name: adminBot.name }), onClick: () => setAdmin(null) }, "×")
++ (0, import_react32.createElement)(AdminStar),
++ (0, import_react32.createElement)("button", { type: "button", "aria-label": t("Remove {name}", { name: adminBot.name }), onClick: () => setAdmin(null) }, "×")
) : null,
- choosingAdmin ? (0, import_react31.createElement)("span", { className: "bt-to-star", "aria-hidden": true }, (0, import_react31.createElement)(AdminStar)) : null,
- pickedBots.map((bot) => (0, import_react31.createElement)(
- choosingAdmin ? (0, import_react29.createElement)("span", { className: "bt-to-star", "aria-hidden": true }, (0, import_react29.createElement)(AdminStar)) : null,
- pickedBots.map((bot) => (0, import_react29.createElement)(
++ choosingAdmin ? (0, import_react32.createElement)("span", { className: "bt-to-star", "aria-hidden": true }, (0, import_react32.createElement)(AdminStar)) : null,
++ pickedBots.map((bot) => (0, import_react32.createElement)(
"span",
{ key: bot.id, className: "bt-token" },
- (0, import_react31.createElement)(BotMark, { bot, size: 16 }),
- (0, import_react29.createElement)(BotMark, { bot, size: 16 }),
++ (0, import_react32.createElement)(BotMark, { bot, size: 16 }),
bot.name,
- (0, import_react31.createElement)("button", { type: "button", "aria-label": t("Remove {name}", { name: bot.name }), onClick: () => setPicked((current) => current.filter((id) => id !== bot.id)) }, "×")
- (0, import_react29.createElement)("button", { type: "button", "aria-label": t("Remove {name}", { name: bot.name }), onClick: () => setPicked((current) => current.filter((id) => id !== bot.id)) }, "×")
++ (0, import_react32.createElement)("button", { type: "button", "aria-label": t("Remove {name}", { name: bot.name }), onClick: () => setPicked((current) => current.filter((id) => id !== bot.id)) }, "×")
)),
- (0, import_react31.createElement)("input", {
- (0, import_react29.createElement)("input", {
++ (0, import_react32.createElement)("input", {
ref: inputRef,
autoFocus: true,
value: query,
@@@ -13247,20 -13087,20 +13444,20 @@@
} else if (event.key === "Backspace" && query === "") unpick();
}
}),
- group && admin !== null ? (0, import_react31.createElement)("button", {
- group && admin !== null ? (0, import_react29.createElement)("button", {
++ group && admin !== null ? (0, import_react32.createElement)("button", {
type: "button",
className: "bt-send bt-to-create",
disabled: busy || picked.length === 0,
title: picked.length === 0 ? t("Add at least one more Bot") : void 0,
onClick: createGroup
}, t("Create group chat")) : null,
- (0, import_react31.createElement)("button", { type: "button", className: "bt-x", "aria-label": t("Close new chat"), onClick: close }, "×")
- (0, import_react29.createElement)("button", { type: "button", className: "bt-x", "aria-label": t("Close new chat"), onClick: close }, "×")
++ (0, import_react32.createElement)("button", { type: "button", className: "bt-x", "aria-label": t("Close new chat"), onClick: close }, "×")
),
- (0, import_react31.createElement)("div", { ref: drop, className: "bt-drop" }, (0, import_react31.createElement)(
- (0, import_react29.createElement)("div", { ref: drop, className: "bt-drop" }, (0, import_react29.createElement)(
++ (0, import_react32.createElement)("div", { ref: drop, className: "bt-drop" }, (0, import_react32.createElement)(
"div",
{ ref: glide.box, role: "listbox", "aria-label": t("Recipients"), className: "bt-drop-list" },
- (0, import_react31.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
- options.length === 0 ? (0, import_react31.createElement)("div", { className: "bt-hint" }, mode === "search" ? t("No Bots match") : t("Type a name to create a Bot")) : options.map((option, index) => (0, import_react31.createElement)(
- (0, import_react29.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
- options.length === 0 ? (0, import_react29.createElement)("div", { className: "bt-hint" }, mode === "search" ? t("No Bots match") : t("Type a name to create a Bot")) : options.map((option, index) => (0, import_react29.createElement)(
++ (0, import_react32.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
++ options.length === 0 ? (0, import_react32.createElement)("div", { className: "bt-hint" }, mode === "search" ? t("No Bots match") : t("Type a name to create a Bot")) : options.map((option, index) => (0, import_react32.createElement)(
"button",
{
key: option.key,
@@@ -13272,21 -13112,21 +13469,21 @@@
onMouseEnter: () => setCursor(index),
onClick: option.run
},
- option.bot ? (0, import_react31.createElement)(BotMark, { bot: option.bot, size: 22 }) : (0, import_react31.createElement)("span", { className: "bt-option-icon" }, option.icon),
- (0, import_react31.createElement)("span", { className: "bt-option-label" }, option.label),
- option.hint && index === active ? (0, import_react31.createElement)("span", { className: "bt-option-hint" }, option.hint) : null
- option.bot ? (0, import_react29.createElement)(BotMark, { bot: option.bot, size: 22 }) : (0, import_react29.createElement)("span", { className: "bt-option-icon" }, option.icon),
- (0, import_react29.createElement)("span", { className: "bt-option-label" }, option.label),
- option.hint && index === active ? (0, import_react29.createElement)("span", { className: "bt-option-hint" }, option.hint) : null
++ option.bot ? (0, import_react32.createElement)(BotMark, { bot: option.bot, size: 22 }) : (0, import_react32.createElement)("span", { className: "bt-option-icon" }, option.icon),
++ (0, import_react32.createElement)("span", { className: "bt-option-label" }, option.label),
++ option.hint && index === active ? (0, import_react32.createElement)("span", { className: "bt-option-hint" }, option.hint) : null
))
)),
- (0, import_react31.createElement)("div", { className: "bt-nc-spacer" }),
- error ? (0, import_react31.createElement)("div", { className: "bt-error" }, error) : null,
- (0, import_react31.createElement)(
- (0, import_react29.createElement)("div", { className: "bt-nc-spacer" }),
- error ? (0, import_react29.createElement)("div", { className: "bt-error" }, error) : null,
- (0, import_react29.createElement)(
++ (0, import_react32.createElement)("div", { className: "bt-nc-spacer" }),
++ error ? (0, import_react32.createElement)("div", { className: "bt-error" }, error) : null,
++ (0, import_react32.createElement)(
"div",
{ className: "bt-nc-compose" },
- (0, import_react31.createElement)(
- (0, import_react29.createElement)(
++ (0, import_react32.createElement)(
"div",
{ className: "bt-nc-card" },
- (0, import_react31.createElement)("span", { className: "bt-nc-plus", "aria-hidden": true }, (0, import_react31.createElement)(PlusIcon)),
- (0, import_react31.createElement)("textarea", {
- (0, import_react29.createElement)("span", { className: "bt-nc-plus", "aria-hidden": true }, (0, import_react29.createElement)(PlusIcon)),
- (0, import_react29.createElement)("textarea", {
++ (0, import_react32.createElement)("span", { className: "bt-nc-plus", "aria-hidden": true }, (0, import_react32.createElement)(PlusIcon)),
++ (0, import_react32.createElement)("textarea", {
rows: 1,
value: message,
placeholder,
@@@ -13299,7 -13139,7 +13496,7 @@@
}
}
}),
- (0, import_react31.createElement)("button", { type: "button", className: "bt-nc-send", "aria-label": t("Send message"), disabled: busy || message.trim() === "" || picked.length === 0, onClick: sendMessage }, (0, import_react31.createElement)(ArrowUpIcon))
- (0, import_react29.createElement)("button", { type: "button", className: "bt-nc-send", "aria-label": t("Send message"), disabled: busy || message.trim() === "" || picked.length === 0, onClick: sendMessage }, (0, import_react29.createElement)(ArrowUpIcon))
++ (0, import_react32.createElement)("button", { type: "button", className: "bt-nc-send", "aria-label": t("Send message"), disabled: busy || message.trim() === "" || picked.length === 0, onClick: sendMessage }, (0, import_react32.createElement)(ArrowUpIcon))
)
)
)
@@@ -13307,14 -13147,14 +13504,14 @@@
}
// src/client/exchange.js
- var import_react32 = require("react");
-var import_react30 = require("react");
++var import_react33 = require("react");
var SHEET_EXIT_MS = 220;
function ExchangeDialog({ pair, roster, actions }) {
- const [entries2, setEntries] = (0, import_react32.useState)(null);
- const [leaving, setLeaving] = (0, import_react32.useState)(false);
- const log = (0, import_react32.useRef)(null);
- const atEnd = (0, import_react32.useRef)(true);
- (0, import_react32.useLayoutEffect)(() => {
- const [entries2, setEntries] = (0, import_react30.useState)(null);
- const [leaving, setLeaving] = (0, import_react30.useState)(false);
- const log = (0, import_react30.useRef)(null);
- const atEnd = (0, import_react30.useRef)(true);
- (0, import_react30.useLayoutEffect)(() => {
++ const [entries2, setEntries] = (0, import_react33.useState)(null);
++ const [leaving, setLeaving] = (0, import_react33.useState)(false);
++ const log = (0, import_react33.useRef)(null);
++ const atEnd = (0, import_react33.useRef)(true);
++ (0, import_react33.useLayoutEffect)(() => {
if (entries2 !== null && atEnd.current && log.current) log.current.scrollTop = log.current.scrollHeight;
}, [entries2]);
const close = () => {
@@@ -13323,7 -13163,7 +13520,7 @@@
setTimeout(() => actions.closeOverlay(), SHEET_EXIT_MS);
};
useEscape(close);
- (0, import_react32.useEffect)(() => {
- (0, import_react30.useEffect)(() => {
++ (0, import_react33.useEffect)(() => {
let stop = false;
let timer;
let seen = null;
@@@ -13350,53 -13190,53 +13547,53 @@@
const flat = layoutOf(roster.prefs) === "flat";
let lastDay = 0;
const paneLeft = usePaneLeft();
- return (0, import_react32.createElement)(
- return (0, import_react30.createElement)(
++ return (0, import_react33.createElement)(
"div",
{ className: "bt-pane bt-exchange", style: { left: paneLeft }, "data-leaving": leaving || void 0 },
- (0, import_react32.createElement)(
- (0, import_react30.createElement)(
++ (0, import_react33.createElement)(
"div",
{ className: "bt-dialog", role: "dialog", "aria-label": t("Bot exchange") },
- (0, import_react32.createElement)("div", { className: "bt-head" }, (0, import_react32.createElement)(
- (0, import_react30.createElement)("div", { className: "bt-head" }, (0, import_react30.createElement)(
++ (0, import_react33.createElement)("div", { className: "bt-head" }, (0, import_react33.createElement)(
"span",
{ className: "bt-pill", style: { cursor: "default" } },
- left ? (0, import_react32.createElement)(BotMark, { bot: left, size: 22 }) : null,
- left ? (0, import_react30.createElement)(BotMark, { bot: left, size: 22 }) : null,
++ left ? (0, import_react33.createElement)(BotMark, { bot: left, size: 22 }) : null,
left?.name ?? "?",
- (0, import_react32.createElement)("span", { className: "bt-swap" }, "⇄"),
- right ? (0, import_react32.createElement)(BotMark, { bot: right, size: 22 }) : null,
- (0, import_react30.createElement)("span", { className: "bt-swap" }, "⇄"),
- right ? (0, import_react30.createElement)(BotMark, { bot: right, size: 22 }) : null,
++ (0, import_react33.createElement)("span", { className: "bt-swap" }, "⇄"),
++ right ? (0, import_react33.createElement)(BotMark, { bot: right, size: 22 }) : null,
right?.name ?? "?"
)),
- (0, import_react32.createElement)(
- (0, import_react30.createElement)(
++ (0, import_react33.createElement)(
"div",
{ ref: log, className: "bt-dialog-log", role: "log", "aria-label": t("Bot exchange transcript"), onScroll: (event) => {
const node = event.currentTarget;
atEnd.current = node.scrollHeight - node.scrollTop - node.clientHeight < 2;
} },
- entries2 === null ? (0, import_react32.createElement)("div", { className: "bt-hint" }, t("Loading…")) : entries2.length === 0 ? (0, import_react32.createElement)("div", { className: "bt-hint" }, t("No messages yet")) : entries2.map((entry) => {
- entries2 === null ? (0, import_react30.createElement)("div", { className: "bt-hint" }, t("Loading…")) : entries2.length === 0 ? (0, import_react30.createElement)("div", { className: "bt-hint" }, t("No messages yet")) : entries2.map((entry) => {
++ entries2 === null ? (0, import_react33.createElement)("div", { className: "bt-hint" }, t("Loading…")) : entries2.length === 0 ? (0, import_react33.createElement)("div", { className: "bt-hint" }, t("No messages yet")) : entries2.map((entry) => {
const bot = roster.byId[entry.from] ?? { id: entry.from, name: t("You"), color: "gray" };
const showDay = entry.time - lastDay > 30 * 60 * 1e3;
lastDay = entry.time;
const whole = entry.length === void 0 ? void 0 : { length: entry.length, load: () => actions.exchangeText(entry.id) };
- const lead = (0, import_react32.createElement)("span", { className: "bt-lead" }, (0, import_react32.createElement)(BotMark, { bot, size: 22 }));
- return (0, import_react32.createElement)(
- import_react32.Fragment,
- const lead = (0, import_react30.createElement)("span", { className: "bt-lead" }, (0, import_react30.createElement)(BotMark, { bot, size: 22 }));
- return (0, import_react30.createElement)(
- import_react30.Fragment,
++ const lead = (0, import_react33.createElement)("span", { className: "bt-lead" }, (0, import_react33.createElement)(BotMark, { bot, size: 22 }));
++ return (0, import_react33.createElement)(
++ import_react33.Fragment,
{ key: entry.id },
- showDay ? (0, import_react32.createElement)("time", { className: "bt-time" }, dayLabel(entry.time)) : null,
- (0, import_react32.createElement)(
- showDay ? (0, import_react30.createElement)("time", { className: "bt-time" }, dayLabel(entry.time)) : null,
- (0, import_react30.createElement)(
++ showDay ? (0, import_react33.createElement)("time", { className: "bt-time" }, dayLabel(entry.time)) : null,
++ (0, import_react33.createElement)(
"div",
{ className: "bt-group-msg" },
- (0, import_react32.createElement)("span", { className: "bt-group-name", style: flat ? void 0 : { color: inkText(colorOf(bot)) } }, flat ? lead : null, bot.name),
- (0, import_react32.createElement)(Bubbles, { texts: [stripLongNote(entry.text)], roster, selfId: bot.id, actions, whole, lead: flat ? null : lead })
- (0, import_react30.createElement)("span", { className: "bt-group-name", style: flat ? void 0 : { color: inkText(colorOf(bot)) } }, flat ? lead : null, bot.name),
- (0, import_react30.createElement)(Bubbles, { texts: [stripLongNote(entry.text)], roster, selfId: bot.id, actions, whole, lead: flat ? null : lead })
++ (0, import_react33.createElement)("span", { className: "bt-group-name", style: flat ? void 0 : { color: inkText(colorOf(bot)) } }, flat ? lead : null, bot.name),
++ (0, import_react33.createElement)(Bubbles, { texts: [stripLongNote(entry.text)], roster, selfId: bot.id, actions, whole, lead: flat ? null : lead })
)
);
})
),
- (0, import_react32.createElement)("div", { className: "bt-dialog-foot" }, (0, import_react32.createElement)("button", { type: "button", className: "bt-soft", onClick: close }, t("Close Chat")))
- (0, import_react30.createElement)("div", { className: "bt-dialog-foot" }, (0, import_react30.createElement)("button", { type: "button", className: "bt-soft", onClick: close }, t("Close Chat")))
++ (0, import_react33.createElement)("div", { className: "bt-dialog-foot" }, (0, import_react33.createElement)("button", { type: "button", className: "bt-soft", onClick: close }, t("Close Chat")))
)
);
}
// src/client/voice.js
- var import_react33 = require("react");
-var import_react31 = require("react");
++var import_react34 = require("react");
var plainSpeech = (text) => stripHeader(text).replace(/```[\s\S]*?```/g, " ").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/[*_`#>|~-]+/g, " ").replace(/\s+/g, " ").trim();
var VOICE_LABELS = {
listening: "Listening",
@@@ -13408,8 -13248,8 +13605,8 @@@
};
var CAPTURE_NOTES = { blocked: "Microphone access is blocked", unavailable: "Voice chat is not available in this browser", "too-long": "That was too long to recognize" };
function useMicLevel(enabled) {
- const [level, setLevel] = (0, import_react33.useState)(0);
- (0, import_react33.useEffect)(() => {
- const [level, setLevel] = (0, import_react31.useState)(0);
- (0, import_react31.useEffect)(() => {
++ const [level, setLevel] = (0, import_react34.useState)(0);
++ (0, import_react34.useEffect)(() => {
if (!enabled || !navigator.mediaDevices?.getUserMedia) return void 0;
let stream = null;
let audio = null;
@@@ -13459,18 -13299,18 +13656,18 @@@ function VoiceMode({ sessionId, roster
const entry = Array.isArray(outline) ? outline[outline.length - 1] : void 0;
return entry ? `${outline.length}|${entry.response ?? ""}` : "0|";
});
- const [speech] = (0, import_react33.useState)(() => actions.speech());
- const [phase, setPhase] = (0, import_react33.useState)(speech ? "starting" : speechApi() ? "listening" : "unsupported");
- const [catalog, setCatalog] = (0, import_react33.useState)(null);
- const [heard, setHeard] = (0, import_react33.useState)("");
- const [said, setSaid] = (0, import_react33.useState)("");
- const [note, setNote] = (0, import_react33.useState)("");
- const [serviceLevel, setServiceLevel] = (0, import_react33.useState)(0);
- const [cycle, setCycle] = (0, import_react33.useState)(0);
- const waiting = (0, import_react33.useRef)(null);
- const reply = (0, import_react33.useRef)(lastReply);
- const [speech] = (0, import_react31.useState)(() => actions.speech());
- const [phase, setPhase] = (0, import_react31.useState)(speech ? "starting" : speechApi() ? "listening" : "unsupported");
- const [catalog, setCatalog] = (0, import_react31.useState)(null);
- const [heard, setHeard] = (0, import_react31.useState)("");
- const [said, setSaid] = (0, import_react31.useState)("");
- const [note, setNote] = (0, import_react31.useState)("");
- const [serviceLevel, setServiceLevel] = (0, import_react31.useState)(0);
- const [cycle, setCycle] = (0, import_react31.useState)(0);
- const waiting = (0, import_react31.useRef)(null);
- const reply = (0, import_react31.useRef)(lastReply);
++ const [speech] = (0, import_react34.useState)(() => actions.speech());
++ const [phase, setPhase] = (0, import_react34.useState)(speech ? "starting" : speechApi() ? "listening" : "unsupported");
++ const [catalog, setCatalog] = (0, import_react34.useState)(null);
++ const [heard, setHeard] = (0, import_react34.useState)("");
++ const [said, setSaid] = (0, import_react34.useState)("");
++ const [note, setNote] = (0, import_react34.useState)("");
++ const [serviceLevel, setServiceLevel] = (0, import_react34.useState)(0);
++ const [cycle, setCycle] = (0, import_react34.useState)(0);
++ const waiting = (0, import_react34.useRef)(null);
++ const reply = (0, import_react34.useRef)(lastReply);
reply.current = lastReply;
- const turn = (0, import_react33.useRef)(0);
- const turn = (0, import_react31.useRef)(0);
++ const turn = (0, import_react34.useRef)(0);
const paneLeft = usePaneLeft();
const close = () => {
turn.current += 1;
@@@ -13490,12 -13330,12 +13687,12 @@@
dictation.stop();
submit(text);
});
- (0, import_react33.useEffect)(() => {
- (0, import_react31.useEffect)(() => {
++ (0, import_react34.useEffect)(() => {
if (!note) return void 0;
const timer = setTimeout(() => setNote(""), 2600);
return () => clearTimeout(timer);
}, [note]);
- (0, import_react33.useEffect)(() => {
- (0, import_react31.useEffect)(() => {
++ (0, import_react34.useEffect)(() => {
if (!speech) return void 0;
let live = true;
speechCatalog(speech).then(({ catalog: next, usable }) => {
@@@ -13510,16 -13350,16 +13707,16 @@@
};
}, [speech]);
const listen = phase === "listening";
- (0, import_react33.useEffect)(() => {
- (0, import_react31.useEffect)(() => {
++ (0, import_react34.useEffect)(() => {
if (speech || !listen || dictation.listening) return void 0;
const timer = setTimeout(() => dictation.start({ continuous: false, onEnd: () => {
} }), 250);
return () => clearTimeout(timer);
}, [listen, dictation.listening]);
- (0, import_react33.useEffect)(() => {
- (0, import_react31.useEffect)(() => {
++ (0, import_react34.useEffect)(() => {
if (phase !== "listening") dictation.stop();
}, [phase]);
- (0, import_react33.useEffect)(() => {
- (0, import_react31.useEffect)(() => {
++ (0, import_react34.useEffect)(() => {
if (!speech || !catalog || !listen) return void 0;
const own = turn.current;
let capture = null;
@@@ -13581,7 -13421,7 +13778,7 @@@
setServiceLevel(0);
};
}, [speech, catalog, listen, cycle]);
- (0, import_react33.useEffect)(() => {
- (0, import_react31.useEffect)(() => {
++ (0, import_react34.useEffect)(() => {
if (phase !== "thinking" || running || waiting.current === null) return;
const [count, text] = [lastReply.slice(0, lastReply.indexOf("|")), lastReply.slice(lastReply.indexOf("|") + 1)];
if (count === waiting.current || !text.trim()) return;
@@@ -13601,7 -13441,7 +13798,7 @@@
window.speechSynthesis.cancel();
window.speechSynthesis.speak(utterance);
}, [phase, running, lastReply]);
- (0, import_react33.useEffect)(() => () => window.speechSynthesis?.cancel(), []);
- (0, import_react31.useEffect)(() => () => window.speechSynthesis?.cancel(), []);
++ (0, import_react34.useEffect)(() => () => window.speechSynthesis?.cancel(), []);
const micLevel = useMicLevel(!speech && phase === "listening" && dictation.listening);
const level = speech ? serviceLevel : micLevel;
const markState = phase === "thinking" || phase === "transcribing" ? "thinking" : phase === "speaking" ? "sending" : "idle";
@@@ -13618,58 -13458,58 +13815,58 @@@
const openSetup = phase === "setup" ? actions.voiceSetup() : null;
const caption = phase === "speaking" ? said : heard;
const shownNote = note || dictation.note;
- return (0, import_react33.createElement)(
- return (0, import_react31.createElement)(
++ return (0, import_react34.createElement)(
"div",
{ className: "bt-pane bt-voice-pane", style: { left: paneLeft } },
- (0, import_react33.createElement)(
- (0, import_react31.createElement)(
++ (0, import_react34.createElement)(
"div",
{ className: "bt-voice-stage", role: "dialog", "aria-label": t("Voice chat with {name}", { name }), "data-phase": phase === "transcribing" ? "thinking" : phase },
- (0, import_react33.createElement)(
- (0, import_react31.createElement)(
++ (0, import_react34.createElement)(
"div",
{ className: "bt-voice-orb", style: { "--bt-level": level } },
- (0, import_react33.createElement)("span", { className: "bt-voice-ring", "aria-hidden": true }),
- (0, import_react33.createElement)("span", { className: "bt-voice-ring bt-voice-ring-2", "aria-hidden": true }),
- bot ? (0, import_react33.createElement)(BotMark, { bot, size: 112, state: markState, live: true, gaze: phase === "listening" }) : room2 ? (0, import_react33.createElement)(RoomAvatar, { room: room2, roster, size: 112 }) : null
- (0, import_react31.createElement)("span", { className: "bt-voice-ring", "aria-hidden": true }),
- (0, import_react31.createElement)("span", { className: "bt-voice-ring bt-voice-ring-2", "aria-hidden": true }),
- bot ? (0, import_react31.createElement)(BotMark, { bot, size: 112, state: markState, live: true, gaze: phase === "listening" }) : room2 ? (0, import_react31.createElement)(RoomAvatar, { room: room2, roster, size: 112 }) : null
++ (0, import_react34.createElement)("span", { className: "bt-voice-ring", "aria-hidden": true }),
++ (0, import_react34.createElement)("span", { className: "bt-voice-ring bt-voice-ring-2", "aria-hidden": true }),
++ bot ? (0, import_react34.createElement)(BotMark, { bot, size: 112, state: markState, live: true, gaze: phase === "listening" }) : room2 ? (0, import_react34.createElement)(RoomAvatar, { room: room2, roster, size: 112 }) : null
),
- (0, import_react33.createElement)("div", { className: "bt-voice-name" }, name),
- (0, import_react33.createElement)(
- (0, import_react31.createElement)("div", { className: "bt-voice-name" }, name),
- (0, import_react31.createElement)(
++ (0, import_react34.createElement)("div", { className: "bt-voice-name" }, name),
++ (0, import_react34.createElement)(
"div",
{ className: "bt-voice-status", role: "status" },
- phase === "thinking" ? (0, import_react33.createElement)(Shimmer, null, t("Thinking…")) : phase === "transcribing" ? (0, import_react33.createElement)(Shimmer, null, t("Recognizing…")) : VOICE_LABELS[phase] ? t(VOICE_LABELS[phase]) : ""
- phase === "thinking" ? (0, import_react31.createElement)(Shimmer, null, t("Thinking…")) : phase === "transcribing" ? (0, import_react31.createElement)(Shimmer, null, t("Recognizing…")) : VOICE_LABELS[phase] ? t(VOICE_LABELS[phase]) : ""
++ phase === "thinking" ? (0, import_react34.createElement)(Shimmer, null, t("Thinking…")) : phase === "transcribing" ? (0, import_react34.createElement)(Shimmer, null, t("Recognizing…")) : VOICE_LABELS[phase] ? t(VOICE_LABELS[phase]) : ""
),
- (0, import_react33.createElement)("div", { className: "bt-voice-caption", key: `${phase}:${caption.slice(0, 12)}` }, caption),
- openSetup ? (0, import_react33.createElement)("button", { type: "button", className: "bt-voice-setup", onClick: () => {
- (0, import_react31.createElement)("div", { className: "bt-voice-caption", key: `${phase}:${caption.slice(0, 12)}` }, caption),
- openSetup ? (0, import_react31.createElement)("button", { type: "button", className: "bt-voice-setup", onClick: () => {
++ (0, import_react34.createElement)("div", { className: "bt-voice-caption", key: `${phase}:${caption.slice(0, 12)}` }, caption),
++ openSetup ? (0, import_react34.createElement)("button", { type: "button", className: "bt-voice-setup", onClick: () => {
close();
openSetup();
} }, t("Set up voice input")) : null,
- shownNote ? (0, import_react33.createElement)("div", { className: "bt-voice-note" }, shownNote) : null
- shownNote ? (0, import_react31.createElement)("div", { className: "bt-voice-note" }, shownNote) : null
++ shownNote ? (0, import_react34.createElement)("div", { className: "bt-voice-note" }, shownNote) : null
),
- (0, import_react33.createElement)(
- (0, import_react31.createElement)(
++ (0, import_react34.createElement)(
"div",
{ className: "bt-voice-bar" },
- (0, import_react33.createElement)("button", {
- (0, import_react31.createElement)("button", {
++ (0, import_react34.createElement)("button", {
type: "button",
className: "bt-voice-btn",
"aria-pressed": phase === "paused",
disabled: blocked,
"aria-label": phase === "paused" ? t("Resume listening") : t("Pause"),
onClick: togglePause
- }, (0, import_react33.createElement)(MicIcon, { size: 20 }), phase === "paused" ? (0, import_react33.createElement)("span", { className: "bt-voice-slash", "aria-hidden": true }) : null),
- (0, import_react33.createElement)("button", { type: "button", className: "bt-voice-btn bt-voice-end", "aria-label": t("End voice chat"), onClick: close }, (0, import_react33.createElement)(CloseIcon))
- }, (0, import_react31.createElement)(MicIcon, { size: 20 }), phase === "paused" ? (0, import_react31.createElement)("span", { className: "bt-voice-slash", "aria-hidden": true }) : null),
- (0, import_react31.createElement)("button", { type: "button", className: "bt-voice-btn bt-voice-end", "aria-label": t("End voice chat"), onClick: close }, (0, import_react31.createElement)(CloseIcon))
++ }, (0, import_react34.createElement)(MicIcon, { size: 20 }), phase === "paused" ? (0, import_react34.createElement)("span", { className: "bt-voice-slash", "aria-hidden": true }) : null),
++ (0, import_react34.createElement)("button", { type: "button", className: "bt-voice-btn bt-voice-end", "aria-label": t("End voice chat"), onClick: close }, (0, import_react34.createElement)(CloseIcon))
)
);
}
// src/client/permission-picker.js
- var import_react34 = require("react");
-var import_react32 = require("react");
++var import_react35 = require("react");
var LABELS = { "read-only": "Read only", "workspace-write": "Workspace", "danger-full-access": "Full access" };
var DANGER = /* @__PURE__ */ new Set(["danger-full-access"]);
var presetDanger = (value) => DANGER.has(value);
var presetName = (value, catalog) => LABELS[value] ? t(LABELS[value]) : catalog?.options?.find((option) => option.value === value)?.name ?? value;
function PermissionPicker({ catalog, saved, onPick, repick = false }) {
- const [pending, setPending] = (0, import_react34.useState)(null);
- const flight = (0, import_react34.useRef)({ value: void 0, latest: void 0 });
- (0, import_react34.useEffect)(() => {
- const [pending, setPending] = (0, import_react32.useState)(null);
- const flight = (0, import_react32.useRef)({ value: void 0, latest: void 0 });
- (0, import_react32.useEffect)(() => {
++ const [pending, setPending] = (0, import_react35.useState)(null);
++ const flight = (0, import_react35.useRef)({ value: void 0, latest: void 0 });
++ (0, import_react35.useEffect)(() => {
const flying = flight.current.value;
if (pending === saved && (flying === void 0 || flying === pending)) setPending(null);
}, [pending, saved]);
@@@ -13696,10 -13536,10 +13893,10 @@@
}
send(value);
};
- return (0, import_react34.createElement)(
- return (0, import_react32.createElement)(
++ return (0, import_react35.createElement)(
Segmented,
{ label: t("Permissions"), value: current },
- catalog.options.map((option) => (0, import_react34.createElement)("button", {
- catalog.options.map((option) => (0, import_react32.createElement)("button", {
++ catalog.options.map((option) => (0, import_react35.createElement)("button", {
key: option.value,
type: "button",
"aria-pressed": option.value === current,
@@@ -13711,7 -13551,7 +13908,7 @@@
}
// src/client/group-settings.js
- var import_react35 = require("react");
-var import_react33 = require("react");
++var import_react36 = require("react");
var ROOM_MODES = [
["admin", "Admin leads", "Plain messages go to the admin, who calls others with @Name."],
["everyone", "Everyone", "Every member answers in turn, admin first."]
@@@ -13722,8 -13562,8 +13919,8 @@@ function roomSubtitle(room2, roster)
return [t("{count} members", { count: room2.members.length }), admin ? t("Admin {name}", { name: admin.name }) : t("No admin")].join(" · ");
}
function RelayLimitRow({ room: room2, update }) {
- const [draft, setDraft] = (0, import_react35.useState)(room2.relayLimit ?? "");
- (0, import_react35.useEffect)(() => setDraft(room2.relayLimit ?? ""), [room2.relayLimit]);
- const [draft, setDraft] = (0, import_react33.useState)(room2.relayLimit ?? "");
- (0, import_react33.useEffect)(() => setDraft(room2.relayLimit ?? ""), [room2.relayLimit]);
++ const [draft, setDraft] = (0, import_react36.useState)(room2.relayLimit ?? "");
++ (0, import_react36.useEffect)(() => setDraft(room2.relayLimit ?? ""), [room2.relayLimit]);
const save = () => {
const text = String(draft).trim();
if (text === "") {
@@@ -13737,10 -13577,10 +13934,10 @@@
}
update({ relayLimit: limit });
};
- return (0, import_react35.createElement)(
- return (0, import_react33.createElement)(
++ return (0, import_react36.createElement)(
Row,
{ label: t("Pause Bot relays after"), hint: t("Counted since your last message in this group.") },
- (0, import_react35.createElement)("input", {
- (0, import_react33.createElement)("input", {
++ (0, import_react36.createElement)("input", {
className: "bt-bs-input bt-bs-num",
type: "number",
min: 1,
@@@ -13762,26 -13602,26 +13959,26 @@@
function GroupPermission({ room: room2, catalog, update }) {
if (!catalog?.options?.length) return null;
const shared2 = room2.permission !== void 0;
- return (0, import_react35.createElement)(
- return (0, import_react33.createElement)(
- Card,
++ return (0, import_react36.createElement)(
+ Card2,
{ title: t("Permissions") },
- (0, import_react35.createElement)(SwitchRow, {
- (0, import_react33.createElement)(SwitchRow, {
++ (0, import_react36.createElement)(SwitchRow, {
label: t("Same for every member"),
hint: t("Replaces each member's own permissions in this group."),
on: shared2,
onChange: (on) => update({ permission: on ? catalog.defaultPreset ?? catalog.options[0].value : null })
}),
- shared2 ? (0, import_react35.createElement)(
- shared2 ? (0, import_react33.createElement)(
++ shared2 ? (0, import_react36.createElement)(
"div",
{ className: "bt-set-row bt-bs-row bt-bs-stack bt-gs-perm bt-veil" },
- (0, import_react35.createElement)(PermissionPicker, { catalog, saved: room2.permission, onPick: (permission) => update({ permission }) })
- (0, import_react33.createElement)(PermissionPicker, { catalog, saved: room2.permission, onPick: (permission) => update({ permission }) })
++ (0, import_react36.createElement)(PermissionPicker, { catalog, saved: room2.permission, onPick: (permission) => update({ permission }) })
) : null
);
}
function GroupSettingsForm({ room: room2, roster, actions, run: run2, onDeleted }) {
- const [adding, setAdding] = (0, import_react35.useState)(false);
- const [confirming, setConfirming] = (0, import_react35.useState)(false);
- (0, import_react35.useEffect)(() => {
- const [adding, setAdding] = (0, import_react33.useState)(false);
- const [confirming, setConfirming] = (0, import_react33.useState)(false);
- (0, import_react33.useEffect)(() => {
++ const [adding, setAdding] = (0, import_react36.useState)(false);
++ const [confirming, setConfirming] = (0, import_react36.useState)(false);
++ (0, import_react36.useEffect)(() => {
if (!confirming) return void 0;
const timer = setTimeout(() => setConfirming(false), 4e3);
return () => clearTimeout(timer);
@@@ -13805,41 -13645,41 +14002,41 @@@
if (done) onDeleted?.();
});
};
- return (0, import_react35.createElement)(
- return (0, import_react33.createElement)(
++ return (0, import_react36.createElement)(
"div",
{ className: "bt-bs" },
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
++ (0, import_react36.createElement)(
"div",
{ className: "bt-bs-hero" },
- (0, import_react35.createElement)(RoomAvatar, { room: room2, roster, size: 64 }),
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(RoomAvatar, { room: room2, roster, size: 64 }),
- (0, import_react33.createElement)(
++ (0, import_react36.createElement)(RoomAvatar, { room: room2, roster, size: 64 }),
++ (0, import_react36.createElement)(
"div",
{ className: "bt-bs-who" },
- (0, import_react35.createElement)("span", { className: "bt-bs-name" }, room2.name),
- (0, import_react35.createElement)("span", { className: "bt-bs-sub" }, roomSubtitle(room2, roster))
- (0, import_react33.createElement)("span", { className: "bt-bs-name" }, room2.name),
- (0, import_react33.createElement)("span", { className: "bt-bs-sub" }, roomSubtitle(room2, roster))
++ (0, import_react36.createElement)("span", { className: "bt-bs-name" }, room2.name),
++ (0, import_react36.createElement)("span", { className: "bt-bs-sub" }, roomSubtitle(room2, roster))
)
),
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
- Card,
++ (0, import_react36.createElement)(
+ Card2,
{ title: t("Profile") },
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
++ (0, import_react36.createElement)(
Row,
{ label: t("Name"), hint: t("Leave it empty to name the group after its members.") },
- (0, import_react35.createElement)(InlineText, { label: t("Group name"), value: room2.named ? room2.name : "", placeholder: t("Name after members"), maxLength: 60, onSave: (name) => update({ name }) })
- (0, import_react33.createElement)(InlineText, { label: t("Group name"), value: room2.named ? room2.name : "", placeholder: t("Name after members"), maxLength: 60, onSave: (name) => update({ name }) })
++ (0, import_react36.createElement)(InlineText, { label: t("Group name"), value: room2.named ? room2.name : "", placeholder: t("Name after members"), maxLength: 60, onSave: (name) => update({ name }) })
),
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
++ (0, import_react36.createElement)(
Row,
{ label: t("Notice"), hint: t("Every member reads it before speaking in this group."), stack: true },
- (0, import_react35.createElement)(InlineText, { label: t("Group notice"), value: room2.notice, multiline: true, maxLength: 2e3, placeholder: t("Shared instructions every member reads before speaking…"), onSave: (notice) => update({ notice }) })
- (0, import_react33.createElement)(InlineText, { label: t("Group notice"), value: room2.notice, multiline: true, maxLength: 2e3, placeholder: t("Shared instructions every member reads before speaking…"), onSave: (notice) => update({ notice }) })
++ (0, import_react36.createElement)(InlineText, { label: t("Group notice"), value: room2.notice, multiline: true, maxLength: 2e3, placeholder: t("Shared instructions every member reads before speaking…"), onSave: (notice) => update({ notice }) })
)
),
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
- Card,
++ (0, import_react36.createElement)(
+ Card2,
{ title: t("Who answers") },
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
++ (0, import_react36.createElement)(
"div",
{ className: "bt-set-row bt-bs-row bt-bs-stack" },
- (0, import_react35.createElement)(Segmented, { label: t("Who answers"), value: mode }, ROOM_MODES.map(([id, label]) => (0, import_react35.createElement)("button", {
- (0, import_react33.createElement)(Segmented, { label: t("Who answers"), value: mode }, ROOM_MODES.map(([id, label]) => (0, import_react33.createElement)("button", {
++ (0, import_react36.createElement)(Segmented, { label: t("Who answers"), value: mode }, ROOM_MODES.map(([id, label]) => (0, import_react36.createElement)("button", {
key: id,
type: "button",
"aria-pressed": mode === id,
@@@ -13849,88 -13689,88 +14046,88 @@@
if (mode !== id) void update({ mode: id });
}
}, t(label)))),
- (0, import_react35.createElement)("span", { key: mode, className: "bt-set-hint bt-veil" }, `${t(modeHint)} ${t("@mentions always pick who answers.")}`)
- (0, import_react33.createElement)("span", { key: mode, className: "bt-set-hint bt-veil" }, `${t(modeHint)} ${t("@mentions always pick who answers.")}`)
++ (0, import_react36.createElement)("span", { key: mode, className: "bt-set-hint bt-veil" }, `${t(modeHint)} ${t("@mentions always pick who answers.")}`)
),
- (0, import_react35.createElement)(RelayLimitRow, { room: room2, update })
- (0, import_react33.createElement)(RelayLimitRow, { room: room2, update })
++ (0, import_react36.createElement)(RelayLimitRow, { room: room2, update })
),
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
- Card,
++ (0, import_react36.createElement)(
+ Card2,
{ title: t("Working folder") },
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
++ (0, import_react36.createElement)(
"div",
{ className: "bt-set-row bt-bs-row" },
- (0, import_react35.createElement)("span", { className: "bt-set-copy" }, (0, import_react35.createElement)("span", { className: "bt-bs-label" }, t("Folder"))),
- (0, import_react35.createElement)(FolderMenu, { value: room2.workDir, group: true, actions, run: run2, onPick: (workDir) => update({ workDir }) })
- (0, import_react33.createElement)("span", { className: "bt-set-copy" }, (0, import_react33.createElement)("span", { className: "bt-bs-label" }, t("Folder"))),
- (0, import_react33.createElement)(FolderMenu, { value: room2.workDir, group: true, actions, run: run2, onPick: (workDir) => update({ workDir }) })
++ (0, import_react36.createElement)("span", { className: "bt-set-copy" }, (0, import_react36.createElement)("span", { className: "bt-bs-label" }, t("Folder"))),
++ (0, import_react36.createElement)(FolderMenu, { value: room2.workDir, group: true, actions, run: run2, onPick: (workDir) => update({ workDir }) })
)
),
- (0, import_react35.createElement)(GroupPermission, { room: room2, catalog: roster.permissions, update }),
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(GroupPermission, { room: room2, catalog: roster.permissions, update }),
- (0, import_react33.createElement)(
- Card,
++ (0, import_react36.createElement)(GroupPermission, { room: room2, catalog: roster.permissions, update }),
++ (0, import_react36.createElement)(
+ Card2,
{ title: t("Members · {count}", { count: members.length }) },
members.map((member) => {
const leads = room2.admin === member.id;
- return (0, import_react35.createElement)(
- return (0, import_react33.createElement)(
++ return (0, import_react36.createElement)(
"div",
{ key: member.id, className: "bt-set-row bt-bs-row bt-gs-member" },
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
++ (0, import_react36.createElement)(
"button",
{ type: "button", className: "bt-gs-who", title: t("Open {name}'s chat", { name: member.name }), onClick: () => openBot(member.id) },
- (0, import_react35.createElement)(BotAvatar, { bot: member, size: 26, main: isMainOf(roster, member.id), admin: leads, live: false }),
- (0, import_react35.createElement)("span", { className: "bt-row-title" }, member.name),
- leads ? (0, import_react35.createElement)("span", { className: "bt-tag" }, t("Admin")) : null
- (0, import_react33.createElement)(BotAvatar, { bot: member, size: 26, main: isMainOf(roster, member.id), admin: leads, live: false }),
- (0, import_react33.createElement)("span", { className: "bt-row-title" }, member.name),
- leads ? (0, import_react33.createElement)("span", { className: "bt-tag" }, t("Admin")) : null
++ (0, import_react36.createElement)(BotAvatar, { bot: member, size: 26, main: isMainOf(roster, member.id), admin: leads, live: false }),
++ (0, import_react36.createElement)("span", { className: "bt-row-title" }, member.name),
++ leads ? (0, import_react36.createElement)("span", { className: "bt-tag" }, t("Admin")) : null
),
- leads ? (0, import_react35.createElement)("button", { type: "button", className: "bt-mini", title: t("Leave the group without an admin"), onClick: () => update({ admin: null }) }, t("Unset")) : (0, import_react35.createElement)("button", { type: "button", className: "bt-mini", onClick: () => update({ admin: member.id }) }, t("Make admin")),
- members.length > 2 ? (0, import_react35.createElement)("button", { type: "button", className: "bt-x", "aria-label": t("Remove {name} from the group", { name: member.name }), title: t("Remove from group"), onClick: () => update({ remove: [member.id] }) }, "×") : null
- leads ? (0, import_react33.createElement)("button", { type: "button", className: "bt-mini", title: t("Leave the group without an admin"), onClick: () => update({ admin: null }) }, t("Unset")) : (0, import_react33.createElement)("button", { type: "button", className: "bt-mini", onClick: () => update({ admin: member.id }) }, t("Make admin")),
- members.length > 2 ? (0, import_react33.createElement)("button", { type: "button", className: "bt-x", "aria-label": t("Remove {name} from the group", { name: member.name }), title: t("Remove from group"), onClick: () => update({ remove: [member.id] }) }, "×") : null
++ leads ? (0, import_react36.createElement)("button", { type: "button", className: "bt-mini", title: t("Leave the group without an admin"), onClick: () => update({ admin: null }) }, t("Unset")) : (0, import_react36.createElement)("button", { type: "button", className: "bt-mini", onClick: () => update({ admin: member.id }) }, t("Make admin")),
++ members.length > 2 ? (0, import_react36.createElement)("button", { type: "button", className: "bt-x", "aria-label": t("Remove {name} from the group", { name: member.name }), title: t("Remove from group"), onClick: () => update({ remove: [member.id] }) }, "×") : null
);
}),
adding ? [
- ...outside.map((bot) => (0, import_react35.createElement)(
- ...outside.map((bot) => (0, import_react33.createElement)(
++ ...outside.map((bot) => (0, import_react36.createElement)(
"button",
{ key: bot.id, type: "button", className: "bt-set-row bt-bs-row bt-gs-pick", onClick: () => {
setAdding(false);
void update({ add: [bot.id] });
} },
- (0, import_react35.createElement)(BotMark, { bot, size: 22 }),
- (0, import_react35.createElement)("span", { className: "bt-set-copy" }, (0, import_react35.createElement)("span", { className: "bt-bs-label" }, bot.name)),
- (0, import_react35.createElement)("span", { className: "bt-set-hint" }, t("Add"))
- (0, import_react33.createElement)(BotMark, { bot, size: 22 }),
- (0, import_react33.createElement)("span", { className: "bt-set-copy" }, (0, import_react33.createElement)("span", { className: "bt-bs-label" }, bot.name)),
- (0, import_react33.createElement)("span", { className: "bt-set-hint" }, t("Add"))
++ (0, import_react36.createElement)(BotMark, { bot, size: 22 }),
++ (0, import_react36.createElement)("span", { className: "bt-set-copy" }, (0, import_react36.createElement)("span", { className: "bt-bs-label" }, bot.name)),
++ (0, import_react36.createElement)("span", { className: "bt-set-hint" }, t("Add"))
)),
- (0, import_react35.createElement)("button", { key: "cancel", type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => setAdding(false) }, t("Cancel"))
- ] : outside.length > 0 ? (0, import_react35.createElement)("button", { type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => setAdding(true) }, (0, import_react35.createElement)(PlusIcon), t("Add member")) : null,
- (0, import_react35.createElement)("div", { className: "bt-set-row bt-gs-note" }, (0, import_react35.createElement)(
- (0, import_react33.createElement)("button", { key: "cancel", type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => setAdding(false) }, t("Cancel"))
- ] : outside.length > 0 ? (0, import_react33.createElement)("button", { type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => setAdding(true) }, (0, import_react33.createElement)(PlusIcon), t("Add member")) : null,
- (0, import_react33.createElement)("div", { className: "bt-set-row bt-gs-note" }, (0, import_react33.createElement)(
++ (0, import_react36.createElement)("button", { key: "cancel", type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => setAdding(false) }, t("Cancel"))
++ ] : outside.length > 0 ? (0, import_react36.createElement)("button", { type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => setAdding(true) }, (0, import_react36.createElement)(PlusIcon), t("Add member")) : null,
++ (0, import_react36.createElement)("div", { className: "bt-set-row bt-gs-note" }, (0, import_react36.createElement)(
"span",
{ className: "bt-set-hint" },
// The host checks for two members on every change, even a rename.
members.length < 2 ? t("Add a Bot first: a group chat needs at least two.") : admin ? t("{name} leads this group: it can call members with @Name, change the group, and post here.", { name: admin.name }) : t("No admin yet. An admin can call members with @Name, change the group, and post here.")
))
),
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
- Card,
++ (0, import_react36.createElement)(
+ Card2,
{ title: t("Sidebar") },
- (0, import_react35.createElement)(SwitchRow, { label: t("Pin"), hint: t("Kept above the other chats."), on: room2.pinned === true, onChange: (pinned) => run2(actions.setFlags(room2.id, { pinned })) }),
- (0, import_react35.createElement)(SwitchRow, { label: t("Hide from sidebar"), hint: t("Search still finds it."), on: room2.hidden === true, onChange: (hidden) => run2(actions.setFlags(room2.id, { hidden })) })
- (0, import_react33.createElement)(SwitchRow, { label: t("Pin"), hint: t("Kept above the other chats."), on: room2.pinned === true, onChange: (pinned) => run2(actions.setFlags(room2.id, { pinned })) }),
- (0, import_react33.createElement)(SwitchRow, { label: t("Hide from sidebar"), hint: t("Search still finds it."), on: room2.hidden === true, onChange: (hidden) => run2(actions.setFlags(room2.id, { hidden })) })
++ (0, import_react36.createElement)(SwitchRow, { label: t("Pin"), hint: t("Kept above the other chats."), on: room2.pinned === true, onChange: (pinned) => run2(actions.setFlags(room2.id, { pinned })) }),
++ (0, import_react36.createElement)(SwitchRow, { label: t("Hide from sidebar"), hint: t("Search still finds it."), on: room2.hidden === true, onChange: (hidden) => run2(actions.setFlags(room2.id, { hidden })) })
),
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
- Card,
++ (0, import_react36.createElement)(
+ Card2,
{ title: t("Manage") },
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
++ (0, import_react36.createElement)(
"button",
{ type: "button", className: "bt-set-row bt-bs-row bt-bs-danger", "data-confirm": confirming || void 0, onClick: remove },
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
++ (0, import_react36.createElement)(
"span",
{ className: "bt-set-copy" },
- (0, import_react35.createElement)("span", { className: "bt-bs-label" }, confirming ? t("Delete {name}?", { name: room2.name }) : t("Delete group")),
- (0, import_react35.createElement)("span", { className: "bt-set-hint" }, confirming ? t("Click again to delete. Its history is archived.") : t("Removes the group chat. Its members stay on the team."))
- (0, import_react33.createElement)("span", { className: "bt-bs-label" }, confirming ? t("Delete {name}?", { name: room2.name }) : t("Delete group")),
- (0, import_react33.createElement)("span", { className: "bt-set-hint" }, confirming ? t("Click again to delete. Its history is archived.") : t("Removes the group chat. Its members stay on the team."))
++ (0, import_react36.createElement)("span", { className: "bt-bs-label" }, confirming ? t("Delete {name}?", { name: room2.name }) : t("Delete group")),
++ (0, import_react36.createElement)("span", { className: "bt-set-hint" }, confirming ? t("Click again to delete. Its history is archived.") : t("Removes the group chat. Its members stay on the team."))
),
- (0, import_react35.createElement)("span", { className: "bt-chevron" }, (0, import_react35.createElement)(ChevronRightIcon))
- (0, import_react33.createElement)("span", { className: "bt-chevron" }, (0, import_react33.createElement)(ChevronRightIcon))
++ (0, import_react36.createElement)("span", { className: "bt-chevron" }, (0, import_react36.createElement)(ChevronRightIcon))
)
)
);
}
function NewGroupForm({ roster, actions, run: run2, onCreated, onCancel }) {
- const [admin, setAdmin] = (0, import_react35.useState)(null);
- const [members, setMembers] = (0, import_react35.useState)([]);
- const [name, setName] = (0, import_react35.useState)("");
- const [busy, setBusy] = (0, import_react35.useState)(false);
- const [admin, setAdmin] = (0, import_react33.useState)(null);
- const [members, setMembers] = (0, import_react33.useState)([]);
- const [name, setName] = (0, import_react33.useState)("");
- const [busy, setBusy] = (0, import_react33.useState)(false);
++ const [admin, setAdmin] = (0, import_react36.useState)(null);
++ const [members, setMembers] = (0, import_react36.useState)([]);
++ const [name, setName] = (0, import_react36.useState)("");
++ const [busy, setBusy] = (0, import_react36.useState)(false);
const toggle = (id) => setMembers((list) => list.includes(id) ? list.filter((item) => item !== id) : [...list, id]);
const pickAdmin = (id) => {
setAdmin(id);
@@@ -13946,48 -13786,48 +14143,48 @@@
if (done && room2) onCreated(room2);
else setBusy(false);
};
- const chip = (bot, on, onClick, role) => (0, import_react35.createElement)("button", {
- const chip = (bot, on, onClick, role) => (0, import_react33.createElement)("button", {
++ const chip = (bot, on, onClick, role) => (0, import_react36.createElement)("button", {
key: bot.id,
type: "button",
role,
className: "bt-ng-chip",
"aria-checked": on,
onClick
- }, (0, import_react35.createElement)(BotAvatar, { bot, size: 22, badge: false, live: false }), (0, import_react35.createElement)("span", { className: "bt-ng-name" }, bot.name), on && role === "radio" ? (0, import_react35.createElement)(AdminStar) : null);
- return (0, import_react35.createElement)(
- }, (0, import_react33.createElement)(BotAvatar, { bot, size: 22, badge: false, live: false }), (0, import_react33.createElement)("span", { className: "bt-ng-name" }, bot.name), on && role === "radio" ? (0, import_react33.createElement)(AdminStar) : null);
- return (0, import_react33.createElement)(
++ }, (0, import_react36.createElement)(BotAvatar, { bot, size: 22, badge: false, live: false }), (0, import_react36.createElement)("span", { className: "bt-ng-name" }, bot.name), on && role === "radio" ? (0, import_react36.createElement)(AdminStar) : null);
++ return (0, import_react36.createElement)(
"div",
{ className: "bt-set-card bt-ng" },
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
++ (0, import_react36.createElement)(
"div",
{ className: "bt-set-row bt-bs-row bt-bs-stack" },
- (0, import_react35.createElement)("span", { className: "bt-set-copy" }, (0, import_react35.createElement)("span", { className: "bt-bs-label bt-ng-label" }, (0, import_react35.createElement)(AdminStar), t("Choose the group admin"))),
- (0, import_react35.createElement)(
- (0, import_react33.createElement)("span", { className: "bt-set-copy" }, (0, import_react33.createElement)("span", { className: "bt-bs-label bt-ng-label" }, (0, import_react33.createElement)(AdminStar), t("Choose the group admin"))),
- (0, import_react33.createElement)(
++ (0, import_react36.createElement)("span", { className: "bt-set-copy" }, (0, import_react36.createElement)("span", { className: "bt-bs-label bt-ng-label" }, (0, import_react36.createElement)(AdminStar), t("Choose the group admin"))),
++ (0, import_react36.createElement)(
"div",
{ className: "bt-ng-picks", role: "radiogroup", "aria-label": t("Group admin") },
roster.bots.map((bot) => chip(bot, admin === bot.id, () => pickAdmin(bot.id), "radio"))
)
),
- admin === null ? null : (0, import_react35.createElement)(
- admin === null ? null : (0, import_react33.createElement)(
++ admin === null ? null : (0, import_react36.createElement)(
"div",
{ className: "bt-set-row bt-bs-row bt-bs-stack bt-ng-step" },
- (0, import_react35.createElement)("span", { className: "bt-set-copy" }, (0, import_react35.createElement)("span", { className: "bt-bs-label" }, t("Who to chat with…"))),
- (0, import_react35.createElement)(
- (0, import_react33.createElement)("span", { className: "bt-set-copy" }, (0, import_react33.createElement)("span", { className: "bt-bs-label" }, t("Who to chat with…"))),
- (0, import_react33.createElement)(
++ (0, import_react36.createElement)("span", { className: "bt-set-copy" }, (0, import_react36.createElement)("span", { className: "bt-bs-label" }, t("Who to chat with…"))),
++ (0, import_react36.createElement)(
"div",
{ className: "bt-ng-picks", role: "group", "aria-label": t("Members") },
roster.bots.filter((bot) => bot.id !== admin).map((bot) => chip(bot, members.includes(bot.id), () => toggle(bot.id), "checkbox"))
)
),
- admin === null || members.length === 0 ? null : (0, import_react35.createElement)(
- admin === null || members.length === 0 ? null : (0, import_react33.createElement)(
++ admin === null || members.length === 0 ? null : (0, import_react36.createElement)(
"label",
{ className: "bt-set-row bt-bs-row bt-ng-step" },
- (0, import_react35.createElement)("span", { className: "bt-set-copy" }, (0, import_react35.createElement)("span", { className: "bt-bs-label" }, t("Name"))),
- (0, import_react35.createElement)("input", { className: "bt-bs-input", value: name, maxLength: 60, placeholder: t("Name after members"), onChange: (event) => setName(event.target.value) })
- (0, import_react33.createElement)("span", { className: "bt-set-copy" }, (0, import_react33.createElement)("span", { className: "bt-bs-label" }, t("Name"))),
- (0, import_react33.createElement)("input", { className: "bt-bs-input", value: name, maxLength: 60, placeholder: t("Name after members"), onChange: (event) => setName(event.target.value) })
++ (0, import_react36.createElement)("span", { className: "bt-set-copy" }, (0, import_react36.createElement)("span", { className: "bt-bs-label" }, t("Name"))),
++ (0, import_react36.createElement)("input", { className: "bt-bs-input", value: name, maxLength: 60, placeholder: t("Name after members"), onChange: (event) => setName(event.target.value) })
),
- (0, import_react35.createElement)(
- (0, import_react33.createElement)(
++ (0, import_react36.createElement)(
"div",
{ className: "bt-set-row bt-task-foot" },
- (0, import_react35.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),
- (0, import_react35.createElement)("button", { type: "button", className: "bt-send bt-soft-sm", disabled: busy || admin === null || members.length === 0, onClick: () => void create() }, t("Create group chat"))
- (0, import_react33.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),
- (0, import_react33.createElement)("button", { type: "button", className: "bt-send bt-soft-sm", disabled: busy || admin === null || members.length === 0, onClick: () => void create() }, t("Create group chat"))
++ (0, import_react36.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),
++ (0, import_react36.createElement)("button", { type: "button", className: "bt-send bt-soft-sm", disabled: busy || admin === null || members.length === 0, onClick: () => void create() }, t("Create group chat"))
)
);
}
@@@ -14147,7 -13987,7 +14344,7 @@@ function percent2(part, whole)
}
// src/client/usage-page.js
- var import_react36 = require("react");
-var import_react34 = require("react");
++var import_react37 = require("react");
var HEAT_WEEKS = 53;
var TOP_SERIES = 7;
var RING_R = 42;
@@@ -14194,9 -14034,9 +14391,9 @@@ function titleOf2(range, bucket)
return dates({ year: "numeric", month: "long" }).format(bucket.start);
}
function useTween(value) {
- const [shown, setShown] = (0, import_react36.useState)(0);
- const from = (0, import_react36.useRef)(0);
- (0, import_react36.useEffect)(() => {
- const [shown, setShown] = (0, import_react34.useState)(0);
- const from = (0, import_react34.useRef)(0);
- (0, import_react34.useEffect)(() => {
++ const [shown, setShown] = (0, import_react37.useState)(0);
++ const from = (0, import_react37.useRef)(0);
++ (0, import_react37.useEffect)(() => {
if (reducedMotion() || typeof requestAnimationFrame !== "function") {
from.current = value;
setShown(value);
@@@ -14216,9 -14056,9 +14413,9 @@@
}, [value]);
return shown;
}
- var glyphBox = (size, icon2) => (0, import_react36.createElement)("span", { className: "bt-us-glyph", style: { width: size, height: size } }, (0, import_react36.createElement)(icon2));
-var glyphBox = (size, icon2) => (0, import_react34.createElement)("span", { className: "bt-us-glyph", style: { width: size, height: size } }, (0, import_react34.createElement)(icon2));
++var glyphBox = (size, icon2) => (0, import_react37.createElement)("span", { className: "bt-us-glyph", style: { width: size, height: size } }, (0, import_react37.createElement)(icon2));
function ModelGlyph({ name, paint, size }) {
- return (0, import_react36.createElement)("span", {
- return (0, import_react34.createElement)("span", {
++ return (0, import_react37.createElement)("span", {
className: "bt-us-model",
"aria-hidden": true,
style: { width: size, height: size, fontSize: Math.round(size * 0.42), background: `color-mix(in srgb, ${paint} 20%, var(--bt-card))`, color: `color-mix(in srgb, ${paint} 72%, var(--bt-ink))` }
@@@ -14235,7 -14075,7 +14432,7 @@@ function ownerFace(owner, roster)
sub: owner.deleted ? t("Deleted") : role.toLowerCase() === name.toLowerCase() ? "" : role,
paint: paintCss(colorOf(bot)),
stops: GRADIENTS[colorOf(bot)],
- glyph: (size) => (0, import_react36.createElement)(BotAvatar, { bot, size, badge: false, live: false })
- glyph: (size) => (0, import_react34.createElement)(BotAvatar, { bot, size, badge: false, live: false })
++ glyph: (size) => (0, import_react37.createElement)(BotAvatar, { bot, size, badge: false, live: false })
};
}
if (owner.kind === "room") {
@@@ -14245,7 -14085,7 +14442,7 @@@
name: owner.name || t("Deleted group chat"),
sub: owner.deleted ? t("Deleted") : t("Group chat"),
paint: "var(--bt-us-rest)",
- glyph: (size) => room2 ? (0, import_react36.createElement)(RoomAvatar, { room: room2, roster, size }) : glyphBox(size, ChatsIcon)
- glyph: (size) => room2 ? (0, import_react34.createElement)(RoomAvatar, { room: room2, roster, size }) : glyphBox(size, ChatsIcon)
++ glyph: (size) => room2 ? (0, import_react37.createElement)(RoomAvatar, { room: room2, roster, size }) : glyphBox(size, ChatsIcon)
};
}
if (owner.kind === "agent") {
@@@ -14267,30 -14107,30 +14464,30 @@@ function Tabs({ label, value, options,
const names = options.map(([, text]) => text).join("\n");
const glide = useGlide(`${value}
${names}`, { box: boxRef });
- return (0, import_react36.createElement)(
- return (0, import_react34.createElement)(
++ return (0, import_react37.createElement)(
"div",
{ ref: glide.box, className: "bt-us-tabs", role: "group", "aria-label": label },
- (0, import_react36.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
- options.map(([id, text, icon2]) => (0, import_react36.createElement)("button", { key: id, type: "button", "aria-pressed": value === id, onClick: () => onChange(id) }, icon2 ? (0, import_react36.createElement)(icon2) : null, text))
- (0, import_react34.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
- options.map(([id, text, icon2]) => (0, import_react34.createElement)("button", { key: id, type: "button", "aria-pressed": value === id, onClick: () => onChange(id) }, icon2 ? (0, import_react34.createElement)(icon2) : null, text))
++ (0, import_react37.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
++ options.map(([id, text, icon2]) => (0, import_react37.createElement)("button", { key: id, type: "button", "aria-pressed": value === id, onClick: () => onChange(id) }, icon2 ? (0, import_react37.createElement)(icon2) : null, text))
);
}
function Stats({ range, total, previous }) {
const shown = useTween(total.total);
const change = previous > 0 ? Math.round((total.total - previous) / previous * 100) : null;
- const cell = (label, value) => (0, import_react36.createElement)("div", { className: "bt-us-stat" }, (0, import_react36.createElement)("span", { className: "bt-us-stat-label" }, label), (0, import_react36.createElement)("span", { className: "bt-us-stat-value" }, value));
- return (0, import_react36.createElement)(
- const cell = (label, value) => (0, import_react34.createElement)("div", { className: "bt-us-stat" }, (0, import_react34.createElement)("span", { className: "bt-us-stat-label" }, label), (0, import_react34.createElement)("span", { className: "bt-us-stat-value" }, value));
- return (0, import_react34.createElement)(
++ const cell = (label, value) => (0, import_react37.createElement)("div", { className: "bt-us-stat" }, (0, import_react37.createElement)("span", { className: "bt-us-stat-label" }, label), (0, import_react37.createElement)("span", { className: "bt-us-stat-value" }, value));
++ return (0, import_react37.createElement)(
"section",
{ className: "bt-us-stats", style: { "--i": 0 } },
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-stat bt-us-stat-main" },
- (0, import_react36.createElement)("span", { className: "bt-us-stat-label" }, lastText(range)),
- (0, import_react36.createElement)(
- (0, import_react34.createElement)("span", { className: "bt-us-stat-label" }, lastText(range)),
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)("span", { className: "bt-us-stat-label" }, lastText(range)),
++ (0, import_react37.createElement)(
"span",
{ className: "bt-us-stat-value" },
compact(shown),
- (0, import_react36.createElement)("small", null, t("tokens")),
- change === null ? null : (0, import_react36.createElement)(
- (0, import_react34.createElement)("small", null, t("tokens")),
- change === null ? null : (0, import_react34.createElement)(
++ (0, import_react37.createElement)("small", null, t("tokens")),
++ change === null ? null : (0, import_react37.createElement)(
"span",
{ className: "bt-us-delta", title: compareText(range) },
`${change >= 0 ? "↑" : "↓"} ${Math.abs(change)}%`
@@@ -14308,83 -14148,83 +14505,83 @@@ function niceTop(max)
return [1, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10].map((scale) => scale * step).find((value) => value >= max);
}
function Chart({ range, columns: columns2, series, tipSeries, by, onBy, onPick }) {
- const [hover, setHover] = (0, import_react36.useState)(null);
- const [hover, setHover] = (0, import_react34.useState)(null);
++ const [hover, setHover] = (0, import_react37.useState)(null);
const top = niceTop(Math.max(0, ...columns2.map((column) => column.total)));
const count = columns2.length;
const fillOf = new Map(series.map((entry) => [entry.key, entry.fill]));
const tipOf = new Map(tipSeries.map((entry) => [entry.key, entry]));
const tip = hover === null ? null : columns2[hover];
const tipSide = hover !== null && hover >= count / 2 ? { right: `calc(${(count - hover) / count * 100}% + 8px)` } : { left: `calc(${(hover + 1) / count * 100}% + 8px)` };
- return (0, import_react36.createElement)(
- return (0, import_react34.createElement)(
++ return (0, import_react37.createElement)(
"section",
{ className: "bt-us-card bt-us-chart", style: { "--i": 1 } },
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-card-head" },
- (0, import_react36.createElement)("h3", null, t("Tokens over time"), (0, import_react36.createElement)("span", null, unitLabel(range.unit))),
- onBy ? (0, import_react36.createElement)(Tabs, { label: t("Group usage by"), value: by, onChange: onBy, options: [["bot", t("By Bot")], ["model", t("By model")]] }) : null
- (0, import_react34.createElement)("h3", null, t("Tokens over time"), (0, import_react34.createElement)("span", null, unitLabel(range.unit))),
- onBy ? (0, import_react34.createElement)(Tabs, { label: t("Group usage by"), value: by, onChange: onBy, options: [["bot", t("By Bot")], ["model", t("By model")]] }) : null
++ (0, import_react37.createElement)("h3", null, t("Tokens over time"), (0, import_react37.createElement)("span", null, unitLabel(range.unit))),
++ onBy ? (0, import_react37.createElement)(Tabs, { label: t("Group usage by"), value: by, onChange: onBy, options: [["bot", t("By Bot")], ["model", t("By model")]] }) : null
),
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-chart-body" },
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-plot", "data-hover": hover === null ? void 0 : "", onMouseLeave: () => setHover(null) },
- [1, 0.5].map((level) => (0, import_react36.createElement)("div", { key: level, className: "bt-us-grid", style: { bottom: `${level * 100}%` } }, (0, import_react36.createElement)("span", null, compact(top * level)))),
- (0, import_react36.createElement)("div", { className: "bt-us-grid bt-us-base", style: { bottom: 0 } }, (0, import_react36.createElement)("span", null, "0")),
- (0, import_react36.createElement)(
- [1, 0.5].map((level) => (0, import_react34.createElement)("div", { key: level, className: "bt-us-grid", style: { bottom: `${level * 100}%` } }, (0, import_react34.createElement)("span", null, compact(top * level)))),
- (0, import_react34.createElement)("div", { className: "bt-us-grid bt-us-base", style: { bottom: 0 } }, (0, import_react34.createElement)("span", null, "0")),
- (0, import_react34.createElement)(
++ [1, 0.5].map((level) => (0, import_react37.createElement)("div", { key: level, className: "bt-us-grid", style: { bottom: `${level * 100}%` } }, (0, import_react37.createElement)("span", null, compact(top * level)))),
++ (0, import_react37.createElement)("div", { className: "bt-us-grid bt-us-base", style: { bottom: 0 } }, (0, import_react37.createElement)("span", null, "0")),
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-cols" },
- columns2.map((column, at) => (0, import_react36.createElement)("div", {
- columns2.map((column, at) => (0, import_react34.createElement)("div", {
++ columns2.map((column, at) => (0, import_react37.createElement)("div", {
key: `${range.from ? `${range.from}~${range.to}` : range.id}:${column.key}`,
className: "bt-us-col",
"data-on": hover === at ? "" : void 0,
onMouseEnter: () => setHover(at)
- }, column.total > 0 ? (0, import_react36.createElement)(
- }, column.total > 0 ? (0, import_react34.createElement)(
++ }, column.total > 0 ? (0, import_react37.createElement)(
"div",
{ className: "bt-us-stack", style: { height: `${column.total / top * 100}%`, "--i": at } },
- column.parts.map(([key, value]) => value > 0 ? (0, import_react36.createElement)("i", { key, style: { flexGrow: value, background: fillOf.get(key) } }) : null)
- ) : (0, import_react36.createElement)("div", { className: "bt-us-stub" })))
- column.parts.map(([key, value]) => value > 0 ? (0, import_react34.createElement)("i", { key, style: { flexGrow: value, background: fillOf.get(key) } }) : null)
- ) : (0, import_react34.createElement)("div", { className: "bt-us-stub" })))
++ column.parts.map(([key, value]) => value > 0 ? (0, import_react37.createElement)("i", { key, style: { flexGrow: value, background: fillOf.get(key) } }) : null)
++ ) : (0, import_react37.createElement)("div", { className: "bt-us-stub" })))
),
- tip ? (0, import_react36.createElement)(
- tip ? (0, import_react34.createElement)(
++ tip ? (0, import_react37.createElement)(
"div",
{ className: "bt-us-tip", style: tipSide },
- (0, import_react36.createElement)("div", { className: "bt-us-tip-title" }, tip.title),
- (0, import_react36.createElement)("div", { className: "bt-us-tip-total" }, t("{count} tokens", { count: full(tip.total) })),
- tip.tip.filter(([, value]) => value > 0).sort((a, b) => b[1] - a[1]).map(([key, value]) => (0, import_react36.createElement)(
- (0, import_react34.createElement)("div", { className: "bt-us-tip-title" }, tip.title),
- (0, import_react34.createElement)("div", { className: "bt-us-tip-total" }, t("{count} tokens", { count: full(tip.total) })),
- tip.tip.filter(([, value]) => value > 0).sort((a, b) => b[1] - a[1]).map(([key, value]) => (0, import_react34.createElement)(
++ (0, import_react37.createElement)("div", { className: "bt-us-tip-title" }, tip.title),
++ (0, import_react37.createElement)("div", { className: "bt-us-tip-total" }, t("{count} tokens", { count: full(tip.total) })),
++ tip.tip.filter(([, value]) => value > 0).sort((a, b) => b[1] - a[1]).map(([key, value]) => (0, import_react37.createElement)(
"div",
{ key, className: "bt-us-tip-row" },
- (0, import_react36.createElement)("i", { className: "bt-us-dot", style: { background: tipOf.get(key)?.fill } }),
- (0, import_react36.createElement)("span", null, tipOf.get(key)?.name),
- (0, import_react36.createElement)("b", null, compact(value))
- (0, import_react34.createElement)("i", { className: "bt-us-dot", style: { background: tipOf.get(key)?.fill } }),
- (0, import_react34.createElement)("span", null, tipOf.get(key)?.name),
- (0, import_react34.createElement)("b", null, compact(value))
++ (0, import_react37.createElement)("i", { className: "bt-us-dot", style: { background: tipOf.get(key)?.fill } }),
++ (0, import_react37.createElement)("span", null, tipOf.get(key)?.name),
++ (0, import_react37.createElement)("b", null, compact(value))
))
) : null
),
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-ticks", "aria-hidden": true },
// A preset counts its labels back from now; a picked span forward from its first day.
- columns2.map((column, at) => (0, import_react36.createElement)(
- columns2.map((column, at) => (0, import_react34.createElement)(
++ columns2.map((column, at) => (0, import_react37.createElement)(
"span",
{ key: column.key, "data-now": at === count - 1 && range.ends !== false ? "" : void 0 },
(range.from ? at : count - 1 - at) % range.stride === 0 ? column.tick : ""
))
)
),
- series.length > 1 || series[0]?.pick ? (0, import_react36.createElement)(
- series.length > 1 || series[0]?.pick ? (0, import_react34.createElement)(
++ series.length > 1 || series[0]?.pick ? (0, import_react37.createElement)(
"div",
{ className: "bt-us-legend" },
- series.map((entry) => (0, import_react36.createElement)(entry.pick ? "button" : "span", {
- series.map((entry) => (0, import_react34.createElement)(entry.pick ? "button" : "span", {
++ series.map((entry) => (0, import_react37.createElement)(entry.pick ? "button" : "span", {
key: entry.key,
className: "bt-us-key",
...entry.pick ? { type: "button", onClick: () => onPick(entry.pick) } : {}
- }, (0, import_react36.createElement)("i", { className: "bt-us-dot", style: { background: entry.fill } }), entry.name))
- }, (0, import_react34.createElement)("i", { className: "bt-us-dot", style: { background: entry.fill } }), entry.name))
++ }, (0, import_react37.createElement)("i", { className: "bt-us-dot", style: { background: entry.fill } }), entry.name))
) : null
);
}
function Row2({ kind, glyph, name, sub, sum, whole, fill: fill2, index, onClick }) {
const width = whole > 0 ? Math.max(sum.total > 0 ? 2 : 0, sum.total / whole * 100) : 0;
- return (0, import_react36.createElement)(
- return (0, import_react34.createElement)(
++ return (0, import_react37.createElement)(
onClick ? "button" : "div",
{
className: "bt-us-row",
@@@ -14393,69 -14233,69 +14590,69 @@@
title: t("{tokens} tokens · {calls} calls", { tokens: full(sum.total), calls: full(sum.calls) }),
...onClick ? { type: "button", onClick } : {}
},
- glyph ? (0, import_react36.createElement)("span", { className: "bt-us-row-glyph" }, glyph) : null,
- (0, import_react36.createElement)(
- glyph ? (0, import_react34.createElement)("span", { className: "bt-us-row-glyph" }, glyph) : null,
- (0, import_react34.createElement)(
++ glyph ? (0, import_react37.createElement)("span", { className: "bt-us-row-glyph" }, glyph) : null,
++ (0, import_react37.createElement)(
"span",
{ className: "bt-us-row-body" },
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
"span",
{ className: "bt-us-row-line" },
- (0, import_react36.createElement)("span", { className: "bt-us-row-name" }, name),
- sub ? (0, import_react36.createElement)("span", { className: "bt-us-row-sub" }, sub) : null
- (0, import_react34.createElement)("span", { className: "bt-us-row-name" }, name),
- sub ? (0, import_react34.createElement)("span", { className: "bt-us-row-sub" }, sub) : null
++ (0, import_react37.createElement)("span", { className: "bt-us-row-name" }, name),
++ sub ? (0, import_react37.createElement)("span", { className: "bt-us-row-sub" }, sub) : null
),
- (0, import_react36.createElement)("span", { className: "bt-us-track" }, (0, import_react36.createElement)("span", { style: { width: `${width}%`, background: fill2 } }))
- (0, import_react34.createElement)("span", { className: "bt-us-track" }, (0, import_react34.createElement)("span", { style: { width: `${width}%`, background: fill2 } }))
++ (0, import_react37.createElement)("span", { className: "bt-us-track" }, (0, import_react37.createElement)("span", { style: { width: `${width}%`, background: fill2 } }))
),
- (0, import_react36.createElement)("span", { className: "bt-us-row-num" }, (0, import_react36.createElement)("b", null, compact(sum.total)), (0, import_react36.createElement)("small", null, `${percent2(sum.total, whole)}%`))
- (0, import_react34.createElement)("span", { className: "bt-us-row-num" }, (0, import_react34.createElement)("b", null, compact(sum.total)), (0, import_react34.createElement)("small", null, `${percent2(sum.total, whole)}%`))
++ (0, import_react37.createElement)("span", { className: "bt-us-row-num" }, (0, import_react37.createElement)("b", null, compact(sum.total)), (0, import_react37.createElement)("small", null, `${percent2(sum.total, whole)}%`))
);
}
function ListCard({ title, count, index, children }) {
- return (0, import_react36.createElement)(
- return (0, import_react34.createElement)(
++ return (0, import_react37.createElement)(
"section",
{ className: "bt-us-card", style: { "--i": index } },
- (0, import_react36.createElement)("div", { className: "bt-us-card-head" }, (0, import_react36.createElement)("h3", null, title, count === void 0 ? null : (0, import_react36.createElement)("span", null, count))),
- (0, import_react36.createElement)("div", { className: "bt-us-rows" }, children)
- (0, import_react34.createElement)("div", { className: "bt-us-card-head" }, (0, import_react34.createElement)("h3", null, title, count === void 0 ? null : (0, import_react34.createElement)("span", null, count))),
- (0, import_react34.createElement)("div", { className: "bt-us-rows" }, children)
++ (0, import_react37.createElement)("div", { className: "bt-us-card-head" }, (0, import_react37.createElement)("h3", null, title, count === void 0 ? null : (0, import_react37.createElement)("span", null, count))),
++ (0, import_react37.createElement)("div", { className: "bt-us-rows" }, children)
);
}
function Profile({ face, share, range }) {
const arc = Math.max(0, Math.min(1, share)) * RING;
- return (0, import_react36.createElement)(
- return (0, import_react34.createElement)(
++ return (0, import_react37.createElement)(
"section",
{ className: "bt-us-profile" },
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
"span",
{ className: "bt-us-ring" },
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
"svg",
{ viewBox: "0 0 96 96", "aria-hidden": true },
- face.stops ? (0, import_react36.createElement)("defs", null, (0, import_react36.createElement)(
- face.stops ? (0, import_react34.createElement)("defs", null, (0, import_react34.createElement)(
++ face.stops ? (0, import_react37.createElement)("defs", null, (0, import_react37.createElement)(
"linearGradient",
{ id: "bt-us-ring-paint", x1: 0, y1: 1, x2: 1, y2: 0 },
- face.stops.map(([offset, color]) => (0, import_react36.createElement)("stop", { key: offset, offset, stopColor: color }))
- face.stops.map(([offset, color]) => (0, import_react34.createElement)("stop", { key: offset, offset, stopColor: color }))
++ face.stops.map(([offset, color]) => (0, import_react37.createElement)("stop", { key: offset, offset, stopColor: color }))
)) : null,
- (0, import_react36.createElement)("circle", { className: "bt-us-ring-track", cx: 48, cy: 48, r: RING_R }),
- arc > 0 ? (0, import_react36.createElement)("circle", { className: "bt-us-ring-arc", cx: 48, cy: 48, r: RING_R, style: { stroke: face.stops ? "url(#bt-us-ring-paint)" : face.paint, strokeDasharray: `${arc} ${RING}` } }) : null
- (0, import_react34.createElement)("circle", { className: "bt-us-ring-track", cx: 48, cy: 48, r: RING_R }),
- arc > 0 ? (0, import_react34.createElement)("circle", { className: "bt-us-ring-arc", cx: 48, cy: 48, r: RING_R, style: { stroke: face.stops ? "url(#bt-us-ring-paint)" : face.paint, strokeDasharray: `${arc} ${RING}` } }) : null
++ (0, import_react37.createElement)("circle", { className: "bt-us-ring-track", cx: 48, cy: 48, r: RING_R }),
++ arc > 0 ? (0, import_react37.createElement)("circle", { className: "bt-us-ring-arc", cx: 48, cy: 48, r: RING_R, style: { stroke: face.stops ? "url(#bt-us-ring-paint)" : face.paint, strokeDasharray: `${arc} ${RING}` } }) : null
),
- (0, import_react36.createElement)("span", { className: "bt-us-ring-face" }, face.glyph(64))
- (0, import_react34.createElement)("span", { className: "bt-us-ring-face" }, face.glyph(64))
++ (0, import_react37.createElement)("span", { className: "bt-us-ring-face" }, face.glyph(64))
),
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-profile-copy" },
- (0, import_react36.createElement)("h3", null, face.name),
- face.sub ? (0, import_react36.createElement)("span", { className: "bt-us-profile-sub" }, face.sub) : null,
- (0, import_react36.createElement)("span", { className: "bt-us-profile-share" }, range.from ? t("{share}% of all usage from {span}", { share: percent2(share, 1), span: spanText(range.from, range.to) }) : t("{share}% of all usage in the last {range}", { share: percent2(share, 1), range: rangeLabel(range.id) }))
- (0, import_react34.createElement)("h3", null, face.name),
- face.sub ? (0, import_react34.createElement)("span", { className: "bt-us-profile-sub" }, face.sub) : null,
- (0, import_react34.createElement)("span", { className: "bt-us-profile-share" }, range.from ? t("{share}% of all usage from {span}", { share: percent2(share, 1), span: spanText(range.from, range.to) }) : t("{share}% of all usage in the last {range}", { share: percent2(share, 1), range: rangeLabel(range.id) }))
++ (0, import_react37.createElement)("h3", null, face.name),
++ face.sub ? (0, import_react37.createElement)("span", { className: "bt-us-profile-sub" }, face.sub) : null,
++ (0, import_react37.createElement)("span", { className: "bt-us-profile-share" }, range.from ? t("{share}% of all usage from {span}", { share: percent2(share, 1), span: spanText(range.from, range.to) }) : t("{share}% of all usage in the last {range}", { share: percent2(share, 1), range: rangeLabel(range.id) }))
)
);
}
var monthOf = (ms) => Date.UTC(yearOf(ms), new Date(ms).getUTCMonth(), 1);
var addMonths = (ms, count) => Date.UTC(yearOf(ms), new Date(ms).getUTCMonth() + count, 1);
function SpanPicker({ span, today, oldest, active, near, onPick, onClose }) {
- const box = (0, import_react36.useRef)(null);
- const box = (0, import_react34.useRef)(null);
++ const box = (0, import_react37.useRef)(null);
const todayMs = hourMs(today);
const thisMonth = monthOf(todayMs);
- const [right, setRight] = (0, import_react36.useState)(() => Math.max(addMonths(oldest, 1), monthOf(hourMs(span?.to ?? today))));
- const [anchor, setAnchor] = (0, import_react36.useState)(null);
- const [hover, setHover] = (0, import_react36.useState)(null);
- (0, import_react36.useEffect)(() => {
- const [right, setRight] = (0, import_react34.useState)(() => Math.max(addMonths(oldest, 1), monthOf(hourMs(span?.to ?? today))));
- const [anchor, setAnchor] = (0, import_react34.useState)(null);
- const [hover, setHover] = (0, import_react34.useState)(null);
- (0, import_react34.useEffect)(() => {
++ const [right, setRight] = (0, import_react37.useState)(() => Math.max(addMonths(oldest, 1), monthOf(hourMs(span?.to ?? today))));
++ const [anchor, setAnchor] = (0, import_react37.useState)(null);
++ const [hover, setHover] = (0, import_react37.useState)(null);
++ (0, import_react37.useEffect)(() => {
const onDown = (event) => {
if (![box, near].some((ref) => ref.current?.contains(event.target))) onClose();
};
@@@ -14481,17 -14321,17 +14678,17 @@@
const [from, to] = [anchor, key].sort();
onPick(from, to);
};
- const weekdays = (0, import_react36.useMemo)(() => Array.from({ length: 7 }, (_, at) => dates({ weekday: "narrow" }).format(Date.UTC(2024, 0, 1 + at))), []);
- const weekdays = (0, import_react34.useMemo)(() => Array.from({ length: 7 }, (_, at) => dates({ weekday: "narrow" }).format(Date.UTC(2024, 0, 1 + at))), []);
++ const weekdays = (0, import_react37.useMemo)(() => Array.from({ length: 7 }, (_, at) => dates({ weekday: "narrow" }).format(Date.UTC(2024, 0, 1 + at))), []);
const month = (start, side) => {
const length = new Date(addMonths(start, 1) - DAY_MS).getUTCDate();
const lead = (new Date(start).getUTCDay() + 6) % 7;
- const cells = Array.from({ length: lead }, (_, at) => (0, import_react36.createElement)("span", { key: `b${at}` }));
- const cells = Array.from({ length: lead }, (_, at) => (0, import_react34.createElement)("span", { key: `b${at}` }));
++ const cells = Array.from({ length: lead }, (_, at) => (0, import_react37.createElement)("span", { key: `b${at}` }));
for (let day = 1; day <= length; day += 1) {
const ms = start + (day - 1) * DAY_MS;
const key = dayKey(ms);
const weekday = (lead + day - 1) % 7;
const flag = (on) => on ? "" : void 0;
- cells.push((0, import_react36.createElement)("button", {
- cells.push((0, import_react34.createElement)("button", {
++ cells.push((0, import_react37.createElement)("button", {
key,
type: "button",
className: "bt-us-day",
@@@ -14507,15 -14347,15 +14704,15 @@@
"data-has": flag(active.has(key)),
onMouseEnter: () => setHover(key),
onClick: () => press(key)
- }, (0, import_react36.createElement)("b", null, day)));
- }, (0, import_react34.createElement)("b", null, day)));
++ }, (0, import_react37.createElement)("b", null, day)));
}
- const nav = side === "left" ? (0, import_react36.createElement)("button", { type: "button", className: "bt-us-month-nav", "data-side": "left", "aria-label": t("Previous month"), disabled: start <= oldest, onClick: () => setRight(addMonths(right, -1)) }, (0, import_react36.createElement)(ChevronLeftIcon)) : (0, import_react36.createElement)("button", { type: "button", className: "bt-us-month-nav", "data-side": "right", "aria-label": t("Next month"), disabled: start >= thisMonth, onClick: () => setRight(addMonths(right, 1)) }, (0, import_react36.createElement)(ChevronRightIcon));
- return (0, import_react36.createElement)(
- const nav = side === "left" ? (0, import_react34.createElement)("button", { type: "button", className: "bt-us-month-nav", "data-side": "left", "aria-label": t("Previous month"), disabled: start <= oldest, onClick: () => setRight(addMonths(right, -1)) }, (0, import_react34.createElement)(ChevronLeftIcon)) : (0, import_react34.createElement)("button", { type: "button", className: "bt-us-month-nav", "data-side": "right", "aria-label": t("Next month"), disabled: start >= thisMonth, onClick: () => setRight(addMonths(right, 1)) }, (0, import_react34.createElement)(ChevronRightIcon));
- return (0, import_react34.createElement)(
++ const nav = side === "left" ? (0, import_react37.createElement)("button", { type: "button", className: "bt-us-month-nav", "data-side": "left", "aria-label": t("Previous month"), disabled: start <= oldest, onClick: () => setRight(addMonths(right, -1)) }, (0, import_react37.createElement)(ChevronLeftIcon)) : (0, import_react37.createElement)("button", { type: "button", className: "bt-us-month-nav", "data-side": "right", "aria-label": t("Next month"), disabled: start >= thisMonth, onClick: () => setRight(addMonths(right, 1)) }, (0, import_react37.createElement)(ChevronRightIcon));
++ return (0, import_react37.createElement)(
"div",
{ key: start, className: "bt-us-month" },
- (0, import_react36.createElement)("div", { className: "bt-us-month-head" }, nav, (0, import_react36.createElement)("span", null, dates({ year: "numeric", month: "long" }).format(start))),
- (0, import_react36.createElement)("div", { className: "bt-us-weekdays", "aria-hidden": true }, weekdays.map((name, at) => (0, import_react36.createElement)("span", { key: at }, name))),
- (0, import_react36.createElement)("div", { className: "bt-us-days", onMouseLeave: () => setHover(null) }, cells)
- (0, import_react34.createElement)("div", { className: "bt-us-month-head" }, nav, (0, import_react34.createElement)("span", null, dates({ year: "numeric", month: "long" }).format(start))),
- (0, import_react34.createElement)("div", { className: "bt-us-weekdays", "aria-hidden": true }, weekdays.map((name, at) => (0, import_react34.createElement)("span", { key: at }, name))),
- (0, import_react34.createElement)("div", { className: "bt-us-days", onMouseLeave: () => setHover(null) }, cells)
++ (0, import_react37.createElement)("div", { className: "bt-us-month-head" }, nav, (0, import_react37.createElement)("span", null, dates({ year: "numeric", month: "long" }).format(start))),
++ (0, import_react37.createElement)("div", { className: "bt-us-weekdays", "aria-hidden": true }, weekdays.map((name, at) => (0, import_react37.createElement)("span", { key: at }, name))),
++ (0, import_react37.createElement)("div", { className: "bt-us-days", onMouseLeave: () => setHover(null) }, cells)
);
};
const shortcuts = [
@@@ -14524,30 -14364,30 +14721,30 @@@
["year", t("This year"), `${today.slice(0, 4)}-01-01`, today]
];
const count = low === null ? 0 : Math.round((hourMs(high) - hourMs(low)) / DAY_MS) + 1;
- return (0, import_react36.createElement)(
- return (0, import_react34.createElement)(
++ return (0, import_react37.createElement)(
"div",
{ ref: box, className: "bt-us-pick", role: "dialog", "aria-label": t("Custom range") },
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-pick-quick" },
- shortcuts.map(([id, label, from, to]) => (0, import_react36.createElement)("button", {
- shortcuts.map(([id, label, from, to]) => (0, import_react34.createElement)("button", {
++ shortcuts.map(([id, label, from, to]) => (0, import_react37.createElement)("button", {
key: id,
type: "button",
"aria-pressed": span?.from === from && span?.to === to,
onClick: () => onPick(from, to)
}, label))
),
- (0, import_react36.createElement)("div", { className: "bt-us-pick-months" }, month(addMonths(right, -1), "left"), month(right, "right")),
- (0, import_react36.createElement)(
- (0, import_react34.createElement)("div", { className: "bt-us-pick-months" }, month(addMonths(right, -1), "left"), month(right, "right")),
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)("div", { className: "bt-us-pick-months" }, month(addMonths(right, -1), "left"), month(right, "right")),
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-pick-foot", role: "status" },
- (0, import_react36.createElement)("span", null, anchor ? t("Pick the last day") : t("Pick the first day")),
- low === null ? null : (0, import_react36.createElement)("span", null, (0, import_react36.createElement)("b", null, spanText(low, high)), ` · ${daysText(count)}`)
- (0, import_react34.createElement)("span", null, anchor ? t("Pick the last day") : t("Pick the first day")),
- low === null ? null : (0, import_react34.createElement)("span", null, (0, import_react34.createElement)("b", null, spanText(low, high)), ` · ${daysText(count)}`)
++ (0, import_react37.createElement)("span", null, anchor ? t("Pick the last day") : t("Pick the first day")),
++ low === null ? null : (0, import_react37.createElement)("span", null, (0, import_react37.createElement)("b", null, spanText(low, high)), ` · ${daysText(count)}`)
)
);
}
function Heat({ view, keep, paint, index }) {
- const [hover, setHover] = (0, import_react36.useState)(null);
- const [hover, setHover] = (0, import_react34.useState)(null);
++ const [hover, setHover] = (0, import_react37.useState)(null);
const today = hourMs(`${view.now.slice(0, 10)} 00`);
const first = mondayOf(today) - (HEAT_WEEKS - 1) * 7 * DAY_MS;
const from = dayKey(first);
@@@ -14563,13 -14403,13 +14760,13 @@@
for (let week = 0; week < HEAT_WEEKS; week += 1) {
const monday = first + week * 7 * DAY_MS;
if (week > 0 && new Date(monday).getUTCMonth() !== new Date(monday - 7 * DAY_MS).getUTCMonth()) {
- months.push((0, import_react36.createElement)("span", { key: week, style: { gridColumn: week + 1 } }, dates({ month: "short" }).format(monday)));
- months.push((0, import_react34.createElement)("span", { key: week, style: { gridColumn: week + 1 } }, dates({ month: "short" }).format(monday)));
++ months.push((0, import_react37.createElement)("span", { key: week, style: { gridColumn: week + 1 } }, dates({ month: "short" }).format(monday)));
}
for (let day = 0; day < 7; day += 1) {
const ms = monday + day * DAY_MS;
const value = daily.get(dayKey(ms)) ?? 0;
const level = value > 0 ? Math.max(1, Math.ceil(4 * Math.sqrt(value / most))) : 0;
- cells.push((0, import_react36.createElement)("span", {
- cells.push((0, import_react34.createElement)("span", {
++ cells.push((0, import_react37.createElement)("span", {
key: ms,
className: "bt-us-cell",
style: { "--w": week },
@@@ -14577,7 -14417,7 +14774,7 @@@
"data-future": ms > today ? "" : void 0,
"data-today": ms === today ? "" : void 0,
onMouseEnter: ms > today ? void 0 : () => setHover({ ms, week, day })
- }, level > 0 ? (0, import_react36.createElement)("i", { style: { background: soften(paint, levels[level - 1]) } }) : null));
- }, level > 0 ? (0, import_react34.createElement)("i", { style: { background: soften(paint, levels[level - 1]) } }) : null));
++ }, level > 0 ? (0, import_react37.createElement)("i", { style: { background: soften(paint, levels[level - 1]) } }) : null));
}
}
const tipSide = hover ? {
@@@ -14586,68 -14426,68 +14783,68 @@@
} : null;
const active = [...daily.values()].filter((value) => value > 0).length;
const summary = active === 1 ? t("Active on 1 day in the last year") : t("Active on {count} days in the last year", { count: active });
- return (0, import_react36.createElement)(
- return (0, import_react34.createElement)(
++ return (0, import_react37.createElement)(
"section",
{ className: "bt-us-card bt-us-heat", style: { "--i": index } },
- (0, import_react36.createElement)("div", { className: "bt-us-card-head" }, (0, import_react36.createElement)("h3", null, t("Activity")), (0, import_react36.createElement)("span", { className: "bt-us-head-note" }, summary)),
- (0, import_react36.createElement)("div", { className: "bt-us-heat-months", "aria-hidden": true }, months),
- (0, import_react36.createElement)(
- (0, import_react34.createElement)("div", { className: "bt-us-card-head" }, (0, import_react34.createElement)("h3", null, t("Activity")), (0, import_react34.createElement)("span", { className: "bt-us-head-note" }, summary)),
- (0, import_react34.createElement)("div", { className: "bt-us-heat-months", "aria-hidden": true }, months),
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)("div", { className: "bt-us-card-head" }, (0, import_react37.createElement)("h3", null, t("Activity")), (0, import_react37.createElement)("span", { className: "bt-us-head-note" }, summary)),
++ (0, import_react37.createElement)("div", { className: "bt-us-heat-months", "aria-hidden": true }, months),
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-heat-plot", onMouseLeave: () => setHover(null) },
- (0, import_react36.createElement)("div", { className: "bt-us-heat-grid", role: "img", "aria-label": summary }, cells),
- hover ? (0, import_react36.createElement)(
- (0, import_react34.createElement)("div", { className: "bt-us-heat-grid", role: "img", "aria-label": summary }, cells),
- hover ? (0, import_react34.createElement)(
++ (0, import_react37.createElement)("div", { className: "bt-us-heat-grid", role: "img", "aria-label": summary }, cells),
++ hover ? (0, import_react37.createElement)(
"div",
{ className: "bt-us-tip bt-us-heat-tip", style: tipSide },
- (0, import_react36.createElement)("div", { className: "bt-us-tip-title" }, dates({ month: "long", day: "numeric", weekday: "short" }).format(hover.ms)),
- (0, import_react36.createElement)("div", { className: "bt-us-tip-total" }, t("{count} tokens", { count: full(daily.get(dayKey(hover.ms)) ?? 0) }))
- (0, import_react34.createElement)("div", { className: "bt-us-tip-title" }, dates({ month: "long", day: "numeric", weekday: "short" }).format(hover.ms)),
- (0, import_react34.createElement)("div", { className: "bt-us-tip-total" }, t("{count} tokens", { count: full(daily.get(dayKey(hover.ms)) ?? 0) }))
++ (0, import_react37.createElement)("div", { className: "bt-us-tip-title" }, dates({ month: "long", day: "numeric", weekday: "short" }).format(hover.ms)),
++ (0, import_react37.createElement)("div", { className: "bt-us-tip-total" }, t("{count} tokens", { count: full(daily.get(dayKey(hover.ms)) ?? 0) }))
) : null
),
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-heat-scale", "aria-hidden": true },
t("Light"),
- levels.map((level) => (0, import_react36.createElement)("span", { key: level, className: "bt-us-cell" }, (0, import_react36.createElement)("i", { style: { background: soften(paint, level) } }))),
- levels.map((level) => (0, import_react34.createElement)("span", { key: level, className: "bt-us-cell" }, (0, import_react34.createElement)("i", { style: { background: soften(paint, level) } }))),
++ levels.map((level) => (0, import_react37.createElement)("span", { key: level, className: "bt-us-cell" }, (0, import_react37.createElement)("i", { style: { background: soften(paint, level) } }))),
t("Heavy")
)
);
}
function Skeleton2() {
- return (0, import_react36.createElement)(
- return (0, import_react34.createElement)(
++ return (0, import_react37.createElement)(
"div",
{ className: "bt-us", "aria-busy": true },
- (0, import_react36.createElement)("div", { className: "bt-us-skel", style: { height: 32, width: 320, borderRadius: 999 } }),
- (0, import_react36.createElement)(
- (0, import_react34.createElement)("div", { className: "bt-us-skel", style: { height: 32, width: 320, borderRadius: 999 } }),
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)("div", { className: "bt-us-skel", style: { height: 32, width: 320, borderRadius: 999 } }),
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-sheet bt-us-skel-sheet" },
- (0, import_react36.createElement)("div", { className: "bt-us-skel", style: { height: 94 } }),
- (0, import_react36.createElement)("div", { className: "bt-us-skel", style: { height: 318 } }),
- (0, import_react36.createElement)(
- (0, import_react34.createElement)("div", { className: "bt-us-skel", style: { height: 94 } }),
- (0, import_react34.createElement)("div", { className: "bt-us-skel", style: { height: 318 } }),
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)("div", { className: "bt-us-skel", style: { height: 94 } }),
++ (0, import_react37.createElement)("div", { className: "bt-us-skel", style: { height: 318 } }),
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-pair" },
- (0, import_react36.createElement)("div", { className: "bt-us-skel", style: { height: 200 } }),
- (0, import_react36.createElement)("div", { className: "bt-us-skel", style: { height: 200 } })
- (0, import_react34.createElement)("div", { className: "bt-us-skel", style: { height: 200 } }),
- (0, import_react34.createElement)("div", { className: "bt-us-skel", style: { height: 200 } })
++ (0, import_react37.createElement)("div", { className: "bt-us-skel", style: { height: 200 } }),
++ (0, import_react37.createElement)("div", { className: "bt-us-skel", style: { height: 200 } })
)
)
);
}
var focusOf = (id) => typeof id !== "string" ? null : id.startsWith("model:") ? { kind: "model", key: id.slice("model:".length) } : id.startsWith("owner:") ? { kind: "owner", key: id.slice("owner:".length) } : null;
function UsagePage({ roster, actions, focusId }) {
- const [view, setView] = (0, import_react36.useState)(null);
- const [error, setError] = (0, import_react36.useState)("");
- const [rangeId, setRangeId] = (0, import_react36.useState)("7d");
- const [span, setSpan] = (0, import_react36.useState)(null);
- const [picking, setPicking] = (0, import_react36.useState)(false);
- const [by, setBy] = (0, import_react36.useState)("bot");
- const tabs = (0, import_react36.useRef)(null);
- const [view, setView] = (0, import_react34.useState)(null);
- const [error, setError] = (0, import_react34.useState)("");
- const [rangeId, setRangeId] = (0, import_react34.useState)("7d");
- const [span, setSpan] = (0, import_react34.useState)(null);
- const [picking, setPicking] = (0, import_react34.useState)(false);
- const [by, setBy] = (0, import_react34.useState)("bot");
- const tabs = (0, import_react34.useRef)(null);
++ const [view, setView] = (0, import_react37.useState)(null);
++ const [error, setError] = (0, import_react37.useState)("");
++ const [rangeId, setRangeId] = (0, import_react37.useState)("7d");
++ const [span, setSpan] = (0, import_react37.useState)(null);
++ const [picking, setPicking] = (0, import_react37.useState)(false);
++ const [by, setBy] = (0, import_react37.useState)("bot");
++ const tabs = (0, import_react37.useRef)(null);
const focus = focusOf(focusId);
- (0, import_react36.useEffect)(() => {
- (0, import_react34.useEffect)(() => {
++ (0, import_react37.useEffect)(() => {
let stopped = false;
let timer;
const load = async () => {
try {
const value = await actions.usage();
if (stopped) return;
- (0, import_react36.startTransition)(() => setView(value));
- (0, import_react34.startTransition)(() => setView(value));
++ (0, import_react37.startTransition)(() => setView(value));
setError("");
timer = setTimeout(load, value.scanning ? 3e3 : 2e4);
} catch (failure) {
@@@ -14664,7 -14504,7 +14861,7 @@@
}, []);
const today = view?.now.slice(0, 10);
const range = rangeId === "custom" && span ? { ...spanRange(span.from, span.to), ends: span.to >= today } : RANGES.find((item) => item.id === rangeId);
- const shaped = (0, import_react36.useMemo)(() => {
- const shaped = (0, import_react34.useMemo)(() => {
++ const shaped = (0, import_react37.useMemo)(() => {
if (!view) return null;
const faces2 = view.owners.map((owner) => ownerFace(owner, roster));
const lifetime = /* @__PURE__ */ new Map();
@@@ -14673,7 -14513,7 +14870,7 @@@
const models2 = view.models.map((model, at) => {
const name = model.name || model.model || t("Unknown model");
const paint = modelPaint.get(at) ?? "var(--bt-us-rest)";
- return { kind: "model", name, sub: model.providerName ?? model.provider, paint, glyph: (size) => (0, import_react36.createElement)(ModelGlyph, { name, paint, size }) };
- return { kind: "model", name, sub: model.providerName ?? model.provider, paint, glyph: (size) => (0, import_react34.createElement)(ModelGlyph, { name, paint, size }) };
++ return { kind: "model", name, sub: model.providerName ?? model.provider, paint, glyph: (size) => (0, import_react37.createElement)(ModelGlyph, { name, paint, size }) };
});
const ownerAt2 = focus?.kind === "owner" ? view.owners.findIndex((owner) => owner.key === focus.key) : -1;
const modelAt = focus?.kind === "model" ? view.models.findIndex((model) => model.key === focus.key) : -1;
@@@ -14721,23 -14561,23 +14918,23 @@@
});
return { faces: faces2, models: models2, ownerAt: ownerAt2, modelAt, face: face2, keep: keep2, all: all2, part: part2, series: series2, tipSeries: tipSeries2, fillOf: fillOf2, columns: columns3, ranked: ranked2, isBot: isBot2, activeDays: activeDays2, oldest: oldest2 };
}, [view, rangeId, span, by, focusId, roster]);
- const root = (0, import_react36.useRef)(null);
- (0, import_react36.useEffect)(() => {
- const root = (0, import_react34.useRef)(null);
- (0, import_react34.useEffect)(() => {
++ const root = (0, import_react37.useRef)(null);
++ (0, import_react37.useEffect)(() => {
root.current?.closest(".bt-settings-scroll")?.scrollTo?.({ top: 0 });
}, [focusId]);
if (!view) {
- return error ? (0, import_react36.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : (0, import_react36.createElement)(Skeleton2);
- return error ? (0, import_react34.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : (0, import_react34.createElement)(Skeleton2);
++ return error ? (0, import_react37.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : (0, import_react37.createElement)(Skeleton2);
}
if (view.rows.length === 0) {
- return (0, import_react36.createElement)(
- return (0, import_react34.createElement)(
++ return (0, import_react37.createElement)(
"div",
{ className: "bt-us" },
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-empty" },
- (0, import_react36.createElement)(BotMark, { look: MAIN_LOOK, size: 56, live: true }),
- (0, import_react36.createElement)("b", null, view.scanning ? t("Reading your chats…") : t("No usage yet.")),
- (0, import_react36.createElement)("span", null, t("Token usage shows up here after a model is called."))
- (0, import_react34.createElement)(BotMark, { look: MAIN_LOOK, size: 56, live: true }),
- (0, import_react34.createElement)("b", null, view.scanning ? t("Reading your chats…") : t("No usage yet.")),
- (0, import_react34.createElement)("span", null, t("Token usage shows up here after a model is called."))
++ (0, import_react37.createElement)(BotMark, { look: MAIN_LOOK, size: 56, live: true }),
++ (0, import_react37.createElement)("b", null, view.scanning ? t("Reading your chats…") : t("No usage yet.")),
++ (0, import_react37.createElement)("span", null, t("Token usage shows up here after a model is called."))
)
);
}
@@@ -14762,7 -14602,7 +14959,7 @@@
["custom", rangeId === "custom" && span ? spanText(span.from, span.to) : t("Custom"), CalendarIcon]
];
const whole = part.total.total;
- const ownerRow = ([at, sum], index, total = whole) => (0, import_react36.createElement)(Row2, {
- const ownerRow = ([at, sum], index, total = whole) => (0, import_react34.createElement)(Row2, {
++ const ownerRow = ([at, sum], index, total = whole) => (0, import_react37.createElement)(Row2, {
key: `o${at}`,
kind: faces[at].kind,
glyph: faces[at].glyph(32),
@@@ -14774,7 -14614,7 +14971,7 @@@
fill: face ? soften(face.paint, 0.8) : fillOf.get(`o${at}`) ?? soften(faces[at].paint),
onClick: () => pick2({ kind: "owner", key: view.owners[at].key })
});
- const modelRow = ([at, sum], index) => (0, import_react36.createElement)(Row2, {
- const modelRow = ([at, sum], index) => (0, import_react34.createElement)(Row2, {
++ const modelRow = ([at, sum], index) => (0, import_react37.createElement)(Row2, {
key: `m${at}`,
kind: "model",
glyph: models[at].glyph(32),
@@@ -14786,30 -14626,30 +14983,30 @@@
fill: face ? soften(face.paint, 0.8) : fillOf.get(`m${at}`) ?? soften(models[at].paint),
onClick: () => pick2({ kind: "model", key: view.models[at].key })
});
- const nothing = (0, import_react36.createElement)("div", { className: "bt-us-none" }, t("Nothing in this range."));
- const nothing = (0, import_react34.createElement)("div", { className: "bt-us-none" }, t("Nothing in this range."));
++ const nothing = (0, import_react37.createElement)("div", { className: "bt-us-none" }, t("Nothing in this range."));
let body;
if (face) {
const kinds = ranked(part.kinds);
const usedModels = ranked(part.models);
const owners = ranked(part.owners);
body = [
- (0, import_react36.createElement)(Profile, { key: "profile", face, range, share: all.total.total > 0 ? whole / all.total.total : 0 }),
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(Profile, { key: "profile", face, range, share: all.total.total > 0 ? whole / all.total.total : 0 }),
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(Profile, { key: "profile", face, range, share: all.total.total > 0 ? whole / all.total.total : 0 }),
++ (0, import_react37.createElement)(
"div",
{ key: "sheet", className: "bt-us-sheet" },
- (0, import_react36.createElement)(Stats, { key: "stats", range, total: part.total, previous: part.previous }),
- (0, import_react36.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, onPick: pick2 }),
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(Stats, { key: "stats", range, total: part.total, previous: part.previous }),
- (0, import_react34.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, onPick: pick2 }),
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(Stats, { key: "stats", range, total: part.total, previous: part.previous }),
++ (0, import_react37.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, onPick: pick2 }),
++ (0, import_react37.createElement)(
"div",
{ key: "pair", className: "bt-us-pair" },
- ownerAt >= 0 ? (0, import_react36.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 2 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing) : (0, import_react36.createElement)(ListCard, { title: t("Who used it"), count: owners.length, index: 2 }, owners.length > 0 ? owners.map((entry, index) => ownerRow(entry, index)) : nothing),
- (0, import_react36.createElement)(
- ownerAt >= 0 ? (0, import_react34.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 2 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing) : (0, import_react34.createElement)(ListCard, { title: t("Who used it"), count: owners.length, index: 2 }, owners.length > 0 ? owners.map((entry, index) => ownerRow(entry, index)) : nothing),
- (0, import_react34.createElement)(
++ ownerAt >= 0 ? (0, import_react37.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 2 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing) : (0, import_react37.createElement)(ListCard, { title: t("Who used it"), count: owners.length, index: 2 }, owners.length > 0 ? owners.map((entry, index) => ownerRow(entry, index)) : nothing),
++ (0, import_react37.createElement)(
ListCard,
{ title: t("What for"), index: 3 },
- kinds.length > 0 ? kinds.map(([at, sum], index) => (0, import_react36.createElement)(Row2, { key: at, name: kindLabel(view.kinds[at], ownerAt >= 0 && isBot(ownerAt)), sum, whole, index, fill: soften(face.paint, 0.8) })) : nothing
- kinds.length > 0 ? kinds.map(([at, sum], index) => (0, import_react34.createElement)(Row2, { key: at, name: kindLabel(view.kinds[at], ownerAt >= 0 && isBot(ownerAt)), sum, whole, index, fill: soften(face.paint, 0.8) })) : nothing
++ kinds.length > 0 ? kinds.map(([at, sum], index) => (0, import_react37.createElement)(Row2, { key: at, name: kindLabel(view.kinds[at], ownerAt >= 0 && isBot(ownerAt)), sum, whole, index, fill: soften(face.paint, 0.8) })) : nothing
)
),
- (0, import_react36.createElement)(Heat, { key: "heat", view, keep, paint: face.paint, index: 4 })
- (0, import_react34.createElement)(Heat, { key: "heat", view, keep, paint: face.paint, index: 4 })
++ (0, import_react37.createElement)(Heat, { key: "heat", view, keep, paint: face.paint, index: 4 })
)
];
} else {
@@@ -14818,39 -14658,39 +15015,39 @@@
const rest = owners.filter(([at]) => !isBot(at));
const usedModels = ranked(all.models);
body = [
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
"div",
{ key: "sheet", className: "bt-us-sheet" },
- (0, import_react36.createElement)(Stats, { key: "stats", range, total: all.total, previous: all.previous }),
- (0, import_react36.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, by, onBy: setBy, onPick: pick2 }),
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(Stats, { key: "stats", range, total: all.total, previous: all.previous }),
- (0, import_react34.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, by, onBy: setBy, onPick: pick2 }),
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(Stats, { key: "stats", range, total: all.total, previous: all.previous }),
++ (0, import_react37.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, by, onBy: setBy, onPick: pick2 }),
++ (0, import_react37.createElement)(
"div",
{ key: "pair", className: "bt-us-pair" },
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
ListCard,
{ title: t("Bots"), count: bots.length, index: 2 },
owners.length > 0 ? null : nothing,
bots.map((entry, index) => ownerRow(entry, index)),
- bots.length > 0 && rest.length > 0 ? (0, import_react36.createElement)("div", { className: "bt-us-split", role: "separator" }) : null,
- bots.length > 0 && rest.length > 0 ? (0, import_react34.createElement)("div", { className: "bt-us-split", role: "separator" }) : null,
++ bots.length > 0 && rest.length > 0 ? (0, import_react37.createElement)("div", { className: "bt-us-split", role: "separator" }) : null,
rest.map((entry, index) => ownerRow(entry, bots.length + index))
),
- (0, import_react36.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 3 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing)
- (0, import_react34.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 3 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing)
++ (0, import_react37.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 3 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing)
),
- (0, import_react36.createElement)(Heat, { key: "heat", view, keep, paint: "var(--bt-accent)", index: 4 })
- (0, import_react34.createElement)(Heat, { key: "heat", view, keep, paint: "var(--bt-accent)", index: 4 })
++ (0, import_react37.createElement)(Heat, { key: "heat", view, keep, paint: "var(--bt-accent)", index: 4 })
)
];
}
- return (0, import_react36.createElement)(
- return (0, import_react34.createElement)(
++ return (0, import_react37.createElement)(
"div",
{ ref: root, className: "bt-us", key: focusId ?? "all" },
- (0, import_react36.createElement)(
- (0, import_react34.createElement)(
++ (0, import_react37.createElement)(
"div",
{ className: "bt-us-top" },
- (0, import_react36.createElement)(Tabs, { label: t("Time range"), value: rangeId, onChange: chooseRange, options: rangeOptions, boxRef: tabs }),
- view.scanning ? (0, import_react36.createElement)("span", { className: "bt-us-note", role: "status" }, t("Still reading older chats; totals may grow.")) : null,
- picking ? (0, import_react36.createElement)(SpanPicker, { span, today, oldest, active: activeDays, near: tabs, onPick: pickSpan, onClose: () => setPicking(false) }) : null
- (0, import_react34.createElement)(Tabs, { label: t("Time range"), value: rangeId, onChange: chooseRange, options: rangeOptions, boxRef: tabs }),
- view.scanning ? (0, import_react34.createElement)("span", { className: "bt-us-note", role: "status" }, t("Still reading older chats; totals may grow.")) : null,
- picking ? (0, import_react34.createElement)(SpanPicker, { span, today, oldest, active: activeDays, near: tabs, onPick: pickSpan, onClose: () => setPicking(false) }) : null
++ (0, import_react37.createElement)(Tabs, { label: t("Time range"), value: rangeId, onChange: chooseRange, options: rangeOptions, boxRef: tabs }),
++ view.scanning ? (0, import_react37.createElement)("span", { className: "bt-us-note", role: "status" }, t("Still reading older chats; totals may grow.")) : null,
++ picking ? (0, import_react37.createElement)(SpanPicker, { span, today, oldest, active: activeDays, near: tabs, onPick: pickSpan, onClose: () => setPicking(false) }) : null
),
- error ? (0, import_react36.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,
- error ? (0, import_react34.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,
++ error ? (0, import_react37.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,
body
);
}
@@@ -15021,12 -14861,12 +15218,12 @@@ button.bt-us-row:hover{background:var(-
`;
// src/client/connectors.js
- var import_react37 = require("react");
-var import_react35 = require("react");
++var import_react38 = require("react");
var TOKEN_URL = "https://github.com/settings/personal-access-tokens/new";
- var GitHubMark = () => (0, import_react37.createElement)(
-var GitHubMark = () => (0, import_react35.createElement)(
++var GitHubMark = () => (0, import_react38.createElement)(
"svg",
{ width: 20, height: 20, viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": true },
- (0, import_react37.createElement)("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" })
- (0, import_react35.createElement)("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" })
++ (0, import_react38.createElement)("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" })
);
var MARKS = { github: GitHubMark };
var ABOUT = { github: () => t("Repositories, issues, and pull requests") };
@@@ -15037,10 -14877,10 +15234,10 @@@ function statusText2(connector)
return ABOUT[connector.id]?.() ?? "";
}
function ConnectorRow({ connector, actions }) {
- const [form, setForm] = (0, import_react37.useState)(false);
- const [token, setToken] = (0, import_react37.useState)("");
- const [busy, setBusy] = (0, import_react37.useState)(false);
- const [error, setError] = (0, import_react37.useState)(null);
- const [form, setForm] = (0, import_react35.useState)(false);
- const [token, setToken] = (0, import_react35.useState)("");
- const [busy, setBusy] = (0, import_react35.useState)(false);
- const [error, setError] = (0, import_react35.useState)(null);
++ const [form, setForm] = (0, import_react38.useState)(false);
++ const [token, setToken] = (0, import_react38.useState)("");
++ const [busy, setBusy] = (0, import_react38.useState)(false);
++ const [error, setError] = (0, import_react38.useState)(null);
const run2 = (task, after) => {
setBusy(true);
setError(null);
@@@ -15057,58 -14897,58 +15254,58 @@@
};
const on = connector.state !== "off";
const Mark = MARKS[connector.id];
- const row = (0, import_react37.useRef)(null);
- const row = (0, import_react35.useRef)(null);
++ const row = (0, import_react38.useRef)(null);
useMorph(row, `${form}:${error !== null}:${connector.state}`);
- return (0, import_react37.createElement)(
- return (0, import_react35.createElement)(
++ return (0, import_react38.createElement)(
"div",
{ ref: row, className: "bt-connector", "data-state": connector.state },
- (0, import_react37.createElement)(
- (0, import_react35.createElement)(
++ (0, import_react38.createElement)(
"div",
{ className: "bt-connector-head" },
- (0, import_react37.createElement)("span", { className: "bt-connector-mark" }, Mark ? (0, import_react37.createElement)(Mark) : null),
- (0, import_react37.createElement)(
- (0, import_react35.createElement)("span", { className: "bt-connector-mark" }, Mark ? (0, import_react35.createElement)(Mark) : null),
- (0, import_react35.createElement)(
++ (0, import_react38.createElement)("span", { className: "bt-connector-mark" }, Mark ? (0, import_react38.createElement)(Mark) : null),
++ (0, import_react38.createElement)(
"span",
{ className: "bt-connector-text" },
- (0, import_react37.createElement)("span", { className: "bt-connector-name" }, connector.name),
- (0, import_react37.createElement)("span", { className: "bt-connector-status" }, statusText2(connector))
- (0, import_react35.createElement)("span", { className: "bt-connector-name" }, connector.name),
- (0, import_react35.createElement)("span", { className: "bt-connector-status" }, statusText2(connector))
++ (0, import_react38.createElement)("span", { className: "bt-connector-name" }, connector.name),
++ (0, import_react38.createElement)("span", { className: "bt-connector-status" }, statusText2(connector))
),
- (0, import_react37.createElement)(
- (0, import_react35.createElement)(
++ (0, import_react38.createElement)(
"span",
{ className: "bt-connector-actions" },
- connector.state === "error" ? (0, import_react37.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => void run2(actions.connectorRetry(connector.id)) }, t("Try again")) : null,
- on ? (0, import_react37.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => void run2(actions.connectorDisconnect(connector.id)) }, t("Disconnect")) : form ? null : (0, import_react37.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setForm(true) }, t("Connect"))
- connector.state === "error" ? (0, import_react35.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => void run2(actions.connectorRetry(connector.id)) }, t("Try again")) : null,
- on ? (0, import_react35.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => void run2(actions.connectorDisconnect(connector.id)) }, t("Disconnect")) : form ? null : (0, import_react35.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setForm(true) }, t("Connect"))
++ connector.state === "error" ? (0, import_react38.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => void run2(actions.connectorRetry(connector.id)) }, t("Try again")) : null,
++ on ? (0, import_react38.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => void run2(actions.connectorDisconnect(connector.id)) }, t("Disconnect")) : form ? null : (0, import_react38.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setForm(true) }, t("Connect"))
)
),
- !on && form ? (0, import_react37.createElement)(
- !on && form ? (0, import_react35.createElement)(
++ !on && form ? (0, import_react38.createElement)(
"div",
{ className: "bt-connector-form" },
- (0, import_react37.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react37.createElement)(MaskedInput, { value: token, onChange: setToken, onEnter: connect, label: t("GitHub token"), autoFocus: true })),
- (0, import_react37.createElement)(
- (0, import_react35.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react35.createElement)(MaskedInput, { value: token, onChange: setToken, onEnter: connect, label: t("GitHub token"), autoFocus: true })),
- (0, import_react35.createElement)(
++ (0, import_react38.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react38.createElement)(MaskedInput, { value: token, onChange: setToken, onEnter: connect, label: t("GitHub token"), autoFocus: true })),
++ (0, import_react38.createElement)(
"div",
{ className: "bt-connector-form-row" },
- (0, import_react37.createElement)("a", { className: "bt-connector-link", href: TOKEN_URL, target: "_blank", rel: "noopener noreferrer" }, t("Create a token on GitHub")),
- (0, import_react37.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => {
- (0, import_react35.createElement)("a", { className: "bt-connector-link", href: TOKEN_URL, target: "_blank", rel: "noopener noreferrer" }, t("Create a token on GitHub")),
- (0, import_react35.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => {
++ (0, import_react38.createElement)("a", { className: "bt-connector-link", href: TOKEN_URL, target: "_blank", rel: "noopener noreferrer" }, t("Create a token on GitHub")),
++ (0, import_react38.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => {
setForm(false);
setToken("");
setError(null);
} }, t("Cancel")),
- (0, import_react37.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy || token.trim() === "", onClick: connect }, busy ? t("Connecting…") : t("Connect"))
- (0, import_react35.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy || token.trim() === "", onClick: connect }, busy ? t("Connecting…") : t("Connect"))
++ (0, import_react38.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy || token.trim() === "", onClick: connect }, busy ? t("Connecting…") : t("Connect"))
)
) : null,
- error ? (0, import_react37.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null
- error ? (0, import_react35.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null
++ error ? (0, import_react38.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null
);
}
function ConnectorsPage({ roster, actions }) {
const list = roster?.connectors ?? [];
- return (0, import_react37.createElement)(
- return (0, import_react35.createElement)(
++ return (0, import_react38.createElement)(
"section",
{ className: "bt-set-section" },
- (0, import_react37.createElement)("div", { className: "bt-set-card bt-connectors-card" }, list.length === 0 ? (0, import_react37.createElement)("div", { className: "bt-set-row" }, (0, import_react37.createElement)("span", { className: "bt-set-hint" }, t("No connectors"))) : list.map((connector) => (0, import_react37.createElement)(ConnectorRow, { key: connector.id, connector, actions })))
- (0, import_react35.createElement)("div", { className: "bt-set-card bt-connectors-card" }, list.length === 0 ? (0, import_react35.createElement)("div", { className: "bt-set-row" }, (0, import_react35.createElement)("span", { className: "bt-set-hint" }, t("No connectors"))) : list.map((connector) => (0, import_react35.createElement)(ConnectorRow, { key: connector.id, connector, actions })))
++ (0, import_react38.createElement)("div", { className: "bt-set-card bt-connectors-card" }, list.length === 0 ? (0, import_react38.createElement)("div", { className: "bt-set-row" }, (0, import_react38.createElement)("span", { className: "bt-set-hint" }, t("No connectors"))) : list.map((connector) => (0, import_react38.createElement)(ConnectorRow, { key: connector.id, connector, actions })))
);
}
// src/client/browser-settings.js
- var import_react38 = require("react");
-var import_react36 = require("react");
++var import_react39 = require("react");
var ACTIONS = [["post", "Post"], ["upload", "Upload"], ["download", "Download"], ["delete", "Delete"]];
var DURATIONS = [["hour", "1 hour"], ["today", "Today"], ["week", "7 days"], ["permanent", "Permanent"]];
var expired = (grant) => Number.isFinite(grant.until) && grant.until <= Date.now();
@@@ -15127,13 -14967,13 +15324,13 @@@ function grantKinds(grant)
}
function BrowserPage({ roster, actions, run: run2, Section, Row: Row3 }) {
const bots = roster.bots ?? [];
- const [botId, setBotId] = (0, import_react38.useState)(bots[0]?.id ?? "");
- const [site, setSite] = (0, import_react38.useState)("");
- const [kinds, setKinds] = (0, import_react38.useState)(["post"]);
- const [duration, setDuration] = (0, import_react38.useState)("hour");
- const [busy, setBusy] = (0, import_react38.useState)(false);
- const [botId, setBotId] = (0, import_react36.useState)(bots[0]?.id ?? "");
- const [site, setSite] = (0, import_react36.useState)("");
- const [kinds, setKinds] = (0, import_react36.useState)(["post"]);
- const [duration, setDuration] = (0, import_react36.useState)("hour");
- const [busy, setBusy] = (0, import_react36.useState)(false);
++ const [botId, setBotId] = (0, import_react39.useState)(bots[0]?.id ?? "");
++ const [site, setSite] = (0, import_react39.useState)("");
++ const [kinds, setKinds] = (0, import_react39.useState)(["post"]);
++ const [duration, setDuration] = (0, import_react39.useState)("hour");
++ const [busy, setBusy] = (0, import_react39.useState)(false);
const selectedBot = bots.find((bot) => bot.id === botId);
- (0, import_react38.useEffect)(() => {
- (0, import_react36.useEffect)(() => {
++ (0, import_react39.useEffect)(() => {
if (!bots.some((bot) => bot.id === botId)) setBotId(bots[0]?.id ?? "");
}, [bots, botId]);
const grants = bots.flatMap((bot) => (bot.browserGrants ?? []).map((grant, index) => ({
@@@ -15166,37 -15006,37 +15363,37 @@@
const toggleKind = (kind, checked) => {
setKinds((current) => checked ? current.includes(kind) ? current : [...current, kind] : current.filter((value) => value !== kind));
};
- return (0, import_react38.createElement)(
- return (0, import_react36.createElement)(
++ return (0, import_react39.createElement)(
"div",
{ className: "bt-browser-settings" },
- (0, import_react38.createElement)(
- (0, import_react36.createElement)(
++ (0, import_react39.createElement)(
Section,
{ title: t("Browser access") },
- (0, import_react38.createElement)("p", { className: "bt-browser-note" }, t("Bots browse, click and fill in forms freely. Posting, uploading, downloading and deleting ask you first unless you allow them here. Payments are always yours: the Bot hands the page to you."))
- (0, import_react36.createElement)("p", { className: "bt-browser-note" }, t("Bots browse, click and fill in forms freely. Posting, uploading, downloading and deleting ask you first unless you allow them here. Payments are always yours: the Bot hands the page to you."))
++ (0, import_react39.createElement)("p", { className: "bt-browser-note" }, t("Bots browse, click and fill in forms freely. Posting, uploading, downloading and deleting ask you first unless you allow them here. Payments are always yours: the Bot hands the page to you."))
),
- (0, import_react38.createElement)(
- (0, import_react36.createElement)(
++ (0, import_react39.createElement)(
Section,
{ title: t("Allowed actions") },
- grants.length === 0 ? (0, import_react38.createElement)(Row3, { label: t("Nothing allowed yet.") }) : grants.map(({ bot, grant, index, expired: expired2 }) => (0, import_react38.createElement)(
- grants.length === 0 ? (0, import_react36.createElement)(Row3, { label: t("Nothing allowed yet.") }) : grants.map(({ bot, grant, index, expired: expired2 }) => (0, import_react36.createElement)(
++ grants.length === 0 ? (0, import_react39.createElement)(Row3, { label: t("Nothing allowed yet.") }) : grants.map(({ bot, grant, index, expired: expired2 }) => (0, import_react39.createElement)(
"div",
{
key: `${bot.id}:${index}`,
className: `bt-browser-grant${expired2 ? " bt-browser-grant-expired" : ""}`
},
- (0, import_react38.createElement)(
- (0, import_react36.createElement)(
++ (0, import_react39.createElement)(
"div",
{ className: "bt-browser-grant-who" },
- (0, import_react38.createElement)(BotAvatar, { bot, size: 28 }),
- (0, import_react38.createElement)("span", null, bot.name)
- (0, import_react36.createElement)(BotAvatar, { bot, size: 28 }),
- (0, import_react36.createElement)("span", null, bot.name)
++ (0, import_react39.createElement)(BotAvatar, { bot, size: 28 }),
++ (0, import_react39.createElement)("span", null, bot.name)
),
- (0, import_react38.createElement)(
- (0, import_react36.createElement)(
++ (0, import_react39.createElement)(
"div",
{ className: "bt-browser-grant-meta" },
- (0, import_react38.createElement)("span", { className: "bt-browser-grant-site" }, grant.site === "*" ? t("All sites") : grant.site),
- (0, import_react38.createElement)("div", { className: "bt-browser-grant-kinds" }, grantKinds(grant).map((label) => (0, import_react38.createElement)("span", { key: label, className: "bt-chip" }, label))),
- (0, import_react38.createElement)("span", { className: "bt-set-hint" }, grantTime(grant))
- (0, import_react36.createElement)("span", { className: "bt-browser-grant-site" }, grant.site === "*" ? t("All sites") : grant.site),
- (0, import_react36.createElement)("div", { className: "bt-browser-grant-kinds" }, grantKinds(grant).map((label) => (0, import_react36.createElement)("span", { key: label, className: "bt-chip" }, label))),
- (0, import_react36.createElement)("span", { className: "bt-set-hint" }, grantTime(grant))
++ (0, import_react39.createElement)("span", { className: "bt-browser-grant-site" }, grant.site === "*" ? t("All sites") : grant.site),
++ (0, import_react39.createElement)("div", { className: "bt-browser-grant-kinds" }, grantKinds(grant).map((label) => (0, import_react39.createElement)("span", { key: label, className: "bt-chip" }, label))),
++ (0, import_react39.createElement)("span", { className: "bt-set-hint" }, grantTime(grant))
),
- (0, import_react38.createElement)("button", {
- (0, import_react36.createElement)("button", {
++ (0, import_react39.createElement)("button", {
type: "button",
className: "bt-soft bt-soft-sm",
onClick: () => remove(bot, index),
@@@ -15204,25 -15044,25 +15401,25 @@@
}, t("Remove grant"))
))
),
- (0, import_react38.createElement)(
- (0, import_react36.createElement)(
++ (0, import_react39.createElement)(
Section,
{ title: t("Allow an action") },
- (0, import_react38.createElement)(
- (0, import_react36.createElement)(
++ (0, import_react39.createElement)(
"form",
{ className: "bt-browser-form", onSubmit: add },
- (0, import_react38.createElement)(
- (0, import_react36.createElement)(
++ (0, import_react39.createElement)(
Row3,
{ label: t("Bot") },
- (0, import_react38.createElement)(
- (0, import_react36.createElement)(
++ (0, import_react39.createElement)(
"select",
{ className: "bt-select", value: botId, onChange: (event) => setBotId(event.target.value), disabled: bots.length === 0 },
- bots.map((bot) => (0, import_react38.createElement)("option", { key: bot.id, value: bot.id }, bot.name))
- bots.map((bot) => (0, import_react36.createElement)("option", { key: bot.id, value: bot.id }, bot.name))
++ bots.map((bot) => (0, import_react39.createElement)("option", { key: bot.id, value: bot.id }, bot.name))
)
),
- (0, import_react38.createElement)(
- (0, import_react36.createElement)(
++ (0, import_react39.createElement)(
Row3,
{ label: t("Site") },
- (0, import_react38.createElement)("input", {
- (0, import_react36.createElement)("input", {
++ (0, import_react39.createElement)("input", {
className: "bt-select bt-browser-site",
type: "text",
value: site,
@@@ -15230,16 -15070,16 +15427,16 @@@
onChange: (event) => setSite(event.target.value)
})
),
- (0, import_react38.createElement)(
- (0, import_react36.createElement)(
++ (0, import_react39.createElement)(
Row3,
{ label: t("Actions") },
- (0, import_react38.createElement)(
- (0, import_react36.createElement)(
++ (0, import_react39.createElement)(
"div",
{ className: "bt-browser-action-list" },
- ACTIONS.map(([kind, label]) => (0, import_react38.createElement)(
- ACTIONS.map(([kind, label]) => (0, import_react36.createElement)(
++ ACTIONS.map(([kind, label]) => (0, import_react39.createElement)(
"label",
{ key: kind, className: "bt-browser-action-choice" },
- (0, import_react38.createElement)("input", {
- (0, import_react36.createElement)("input", {
++ (0, import_react39.createElement)("input", {
type: "checkbox",
checked: kinds.includes(kind),
onChange: (event) => toggleKind(kind, event.target.checked)
@@@ -15248,13 -15088,13 +15445,13 @@@
))
)
),
- (0, import_react38.createElement)(
- (0, import_react36.createElement)(
++ (0, import_react39.createElement)(
Row3,
{ label: t("Duration") },
- (0, import_react38.createElement)(
- (0, import_react36.createElement)(
++ (0, import_react39.createElement)(
"div",
{ className: "bt-browser-duration", role: "group", "aria-label": t("Duration") },
- DURATIONS.map(([key, label]) => (0, import_react38.createElement)("button", {
- DURATIONS.map(([key, label]) => (0, import_react36.createElement)("button", {
++ DURATIONS.map(([key, label]) => (0, import_react39.createElement)("button", {
key,
type: "button",
className: "bt-browser-duration-choice",
@@@ -15263,10 -15103,10 +15460,10 @@@
}, t(label)))
)
),
- (0, import_react38.createElement)(
- (0, import_react36.createElement)(
++ (0, import_react39.createElement)(
"div",
{ className: "bt-browser-form-foot" },
- (0, import_react38.createElement)("button", {
- (0, import_react36.createElement)("button", {
++ (0, import_react39.createElement)("button", {
type: "submit",
className: "bt-soft",
disabled: busy || !selectedBot || kinds.length === 0
@@@ -15278,12 -15118,12 +15475,12 @@@
}
// src/client/feedback.js
- var import_react39 = require("react");
- var FeedbackIcon = () => (0, import_react39.createElement)(
-var import_react37 = require("react");
-var FeedbackIcon = () => (0, import_react37.createElement)(
++var import_react40 = require("react");
++var FeedbackIcon = () => (0, import_react40.createElement)(
"svg",
{ width: 15, height: 15, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true },
- (0, import_react39.createElement)("path", { d: "M4 4.5h12a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H9l-3.5 3v-3H4a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1z" }),
- (0, import_react39.createElement)("path", { d: "M10 7v2.6M10 11.4h.01" })
- (0, import_react37.createElement)("path", { d: "M4 4.5h12a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H9l-3.5 3v-3H4a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1z" }),
- (0, import_react37.createElement)("path", { d: "M10 7v2.6M10 11.4h.01" })
++ (0, import_react40.createElement)("path", { d: "M4 4.5h12a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H9l-3.5 3v-3H4a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1z" }),
++ (0, import_react40.createElement)("path", { d: "M10 7v2.6M10 11.4h.01" })
);
function download(name, text) {
const url = URL.createObjectURL(new Blob([text], { type: "text/plain;charset=utf-8" }));
@@@ -15321,16 -15161,16 +15518,16 @@@ function issueWindow()
};
}
function FeedbackPage({ actions, run: run2, Section, Row: Row3 }) {
- const [what, setWhat] = (0, import_react39.useState)("");
- const [report, setReport] = (0, import_react39.useState)(null);
- const [preview, setPreview] = (0, import_react39.useState)(false);
- const [note, setNote] = (0, import_react39.useState)("");
- const [what, setWhat] = (0, import_react37.useState)("");
- const [report, setReport] = (0, import_react37.useState)(null);
- const [preview, setPreview] = (0, import_react37.useState)(false);
- const [note, setNote] = (0, import_react37.useState)("");
++ const [what, setWhat] = (0, import_react40.useState)("");
++ const [report, setReport] = (0, import_react40.useState)(null);
++ const [preview, setPreview] = (0, import_react40.useState)(false);
++ const [note, setNote] = (0, import_react40.useState)("");
const fetchReport = () => actions.diagnostics({ client: clientFacts(), clientErrors: clientErrors() }).then((next) => {
setReport(next);
return next;
});
const load = () => fetchReport().then(() => void 0);
- (0, import_react39.useEffect)(() => {
- (0, import_react37.useEffect)(() => {
++ (0, import_react40.useEffect)(() => {
void run2(load());
}, []);
const copyReport = () => run2(fetchReport().then(async (next) => {
@@@ -15338,7 -15178,7 +15535,7 @@@
setNote(copied ? t("Copied the diagnostics.") : t("Could not copy. Select the text below and copy it."));
if (!copied) setPreview(true);
}));
- const [issueLink, setIssueLink] = (0, import_react39.useState)(null);
- const [issueLink, setIssueLink] = (0, import_react37.useState)(null);
++ const [issueLink, setIssueLink] = (0, import_react40.useState)(null);
const openIssue = () => {
const target = issueWindow();
run2(fetchReport().then(async (next) => {
@@@ -15364,59 -15204,59 +15561,59 @@@
const total = (report?.total ?? 0) + browserErrors.length;
const shown = entries2.slice(0, 8);
return [
- (0, import_react39.createElement)(
- (0, import_react37.createElement)(
++ (0, import_react40.createElement)(
Section,
{ key: "report", title: t("Report a problem") },
- (0, import_react39.createElement)(
- (0, import_react37.createElement)(
++ (0, import_react40.createElement)(
"div",
{ className: "bt-set-row bt-set-paste bt-fb-what" },
- (0, import_react39.createElement)(
- (0, import_react37.createElement)(
++ (0, import_react40.createElement)(
"label",
{ className: "bt-set-copy", htmlFor: "bt-fb-what" },
- (0, import_react39.createElement)("span", null, t("What happened?")),
- (0, import_react39.createElement)("span", { className: "bt-set-hint" }, t("What you did, what you expected, and what happened instead. It goes into the issue."))
- (0, import_react37.createElement)("span", null, t("What happened?")),
- (0, import_react37.createElement)("span", { className: "bt-set-hint" }, t("What you did, what you expected, and what happened instead. It goes into the issue."))
++ (0, import_react40.createElement)("span", null, t("What happened?")),
++ (0, import_react40.createElement)("span", { className: "bt-set-hint" }, t("What you did, what you expected, and what happened instead. It goes into the issue."))
),
- (0, import_react39.createElement)("textarea", { id: "bt-fb-what", className: "bt-input bt-input-area", value: what, maxLength: WHAT_MAX, placeholder: t("For example: I asked Writer in the group chat and it showed an error."), onChange: (event) => setWhat(event.target.value) })
- (0, import_react37.createElement)("textarea", { id: "bt-fb-what", className: "bt-input bt-input-area", value: what, maxLength: WHAT_MAX, placeholder: t("For example: I asked Writer in the group chat and it showed an error."), onChange: (event) => setWhat(event.target.value) })
++ (0, import_react40.createElement)("textarea", { id: "bt-fb-what", className: "bt-input bt-input-area", value: what, maxLength: WHAT_MAX, placeholder: t("For example: I asked Writer in the group chat and it showed an error."), onChange: (event) => setWhat(event.target.value) })
),
- (0, import_react39.createElement)(
- (0, import_react37.createElement)(
++ (0, import_react40.createElement)(
Row3,
{ label: t("Diagnostics"), hint: t("Versions, system, models, and the latest errors. Saved keys, tokens, and your home folder are hidden.") },
- (0, import_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setPreview(!preview), "aria-expanded": preview }, preview ? t("Hide") : t("Show")),
- (0, import_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: copyReport }, t("Copy"))
- (0, import_react37.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setPreview(!preview), "aria-expanded": preview }, preview ? t("Hide") : t("Show")),
- (0, import_react37.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: copyReport }, t("Copy"))
++ (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setPreview(!preview), "aria-expanded": preview }, preview ? t("Hide") : t("Show")),
++ (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: copyReport }, t("Copy"))
),
- preview ? (0, import_react39.createElement)("div", { className: "bt-set-row bt-fb-preview" }, (0, import_react39.createElement)("pre", { tabIndex: 0, "aria-label": t("Diagnostics") }, report?.markdown || t("Loading…"))) : null,
- (0, import_react39.createElement)(
- preview ? (0, import_react37.createElement)("div", { className: "bt-set-row bt-fb-preview" }, (0, import_react37.createElement)("pre", { tabIndex: 0, "aria-label": t("Diagnostics") }, report?.markdown || t("Loading…"))) : null,
- (0, import_react37.createElement)(
++ preview ? (0, import_react40.createElement)("div", { className: "bt-set-row bt-fb-preview" }, (0, import_react40.createElement)("pre", { tabIndex: 0, "aria-label": t("Diagnostics") }, report?.markdown || t("Loading…"))) : null,
++ (0, import_react40.createElement)(
Row3,
{ label: t("GitHub issue"), hint: t("Opens a new issue in the DS Bot repository with all of this filled in. Nothing is sent until you submit it there.") },
- (0, import_react39.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: openIssue }, t("Report on GitHub"))
- (0, import_react37.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: openIssue }, t("Report on GitHub"))
++ (0, import_react40.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: openIssue }, t("Report on GitHub"))
)
),
- note ? (0, import_react39.createElement)(
- note ? (0, import_react37.createElement)(
++ note ? (0, import_react40.createElement)(
"div",
{ key: "note", className: "bt-note bt-fb-note", role: "status" },
note,
- issueLink ? [" ", (0, import_react39.createElement)("a", { key: "link", href: issueLink, target: "_blank", rel: "noopener noreferrer" }, t("Open the issue"))] : null
- issueLink ? [" ", (0, import_react37.createElement)("a", { key: "link", href: issueLink, target: "_blank", rel: "noopener noreferrer" }, t("Open the issue"))] : null
++ issueLink ? [" ", (0, import_react40.createElement)("a", { key: "link", href: issueLink, target: "_blank", rel: "noopener noreferrer" }, t("Open the issue"))] : null
) : null,
- (0, import_react39.createElement)(
- (0, import_react37.createElement)(
++ (0, import_react40.createElement)(
Section,
{ key: "errors", title: report ? t("Recent errors · {count}", { count: total }) : t("Recent errors") },
- shown.length === 0 ? (0, import_react39.createElement)(Row3, { label: t("No errors recorded."), hint: t("Failed model calls and DS Bot problems show here, newest first.") }) : shown.map((entry, index) => (0, import_react39.createElement)(
- shown.length === 0 ? (0, import_react37.createElement)(Row3, { label: t("No errors recorded."), hint: t("Failed model calls and DS Bot problems show here, newest first.") }) : shown.map((entry, index) => (0, import_react37.createElement)(
++ shown.length === 0 ? (0, import_react40.createElement)(Row3, { label: t("No errors recorded."), hint: t("Failed model calls and DS Bot problems show here, newest first.") }) : shown.map((entry, index) => (0, import_react40.createElement)(
"div",
{ key: `${entry.time}-${index}`, className: "bt-set-row bt-fb-entry", title: entry.text },
- (0, import_react39.createElement)("span", { className: "bt-fb-dot", "data-level": entry.level, "aria-hidden": true }),
- (0, import_react39.createElement)(
- (0, import_react37.createElement)("span", { className: "bt-fb-dot", "data-level": entry.level, "aria-hidden": true }),
- (0, import_react37.createElement)(
++ (0, import_react40.createElement)("span", { className: "bt-fb-dot", "data-level": entry.level, "aria-hidden": true }),
++ (0, import_react40.createElement)(
"div",
{ className: "bt-set-copy" },
- (0, import_react39.createElement)("span", { className: "bt-fb-text" }, entrySummary(entry)),
- (0, import_react39.createElement)("span", { className: "bt-set-hint" }, [whenText(entry.time), entry.bot, entry.where, t(SOURCES[entry.source] ?? "DS Bot")].filter(Boolean).join(" · "))
- (0, import_react37.createElement)("span", { className: "bt-fb-text" }, entrySummary(entry)),
- (0, import_react37.createElement)("span", { className: "bt-set-hint" }, [whenText(entry.time), entry.bot, entry.where, t(SOURCES[entry.source] ?? "DS Bot")].filter(Boolean).join(" · "))
++ (0, import_react40.createElement)("span", { className: "bt-fb-text" }, entrySummary(entry)),
++ (0, import_react40.createElement)("span", { className: "bt-set-hint" }, [whenText(entry.time), entry.bot, entry.where, t(SOURCES[entry.source] ?? "DS Bot")].filter(Boolean).join(" · "))
),
- entry.code ? (0, import_react39.createElement)("span", { className: "bt-tag bt-fb-code" }, entry.status ? `${entry.code} ${entry.status}` : entry.code) : null
- entry.code ? (0, import_react37.createElement)("span", { className: "bt-tag bt-fb-code" }, entry.status ? `${entry.code} ${entry.status}` : entry.code) : null
++ entry.code ? (0, import_react40.createElement)("span", { className: "bt-tag bt-fb-code" }, entry.status ? `${entry.code} ${entry.status}` : entry.code) : null
)),
- (0, import_react39.createElement)(
- (0, import_react37.createElement)(
++ (0, import_react40.createElement)(
Row3,
{ label: t("Error log"), hint: t("Kept on this computer across restarts, up to about 1 MB.") },
- (0, import_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: downloadLog }, t("Download")),
- (0, import_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: clearLog, disabled: !report || total === 0 }, t("Clear"))
- (0, import_react37.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: downloadLog }, t("Download")),
- (0, import_react37.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: clearLog, disabled: !report || total === 0 }, t("Clear"))
++ (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: downloadLog }, t("Download")),
++ (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: clearLog, disabled: !report || total === 0 }, t("Clear"))
)
)
];
@@@ -15424,8 -15264,8 +15621,8 @@@
var TOAST_MS = 6e3;
function ErrorToast({ useUi, actions }) {
const toast = useUi((state) => state.toast);
- const [leaving, setLeaving] = (0, import_react39.useState)(false);
- (0, import_react39.useEffect)(() => {
- const [leaving, setLeaving] = (0, import_react37.useState)(false);
- (0, import_react37.useEffect)(() => {
++ const [leaving, setLeaving] = (0, import_react40.useState)(false);
++ (0, import_react40.useEffect)(() => {
if (!toast) return void 0;
setLeaving(false);
const fade = setTimeout(() => setLeaving(true), TOAST_MS);
@@@ -15436,15 -15276,15 +15633,15 @@@
};
}, [toast?.token]);
if (!toast) return null;
- return (0, import_react39.createElement)(
- return (0, import_react37.createElement)(
++ return (0, import_react40.createElement)(
"div",
{ className: "bt-toast", role: "alert", "data-leaving": leaving || void 0 },
- (0, import_react39.createElement)("span", { className: "bt-toast-text" }, toast.text),
- (0, import_react39.createElement)("button", { type: "button", className: "bt-toast-link", onClick: () => {
- (0, import_react37.createElement)("span", { className: "bt-toast-text" }, toast.text),
- (0, import_react37.createElement)("button", { type: "button", className: "bt-toast-link", onClick: () => {
++ (0, import_react40.createElement)("span", { className: "bt-toast-text" }, toast.text),
++ (0, import_react40.createElement)("button", { type: "button", className: "bt-toast-link", onClick: () => {
actions.dismissToast(toast.token);
actions.openSettings("feedback");
} }, t("Details")),
- (0, import_react39.createElement)("button", { type: "button", className: "bt-icon-btn bt-toast-close", "aria-label": t("Dismiss"), onClick: () => actions.dismissToast(toast.token) }, (0, import_react39.createElement)(CloseIcon))
- (0, import_react37.createElement)("button", { type: "button", className: "bt-icon-btn bt-toast-close", "aria-label": t("Dismiss"), onClick: () => actions.dismissToast(toast.token) }, (0, import_react37.createElement)(CloseIcon))
++ (0, import_react40.createElement)("button", { type: "button", className: "bt-icon-btn bt-toast-close", "aria-label": t("Dismiss"), onClick: () => actions.dismissToast(toast.token) }, (0, import_react40.createElement)(CloseIcon))
);
}
var FEEDBACK_CSS = `
@@@ -15476,7 -15316,7 +15673,7 @@@
`;
// src/client/about.js
- var import_react40 = require("react");
-var import_react38 = require("react");
++var import_react41 = require("react");
var CHEER_MS = 1800;
var starCount = (count) => new Intl.NumberFormat(dateLocale(), { notation: "compact", maximumFractionDigits: 1 }).format(count);
function botHint(update) {
@@@ -15524,9 -15364,9 +15721,9 @@@ function dshHint(dsh, shown)
var linkProps = (href) => ({ className: "bt-soft bt-soft-sm bt-about-link", href, target: "_blank", rel: "noopener noreferrer" });
function AboutPage({ useUpdate, actions, run: run2, Section, Row: Row3 }) {
const update = useUpdate((value) => value) ?? {};
- const [checking, setChecking] = (0, import_react40.useState)(false);
- const [stars, setStars] = (0, import_react40.useState)(null);
- (0, import_react40.useEffect)(() => {
- const [checking, setChecking] = (0, import_react38.useState)(false);
- const [stars, setStars] = (0, import_react38.useState)(null);
- (0, import_react38.useEffect)(() => {
++ const [checking, setChecking] = (0, import_react41.useState)(false);
++ const [stars, setStars] = (0, import_react41.useState)(null);
++ (0, import_react41.useEffect)(() => {
let live = true;
actions.repoStars().then((count) => {
if (live && Number.isInteger(count)) setStars(count);
@@@ -15536,8 -15376,8 +15733,8 @@@
live = false;
};
}, []);
- const [cheer, setCheer] = (0, import_react40.useState)(true);
- (0, import_react40.useEffect)(() => {
- const [cheer, setCheer] = (0, import_react38.useState)(true);
- (0, import_react38.useEffect)(() => {
++ const [cheer, setCheer] = (0, import_react41.useState)(true);
++ (0, import_react41.useEffect)(() => {
if (!cheer) return void 0;
const timer = setTimeout(() => setCheer(false), CHEER_MS);
return () => clearTimeout(timer);
@@@ -15552,37 -15392,37 +15749,37 @@@
const phase = update.phase ?? "idle";
const dsh = update.dsh;
const dshPhase = dsh?.phase ?? "idle";
- (0, import_react40.useEffect)(() => {
- (0, import_react38.useEffect)(() => {
++ (0, import_react41.useEffect)(() => {
if (phase === "installed" || phase === "updated" || dshPhase === "installed") setCheer(true);
}, [phase, dshPhase]);
const markState = checking ? "searching" : phase === "installing" || dshPhase === "installing" ? "working" : cheer ? "done" : "idle";
const dshNew = showsDshRow(dsh, update.app);
const dshShown = dshNew && dsh.available;
const ownRow = update.source === "app" ? ownAppRow(update.ownApp) : null;
- const ownControl = ownRow?.button === "restart" ? (0, import_react40.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: () => run2(actions.installOwnApp()) }, t("Restart to update")) : ownRow?.button === "check" ? (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.checkOwnApp()) }, t("Check for updates")) : ownRow?.button === "open" ? (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.openOwnApp()) }, t("Download")) : null;
- const botControl = ownRow !== null ? ownControl : phase === "installed" || phase === "updated" || update.source === "app" ? null : update.available || phase === "installing" ? (0, import_react40.createElement)(
- const ownControl = ownRow?.button === "restart" ? (0, import_react38.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: () => run2(actions.installOwnApp()) }, t("Restart to update")) : ownRow?.button === "check" ? (0, import_react38.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.checkOwnApp()) }, t("Check for updates")) : ownRow?.button === "open" ? (0, import_react38.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.openOwnApp()) }, t("Download")) : null;
- const botControl = ownRow !== null ? ownControl : phase === "installed" || phase === "updated" || update.source === "app" ? null : update.available || phase === "installing" ? (0, import_react38.createElement)(
++ const ownControl = ownRow?.button === "restart" ? (0, import_react41.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: () => run2(actions.installOwnApp()) }, t("Restart to update")) : ownRow?.button === "check" ? (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.checkOwnApp()) }, t("Check for updates")) : ownRow?.button === "open" ? (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.openOwnApp()) }, t("Download")) : null;
++ const botControl = ownRow !== null ? ownControl : phase === "installed" || phase === "updated" || update.source === "app" ? null : update.available || phase === "installing" ? (0, import_react41.createElement)(
"button",
{ type: "button", className: "bt-fb-primary", disabled: phase === "installing", onClick: () => run2(actions.installUpdate()) },
phase === "installing" ? t("Updating…") : phase === "failed" ? t("Try again") : t("Update")
- ) : (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: checking || update.enabled === false, onClick: check }, checking ? t("Checking…") : t("Check for updates"));
- const dshControl = !dshNew || dshPhase === "installed" ? null : dsh.kind === "app" ? dsh.available ? (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.openAppUpdates(dsh.verified)) }, t("Open updates")) : null : dsh.available || dshPhase !== "idle" ? (0, import_react40.createElement)(
- ) : (0, import_react38.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: checking || update.enabled === false, onClick: check }, checking ? t("Checking…") : t("Check for updates"));
- const dshControl = !dshNew || dshPhase === "installed" ? null : dsh.kind === "app" ? dsh.available ? (0, import_react38.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.openAppUpdates(dsh.verified)) }, t("Open updates")) : null : dsh.available || dshPhase !== "idle" ? (0, import_react38.createElement)(
++ ) : (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: checking || update.enabled === false, onClick: check }, checking ? t("Checking…") : t("Check for updates"));
++ const dshControl = !dshNew || dshPhase === "installed" ? null : dsh.kind === "app" ? dsh.available ? (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.openAppUpdates(dsh.verified)) }, t("Open updates")) : null : dsh.available || dshPhase !== "idle" ? (0, import_react41.createElement)(
"button",
{ type: "button", className: "bt-fb-primary", disabled: dshPhase === "installing", onClick: () => run2(actions.installDshUpdate()) },
dshPhase === "installing" ? t("Updating…") : dshPhase === "failed" ? t("Try again") : t("Update")
) : null;
const repo = update.repoUrl;
return [
- (0, import_react40.createElement)(
- (0, import_react38.createElement)(
++ (0, import_react41.createElement)(
"div",
{ key: "hero", className: "bt-about-hero" },
- (0, import_react40.createElement)("span", { className: "bt-about-mark" }, (0, import_react40.createElement)(BotMark, { look: MAIN_LOOK, bot: { id: "about" }, size: 52, state: markState, live: true, gaze: true, pokeable: true })),
- (0, import_react40.createElement)(
- (0, import_react38.createElement)("span", { className: "bt-about-mark" }, (0, import_react38.createElement)(BotMark, { look: MAIN_LOOK, bot: { id: "about" }, size: 52, state: markState, live: true, gaze: true, pokeable: true })),
- (0, import_react38.createElement)(
++ (0, import_react41.createElement)("span", { className: "bt-about-mark" }, (0, import_react41.createElement)(BotMark, { look: MAIN_LOOK, bot: { id: "about" }, size: 52, state: markState, live: true, gaze: true, pokeable: true })),
++ (0, import_react41.createElement)(
"div",
{ className: "bt-about-copy" },
- (0, import_react40.createElement)("span", { className: "bt-about-name" }, "DS Bot"),
- update.current ? (0, import_react40.createElement)("span", { className: "bt-about-version" }, t("Version {version}", { version: update.current })) : null
- (0, import_react38.createElement)("span", { className: "bt-about-name" }, "DS Bot"),
- update.current ? (0, import_react38.createElement)("span", { className: "bt-about-version" }, t("Version {version}", { version: update.current })) : null
++ (0, import_react41.createElement)("span", { className: "bt-about-name" }, "DS Bot"),
++ update.current ? (0, import_react41.createElement)("span", { className: "bt-about-version" }, t("Version {version}", { version: update.current })) : null
),
- repo ? (0, import_react40.createElement)(
- repo ? (0, import_react38.createElement)(
++ repo ? (0, import_react41.createElement)(
"a",
{
className: "bt-star",
@@@ -15592,23 -15432,23 +15789,23 @@@
title: t("Star DS Bot on GitHub"),
"aria-label": stars === null ? t("Star DS Bot on GitHub") : `${t("Star DS Bot on GitHub")} · ${t("{count} stars", { count: stars })}`
},
- (0, import_react40.createElement)("span", { className: "bt-star-main" }, (0, import_react40.createElement)("span", { className: "bt-star-icon" }, (0, import_react40.createElement)(StarLineIcon)), "Star"),
- stars === null ? null : (0, import_react40.createElement)("span", { className: "bt-star-count" }, starCount(stars))
- (0, import_react38.createElement)("span", { className: "bt-star-main" }, (0, import_react38.createElement)("span", { className: "bt-star-icon" }, (0, import_react38.createElement)(StarLineIcon)), "Star"),
- stars === null ? null : (0, import_react38.createElement)("span", { className: "bt-star-count" }, starCount(stars))
++ (0, import_react41.createElement)("span", { className: "bt-star-main" }, (0, import_react41.createElement)("span", { className: "bt-star-icon" }, (0, import_react41.createElement)(StarLineIcon)), "Star"),
++ stars === null ? null : (0, import_react41.createElement)("span", { className: "bt-star-count" }, starCount(stars))
) : null
),
- repo ? (0, import_react40.createElement)("p", { key: "ask", className: "bt-about-ask" }, t("If DS Bot helps you, a star on GitHub helps more people find it.")) : null,
- (0, import_react40.createElement)(
- repo ? (0, import_react38.createElement)("p", { key: "ask", className: "bt-about-ask" }, t("If DS Bot helps you, a star on GitHub helps more people find it.")) : null,
- (0, import_react38.createElement)(
++ repo ? (0, import_react41.createElement)("p", { key: "ask", className: "bt-about-ask" }, t("If DS Bot helps you, a star on GitHub helps more people find it.")) : null,
++ (0, import_react41.createElement)(
Section,
{ key: "updates", title: t("Updates") },
- (0, import_react40.createElement)(Row3, { label: "DS Bot", hint: ownRow?.hint ?? botHint(update) }, botControl, update.available && update.notesUrl ? (0, import_react40.createElement)("a", linkProps(update.notesUrl), t("What's new")) : null),
- dsh?.current ? (0, import_react40.createElement)(Row3, { label: "DeepSeek Harness", hint: dshHint(dsh, dshShown) }, dshControl) : null
- (0, import_react38.createElement)(Row3, { label: "DS Bot", hint: ownRow?.hint ?? botHint(update) }, botControl, update.available && update.notesUrl ? (0, import_react38.createElement)("a", linkProps(update.notesUrl), t("What's new")) : null),
- dsh?.current ? (0, import_react38.createElement)(Row3, { label: "DeepSeek Harness", hint: dshHint(dsh, dshShown) }, dshControl) : null
++ (0, import_react41.createElement)(Row3, { label: "DS Bot", hint: ownRow?.hint ?? botHint(update) }, botControl, update.available && update.notesUrl ? (0, import_react41.createElement)("a", linkProps(update.notesUrl), t("What's new")) : null),
++ dsh?.current ? (0, import_react41.createElement)(Row3, { label: "DeepSeek Harness", hint: dshHint(dsh, dshShown) }, dshControl) : null
),
- (0, import_react40.createElement)(
- (0, import_react38.createElement)(
++ (0, import_react41.createElement)(
Section,
{ key: "links", title: t("Links") },
- repo ? (0, import_react40.createElement)(Row3, { label: t("Source code"), hint: repo.replace(/^https:\/\//, "") }, (0, import_react40.createElement)("a", linkProps(repo), (0, import_react40.createElement)(GitHubMark), t("Open"))) : null,
- update.notesUrl ? (0, import_react40.createElement)(Row3, { label: t("Release notes") }, (0, import_react40.createElement)("a", linkProps(update.notesUrl), t("Open"))) : null,
- (0, import_react40.createElement)(Row3, { label: t("Report a problem") }, (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("feedback") }, t("Open")))
- repo ? (0, import_react38.createElement)(Row3, { label: t("Source code"), hint: repo.replace(/^https:\/\//, "") }, (0, import_react38.createElement)("a", linkProps(repo), (0, import_react38.createElement)(GitHubMark), t("Open"))) : null,
- update.notesUrl ? (0, import_react38.createElement)(Row3, { label: t("Release notes") }, (0, import_react38.createElement)("a", linkProps(update.notesUrl), t("Open"))) : null,
- (0, import_react38.createElement)(Row3, { label: t("Report a problem") }, (0, import_react38.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("feedback") }, t("Open")))
++ repo ? (0, import_react41.createElement)(Row3, { label: t("Source code"), hint: repo.replace(/^https:\/\//, "") }, (0, import_react41.createElement)("a", linkProps(repo), (0, import_react41.createElement)(GitHubMark), t("Open"))) : null,
++ update.notesUrl ? (0, import_react41.createElement)(Row3, { label: t("Release notes") }, (0, import_react41.createElement)("a", linkProps(update.notesUrl), t("Open"))) : null,
++ (0, import_react41.createElement)(Row3, { label: t("Report a problem") }, (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("feedback") }, t("Open")))
)
];
}
@@@ -15641,7 -15481,7 +15838,7 @@@ body:not([data-bt-motion=quiet]) .bt-ab
`;
// src/client/providers-page.js
- var import_react41 = require("react");
-var import_react39 = require("react");
++var import_react42 = require("react");
var PROTOCOL_NAMES = { "openai-completions": "OpenAI Chat Completions", "openai-responses": "OpenAI Responses", "anthropic-messages": "Anthropic Messages" };
var ENDPOINT_HINTS = { "anthropic-messages": "https://gateway.example" };
var SHOWN_MODELS = 8;
@@@ -15649,22 -15489,22 +15846,22 @@@ var translated = (promise) => Promise.r
throw new Error(hostText(failure?.message ?? String(failure)));
});
function ProvidersPage({ actions, run: run2, Section }) {
- const [view, setView] = (0, import_react41.useState)(null);
- const [open, setOpen] = (0, import_react41.useState)(null);
- const [adding, setAdding] = (0, import_react41.useState)(false);
- const [view, setView] = (0, import_react39.useState)(null);
- const [open, setOpen] = (0, import_react39.useState)(null);
- const [adding, setAdding] = (0, import_react39.useState)(false);
++ const [view, setView] = (0, import_react42.useState)(null);
++ const [open, setOpen] = (0, import_react42.useState)(null);
++ const [adding, setAdding] = (0, import_react42.useState)(false);
const apply2 = (promise) => run2(translated(promise).then((next) => {
if (next?.providers) setView(next);
}));
- (0, import_react41.useEffect)(() => {
- (0, import_react39.useEffect)(() => {
++ (0, import_react42.useEffect)(() => {
void apply2(actions.providers());
}, []);
if (view === null) return null;
- if (!view.available) return (0, import_react41.createElement)("p", { className: "bt-set-hint" }, t("This DSH cannot set up model providers."));
- if (!view.available) return (0, import_react39.createElement)("p", { className: "bt-set-hint" }, t("This DSH cannot set up model providers."));
++ if (!view.available) return (0, import_react42.createElement)("p", { className: "bt-set-hint" }, t("This DSH cannot set up model providers."));
return [
- (0, import_react41.createElement)(
- (0, import_react39.createElement)(
++ (0, import_react42.createElement)(
Section,
{ key: "list", title: t("Model providers · {count}", { count: view.providers.length }) },
- view.providers.map((provider) => (0, import_react41.createElement)(ProviderRow, {
- view.providers.map((provider) => (0, import_react39.createElement)(ProviderRow, {
++ view.providers.map((provider) => (0, import_react42.createElement)(ProviderRow, {
key: provider.id,
provider,
apply: apply2,
@@@ -15672,9 -15512,9 +15869,9 @@@
open: open === provider.id,
onToggle: () => setOpen(open === provider.id ? null : provider.id)
})),
- adding ? (0, import_react41.createElement)(AddProvider, { key: "add", view, apply: apply2, actions, onDone: () => setAdding(false) }) : null
- adding ? (0, import_react39.createElement)(AddProvider, { key: "add", view, apply: apply2, actions, onDone: () => setAdding(false) }) : null
++ adding ? (0, import_react42.createElement)(AddProvider, { key: "add", view, apply: apply2, actions, onDone: () => setAdding(false) }) : null
),
- adding ? null : (0, import_react41.createElement)("div", { key: "add", className: "bt-actions" }, (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setAdding(true) }, t("Add a provider")))
- adding ? null : (0, import_react39.createElement)("div", { key: "add", className: "bt-actions" }, (0, import_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setAdding(true) }, t("Add a provider")))
++ adding ? null : (0, import_react42.createElement)("div", { key: "add", className: "bt-actions" }, (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setAdding(true) }, t("Add a provider")))
];
}
function keyState(key) {
@@@ -15683,58 -15523,58 +15880,58 @@@
return key.writable ? ["set", t("Key set")] : ["outside", t("Key set outside DS Bot")];
}
function ProviderRow({ provider, apply: apply2, actions, open, onToggle }) {
- const [confirm, setConfirm] = (0, import_react41.useState)(false);
- (0, import_react41.useEffect)(() => {
- const [confirm, setConfirm] = (0, import_react39.useState)(false);
- (0, import_react39.useEffect)(() => {
++ const [confirm, setConfirm] = (0, import_react42.useState)(false);
++ (0, import_react42.useEffect)(() => {
if (!open) setConfirm(false);
}, [open]);
const state = keyState(provider.key);
const shown = provider.models.slice(0, SHOWN_MODELS);
const hint = provider.error ?? (provider.models.length === 0 ? t("No models") : t("{count} models", { count: provider.models.length }));
- return (0, import_react41.createElement)(
- return (0, import_react39.createElement)(
++ return (0, import_react42.createElement)(
"div",
{ className: "bt-secret-item bt-provider", "data-open": open ? "" : void 0 },
- (0, import_react41.createElement)(
- (0, import_react39.createElement)(
++ (0, import_react42.createElement)(
"button",
{ type: "button", className: "bt-set-row bt-secret-summary", "aria-expanded": open, onClick: onToggle },
- (0, import_react41.createElement)(
- (0, import_react39.createElement)(
++ (0, import_react42.createElement)(
"span",
{ className: "bt-set-copy" },
- (0, import_react41.createElement)("span", { className: "bt-secret-title" }, provider.name, provider.name !== provider.id ? (0, import_react41.createElement)("span", { className: "bt-provider-id" }, provider.id) : null),
- (0, import_react41.createElement)("span", { className: "bt-set-hint", "data-error": provider.error ? "" : void 0 }, hint)
- (0, import_react39.createElement)("span", { className: "bt-secret-title" }, provider.name, provider.name !== provider.id ? (0, import_react39.createElement)("span", { className: "bt-provider-id" }, provider.id) : null),
- (0, import_react39.createElement)("span", { className: "bt-set-hint", "data-error": provider.error ? "" : void 0 }, hint)
++ (0, import_react42.createElement)("span", { className: "bt-secret-title" }, provider.name, provider.name !== provider.id ? (0, import_react42.createElement)("span", { className: "bt-provider-id" }, provider.id) : null),
++ (0, import_react42.createElement)("span", { className: "bt-set-hint", "data-error": provider.error ? "" : void 0 }, hint)
),
- state ? (0, import_react41.createElement)("span", { className: "bt-set-control" }, (0, import_react41.createElement)("span", { className: "bt-provider-state", "data-state": state[0] }, state[1])) : null
- state ? (0, import_react39.createElement)("span", { className: "bt-set-control" }, (0, import_react39.createElement)("span", { className: "bt-provider-state", "data-state": state[0] }, state[1])) : null
++ state ? (0, import_react42.createElement)("span", { className: "bt-set-control" }, (0, import_react42.createElement)("span", { className: "bt-provider-state", "data-state": state[0] }, state[1])) : null
),
- open ? (0, import_react41.createElement)(
- open ? (0, import_react39.createElement)(
++ open ? (0, import_react42.createElement)(
"div",
{ className: "bt-secret-edit" },
- provider.key?.writable ? (0, import_react41.createElement)(KeyEditor, { provider, apply: apply2, actions }) : null,
- provider.key && !provider.key.writable ? (0, import_react41.createElement)("div", { className: "bt-set-hint" }, t("This key comes from outside DS Bot, such as an environment variable, and cannot be changed here.")) : null,
- provider.models.length > 0 ? (0, import_react41.createElement)(
- provider.key?.writable ? (0, import_react39.createElement)(KeyEditor, { provider, apply: apply2, actions }) : null,
- provider.key && !provider.key.writable ? (0, import_react39.createElement)("div", { className: "bt-set-hint" }, t("This key comes from outside DS Bot, such as an environment variable, and cannot be changed here.")) : null,
- provider.models.length > 0 ? (0, import_react39.createElement)(
++ provider.key?.writable ? (0, import_react42.createElement)(KeyEditor, { provider, apply: apply2, actions }) : null,
++ provider.key && !provider.key.writable ? (0, import_react42.createElement)("div", { className: "bt-set-hint" }, t("This key comes from outside DS Bot, such as an environment variable, and cannot be changed here.")) : null,
++ provider.models.length > 0 ? (0, import_react42.createElement)(
"div",
{ className: "bt-secret-edit-block" },
- (0, import_react41.createElement)("div", { className: "bt-secret-edit-label" }, t("Models")),
- (0, import_react41.createElement)(
- (0, import_react39.createElement)("div", { className: "bt-secret-edit-label" }, t("Models")),
- (0, import_react39.createElement)(
++ (0, import_react42.createElement)("div", { className: "bt-secret-edit-label" }, t("Models")),
++ (0, import_react42.createElement)(
"div",
{ className: "bt-provider-models" },
- shown.map((model) => (0, import_react41.createElement)("span", { key: model.ref, className: "bt-tag", title: model.ref }, model.name)),
- provider.models.length > shown.length ? (0, import_react41.createElement)("span", { className: "bt-set-hint" }, t("and {count} more", { count: provider.models.length - shown.length })) : null
- shown.map((model) => (0, import_react39.createElement)("span", { key: model.ref, className: "bt-tag", title: model.ref }, model.name)),
- provider.models.length > shown.length ? (0, import_react39.createElement)("span", { className: "bt-set-hint" }, t("and {count} more", { count: provider.models.length - shown.length })) : null
++ shown.map((model) => (0, import_react42.createElement)("span", { key: model.ref, className: "bt-tag", title: model.ref }, model.name)),
++ provider.models.length > shown.length ? (0, import_react42.createElement)("span", { className: "bt-set-hint" }, t("and {count} more", { count: provider.models.length - shown.length })) : null
)
) : null,
- provider.removable ? (0, import_react41.createElement)(
- provider.removable ? (0, import_react39.createElement)(
++ provider.removable ? (0, import_react42.createElement)(
"div",
{ className: "bt-secret-row-actions" },
confirm ? [
- (0, import_react41.createElement)("span", { key: "q", className: "bt-set-hint" }, t("Remove {name}? Bots on its models need another model.", { name: provider.name })),
- (0, import_react41.createElement)("button", { key: "no", type: "button", className: "bt-soft bt-soft-sm", onClick: () => setConfirm(false) }, t("Keep")),
- (0, import_react41.createElement)("button", { key: "yes", type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => apply2(actions.removeProvider(provider.id)) }, t("Remove"))
- ] : (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => setConfirm(true) }, (0, import_react41.createElement)(TrashIcon), t("Remove provider"))
- (0, import_react39.createElement)("span", { key: "q", className: "bt-set-hint" }, t("Remove {name}? Bots on its models need another model.", { name: provider.name })),
- (0, import_react39.createElement)("button", { key: "no", type: "button", className: "bt-soft bt-soft-sm", onClick: () => setConfirm(false) }, t("Keep")),
- (0, import_react39.createElement)("button", { key: "yes", type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => apply2(actions.removeProvider(provider.id)) }, t("Remove"))
- ] : (0, import_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => setConfirm(true) }, (0, import_react39.createElement)(TrashIcon), t("Remove provider"))
++ (0, import_react42.createElement)("span", { key: "q", className: "bt-set-hint" }, t("Remove {name}? Bots on its models need another model.", { name: provider.name })),
++ (0, import_react42.createElement)("button", { key: "no", type: "button", className: "bt-soft bt-soft-sm", onClick: () => setConfirm(false) }, t("Keep")),
++ (0, import_react42.createElement)("button", { key: "yes", type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => apply2(actions.removeProvider(provider.id)) }, t("Remove"))
++ ] : (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => setConfirm(true) }, (0, import_react42.createElement)(TrashIcon), t("Remove provider"))
) : null
) : null
);
}
function KeyEditor({ provider, apply: apply2, actions }) {
- const [value, setValue] = (0, import_react41.useState)("");
- const [saved, setSaved] = (0, import_react41.useState)(false);
- const [value, setValue] = (0, import_react39.useState)("");
- const [saved, setSaved] = (0, import_react39.useState)(false);
++ const [value, setValue] = (0, import_react42.useState)("");
++ const [saved, setSaved] = (0, import_react42.useState)(false);
const ready = value.trim() !== "";
const save = () => {
if (!ready) return;
@@@ -15750,29 -15590,29 +15947,29 @@@
setSaved(false);
};
const label = t("{provider} API key", { provider: provider.name });
- return (0, import_react41.createElement)(
- return (0, import_react39.createElement)(
++ return (0, import_react42.createElement)(
"div",
{ className: "bt-secret-edit-block" },
- (0, import_react41.createElement)("div", { className: "bt-secret-edit-label" }, provider.key.configured ? t("Replace the API key") : t("API key")),
- (0, import_react41.createElement)(
- (0, import_react39.createElement)("div", { className: "bt-secret-edit-label" }, provider.key.configured ? t("Replace the API key") : t("API key")),
- (0, import_react39.createElement)(
++ (0, import_react42.createElement)("div", { className: "bt-secret-edit-label" }, provider.key.configured ? t("Replace the API key") : t("API key")),
++ (0, import_react42.createElement)(
"div",
{ className: "bt-secret-inline" },
- (0, import_react41.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react41.createElement)(KeyIcon), (0, import_react41.createElement)(MaskedInput, { value, onChange: edit, onEnter: save, label })),
- (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: save }, t("Save")),
- provider.key.configured ? (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => apply2(actions.setProviderKey(provider.id, null)) }, t("Remove key")) : null
- (0, import_react39.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react39.createElement)(KeyIcon), (0, import_react39.createElement)(MaskedInput, { value, onChange: edit, onEnter: save, label })),
- (0, import_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: save }, t("Save")),
- provider.key.configured ? (0, import_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => apply2(actions.setProviderKey(provider.id, null)) }, t("Remove key")) : null
++ (0, import_react42.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react42.createElement)(KeyIcon), (0, import_react42.createElement)(MaskedInput, { value, onChange: edit, onEnter: save, label })),
++ (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: save }, t("Save")),
++ provider.key.configured ? (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => apply2(actions.setProviderKey(provider.id, null)) }, t("Remove key")) : null
),
- saved ? (0, import_react41.createElement)("div", { className: "bt-set-hint bt-secret-ok", role: "status" }, (0, import_react41.createElement)(CheckIcon), t("Saved.")) : null
- saved ? (0, import_react39.createElement)("div", { className: "bt-set-hint bt-secret-ok", role: "status" }, (0, import_react39.createElement)(CheckIcon), t("Saved.")) : null
++ saved ? (0, import_react42.createElement)("div", { className: "bt-set-hint bt-secret-ok", role: "status" }, (0, import_react42.createElement)(CheckIcon), t("Saved.")) : null
);
}
function AddProvider({ view, apply: apply2, actions, onDone }) {
- const [mode, setMode] = (0, import_react41.useState)(view.addable.length > 0 ? "known" : "custom");
- return (0, import_react41.createElement)(
- const [mode, setMode] = (0, import_react39.useState)(view.addable.length > 0 ? "known" : "custom");
- return (0, import_react39.createElement)(
++ const [mode, setMode] = (0, import_react42.useState)(view.addable.length > 0 ? "known" : "custom");
++ return (0, import_react42.createElement)(
"div",
{ className: "bt-set-row bt-set-paste bt-provider-add" },
- (0, import_react41.createElement)(
- (0, import_react39.createElement)(
++ (0, import_react42.createElement)(
Segmented,
{ label: t("Kind of provider"), value: mode },
- [["known", t("Known provider")], ["custom", t("Custom API")]].map(([id, label]) => (0, import_react41.createElement)("button", {
- [["known", t("Known provider")], ["custom", t("Custom API")]].map(([id, label]) => (0, import_react39.createElement)("button", {
++ [["known", t("Known provider")], ["custom", t("Custom API")]].map(([id, label]) => (0, import_react42.createElement)("button", {
key: id,
type: "button",
"aria-pressed": mode === id,
@@@ -15781,13 -15621,13 +15978,13 @@@
}, label))
),
// Both forms stay mounted, so switching keeps what is typed in the other.
- (0, import_react41.createElement)("div", { hidden: mode !== "known" }, (0, import_react41.createElement)(KnownForm, { view, apply: apply2, actions, onDone })),
- (0, import_react41.createElement)("div", { hidden: mode !== "custom" }, (0, import_react41.createElement)(CustomForm, { view, apply: apply2, actions, onDone }))
- (0, import_react39.createElement)("div", { hidden: mode !== "known" }, (0, import_react39.createElement)(KnownForm, { view, apply: apply2, actions, onDone })),
- (0, import_react39.createElement)("div", { hidden: mode !== "custom" }, (0, import_react39.createElement)(CustomForm, { view, apply: apply2, actions, onDone }))
++ (0, import_react42.createElement)("div", { hidden: mode !== "known" }, (0, import_react42.createElement)(KnownForm, { view, apply: apply2, actions, onDone })),
++ (0, import_react42.createElement)("div", { hidden: mode !== "custom" }, (0, import_react42.createElement)(CustomForm, { view, apply: apply2, actions, onDone }))
);
}
function KnownForm({ view, apply: apply2, actions, onDone }) {
- const [provider, setProvider] = (0, import_react41.useState)("");
- const [key, setKey] = (0, import_react41.useState)("");
- const [provider, setProvider] = (0, import_react39.useState)("");
- const [key, setKey] = (0, import_react39.useState)("");
++ const [provider, setProvider] = (0, import_react42.useState)("");
++ const [key, setKey] = (0, import_react42.useState)("");
const options = [...view.addable].sort((a, b) => a.name.localeCompare(b.name));
const add = () => {
if (provider === "") return;
@@@ -15795,24 -15635,24 +15992,24 @@@
if (ok) onDone();
});
};
- return (0, import_react41.createElement)(
- return (0, import_react39.createElement)(
++ return (0, import_react42.createElement)(
"div",
{ className: "bt-provider-form" },
- (0, import_react41.createElement)(
- (0, import_react39.createElement)(
++ (0, import_react42.createElement)(
"select",
{ className: "bt-select", "aria-label": t("Provider"), value: provider, onChange: (event) => setProvider(event.target.value) },
- (0, import_react41.createElement)("option", { value: "", disabled: true }, t("Choose a provider")),
- options.map((option) => (0, import_react41.createElement)("option", { key: option.id, value: option.id }, option.name))
- (0, import_react39.createElement)("option", { value: "", disabled: true }, t("Choose a provider")),
- options.map((option) => (0, import_react39.createElement)("option", { key: option.id, value: option.id }, option.name))
++ (0, import_react42.createElement)("option", { value: "", disabled: true }, t("Choose a provider")),
++ options.map((option) => (0, import_react42.createElement)("option", { key: option.id, value: option.id }, option.name))
),
- (0, import_react41.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react41.createElement)(KeyIcon), (0, import_react41.createElement)(MaskedInput, { value: key, onChange: setKey, onEnter: add, label: t("API key") })),
- (0, import_react41.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready: provider !== "" })
- (0, import_react39.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react39.createElement)(KeyIcon), (0, import_react39.createElement)(MaskedInput, { value: key, onChange: setKey, onEnter: add, label: t("API key") })),
- (0, import_react39.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready: provider !== "" })
++ (0, import_react42.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react42.createElement)(KeyIcon), (0, import_react42.createElement)(MaskedInput, { value: key, onChange: setKey, onEnter: add, label: t("API key") })),
++ (0, import_react42.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready: provider !== "" })
);
}
function CustomForm({ view, apply: apply2, actions, onDone }) {
- const [draft, setDraft] = (0, import_react41.useState)({ provider: "", name: "", baseURL: "", api: view.protocols[0], key: "", typed: "" });
- const [found, setFound] = (0, import_react41.useState)(null);
- const [picked, setPicked] = (0, import_react41.useState)([]);
- const [asking, setAsking] = (0, import_react41.useState)(false);
- const [draft, setDraft] = (0, import_react39.useState)({ provider: "", name: "", baseURL: "", api: view.protocols[0], key: "", typed: "" });
- const [found, setFound] = (0, import_react39.useState)(null);
- const [picked, setPicked] = (0, import_react39.useState)([]);
- const [asking, setAsking] = (0, import_react39.useState)(false);
++ const [draft, setDraft] = (0, import_react42.useState)({ provider: "", name: "", baseURL: "", api: view.protocols[0], key: "", typed: "" });
++ const [found, setFound] = (0, import_react42.useState)(null);
++ const [picked, setPicked] = (0, import_react42.useState)([]);
++ const [asking, setAsking] = (0, import_react42.useState)(false);
const set = (field, value) => setDraft((current) => ({ ...current, [field]: value }));
const typed = draft.typed.split(/[\s,]+/).map((id) => id.trim()).filter(Boolean);
const models = [...(found ?? []).filter((model) => picked.includes(model.id)), ...typed.filter((id) => !picked.includes(id)).map((id) => ({ id }))];
@@@ -15831,7 -15671,7 +16028,7 @@@
if (ok) onDone();
});
};
- const input = (field, label, placeholder) => (0, import_react41.createElement)("input", {
- const input = (field, label, placeholder) => (0, import_react39.createElement)("input", {
++ const input = (field, label, placeholder) => (0, import_react42.createElement)("input", {
className: "bt-input",
"aria-label": label,
placeholder,
@@@ -15840,55 -15680,55 +16037,55 @@@
autoComplete: "off",
onChange: (event) => set(field, event.target.value)
});
- return (0, import_react41.createElement)(
- return (0, import_react39.createElement)(
++ return (0, import_react42.createElement)(
"div",
{ className: "bt-provider-form" },
- (0, import_react41.createElement)(
- (0, import_react39.createElement)(
++ (0, import_react42.createElement)(
"div",
{ className: "bt-provider-pair" },
input("provider", t("Provider ID"), t("Provider ID, e.g. my-gateway")),
input("name", t("Name"), t("Name (optional)"))
),
- (0, import_react41.createElement)(
- (0, import_react39.createElement)(
++ (0, import_react42.createElement)(
"div",
{ className: "bt-provider-pair" },
input("baseURL", t("Endpoint"), ENDPOINT_HINTS[draft.api] ?? "https://gateway.example/v1"),
- (0, import_react41.createElement)(
- (0, import_react39.createElement)(
++ (0, import_react42.createElement)(
"select",
{ className: "bt-select", "aria-label": t("Protocol"), value: draft.api, onChange: (event) => set("api", event.target.value) },
- view.protocols.map((api) => (0, import_react41.createElement)("option", { key: api, value: api }, PROTOCOL_NAMES[api] ?? api))
- view.protocols.map((api) => (0, import_react39.createElement)("option", { key: api, value: api }, PROTOCOL_NAMES[api] ?? api))
++ view.protocols.map((api) => (0, import_react42.createElement)("option", { key: api, value: api }, PROTOCOL_NAMES[api] ?? api))
)
),
- (0, import_react41.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react41.createElement)(KeyIcon), (0, import_react41.createElement)(MaskedInput, { value: draft.key, onChange: (value) => set("key", value), label: t("API key") })),
- (0, import_react41.createElement)(
- (0, import_react39.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react39.createElement)(KeyIcon), (0, import_react39.createElement)(MaskedInput, { value: draft.key, onChange: (value) => set("key", value), label: t("API key") })),
- (0, import_react39.createElement)(
++ (0, import_react42.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react42.createElement)(KeyIcon), (0, import_react42.createElement)(MaskedInput, { value: draft.key, onChange: (value) => set("key", value), label: t("API key") })),
++ (0, import_react42.createElement)(
"div",
{ className: "bt-secret-edit-block" },
- (0, import_react41.createElement)(
- (0, import_react39.createElement)(
++ (0, import_react42.createElement)(
"div",
{ className: "bt-provider-models-head" },
- (0, import_react41.createElement)("span", { className: "bt-secret-edit-label" }, t("Models")),
- (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: asking || draft.baseURL.trim() === "", onClick: fetchModels }, asking ? t("Asking…") : t("Fetch models"))
- (0, import_react39.createElement)("span", { className: "bt-secret-edit-label" }, t("Models")),
- (0, import_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: asking || draft.baseURL.trim() === "", onClick: fetchModels }, asking ? t("Asking…") : t("Fetch models"))
++ (0, import_react42.createElement)("span", { className: "bt-secret-edit-label" }, t("Models")),
++ (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: asking || draft.baseURL.trim() === "", onClick: fetchModels }, asking ? t("Asking…") : t("Fetch models"))
),
- found !== null && found.length === 0 ? (0, import_react41.createElement)("div", { className: "bt-set-hint" }, t("The endpoint lists no models. Enter their ids below.")) : null,
- found !== null && found.length > 0 ? (0, import_react41.createElement)("div", { className: "bt-secret-bots bt-provider-found" }, found.map((model) => (0, import_react41.createElement)("button", {
- found !== null && found.length === 0 ? (0, import_react39.createElement)("div", { className: "bt-set-hint" }, t("The endpoint lists no models. Enter their ids below.")) : null,
- found !== null && found.length > 0 ? (0, import_react39.createElement)("div", { className: "bt-secret-bots bt-provider-found" }, found.map((model) => (0, import_react39.createElement)("button", {
++ found !== null && found.length === 0 ? (0, import_react42.createElement)("div", { className: "bt-set-hint" }, t("The endpoint lists no models. Enter their ids below.")) : null,
++ found !== null && found.length > 0 ? (0, import_react42.createElement)("div", { className: "bt-secret-bots bt-provider-found" }, found.map((model) => (0, import_react42.createElement)("button", {
key: model.id,
type: "button",
className: "bt-secret-bot",
"aria-pressed": picked.includes(model.id),
title: model.name && model.name !== model.id ? model.name : void 0,
onClick: () => toggle(model.id)
- }, (0, import_react41.createElement)("code", null, model.id), picked.includes(model.id) ? (0, import_react41.createElement)(CheckIcon) : null))) : null,
- }, (0, import_react39.createElement)("code", null, model.id), picked.includes(model.id) ? (0, import_react39.createElement)(CheckIcon) : null))) : null,
++ }, (0, import_react42.createElement)("code", null, model.id), picked.includes(model.id) ? (0, import_react42.createElement)(CheckIcon) : null))) : null,
input("typed", t("Model ids"), t("Model ids, separated by commas"))
),
- (0, import_react41.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready })
- (0, import_react39.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready })
++ (0, import_react42.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready })
);
}
function FormActions({ onCancel, onAdd, ready }) {
- return (0, import_react41.createElement)(
- return (0, import_react39.createElement)(
++ return (0, import_react42.createElement)(
"div",
{ className: "bt-secret-row-actions" },
- (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),
- (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: onAdd }, t("Add"))
- (0, import_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),
- (0, import_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: onAdd }, t("Add"))
++ (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),
++ (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: onAdd }, t("Add"))
);
}
var PROVIDERS_CSS = `
@@@ -15918,24 -15758,24 +16115,24 @@@
`;
// src/client/settings.js
- var import_react42 = require("react");
-var import_react40 = require("react");
++var import_react43 = require("react");
var capitalize2 = (word) => word[0].toUpperCase() + word.slice(1);
var SETTINGS_PAGES = [["general", "General"], ["models", "Models"], ["bots", "Bots"], ["groups", "Group chats"], ["connectors", "Connectors"], ["capabilities", "Capabilities"], ["browser", "Browser"], ["schedules", "Scheduled tasks"], ["usage", "Usage"], ["secrets", "Secrets"], ["feedback", "Feedback"], ["about", "About DS Bot"]];
var PAGE_ICONS = { ...SETTINGS_ICONS, models: SlidersIcon, connectors: ConnectorIcon, capabilities: PlugIcon, browser: ConnectorIcon, schedules: ClockIcon, secrets: KeyIcon, feedback: FeedbackIcon, about: InfoIcon };
function SetSection({ title, className = "", children }) {
- return (0, import_react42.createElement)("section", { className: `bt-set-section ${className}`.trim() }, (0, import_react42.createElement)("h3", null, title), (0, import_react42.createElement)("div", { className: "bt-set-card" }, children));
- return (0, import_react40.createElement)("section", { className: `bt-set-section ${className}`.trim() }, (0, import_react40.createElement)("h3", null, title), (0, import_react40.createElement)("div", { className: "bt-set-card" }, children));
++ return (0, import_react43.createElement)("section", { className: `bt-set-section ${className}`.trim() }, (0, import_react43.createElement)("h3", null, title), (0, import_react43.createElement)("div", { className: "bt-set-card" }, children));
}
function SetRow({ label, hint, children, className = "" }) {
- return (0, import_react42.createElement)(
- return (0, import_react40.createElement)(
++ return (0, import_react43.createElement)(
"div",
{ className: `bt-set-row ${className}`.trim() },
- (0, import_react42.createElement)("div", { className: "bt-set-copy" }, (0, import_react42.createElement)("span", null, label), hint ? (0, import_react42.createElement)("span", { className: "bt-set-hint" }, hint) : null),
- children ? (0, import_react42.createElement)("div", { className: "bt-set-control" }, children) : null
- (0, import_react40.createElement)("div", { className: "bt-set-copy" }, (0, import_react40.createElement)("span", null, label), hint ? (0, import_react40.createElement)("span", { className: "bt-set-hint" }, hint) : null),
- children ? (0, import_react40.createElement)("div", { className: "bt-set-control" }, children) : null
++ (0, import_react43.createElement)("div", { className: "bt-set-copy" }, (0, import_react43.createElement)("span", null, label), hint ? (0, import_react43.createElement)("span", { className: "bt-set-hint" }, hint) : null),
++ children ? (0, import_react43.createElement)("div", { className: "bt-set-control" }, children) : null
);
}
var LAYOUTS = [["bubble", "Bubble"], ["flat", "Flat"]];
function Choice({ label, value, options, pick: pick2 }) {
- return (0, import_react42.createElement)(Segmented, { label, value, className: "bt-look-seg" }, options.map(([id, text]) => (0, import_react42.createElement)("button", {
- return (0, import_react40.createElement)(Segmented, { label, value, className: "bt-look-seg" }, options.map(([id, text]) => (0, import_react40.createElement)("button", {
++ return (0, import_react43.createElement)(Segmented, { label, value, className: "bt-look-seg" }, options.map(([id, text]) => (0, import_react43.createElement)("button", {
key: id,
type: "button",
"aria-pressed": value === id,
@@@ -15945,12 -15785,12 +16142,12 @@@
}, t(text))));
}
function WidthSlider({ label, value, save }) {
- const [width, setWidth] = (0, import_react42.useState)(value);
- const pending = (0, import_react42.useRef)(null);
- const timer = (0, import_react42.useRef)(0);
- const saveRef = (0, import_react42.useRef)(save);
- const [width, setWidth] = (0, import_react40.useState)(value);
- const pending = (0, import_react40.useRef)(null);
- const timer = (0, import_react40.useRef)(0);
- const saveRef = (0, import_react40.useRef)(save);
++ const [width, setWidth] = (0, import_react43.useState)(value);
++ const pending = (0, import_react43.useRef)(null);
++ const timer = (0, import_react43.useRef)(0);
++ const saveRef = (0, import_react43.useRef)(save);
saveRef.current = save;
- (0, import_react42.useEffect)(() => {
- (0, import_react40.useEffect)(() => {
++ (0, import_react43.useEffect)(() => {
if (pending.current === null) setWidth(value);
}, [value]);
const flush = () => {
@@@ -15958,7 -15798,7 +16155,7 @@@
pending.current = null;
if (next !== null) saveRef.current(next);
};
- (0, import_react42.useEffect)(() => () => {
- (0, import_react40.useEffect)(() => () => {
++ (0, import_react43.useEffect)(() => () => {
clearTimeout(timer.current);
flush();
}, []);
@@@ -15969,46 -15809,46 +16166,46 @@@
timer.current = setTimeout(flush, 350);
};
const { min, max, step } = MESSAGE_WIDTH;
- return (0, import_react42.createElement)(
- return (0, import_react40.createElement)(
++ return (0, import_react43.createElement)(
"div",
{ className: "bt-range", style: { "--bt-fill": `${(width - min) / (max - min) * 100}%` } },
- (0, import_react42.createElement)("input", { type: "range", min, max, step, value: width, "aria-label": label, "aria-valuetext": `${width}%`, onChange: (event) => pick2(Number(event.target.value)) }),
- (0, import_react42.createElement)("output", null, `${width}%`)
- (0, import_react40.createElement)("input", { type: "range", min, max, step, value: width, "aria-label": label, "aria-valuetext": `${width}%`, onChange: (event) => pick2(Number(event.target.value)) }),
- (0, import_react40.createElement)("output", null, `${width}%`)
++ (0, import_react43.createElement)("input", { type: "range", min, max, step, value: width, "aria-label": label, "aria-valuetext": `${width}%`, onChange: (event) => pick2(Number(event.target.value)) }),
++ (0, import_react43.createElement)("output", null, `${width}%`)
);
}
function GeneralPage({ roster, actions, run: run2 }) {
const prefs = roster.prefs ?? {};
const themes = allThemes();
const current = themes[prefs.theme] ? prefs.theme : "deepseek";
- const [custom, setCustom] = (0, import_react42.useState)(prefs.accent ?? "#4d6bfe");
- const timer = (0, import_react42.useRef)(0);
- (0, import_react42.useEffect)(() => () => clearTimeout(timer.current), []);
- const [custom, setCustom] = (0, import_react40.useState)(prefs.accent ?? "#4d6bfe");
- const timer = (0, import_react40.useRef)(0);
- (0, import_react40.useEffect)(() => () => clearTimeout(timer.current), []);
++ const [custom, setCustom] = (0, import_react43.useState)(prefs.accent ?? "#4d6bfe");
++ const timer = (0, import_react43.useRef)(0);
++ (0, import_react43.useEffect)(() => () => clearTimeout(timer.current), []);
const pickCustom = (value) => {
setCustom(value);
clearTimeout(timer.current);
timer.current = setTimeout(() => run2(actions.setPrefs({ accent: value })), 350);
};
return [
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
SetSection,
{ key: "look", title: t("Appearance") },
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
SetRow,
{ label: t("Theme"), hint: t("Colors for the whole team, on every device.") },
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
"select",
{ className: "bt-select", "aria-label": t("Theme"), value: current, onChange: (event) => run2(actions.setPrefs({ theme: event.target.value })) },
- Object.entries(themes).map(([id, theme]) => (0, import_react42.createElement)("option", { key: id, value: id }, t(theme.label)))
- Object.entries(themes).map(([id, theme]) => (0, import_react40.createElement)("option", { key: id, value: id }, t(theme.label)))
++ Object.entries(themes).map(([id, theme]) => (0, import_react43.createElement)("option", { key: id, value: id }, t(theme.label)))
)
),
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
SetRow,
{ label: t("Accent"), hint: t("Unread marks, badges, and the brand mark.") },
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
"div",
{ className: "bt-swatches" },
- (0, import_react42.createElement)("button", { type: "button", className: "bt-swatch bt-swatch-default", title: t("Theme accent"), "aria-label": t("Theme accent"), "aria-pressed": !prefs.accent, onClick: () => run2(actions.setPrefs({ accent: null })) }),
- ACCENT_INKS.map((ink) => (0, import_react42.createElement)("button", {
- (0, import_react40.createElement)("button", { type: "button", className: "bt-swatch bt-swatch-default", title: t("Theme accent"), "aria-label": t("Theme accent"), "aria-pressed": !prefs.accent, onClick: () => run2(actions.setPrefs({ accent: null })) }),
- ACCENT_INKS.map((ink) => (0, import_react40.createElement)("button", {
++ (0, import_react43.createElement)("button", { type: "button", className: "bt-swatch bt-swatch-default", title: t("Theme accent"), "aria-label": t("Theme accent"), "aria-pressed": !prefs.accent, onClick: () => run2(actions.setPrefs({ accent: null })) }),
++ ACCENT_INKS.map((ink) => (0, import_react43.createElement)("button", {
key: ink,
type: "button",
className: "bt-swatch",
@@@ -16018,38 -15858,38 +16215,38 @@@
style: { background: INKS[ink][0] },
onClick: () => run2(actions.setPrefs({ accent: INKS[ink][0] }))
})),
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
"label",
{ className: "bt-swatch bt-swatch-custom", title: t("Custom accent"), "data-on": Boolean(prefs.accent) && !ACCENT_INKS.some((ink) => INKS[ink][0] === prefs.accent) },
- (0, import_react42.createElement)("input", { type: "color", value: custom, "aria-label": t("Custom accent"), onChange: (event) => pickCustom(event.target.value) })
- (0, import_react40.createElement)("input", { type: "color", value: custom, "aria-label": t("Custom accent"), onChange: (event) => pickCustom(event.target.value) })
++ (0, import_react43.createElement)("input", { type: "color", value: custom, "aria-label": t("Custom accent"), onChange: (event) => pickCustom(event.target.value) })
)
)
),
- (0, import_react42.createElement)(SetRow, { label: t("Message layout") }, (0, import_react42.createElement)(Choice, { label: t("Message layout"), value: layoutOf(prefs), options: LAYOUTS, pick: (id) => run2(actions.setPrefs({ layout: id })) })),
- (0, import_react40.createElement)(SetRow, { label: t("Message layout") }, (0, import_react40.createElement)(Choice, { label: t("Message layout"), value: layoutOf(prefs), options: LAYOUTS, pick: (id) => run2(actions.setPrefs({ layout: id })) })),
++ (0, import_react43.createElement)(SetRow, { label: t("Message layout") }, (0, import_react43.createElement)(Choice, { label: t("Message layout"), value: layoutOf(prefs), options: LAYOUTS, pick: (id) => run2(actions.setPrefs({ layout: id })) })),
// The flat layout's text has a width of its own; the bubble width stays for the user's messages.
- layoutOf(prefs) === "flat" ? (0, import_react42.createElement)(SetRow, { label: t("Text width") }, (0, import_react42.createElement)(WidthSlider, { label: t("Text width"), value: flatWidthOf(prefs), save: (flatWidth) => run2(actions.setPrefs({ flatWidth })) })) : null,
- (0, import_react42.createElement)(SetRow, { label: t("Bubble width") }, (0, import_react42.createElement)(WidthSlider, { label: t("Bubble width"), value: widthOf(prefs), save: (width) => run2(actions.setPrefs({ width })) })),
- (0, import_react42.createElement)(SetRow, { label: t("Show thinking") }, (0, import_react42.createElement)(Switch, { label: t("Show thinking"), on: thinkingShown(prefs), onChange: (thinking) => run2(actions.setPrefs({ thinking })) }))
- layoutOf(prefs) === "flat" ? (0, import_react40.createElement)(SetRow, { label: t("Text width") }, (0, import_react40.createElement)(WidthSlider, { label: t("Text width"), value: flatWidthOf(prefs), save: (flatWidth) => run2(actions.setPrefs({ flatWidth })) })) : null,
- (0, import_react40.createElement)(SetRow, { label: t("Bubble width") }, (0, import_react40.createElement)(WidthSlider, { label: t("Bubble width"), value: widthOf(prefs), save: (width) => run2(actions.setPrefs({ width })) })),
- (0, import_react40.createElement)(SetRow, { label: t("Show thinking") }, (0, import_react40.createElement)(Switch, { label: t("Show thinking"), on: thinkingShown(prefs), onChange: (thinking) => run2(actions.setPrefs({ thinking })) }))
++ layoutOf(prefs) === "flat" ? (0, import_react43.createElement)(SetRow, { label: t("Text width") }, (0, import_react43.createElement)(WidthSlider, { label: t("Text width"), value: flatWidthOf(prefs), save: (flatWidth) => run2(actions.setPrefs({ flatWidth })) })) : null,
++ (0, import_react43.createElement)(SetRow, { label: t("Bubble width") }, (0, import_react43.createElement)(WidthSlider, { label: t("Bubble width"), value: widthOf(prefs), save: (width) => run2(actions.setPrefs({ width })) })),
++ (0, import_react43.createElement)(SetRow, { label: t("Show thinking") }, (0, import_react43.createElement)(Switch, { label: t("Show thinking"), on: thinkingShown(prefs), onChange: (thinking) => run2(actions.setPrefs({ thinking })) }))
),
- actions.setSurface ? (0, import_react42.createElement)(
- actions.setSurface ? (0, import_react40.createElement)(
++ actions.setSurface ? (0, import_react43.createElement)(
SetSection,
{ key: "mode", title: t("Mode") },
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
SetRow,
{ label: t("Classic Agent mode") },
- (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.setSurface("agent") }, t("Switch"))
- (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.setSurface("agent") }, t("Switch"))
++ (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.setSurface("agent") }, t("Switch"))
)
) : null,
- (0, import_react42.createElement)(LocationsSection, { key: "places", actions, run: run2 })
- (0, import_react40.createElement)(LocationsSection, { key: "places", actions, run: run2 })
++ (0, import_react43.createElement)(LocationsSection, { key: "places", actions, run: run2 })
];
}
function LocationsSection({ actions, run: run2 }) {
const app = globalThis.dsBotApp;
- const [team, setTeam] = (0, import_react42.useState)(null);
- const [data, setData] = (0, import_react42.useState)(null);
- const [moving, setMoving] = (0, import_react42.useState)(false);
- const busy = (0, import_react42.useRef)(false);
- (0, import_react42.useEffect)(() => {
- const [team, setTeam] = (0, import_react40.useState)(null);
- const [data, setData] = (0, import_react40.useState)(null);
- const [moving, setMoving] = (0, import_react40.useState)(false);
- const busy = (0, import_react40.useRef)(false);
- (0, import_react40.useEffect)(() => {
++ const [team, setTeam] = (0, import_react43.useState)(null);
++ const [data, setData] = (0, import_react43.useState)(null);
++ const [moving, setMoving] = (0, import_react43.useState)(false);
++ const busy = (0, import_react43.useRef)(false);
++ (0, import_react43.useEffect)(() => {
void Promise.resolve(actions.folders()).then((info) => setTeam(info?.team ?? null)).catch(() => {
});
if (app !== void 0) void Promise.resolve(app.dataLocation()).then(setData).catch(() => {
@@@ -16067,18 -15907,18 +16264,18 @@@
setMoving(false);
}));
};
- return (0, import_react42.createElement)(
- return (0, import_react40.createElement)(
++ return (0, import_react43.createElement)(
SetSection,
{ title: t("Locations"), className: "bt-set-places" },
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
SetRow,
{ label: t("Team workspace"), hint: t("Where Bots without a folder of their own work.") },
- team === null ? null : (0, import_react42.createElement)(FolderMenu, { value: team, team: true, actions, run: run2, onPick: pickTeam, disabled: moving })
- team === null ? null : (0, import_react40.createElement)(FolderMenu, { value: team, team: true, actions, run: run2, onPick: pickTeam, disabled: moving })
++ team === null ? null : (0, import_react43.createElement)(FolderMenu, { value: team, team: true, actions, run: run2, onPick: pickTeam, disabled: moving })
),
- data === null ? null : (0, import_react42.createElement)(
- data === null ? null : (0, import_react40.createElement)(
++ data === null ? null : (0, import_react43.createElement)(
SetRow,
{ label: t("Data location"), hint: data.path },
- data.fixed ? null : (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: moving, onClick: () => {
- data.fixed ? null : (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: moving, onClick: () => {
++ data.fixed ? null : (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: moving, onClick: () => {
if (!busy.current) void run2(app.moveData(team ?? void 0));
} }, t("Change…"))
)
@@@ -16088,52 -15928,52 +16285,52 @@@ function MainBotsSection({ roster, acti
const mains = (roster.mainBotIds ?? []).map((id) => roster.byId[id]).filter(Boolean);
const [first, ...others] = mains;
const candidates = roster.bots.filter((bot) => !isMainOf(roster, bot.id));
- return (0, import_react42.createElement)(
- return (0, import_react40.createElement)(
++ return (0, import_react43.createElement)(
SetSection,
{ title: t("Main Bot") },
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
SetRow,
{
label: t("Main Bot"),
hint: first ? t("First in the sidebar. Pick another Bot to hand it the role; {name} then stops being a Main Bot.", { name: first.name }) : void 0
},
- (0, import_react42.createElement)("select", {
- (0, import_react40.createElement)("select", {
++ (0, import_react43.createElement)("select", {
className: "bt-select",
"aria-label": t("Main Bot"),
value: first?.id ?? "",
onChange: (event) => run2(actions.setMain(event.target.value, true, first ? { replace: first.id } : {}))
- }, first ? null : (0, import_react42.createElement)("option", { value: "" }, t("Choose a Bot…")), roster.bots.map((bot) => (0, import_react42.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))
- }, first ? null : (0, import_react40.createElement)("option", { value: "" }, t("Choose a Bot…")), roster.bots.map((bot) => (0, import_react40.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))
++ }, first ? null : (0, import_react43.createElement)("option", { value: "" }, t("Choose a Bot…")), roster.bots.map((bot) => (0, import_react43.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))
),
- others.map((bot) => (0, import_react42.createElement)(
- others.map((bot) => (0, import_react40.createElement)(
++ others.map((bot) => (0, import_react43.createElement)(
SetRow,
{ key: bot.id, label: bot.name, hint: t("Also a Main Bot.") },
- (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setMain(bot.id, true, { primary: true })) }, t("Move to first")),
- (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setMain(bot.id, false)) }, t("Remove Main Bot role"))
- (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setMain(bot.id, true, { primary: true })) }, t("Move to first")),
- (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setMain(bot.id, false)) }, t("Remove Main Bot role"))
++ (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setMain(bot.id, true, { primary: true })) }, t("Move to first")),
++ (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setMain(bot.id, false)) }, t("Remove Main Bot role"))
)),
- candidates.length > 0 ? (0, import_react42.createElement)(
- candidates.length > 0 ? (0, import_react40.createElement)(
++ candidates.length > 0 ? (0, import_react43.createElement)(
SetRow,
{ label: t("Add a Main Bot"), hint: t("Main Bots can create and change Bots, and run every group chat.") },
- (0, import_react42.createElement)("select", {
- (0, import_react40.createElement)("select", {
++ (0, import_react43.createElement)("select", {
className: "bt-select",
"aria-label": t("Add a Main Bot"),
value: "",
onChange: (event) => {
if (event.target.value) void run2(actions.setMain(event.target.value, true));
}
- }, (0, import_react42.createElement)("option", { value: "" }, t("Choose a Bot…")), candidates.map((bot) => (0, import_react42.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))
- }, (0, import_react40.createElement)("option", { value: "" }, t("Choose a Bot…")), candidates.map((bot) => (0, import_react40.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))
++ }, (0, import_react43.createElement)("option", { value: "" }, t("Choose a Bot…")), candidates.map((bot) => (0, import_react43.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))
) : null
);
}
var MOTIONS = [["quiet", "Quiet"], ["normal", "Normal"], ["lively", "Lively"]];
function MotionSection({ roster, actions, run: run2 }) {
const motion = roster.prefs?.motion === "quiet" || roster.prefs?.motion === "lively" ? roster.prefs.motion : "normal";
- return (0, import_react42.createElement)(
- return (0, import_react40.createElement)(
++ return (0, import_react43.createElement)(
SetSection,
{ title: t("Animation") },
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
SetRow,
{ label: t("Bot animation") },
- (0, import_react42.createElement)(Segmented, { label: t("Bot animation"), value: motion, className: "bt-motion-seg" }, MOTIONS.map(([id, label]) => (0, import_react42.createElement)("button", {
- (0, import_react40.createElement)(Segmented, { label: t("Bot animation"), value: motion, className: "bt-motion-seg" }, MOTIONS.map(([id, label]) => (0, import_react40.createElement)("button", {
++ (0, import_react43.createElement)(Segmented, { label: t("Bot animation"), value: motion, className: "bt-motion-seg" }, MOTIONS.map(([id, label]) => (0, import_react43.createElement)("button", {
key: id,
type: "button",
"aria-pressed": motion === id,
@@@ -16145,69 -15985,69 +16342,69 @@@
);
}
function BotsPage({ roster, actions, run: run2 }) {
- const [creating, setCreating] = (0, import_react42.useState)(false);
- const [creating, setCreating] = (0, import_react40.useState)(false);
++ const [creating, setCreating] = (0, import_react43.useState)(false);
return [
- (0, import_react42.createElement)(MainBotsSection, { key: "main", roster, actions, run: run2 }),
- (0, import_react42.createElement)(MotionSection, { key: "motion", roster, actions, run: run2 }),
- creating ? (0, import_react42.createElement)(CreateBot, { key: "create", roster, actions, inline: true, onBack: () => setCreating(false), onCreated: (bot) => actions.openSettings("bots", bot.id) }) : (0, import_react42.createElement)(
- (0, import_react40.createElement)(MainBotsSection, { key: "main", roster, actions, run: run2 }),
- (0, import_react40.createElement)(MotionSection, { key: "motion", roster, actions, run: run2 }),
- creating ? (0, import_react40.createElement)(CreateBot, { key: "create", roster, actions, inline: true, onBack: () => setCreating(false), onCreated: (bot) => actions.openSettings("bots", bot.id) }) : (0, import_react40.createElement)(
++ (0, import_react43.createElement)(MainBotsSection, { key: "main", roster, actions, run: run2 }),
++ (0, import_react43.createElement)(MotionSection, { key: "motion", roster, actions, run: run2 }),
++ creating ? (0, import_react43.createElement)(CreateBot, { key: "create", roster, actions, inline: true, onBack: () => setCreating(false), onCreated: (bot) => actions.openSettings("bots", bot.id) }) : (0, import_react43.createElement)(
"div",
{ key: "new", className: "bt-actions" },
- (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", onClick: () => setCreating(true) }, (0, import_react42.createElement)(PlusIcon), t("New Bot"))
- (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", onClick: () => setCreating(true) }, (0, import_react40.createElement)(PlusIcon), t("New Bot"))
++ (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", onClick: () => setCreating(true) }, (0, import_react43.createElement)(PlusIcon), t("New Bot"))
),
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
SetSection,
{ key: "bots", title: t("Bots · {count}", { count: roster.bots.length }) },
- roster.bots.map((bot) => (0, import_react42.createElement)(
- roster.bots.map((bot) => (0, import_react40.createElement)(
++ roster.bots.map((bot) => (0, import_react43.createElement)(
"button",
{ key: bot.id, type: "button", className: "bt-set-row", onClick: () => actions.openSettings("bots", bot.id) },
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
"span",
{ className: "bt-set-bot" },
- (0, import_react42.createElement)(BotAvatar, { bot, size: 28, badge: false, live: false }),
- (0, import_react42.createElement)("span", { className: "bt-row-title" }, bot.name),
- bot.role ? (0, import_react42.createElement)("span", { className: "bt-tag" }, bot.role) : null,
- isMainOf(roster, bot.id) ? (0, import_react42.createElement)("span", { className: "bt-tag" }, t("Main Bot")) : null,
- bot.hidden && !isMainOf(roster, bot.id) ? (0, import_react42.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null
- (0, import_react40.createElement)(BotAvatar, { bot, size: 28, badge: false, live: false }),
- (0, import_react40.createElement)("span", { className: "bt-row-title" }, bot.name),
- bot.role ? (0, import_react40.createElement)("span", { className: "bt-tag" }, bot.role) : null,
- isMainOf(roster, bot.id) ? (0, import_react40.createElement)("span", { className: "bt-tag" }, t("Main Bot")) : null,
- bot.hidden && !isMainOf(roster, bot.id) ? (0, import_react40.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null
++ (0, import_react43.createElement)(BotAvatar, { bot, size: 28, badge: false, live: false }),
++ (0, import_react43.createElement)("span", { className: "bt-row-title" }, bot.name),
++ bot.role ? (0, import_react43.createElement)("span", { className: "bt-tag" }, bot.role) : null,
++ isMainOf(roster, bot.id) ? (0, import_react43.createElement)("span", { className: "bt-tag" }, t("Main Bot")) : null,
++ bot.hidden && !isMainOf(roster, bot.id) ? (0, import_react43.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null
),
- (0, import_react42.createElement)("span", { className: "bt-chevron" }, (0, import_react42.createElement)(ChevronRightIcon))
- (0, import_react40.createElement)("span", { className: "bt-chevron" }, (0, import_react40.createElement)(ChevronRightIcon))
++ (0, import_react43.createElement)("span", { className: "bt-chevron" }, (0, import_react43.createElement)(ChevronRightIcon))
))
)
];
}
function GroupsPage({ roster, actions, run: run2 }) {
- const [creating, setCreating] = (0, import_react42.useState)(false);
- const [creating, setCreating] = (0, import_react40.useState)(false);
++ const [creating, setCreating] = (0, import_react43.useState)(false);
return [
- creating ? (0, import_react42.createElement)(NewGroupForm, { key: "create", roster, actions, run: run2, onCancel: () => setCreating(false), onCreated: (room2) => actions.openSettings("groups", room2.id) }) : (0, import_react42.createElement)(
- creating ? (0, import_react40.createElement)(NewGroupForm, { key: "create", roster, actions, run: run2, onCancel: () => setCreating(false), onCreated: (room2) => actions.openSettings("groups", room2.id) }) : (0, import_react40.createElement)(
++ creating ? (0, import_react43.createElement)(NewGroupForm, { key: "create", roster, actions, run: run2, onCancel: () => setCreating(false), onCreated: (room2) => actions.openSettings("groups", room2.id) }) : (0, import_react43.createElement)(
"div",
{ key: "new", className: "bt-actions" },
- (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", disabled: roster.bots.length < 2, title: roster.bots.length < 2 ? t("A group chat needs at least two Bots") : void 0, onClick: () => setCreating(true) }, (0, import_react42.createElement)(PlusIcon), t("Create group chat"))
- (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", disabled: roster.bots.length < 2, title: roster.bots.length < 2 ? t("A group chat needs at least two Bots") : void 0, onClick: () => setCreating(true) }, (0, import_react40.createElement)(PlusIcon), t("Create group chat"))
++ (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", disabled: roster.bots.length < 2, title: roster.bots.length < 2 ? t("A group chat needs at least two Bots") : void 0, onClick: () => setCreating(true) }, (0, import_react43.createElement)(PlusIcon), t("Create group chat"))
),
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
SetSection,
{ key: "groups", title: t("Group chats · {count}", { count: roster.rooms.length }) },
- roster.rooms.length === 0 ? (0, import_react42.createElement)(SetRow, { label: t("No group chats yet."), hint: t("A group chat lets several Bots work on one thing with you.") }) : roster.rooms.map((room2) => {
- roster.rooms.length === 0 ? (0, import_react40.createElement)(SetRow, { label: t("No group chats yet."), hint: t("A group chat lets several Bots work on one thing with you.") }) : roster.rooms.map((room2) => {
++ roster.rooms.length === 0 ? (0, import_react43.createElement)(SetRow, { label: t("No group chats yet."), hint: t("A group chat lets several Bots work on one thing with you.") }) : roster.rooms.map((room2) => {
const admin = roster.byId[room2.admin];
- return (0, import_react42.createElement)(
- return (0, import_react40.createElement)(
++ return (0, import_react43.createElement)(
"button",
{ key: room2.id, type: "button", className: "bt-set-row", onClick: () => actions.openSettings("groups", room2.id) },
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
"span",
{ className: "bt-set-bot" },
- (0, import_react42.createElement)(RoomAvatar, { room: room2, roster, size: 28 }),
- (0, import_react42.createElement)("span", { className: "bt-row-title" }, room2.name),
- (0, import_react42.createElement)("span", { className: "bt-tag" }, t("{count} members", { count: room2.members.length })),
- admin ? (0, import_react42.createElement)("span", { className: "bt-tag bt-tag-admin" }, (0, import_react42.createElement)(AdminStar), admin.name) : null,
- room2.hidden ? (0, import_react42.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null
- (0, import_react40.createElement)(RoomAvatar, { room: room2, roster, size: 28 }),
- (0, import_react40.createElement)("span", { className: "bt-row-title" }, room2.name),
- (0, import_react40.createElement)("span", { className: "bt-tag" }, t("{count} members", { count: room2.members.length })),
- admin ? (0, import_react40.createElement)("span", { className: "bt-tag bt-tag-admin" }, (0, import_react40.createElement)(AdminStar), admin.name) : null,
- room2.hidden ? (0, import_react40.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null
++ (0, import_react43.createElement)(RoomAvatar, { room: room2, roster, size: 28 }),
++ (0, import_react43.createElement)("span", { className: "bt-row-title" }, room2.name),
++ (0, import_react43.createElement)("span", { className: "bt-tag" }, t("{count} members", { count: room2.members.length })),
++ admin ? (0, import_react43.createElement)("span", { className: "bt-tag bt-tag-admin" }, (0, import_react43.createElement)(AdminStar), admin.name) : null,
++ room2.hidden ? (0, import_react43.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null
),
- (0, import_react42.createElement)("span", { className: "bt-chevron" }, (0, import_react42.createElement)(ChevronRightIcon))
- (0, import_react40.createElement)("span", { className: "bt-chevron" }, (0, import_react40.createElement)(ChevronRightIcon))
++ (0, import_react43.createElement)("span", { className: "bt-chevron" }, (0, import_react43.createElement)(ChevronRightIcon))
);
})
)
];
}
function SettingsDialog({ page, id, roster, actions, useUpdate, leaving = false }) {
- const [error, setError] = (0, import_react42.useState)("");
- const close = (0, import_react42.useCallback)(() => actions.closeSettings(), []);
- const [error, setError] = (0, import_react40.useState)("");
- const close = (0, import_react40.useCallback)(() => actions.closeSettings(), []);
++ const [error, setError] = (0, import_react43.useState)("");
++ const close = (0, import_react43.useCallback)(() => actions.closeSettings(), []);
useEscape(close);
const run2 = (promise) => Promise.resolve(promise).then(() => {
setError("");
@@@ -16226,32 -16066,32 +16423,32 @@@
const nav = useGlide(shown, { axis: "y" });
const pageKey = `${shown}:${bot?.id ?? room2?.id ?? ""}`;
const depth = bot || room2 ? 1 : 0;
- const last = (0, import_react42.useRef)({ key: pageKey, depth, move: "up" });
- const last = (0, import_react40.useRef)({ key: pageKey, depth, move: "up" });
++ const last = (0, import_react43.useRef)({ key: pageKey, depth, move: "up" });
if (last.current.key !== pageKey) {
last.current = { key: pageKey, depth, move: depth > last.current.depth ? "in" : depth < last.current.depth ? "out" : "up" };
}
- const [usageOpened, setUsageOpened] = (0, import_react42.useState)(shown === "usage");
- const [usageOpened, setUsageOpened] = (0, import_react40.useState)(shown === "usage");
++ const [usageOpened, setUsageOpened] = (0, import_react43.useState)(shown === "usage");
if (shown === "usage" && !usageOpened) setUsageOpened(true);
- const errorLine = error ? (0, import_react42.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;
- return (0, import_react42.createElement)(
- const errorLine = error ? (0, import_react40.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;
- return (0, import_react40.createElement)(
++ const errorLine = error ? (0, import_react43.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;
++ return (0, import_react43.createElement)(
"div",
{ className: "bt-settings-layer", "data-leaving": leaving || void 0 },
- (0, import_react42.createElement)("div", { className: "bt-scrim", onMouseDown: close }),
- (0, import_react42.createElement)(
- (0, import_react40.createElement)("div", { className: "bt-scrim", onMouseDown: close }),
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)("div", { className: "bt-scrim", onMouseDown: close }),
++ (0, import_react43.createElement)(
"div",
{ className: "bt-settings", role: "dialog", "aria-modal": true, "aria-label": t("DS Bot settings") },
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
"nav",
{ ref: nav.box, className: "bt-settings-nav", "aria-label": t("Settings pages") },
- (0, import_react42.createElement)("span", { ref: nav.thumb, className: "bt-thumb", "aria-hidden": true }),
- pages.map(([key, text]) => (0, import_react42.createElement)("button", {
- (0, import_react40.createElement)("span", { ref: nav.thumb, className: "bt-thumb", "aria-hidden": true }),
- pages.map(([key, text]) => (0, import_react40.createElement)("button", {
++ (0, import_react43.createElement)("span", { ref: nav.thumb, className: "bt-thumb", "aria-hidden": true }),
++ pages.map(([key, text]) => (0, import_react43.createElement)("button", {
key,
type: "button",
className: "bt-settings-item",
"aria-current": shown === key ? "page" : void 0,
onClick: () => actions.openSettings(key)
- }, (0, import_react42.createElement)(PAGE_ICONS[key]), t(text))),
- actions.openHarnessSettings ? (0, import_react42.createElement)("button", {
- }, (0, import_react40.createElement)(PAGE_ICONS[key]), t(text))),
- actions.openHarnessSettings ? (0, import_react40.createElement)("button", {
++ }, (0, import_react43.createElement)(PAGE_ICONS[key]), t(text))),
++ actions.openHarnessSettings ? (0, import_react43.createElement)("button", {
type: "button",
className: "bt-settings-item bt-settings-shell",
title: t("Models, providers, and the rest of DeepSeek Harness"),
@@@ -16259,67 -16099,67 +16456,67 @@@
close();
actions.openHarnessSettings();
}
- }, (0, import_react42.createElement)(SlidersIcon), t("Harness settings")) : null
- }, (0, import_react40.createElement)(SlidersIcon), t("Harness settings")) : null
++ }, (0, import_react43.createElement)(SlidersIcon), t("Harness settings")) : null
),
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
"div",
{ className: "bt-settings-main" },
- (0, import_react42.createElement)(
- (0, import_react40.createElement)(
++ (0, import_react43.createElement)(
"div",
{ className: "bt-settings-head" },
- back ? (0, import_react42.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": back, title: back, onClick: () => actions.openSettings(shown) }, (0, import_react42.createElement)(ChevronLeftIcon)) : null,
- (0, import_react42.createElement)("h2", { key: bot?.id ?? room2?.id ?? shown }, bot?.name ?? room2?.name ?? label)
- back ? (0, import_react40.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": back, title: back, onClick: () => actions.openSettings(shown) }, (0, import_react40.createElement)(ChevronLeftIcon)) : null,
- (0, import_react40.createElement)("h2", { key: bot?.id ?? room2?.id ?? shown }, bot?.name ?? room2?.name ?? label)
++ back ? (0, import_react43.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": back, title: back, onClick: () => actions.openSettings(shown) }, (0, import_react43.createElement)(ChevronLeftIcon)) : null,
++ (0, import_react43.createElement)("h2", { key: bot?.id ?? room2?.id ?? shown }, bot?.name ?? room2?.name ?? label)
),
- shown === "usage" ? null : (0, import_react42.createElement)(
- shown === "usage" ? null : (0, import_react40.createElement)(
++ shown === "usage" ? null : (0, import_react43.createElement)(
"div",
{ key: pageKey, className: "bt-settings-scroll bt-settings-page", "data-move": last.current.move },
errorLine,
- shown === "general" ? (0, import_react42.createElement)(GeneralPage, { roster, actions, run: run2 }) : null,
- shown === "models" ? (0, import_react42.createElement)(ProvidersPage, { actions, run: run2, Section: SetSection }) : null,
- bot ? (0, import_react42.createElement)("div", { className: "bt-settings-form" }, (0, import_react42.createElement)(BotSettingsForm, { key: bot.id, bot, roster, actions, run: run2 })) : null,
- shown === "bots" && !bot ? (0, import_react42.createElement)(BotsPage, { roster, actions, run: run2 }) : null,
- room2 ? (0, import_react42.createElement)("div", { className: "bt-settings-form" }, (0, import_react42.createElement)(GroupSettingsForm, { key: room2.id, room: room2, roster, actions, run: run2 })) : null,
- shown === "groups" && !room2 ? (0, import_react42.createElement)(GroupsPage, { roster, actions, run: run2 }) : null,
- shown === "connectors" ? (0, import_react42.createElement)(ConnectorsPage, { roster, actions }) : null,
- shown === "capabilities" ? (0, import_react42.createElement)(CapabilitiesPage, { roster, actions, run: run2 }) : null,
- shown === "browser" ? (0, import_react42.createElement)(BrowserPage, { roster, actions, run: run2, Section: SetSection, Row: SetRow }) : null,
- shown === "schedules" ? (0, import_react42.createElement)(SchedulesPage, { roster, actions, start: id ?? void 0 }) : null,
- shown === "secrets" ? (0, import_react42.createElement)(SecretsPage, { roster, actions, run: run2, Section: SetSection }) : null,
- shown === "feedback" ? (0, import_react42.createElement)(FeedbackPage, { actions, run: run2, Section: SetSection, Row: SetRow }) : null,
- shown === "about" ? (0, import_react42.createElement)(AboutPage, { useUpdate, actions, run: run2, Section: SetSection, Row: SetRow }) : null
- shown === "general" ? (0, import_react40.createElement)(GeneralPage, { roster, actions, run: run2 }) : null,
- shown === "models" ? (0, import_react40.createElement)(ProvidersPage, { actions, run: run2, Section: SetSection }) : null,
- bot ? (0, import_react40.createElement)("div", { className: "bt-settings-form" }, (0, import_react40.createElement)(BotSettingsForm, { key: bot.id, bot, roster, actions, run: run2 })) : null,
- shown === "bots" && !bot ? (0, import_react40.createElement)(BotsPage, { roster, actions, run: run2 }) : null,
- room2 ? (0, import_react40.createElement)("div", { className: "bt-settings-form" }, (0, import_react40.createElement)(GroupSettingsForm, { key: room2.id, room: room2, roster, actions, run: run2 })) : null,
- shown === "groups" && !room2 ? (0, import_react40.createElement)(GroupsPage, { roster, actions, run: run2 }) : null,
- shown === "connectors" ? (0, import_react40.createElement)(ConnectorsPage, { roster, actions }) : null,
- shown === "capabilities" ? (0, import_react40.createElement)(CapabilitiesPage, { roster, actions, run: run2 }) : null,
- shown === "browser" ? (0, import_react40.createElement)(BrowserPage, { roster, actions, run: run2, Section: SetSection, Row: SetRow }) : null,
- shown === "schedules" ? (0, import_react40.createElement)(SchedulesPage, { roster, actions, start: id ?? void 0 }) : null,
- shown === "secrets" ? (0, import_react40.createElement)(SecretsPage, { roster, actions, run: run2, Section: SetSection }) : null,
- shown === "feedback" ? (0, import_react40.createElement)(FeedbackPage, { actions, run: run2, Section: SetSection, Row: SetRow }) : null,
- shown === "about" ? (0, import_react40.createElement)(AboutPage, { useUpdate, actions, run: run2, Section: SetSection, Row: SetRow }) : null
++ shown === "general" ? (0, import_react43.createElement)(GeneralPage, { roster, actions, run: run2 }) : null,
++ shown === "models" ? (0, import_react43.createElement)(ProvidersPage, { actions, run: run2, Section: SetSection }) : null,
++ bot ? (0, import_react43.createElement)("div", { className: "bt-settings-form" }, (0, import_react43.createElement)(BotSettingsForm, { key: bot.id, bot, roster, actions, run: run2 })) : null,
++ shown === "bots" && !bot ? (0, import_react43.createElement)(BotsPage, { roster, actions, run: run2 }) : null,
++ room2 ? (0, import_react43.createElement)("div", { className: "bt-settings-form" }, (0, import_react43.createElement)(GroupSettingsForm, { key: room2.id, room: room2, roster, actions, run: run2 })) : null,
++ shown === "groups" && !room2 ? (0, import_react43.createElement)(GroupsPage, { roster, actions, run: run2 }) : null,
++ shown === "connectors" ? (0, import_react43.createElement)(ConnectorsPage, { roster, actions }) : null,
++ shown === "capabilities" ? (0, import_react43.createElement)(CapabilitiesPage, { roster, actions, run: run2 }) : null,
++ shown === "browser" ? (0, import_react43.createElement)(BrowserPage, { roster, actions, run: run2, Section: SetSection, Row: SetRow }) : null,
++ shown === "schedules" ? (0, import_react43.createElement)(SchedulesPage, { roster, actions, start: id ?? void 0 }) : null,
++ shown === "secrets" ? (0, import_react43.createElement)(SecretsPage, { roster, actions, run: run2, Section: SetSection }) : null,
++ shown === "feedback" ? (0, import_react43.createElement)(FeedbackPage, { actions, run: run2, Section: SetSection, Row: SetRow }) : null,
++ shown === "about" ? (0, import_react43.createElement)(AboutPage, { useUpdate, actions, run: run2, Section: SetSection, Row: SetRow }) : null
),
- usageOpened ? (0, import_react42.createElement)(
- usageOpened ? (0, import_react40.createElement)(
++ usageOpened ? (0, import_react43.createElement)(
"div",
{ key: "usage", className: "bt-settings-scroll bt-settings-usage", "data-off": shown === "usage" ? void 0 : "", "aria-hidden": shown === "usage" ? void 0 : true },
shown === "usage" ? errorLine : null,
- (0, import_react42.createElement)(UsagePage, { roster, actions, focusId: usageFocus })
- (0, import_react40.createElement)(UsagePage, { roster, actions, focusId: usageFocus })
++ (0, import_react43.createElement)(UsagePage, { roster, actions, focusId: usageFocus })
) : null
),
- (0, import_react42.createElement)("button", { type: "button", className: "bt-settings-close", "aria-label": t("Close settings"), onClick: close }, (0, import_react42.createElement)(CloseIcon))
- (0, import_react40.createElement)("button", { type: "button", className: "bt-settings-close", "aria-label": t("Close settings"), onClick: close }, (0, import_react40.createElement)(CloseIcon))
++ (0, import_react43.createElement)("button", { type: "button", className: "bt-settings-close", "aria-label": t("Close settings"), onClick: close }, (0, import_react43.createElement)(CloseIcon))
)
);
}
// src/client/context-menu.js
- var import_react43 = require("react");
-var import_react41 = require("react");
++var import_react44 = require("react");
function ContextMenu({ menu, roster, actions, leaving = false }) {
useEscape(() => actions.closeMenu());
- (0, import_react43.useEffect)(() => {
- (0, import_react41.useEffect)(() => {
++ (0, import_react44.useEffect)(() => {
const onDown = (event) => {
if (!(event.target instanceof Element) || !event.target.closest(".bt-menu")) actions.closeMenu();
};
window.addEventListener("mousedown", onDown);
return () => window.removeEventListener("mousedown", onDown);
}, []);
- const ref = (0, import_react43.useRef)(null);
- const [place, setPlace] = (0, import_react43.useState)({ left: menu.x, top: menu.y });
- const ref = (0, import_react41.useRef)(null);
- const [place, setPlace] = (0, import_react41.useState)({ left: menu.x, top: menu.y });
++ const ref = (0, import_react44.useRef)(null);
++ const [place, setPlace] = (0, import_react44.useState)({ left: menu.x, top: menu.y });
const tick = useViewport();
- (0, import_react43.useLayoutEffect)(() => {
- (0, import_react41.useLayoutEffect)(() => {
++ (0, import_react44.useLayoutEffect)(() => {
const box = ref.current?.getBoundingClientRect();
if (!box) return;
setPlace({ left: Math.max(8, Math.min(menu.x, window.innerWidth - box.width - 8)), top: Math.max(8, Math.min(menu.y, viewBottom() - box.height - 8)) });
}, [menu.x, menu.y, tick]);
- if (menu.kind === "agent" || menu.kind === "agent-session") return (0, import_react43.createElement)(AgentMenu, { menu, roster, actions, leaving });
- if (menu.kind === "agent" || menu.kind === "agent-session") return (0, import_react41.createElement)(AgentMenu, { menu, roster, actions, leaving });
++ if (menu.kind === "agent" || menu.kind === "agent-session") return (0, import_react44.createElement)(AgentMenu, { menu, roster, actions, leaving });
const bot = roster.byId[menu.id];
const room2 = roster.roomsById[menu.id];
const entry = bot ?? room2;
@@@ -16350,14 -16190,14 +16547,14 @@@
isMainBot ? null : [room2 ? t("Delete group") : t("Delete"), TrashIcon, () => bot ? actions.deleteBot(bot.id) : actions.deleteRoom(menu.id), true]
]
].map((group) => group.filter(Boolean)).filter((group) => group.length > 0);
- return (0, import_react43.createElement)(
- return (0, import_react41.createElement)(
++ return (0, import_react44.createElement)(
"div",
{ ref, className: "bt-menu", role: "menu", "aria-label": t("{name} actions", { name: bot?.name ?? room2.name }), style: place, "data-leaving": leaving || void 0 },
- groups.map((group, index) => (0, import_react43.createElement)(
- import_react43.Fragment,
- groups.map((group, index) => (0, import_react41.createElement)(
- import_react41.Fragment,
++ groups.map((group, index) => (0, import_react44.createElement)(
++ import_react44.Fragment,
{ key: index },
- index > 0 ? (0, import_react43.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,
- group.map(([label, Icon, run2, danger]) => (0, import_react43.createElement)("button", {
- index > 0 ? (0, import_react41.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,
- group.map(([label, Icon, run2, danger]) => (0, import_react41.createElement)("button", {
++ index > 0 ? (0, import_react44.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,
++ group.map(([label, Icon, run2, danger]) => (0, import_react44.createElement)("button", {
key: label,
type: "button",
role: "menuitem",
@@@ -16366,15 -16206,15 +16563,15 @@@
actions.closeMenu();
void Promise.resolve(run2()).catch((error) => actions.reportError(error, "menu"));
}
- }, (0, import_react43.createElement)(Icon), label))
- }, (0, import_react41.createElement)(Icon), label))
++ }, (0, import_react44.createElement)(Icon), label))
))
);
}
function AgentMenu({ menu, roster, actions, leaving }) {
- const ref = (0, import_react43.useRef)(null);
- const [place, setPlace] = (0, import_react43.useState)({ left: menu.x, top: menu.y });
- const ref = (0, import_react41.useRef)(null);
- const [place, setPlace] = (0, import_react41.useState)({ left: menu.x, top: menu.y });
++ const ref = (0, import_react44.useRef)(null);
++ const [place, setPlace] = (0, import_react44.useState)({ left: menu.x, top: menu.y });
const tick = useViewport();
- (0, import_react43.useLayoutEffect)(() => {
- (0, import_react41.useLayoutEffect)(() => {
++ (0, import_react44.useLayoutEffect)(() => {
const box = ref.current?.getBoundingClientRect();
if (!box) return;
setPlace({ left: Math.max(8, Math.min(menu.x, window.innerWidth - box.width - 8)), top: Math.max(8, Math.min(menu.y, viewBottom() - box.height - 8)) });
@@@ -16396,14 -16236,14 +16593,14 @@@
[t("Archive"), TrashIcon, () => actions.archiveAgentSession(agent.id, menu.id), true]
]
];
- return (0, import_react43.createElement)(
- return (0, import_react41.createElement)(
++ return (0, import_react44.createElement)(
"div",
{ ref, className: "bt-menu", role: "menu", "aria-label": menu.kind === "agent" ? "DSH Agent" : t("Session actions"), style: place, "data-leaving": leaving || void 0 },
- groups.map((group, index) => (0, import_react43.createElement)(
- import_react43.Fragment,
- groups.map((group, index) => (0, import_react41.createElement)(
- import_react41.Fragment,
++ groups.map((group, index) => (0, import_react44.createElement)(
++ import_react44.Fragment,
{ key: index },
- index > 0 ? (0, import_react43.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,
- group.map(([label, Icon, run2, danger]) => (0, import_react43.createElement)("button", {
- index > 0 ? (0, import_react41.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,
- group.map(([label, Icon, run2, danger]) => (0, import_react41.createElement)("button", {
++ index > 0 ? (0, import_react44.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,
++ group.map(([label, Icon, run2, danger]) => (0, import_react44.createElement)("button", {
key: label,
type: "button",
role: "menuitem",
@@@ -16412,13 -16252,13 +16609,13 @@@
actions.closeMenu();
void Promise.resolve(run2()).catch((error) => console.warn("[ds-bot]", error));
}
- }, (0, import_react43.createElement)(Icon), label))
- }, (0, import_react41.createElement)(Icon), label))
++ }, (0, import_react44.createElement)(Icon), label))
))
);
}
// src/client/member-status.js
- var import_react44 = require("react");
-var import_react42 = require("react");
++var import_react45 = require("react");
var NO_WORK = { bots: {}, rooms: {}, approvals: [] };
var FACES_MAX = 3;
var DOCK_EXIT_MS = 160;
@@@ -16479,15 -16319,15 +16676,15 @@@ function dockModel(sessionId, roster, w
};
}
function Face({ bot, ask, state }) {
- return (0, import_react44.createElement)(
- return (0, import_react42.createElement)(
++ return (0, import_react45.createElement)(
"span",
{ className: "bt-mw-face", "data-ask": ask || void 0 },
- (0, import_react44.createElement)(BotMark, { bot, size: 20, state: ask ? "alert" : state })
- (0, import_react42.createElement)(BotMark, { bot, size: 20, state: ask ? "alert" : state })
++ (0, import_react45.createElement)(BotMark, { bot, size: 20, state: ask ? "alert" : state })
);
}
function useFitWidth(inner, key) {
- const [width, setWidth] = (0, import_react44.useState)(null);
- (0, import_react44.useLayoutEffect)(() => {
- const [width, setWidth] = (0, import_react42.useState)(null);
- (0, import_react42.useLayoutEffect)(() => {
++ const [width, setWidth] = (0, import_react45.useState)(null);
++ (0, import_react45.useLayoutEffect)(() => {
setWidth(key && inner.current ? inner.current.offsetWidth : null);
}, [key]);
return width;
@@@ -16498,61 -16338,61 +16695,61 @@@ function MemberDock({ sessionId, useRos
const live = dockModel(sessionId, roster, work);
const [kept, leaving] = useLinger(live ? JSON.stringify(live) : null, DOCK_EXIT_MS);
const model = kept ? JSON.parse(kept) : null;
- const inner = (0, import_react44.useRef)(null);
- const inner = (0, import_react42.useRef)(null);
++ const inner = (0, import_react45.useRef)(null);
const width = useFitWidth(inner, kept);
if (!model) return null;
const faces = model.faces.map((face) => ({ ...face, bot: roster.byId[face.id] })).filter((face) => face.bot);
const label = [model.waiting, model.doing].filter(Boolean).join(" · ");
const open = () => model.open.details ? actions.showDetails(model.open.details) : actions.openSession(model.open.session);
- return (0, import_react44.createElement)(
- return (0, import_react42.createElement)(
++ return (0, import_react45.createElement)(
"div",
{ className: "bt-mw-dock", "data-leaving": leaving || void 0 },
- (0, import_react44.createElement)(
- (0, import_react42.createElement)(
++ (0, import_react45.createElement)(
"button",
{ type: "button", className: "bt-mw-pill", "aria-label": label, onClick: open, disabled: leaving, style: width ? { width } : void 0 },
- (0, import_react44.createElement)(
- (0, import_react42.createElement)(
++ (0, import_react45.createElement)(
"span",
{ ref: inner, className: "bt-mw-pill-in" },
- (0, import_react44.createElement)("span", { className: "bt-mw-faces", "aria-hidden": true }, faces.map((face) => (0, import_react44.createElement)(Face, { key: face.id, ...face }))),
- (0, import_react44.createElement)(
- (0, import_react42.createElement)("span", { className: "bt-mw-faces", "aria-hidden": true }, faces.map((face) => (0, import_react42.createElement)(Face, { key: face.id, ...face }))),
- (0, import_react42.createElement)(
++ (0, import_react45.createElement)("span", { className: "bt-mw-faces", "aria-hidden": true }, faces.map((face) => (0, import_react45.createElement)(Face, { key: face.id, ...face }))),
++ (0, import_react45.createElement)(
"span",
{ key: label, className: "bt-mw-label", "aria-hidden": true },
- model.waiting ? (0, import_react44.createElement)("span", { className: "bt-mw-ask" }, model.waiting) : null,
- model.waiting && model.doing ? (0, import_react44.createElement)("span", { className: "bt-mw-dot" }, "·") : null,
- model.doing ? (0, import_react44.createElement)("span", { className: "bt-mw-doing" }, (0, import_react44.createElement)(Shimmer, null, model.doing)) : null
- model.waiting ? (0, import_react42.createElement)("span", { className: "bt-mw-ask" }, model.waiting) : null,
- model.waiting && model.doing ? (0, import_react42.createElement)("span", { className: "bt-mw-dot" }, "·") : null,
- model.doing ? (0, import_react42.createElement)("span", { className: "bt-mw-doing" }, (0, import_react42.createElement)(Shimmer, null, model.doing)) : null
++ model.waiting ? (0, import_react45.createElement)("span", { className: "bt-mw-ask" }, model.waiting) : null,
++ model.waiting && model.doing ? (0, import_react45.createElement)("span", { className: "bt-mw-dot" }, "·") : null,
++ model.doing ? (0, import_react45.createElement)("span", { className: "bt-mw-doing" }, (0, import_react45.createElement)(Shimmer, null, model.doing)) : null
)
)
)
);
}
- var stateLine = (className, at, ...what) => (0, import_react44.createElement)(
-var stateLine = (className, at, ...what) => (0, import_react42.createElement)(
++var stateLine = (className, at, ...what) => (0, import_react45.createElement)(
"span",
{ className },
- (0, import_react44.createElement)("span", { className: "bt-member-what" }, ...what),
- typeof at === "number" ? (0, import_react44.createElement)(Elapsed, { at, className: "bt-member-time" }) : null
- (0, import_react42.createElement)("span", { className: "bt-member-what" }, ...what),
- typeof at === "number" ? (0, import_react42.createElement)(Elapsed, { at, className: "bt-member-time" }) : null
++ (0, import_react45.createElement)("span", { className: "bt-member-what" }, ...what),
++ typeof at === "number" ? (0, import_react45.createElement)(Elapsed, { at, className: "bt-member-time" }) : null
);
function ApprovalCard({ approval, bot, actions }) {
- const [busy, setBusy] = (0, import_react44.useState)(false);
- const [busy, setBusy] = (0, import_react42.useState)(false);
++ const [busy, setBusy] = (0, import_react45.useState)(false);
const answer = (choice) => {
setBusy(true);
void Promise.resolve(actions.answerApproval(approval.id, choice)).catch((error) => actions.reportError(error, "approval")).finally(() => setBusy(false));
};
- return (0, import_react44.createElement)(
- return (0, import_react42.createElement)(
++ return (0, import_react45.createElement)(
"div",
{ className: "bt-mw-card", role: "group", "aria-label": t("{name} is waiting for your approval", { name: bot.name }) },
- (0, import_react44.createElement)("div", { className: "bt-mw-tool" }, approval.tool),
- approval.detail?.text ? (0, import_react44.createElement)("div", { className: "bt-mw-text" }, approval.detail.text) : null,
- approval.reason ? (0, import_react44.createElement)("div", { className: "bt-mw-reason" }, approval.reason) : null,
- approval.detail?.code ? (0, import_react44.createElement)("code", { className: "bt-mw-code", title: approval.detail.code }, approval.detail.code) : null,
- approval.answerable ? (0, import_react44.createElement)(
- (0, import_react42.createElement)("div", { className: "bt-mw-tool" }, approval.tool),
- approval.detail?.text ? (0, import_react42.createElement)("div", { className: "bt-mw-text" }, approval.detail.text) : null,
- approval.reason ? (0, import_react42.createElement)("div", { className: "bt-mw-reason" }, approval.reason) : null,
- approval.detail?.code ? (0, import_react42.createElement)("code", { className: "bt-mw-code", title: approval.detail.code }, approval.detail.code) : null,
- approval.answerable ? (0, import_react42.createElement)(
++ (0, import_react45.createElement)("div", { className: "bt-mw-tool" }, approval.tool),
++ approval.detail?.text ? (0, import_react45.createElement)("div", { className: "bt-mw-text" }, approval.detail.text) : null,
++ approval.reason ? (0, import_react45.createElement)("div", { className: "bt-mw-reason" }, approval.reason) : null,
++ approval.detail?.code ? (0, import_react45.createElement)("code", { className: "bt-mw-code", title: approval.detail.code }, approval.detail.code) : null,
++ approval.answerable ? (0, import_react45.createElement)(
"div",
{ className: "bt-mw-actions" },
- (0, import_react44.createElement)("button", { type: "button", className: "bt-q-btn", disabled: busy, onClick: () => answer("reject") }, t("Reject")),
- (0, import_react44.createElement)("button", { type: "button", className: "bt-q-submit", disabled: busy, onClick: () => answer("allow") }, t("Allow once"))
- ) : (0, import_react44.createElement)(
- (0, import_react42.createElement)("button", { type: "button", className: "bt-q-btn", disabled: busy, onClick: () => answer("reject") }, t("Reject")),
- (0, import_react42.createElement)("button", { type: "button", className: "bt-q-submit", disabled: busy, onClick: () => answer("allow") }, t("Allow once"))
- ) : (0, import_react42.createElement)(
++ (0, import_react45.createElement)("button", { type: "button", className: "bt-q-btn", disabled: busy, onClick: () => answer("reject") }, t("Reject")),
++ (0, import_react45.createElement)("button", { type: "button", className: "bt-q-submit", disabled: busy, onClick: () => answer("allow") }, t("Allow once"))
++ ) : (0, import_react45.createElement)(
"div",
{ className: "bt-mw-actions" },
- (0, import_react44.createElement)("button", { type: "button", className: "bt-q-btn", onClick: () => actions.openSession(bot.id) }, t("Open {name}'s chat", { name: bot.name }))
- (0, import_react42.createElement)("button", { type: "button", className: "bt-q-btn", onClick: () => actions.openSession(bot.id) }, t("Open {name}'s chat", { name: bot.name }))
++ (0, import_react45.createElement)("button", { type: "button", className: "bt-q-btn", onClick: () => actions.openSession(bot.id) }, t("Open {name}'s chat", { name: bot.name }))
)
);
}
@@@ -16560,20 -16400,20 +16757,20 @@@ function MemberState({ entry, bot, room
if (entry?.state === "ask") return stateLine("bt-member-state bt-mw-ask", entry.approvals[0].at, t("Waiting for your approval"));
if (entry?.state !== "work") return bot.role ? stateLine("bt-member-state", void 0, bot.role) : null;
const where = entry.doing.roomId === room2.id ? "" : entry.doing.roomId ? t("in {name}", { name: roster.roomsById[entry.doing.roomId]?.name ?? t("a group chat") }) : t("in its own chat");
- return stateLine("bt-member-state", entry.doing.since, (0, import_react44.createElement)(Shimmer, null, `${workPhrase(entry.doing)}…`), where ? ` ${where}` : "");
- return stateLine("bt-member-state", entry.doing.since, (0, import_react42.createElement)(Shimmer, null, `${workPhrase(entry.doing)}…`), where ? ` ${where}` : "");
++ return stateLine("bt-member-state", entry.doing.since, (0, import_react45.createElement)(Shimmer, null, `${workPhrase(entry.doing)}…`), where ? ` ${where}` : "");
}
function StopMemberWork({ entry, bot, room: room2, actions }) {
- const [stopping, setStopping] = (0, import_react44.useState)(false);
- const [stopping, setStopping] = (0, import_react42.useState)(false);
++ const [stopping, setStopping] = (0, import_react45.useState)(false);
if (!entry?.here || entry.state !== "work" && entry.state !== "ask") return null;
const stop = () => {
setStopping(true);
void Promise.resolve(actions.stopMemberWork(room2.id, bot.id)).catch((error) => actions.reportError(error, "stop")).finally(() => setStopping(false));
};
- return (0, import_react44.createElement)("button", { type: "button", className: "bt-member-stop", disabled: stopping, "aria-label": `${t("Stop")} · ${bot.name}`, onClick: stop }, t("Stop"));
- return (0, import_react42.createElement)("button", { type: "button", className: "bt-member-stop", disabled: stopping, "aria-label": `${t("Stop")} · ${bot.name}`, onClick: stop }, t("Stop"));
++ return (0, import_react45.createElement)("button", { type: "button", className: "bt-member-stop", disabled: stopping, "aria-label": `${t("Stop")} · ${bot.name}`, onClick: stop }, t("Stop"));
}
function MemberApprovals({ entry, bot, actions }) {
if (entry?.state !== "ask") return null;
- return (0, import_react44.createElement)("div", { className: "bt-member-cards" }, entry.approvals.map((approval) => (0, import_react44.createElement)(ApprovalCard, { key: approval.id, approval, bot, actions })));
- return (0, import_react42.createElement)("div", { className: "bt-member-cards" }, entry.approvals.map((approval) => (0, import_react42.createElement)(ApprovalCard, { key: approval.id, approval, bot, actions })));
++ return (0, import_react45.createElement)("div", { className: "bt-member-cards" }, entry.approvals.map((approval) => (0, import_react45.createElement)(ApprovalCard, { key: approval.id, approval, bot, actions })));
}
function useMemberWork(room2, useWork) {
const work = useWork?.((value) => value) ?? NO_WORK;
@@@ -16632,7 -16472,7 +16829,7 @@@ body[data-ds-dark-theme] .bt-member-sta
`;
// src/client/details-drawer.js
- var import_react45 = require("react");
-var import_react43 = require("react");
++var import_react46 = require("react");
function transcriptOf(list, id, name, hiddenTurns = []) {
const outline = list.projectionsBySession?.[id]?.values?.turnOutline ?? list.byId[id]?.projectionValues?.turnOutline;
if (!Array.isArray(outline)) return "";
@@@ -16657,17 -16497,17 +16854,17 @@@ var EMPTY_TABS = { ids: [], active: nul
function PermissionRow({ bot, roster, actions, run: run2 }) {
const catalog = roster.permissions;
if (!catalog?.options?.length) return null;
- return (0, import_react45.createElement)(
- return (0, import_react43.createElement)(
++ return (0, import_react46.createElement)(
"div",
{ className: "bt-drawer-permission" },
- (0, import_react45.createElement)("div", { className: "bt-section-title" }, t("Permissions")),
- (0, import_react43.createElement)("div", { className: "bt-section-title" }, t("Permissions")),
++ (0, import_react46.createElement)("div", { className: "bt-section-title" }, t("Permissions")),
// A Bot without its own preset may run on another one set in DSH, so its first pick always applies.
- (0, import_react45.createElement)(PermissionPicker, { catalog, saved: bot.permission ?? catalog.defaultPreset, repick: bot.permission === void 0, onPick: (permission) => run2(actions.updateBot(bot.id, { permission })) })
- (0, import_react43.createElement)(PermissionPicker, { catalog, saved: bot.permission ?? catalog.defaultPreset, repick: bot.permission === void 0, onPick: (permission) => run2(actions.updateBot(bot.id, { permission })) })
++ (0, import_react46.createElement)(PermissionPicker, { catalog, saved: bot.permission ?? catalog.defaultPreset, repick: bot.permission === void 0, onPick: (permission) => run2(actions.updateBot(bot.id, { permission })) })
);
}
function RunStats({ bot, part, running, actions }) {
- const [values, setValues] = (0, import_react45.useState)(null);
- (0, import_react45.useEffect)(() => {
- const [values, setValues] = (0, import_react43.useState)(null);
- (0, import_react43.useEffect)(() => {
++ const [values, setValues] = (0, import_react46.useState)(null);
++ (0, import_react46.useEffect)(() => {
if (!actions.runStats) return void 0;
let current = true;
actions.runStats(bot.id).then(
@@@ -16684,56 -16524,56 +16881,56 @@@
}, [bot.id, part, running]);
const shown = runStatsOf(values);
if (shown.length === 0) return null;
- return (0, import_react45.createElement)(
- return (0, import_react43.createElement)(
++ return (0, import_react46.createElement)(
"div",
{ className: "bt-run-stats" },
- shown.map((entry, index) => (0, import_react45.createElement)(
- import_react45.Fragment,
- shown.map((entry, index) => (0, import_react43.createElement)(
- import_react43.Fragment,
++ shown.map((entry, index) => (0, import_react46.createElement)(
++ import_react46.Fragment,
{ key: entry.key },
- index > 0 ? (0, import_react45.createElement)("span", { className: "bt-run-sep", "aria-hidden": true }, "·") : null,
- (0, import_react45.createElement)("span", { title: entry.title }, entry.text)
- index > 0 ? (0, import_react43.createElement)("span", { className: "bt-run-sep", "aria-hidden": true }, "·") : null,
- (0, import_react43.createElement)("span", { title: entry.title }, entry.text)
++ index > 0 ? (0, import_react46.createElement)("span", { className: "bt-run-sep", "aria-hidden": true }, "·") : null,
++ (0, import_react46.createElement)("span", { title: entry.title }, entry.text)
))
);
}
function BrowserCards({ bot, sessionId, roster, actions, useBrowserTabs, useBrowserPages }) {
const state = useBrowserTabs((map) => map[bot.id] ?? EMPTY_TABS);
const pages = useBrowserPages((map) => map);
- (0, import_react45.useEffect)(() => {
- (0, import_react43.useEffect)(() => {
++ (0, import_react46.useEffect)(() => {
actions.browserEnsure?.(bot.id);
}, [bot.id]);
if (roster.browser !== true || !actions.browserShow) {
- return (0, import_react45.createElement)("div", { className: "bt-muted" }, t("The browser is in DSH Desktop and the DeepSeek Bot app."));
- return (0, import_react43.createElement)("div", { className: "bt-muted" }, t("The browser is in DSH Desktop and the DeepSeek Bot app."));
++ return (0, import_react46.createElement)("div", { className: "bt-muted" }, t("The browser is in DSH Desktop and the DeepSeek Bot app."));
}
if (state.ids.length === 0) {
- return (0, import_react45.createElement)(
- return (0, import_react43.createElement)(
++ return (0, import_react46.createElement)(
"div",
{ className: "bt-browser-empty-mark" },
- (0, import_react45.createElement)(BotMark, { bot, size: 40, state: "idle", live: true }),
- (0, import_react45.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),
- (0, import_react45.createElement)("div", { className: "bt-muted" }, t("Open a page here and {name} can read it with you. Logins and cookies stay with {name}; other Bots never see them.", { name: bot.name })),
- (0, import_react45.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => actions.openBrowser(sessionId) }, t("Open browser"))
- (0, import_react43.createElement)(BotMark, { bot, size: 40, state: "idle", live: true }),
- (0, import_react43.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),
- (0, import_react43.createElement)("div", { className: "bt-muted" }, t("Open a page here and {name} can read it with you. Logins and cookies stay with {name}; other Bots never see them.", { name: bot.name })),
- (0, import_react43.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => actions.openBrowser(sessionId) }, t("Open browser"))
++ (0, import_react46.createElement)(BotMark, { bot, size: 40, state: "idle", live: true }),
++ (0, import_react46.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),
++ (0, import_react46.createElement)("div", { className: "bt-muted" }, t("Open a page here and {name} can read it with you. Logins and cookies stay with {name}; other Bots never see them.", { name: bot.name })),
++ (0, import_react46.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => actions.openBrowser(sessionId) }, t("Open browser"))
);
}
- return (0, import_react45.createElement)(
- return (0, import_react43.createElement)(
++ return (0, import_react46.createElement)(
"div",
{ className: "bt-bcards" },
state.ids.map((tabId, index) => {
const page = pages[tabId] ?? {};
const label = page.title || shortUrl(page.url) || t("New tab");
- return (0, import_react45.createElement)(
- return (0, import_react43.createElement)(
++ return (0, import_react46.createElement)(
"div",
{ key: tabId, className: "bt-bcard", "data-active": state.active === tabId || void 0, style: { animationDelay: `${index * 30}ms` } },
- (0, import_react45.createElement)(
- (0, import_react43.createElement)(
++ (0, import_react46.createElement)(
"button",
{ type: "button", className: "bt-bcard-shot", "aria-label": t("Open {title}", { title: label }), title: page.url, onClick: () => actions.browserPick(sessionId, tabId) },
- page.excerpt ? (0, import_react45.createElement)(
- page.excerpt ? (0, import_react43.createElement)(
++ page.excerpt ? (0, import_react46.createElement)(
"span",
{ className: "bt-bcard-preview" },
- (0, import_react45.createElement)("span", { className: "bt-bcard-ptitle" }, label),
- (0, import_react45.createElement)("span", { className: "bt-bcard-excerpt" }, page.excerpt)
- ) : (0, import_react45.createElement)("span", { className: "bt-bcard-blank" }, (0, import_react45.createElement)(GlobeIcon2), (0, import_react45.createElement)("span", null, label))
- (0, import_react43.createElement)("span", { className: "bt-bcard-ptitle" }, label),
- (0, import_react43.createElement)("span", { className: "bt-bcard-excerpt" }, page.excerpt)
- ) : (0, import_react43.createElement)("span", { className: "bt-bcard-blank" }, (0, import_react43.createElement)(GlobeIcon2), (0, import_react43.createElement)("span", null, label))
++ (0, import_react46.createElement)("span", { className: "bt-bcard-ptitle" }, label),
++ (0, import_react46.createElement)("span", { className: "bt-bcard-excerpt" }, page.excerpt)
++ ) : (0, import_react46.createElement)("span", { className: "bt-bcard-blank" }, (0, import_react46.createElement)(GlobeIcon2), (0, import_react46.createElement)("span", null, label))
),
- (0, import_react45.createElement)("button", {
- (0, import_react43.createElement)("button", {
++ (0, import_react46.createElement)("button", {
type: "button",
className: "bt-bcard-x",
"aria-label": t("Close tab"),
@@@ -16742,29 -16582,29 +16939,29 @@@
void actions.browserCloseTab(bot.id, tabId);
}
}, "×"),
- (0, import_react45.createElement)(
- (0, import_react43.createElement)(
++ (0, import_react46.createElement)(
"div",
{ className: "bt-bcard-row" },
- (0, import_react45.createElement)(Favicon, { src: page.favicon, className: "bt-bcard-fav" }),
- (0, import_react45.createElement)("span", { className: "bt-bcard-title" }, label),
- page.url ? (0, import_react45.createElement)("span", { className: "bt-bcard-host" }, hostOf2(page.url)) : null
- (0, import_react43.createElement)(Favicon, { src: page.favicon, className: "bt-bcard-fav" }),
- (0, import_react43.createElement)("span", { className: "bt-bcard-title" }, label),
- page.url ? (0, import_react43.createElement)("span", { className: "bt-bcard-host" }, hostOf2(page.url)) : null
++ (0, import_react46.createElement)(Favicon, { src: page.favicon, className: "bt-bcard-fav" }),
++ (0, import_react46.createElement)("span", { className: "bt-bcard-title" }, label),
++ page.url ? (0, import_react46.createElement)("span", { className: "bt-bcard-host" }, hostOf2(page.url)) : null
)
);
}),
- (0, import_react45.createElement)("button", { type: "button", className: "bt-bcard-new", style: { animationDelay: `${state.ids.length * 30}ms` }, onClick: () => actions.browserNewTab(sessionId) }, (0, import_react45.createElement)(PlusIcon), t("New tab"))
- (0, import_react43.createElement)("button", { type: "button", className: "bt-bcard-new", style: { animationDelay: `${state.ids.length * 30}ms` }, onClick: () => actions.browserNewTab(sessionId) }, (0, import_react43.createElement)(PlusIcon), t("New tab"))
++ (0, import_react46.createElement)("button", { type: "button", className: "bt-bcard-new", style: { animationDelay: `${state.ids.length * 30}ms` }, onClick: () => actions.browserNewTab(sessionId) }, (0, import_react46.createElement)(PlusIcon), t("New tab"))
);
}
function About({ text, title = "About" }) {
- const [open, setOpen] = (0, import_react45.useState)(false);
- const [open, setOpen] = (0, import_react43.useState)(false);
++ const [open, setOpen] = (0, import_react46.useState)(false);
const long = text.split("\n").length > 5 || text.length > 240;
- const body = (0, import_react45.useRef)(null);
- const body = (0, import_react43.useRef)(null);
++ const body = (0, import_react46.useRef)(null);
useMorph(body, open);
- return (0, import_react45.createElement)(
- return (0, import_react43.createElement)(
++ return (0, import_react46.createElement)(
"div",
null,
- (0, import_react45.createElement)("div", { className: "bt-section-title" }, t(title)),
- (0, import_react45.createElement)("div", { ref: body, className: "bt-about", "data-open": open || void 0 }, text),
- long ? (0, import_react45.createElement)("button", { type: "button", className: "bt-more", onClick: () => setOpen((value) => !value) }, open ? t("Show less") : t("Show more")) : null
- (0, import_react43.createElement)("div", { className: "bt-section-title" }, t(title)),
- (0, import_react43.createElement)("div", { ref: body, className: "bt-about", "data-open": open || void 0 }, text),
- long ? (0, import_react43.createElement)("button", { type: "button", className: "bt-more", onClick: () => setOpen((value) => !value) }, open ? t("Show less") : t("Show more")) : null
++ (0, import_react46.createElement)("div", { className: "bt-section-title" }, t(title)),
++ (0, import_react46.createElement)("div", { ref: body, className: "bt-about", "data-open": open || void 0 }, text),
++ long ? (0, import_react46.createElement)("button", { type: "button", className: "bt-more", onClick: () => setOpen((value) => !value) }, open ? t("Show less") : t("Show more")) : null
);
}
var PILE_MAX = 4;
@@@ -16772,52 -16612,52 +16969,52 @@@ function MemberPile({ room: room2, rost
const members = room2.members.map((id) => roster.byId[id]).filter(Boolean);
const shown = members.length > PILE_MAX ? members.slice(0, PILE_MAX - 1) : members;
const more = members.length - shown.length;
- return (0, import_react45.createElement)(
- return (0, import_react43.createElement)(
++ return (0, import_react46.createElement)(
"span",
{ className: "bt-pile", "aria-hidden": true },
- shown.map((bot, index) => (0, import_react45.createElement)("span", { key: bot.id, className: "bt-pile-face", style: { animationDelay: `${index * 40}ms` } }, (0, import_react45.createElement)(BotMark, { bot, size: 44, live: true }))),
- more > 0 ? (0, import_react45.createElement)("span", { key: "more", className: "bt-pile-face bt-pile-more", style: { animationDelay: `${shown.length * 40}ms` } }, `+${more}`) : null
- shown.map((bot, index) => (0, import_react43.createElement)("span", { key: bot.id, className: "bt-pile-face", style: { animationDelay: `${index * 40}ms` } }, (0, import_react43.createElement)(BotMark, { bot, size: 44, live: true }))),
- more > 0 ? (0, import_react43.createElement)("span", { key: "more", className: "bt-pile-face bt-pile-more", style: { animationDelay: `${shown.length * 40}ms` } }, `+${more}`) : null
++ shown.map((bot, index) => (0, import_react46.createElement)("span", { key: bot.id, className: "bt-pile-face", style: { animationDelay: `${index * 40}ms` } }, (0, import_react46.createElement)(BotMark, { bot, size: 44, live: true }))),
++ more > 0 ? (0, import_react46.createElement)("span", { key: "more", className: "bt-pile-face bt-pile-more", style: { animationDelay: `${shown.length * 40}ms` } }, `+${more}`) : null
);
}
var markOf = (entry) => entry?.state === "ask" ? "alert" : entry?.state === "work" ? workState(entry.doing) : "idle";
function MemberRow({ member, entry, room: room2, roster, actions }) {
- return (0, import_react45.createElement)(
- return (0, import_react43.createElement)(
++ return (0, import_react46.createElement)(
"div",
{ role: "listitem", className: "bt-member" },
- (0, import_react45.createElement)(
- (0, import_react43.createElement)(
++ (0, import_react46.createElement)(
"div",
{ className: "bt-member-row" },
- (0, import_react45.createElement)(
- (0, import_react43.createElement)(
++ (0, import_react46.createElement)(
"button",
{ type: "button", className: "bt-member-open", title: t("Open {name}'s chat", { name: member.name }), onClick: () => actions.openSession(member.id) },
- (0, import_react45.createElement)(BotMark, { bot: member, size: 32, state: markOf(entry) }),
- (0, import_react45.createElement)(
- (0, import_react43.createElement)(BotMark, { bot: member, size: 32, state: markOf(entry) }),
- (0, import_react43.createElement)(
++ (0, import_react46.createElement)(BotMark, { bot: member, size: 32, state: markOf(entry) }),
++ (0, import_react46.createElement)(
"span",
{ className: "bt-member-text" },
- (0, import_react45.createElement)(
- (0, import_react43.createElement)(
++ (0, import_react46.createElement)(
"span",
{ className: "bt-member-line" },
- (0, import_react45.createElement)("span", { className: "bt-member-name" }, member.name),
- room2.admin === member.id ? (0, import_react45.createElement)("span", { className: "bt-tag" }, t("Admin")) : null
- (0, import_react43.createElement)("span", { className: "bt-member-name" }, member.name),
- room2.admin === member.id ? (0, import_react43.createElement)("span", { className: "bt-tag" }, t("Admin")) : null
++ (0, import_react46.createElement)("span", { className: "bt-member-name" }, member.name),
++ room2.admin === member.id ? (0, import_react46.createElement)("span", { className: "bt-tag" }, t("Admin")) : null
),
- (0, import_react45.createElement)(MemberState, { entry, bot: member, room: room2, roster })
- (0, import_react43.createElement)(MemberState, { entry, bot: member, room: room2, roster })
++ (0, import_react46.createElement)(MemberState, { entry, bot: member, room: room2, roster })
)
),
- (0, import_react45.createElement)(StopMemberWork, { entry, bot: member, room: room2, actions })
- (0, import_react43.createElement)(StopMemberWork, { entry, bot: member, room: room2, actions })
++ (0, import_react46.createElement)(StopMemberWork, { entry, bot: member, room: room2, actions })
),
- (0, import_react45.createElement)(MemberApprovals, { entry, bot: member, actions })
- (0, import_react43.createElement)(MemberApprovals, { entry, bot: member, actions })
++ (0, import_react46.createElement)(MemberApprovals, { entry, bot: member, actions })
);
}
function GroupOverview({ room: room2, roster, actions, usage, useWork, openSettings }) {
const members = room2.members.map((id) => roster.byId[id]).filter(Boolean);
const { entries: entries2 } = useMemberWork(room2, useWork);
return [
- room2.notice ? (0, import_react45.createElement)(About, { key: "notice", title: "Notice", text: room2.notice }) : (0, import_react45.createElement)("button", { key: "notice", type: "button", className: "bt-more", onClick: openSettings }, t("Add a notice in group settings")),
- (0, import_react45.createElement)(
- room2.notice ? (0, import_react43.createElement)(About, { key: "notice", title: "Notice", text: room2.notice }) : (0, import_react43.createElement)("button", { key: "notice", type: "button", className: "bt-more", onClick: openSettings }, t("Add a notice in group settings")),
- (0, import_react43.createElement)(
++ room2.notice ? (0, import_react46.createElement)(About, { key: "notice", title: "Notice", text: room2.notice }) : (0, import_react46.createElement)("button", { key: "notice", type: "button", className: "bt-more", onClick: openSettings }, t("Add a notice in group settings")),
++ (0, import_react46.createElement)(
"div",
{ key: "members" },
- (0, import_react45.createElement)("div", { className: "bt-section-title" }, t("Members · {count}", { count: members.length })),
- (0, import_react45.createElement)("div", { className: "bt-members", role: "list" }, members.map((member) => (0, import_react45.createElement)(MemberRow, {
- (0, import_react43.createElement)("div", { className: "bt-section-title" }, t("Members · {count}", { count: members.length })),
- (0, import_react43.createElement)("div", { className: "bt-members", role: "list" }, members.map((member) => (0, import_react43.createElement)(MemberRow, {
++ (0, import_react46.createElement)("div", { className: "bt-section-title" }, t("Members · {count}", { count: members.length })),
++ (0, import_react46.createElement)("div", { className: "bt-members", role: "list" }, members.map((member) => (0, import_react46.createElement)(MemberRow, {
key: member.id,
member,
entry: entries2.find((item) => item.id === member.id),
@@@ -16826,24 -16666,24 +17023,24 @@@
actions
})))
),
- (0, import_react45.createElement)(
- (0, import_react43.createElement)(
++ (0, import_react46.createElement)(
"div",
{ key: "mode" },
- (0, import_react45.createElement)("div", { className: "bt-section-title" }, t("Who answers")),
- (0, import_react45.createElement)("div", { className: "bt-kv" }, (0, import_react45.createElement)("span", null, t(ROOM_MODES.find(([id]) => id === shownMode(room2, roster))?.[1] ?? "Everyone")))
- (0, import_react43.createElement)("div", { className: "bt-section-title" }, t("Who answers")),
- (0, import_react43.createElement)("div", { className: "bt-kv" }, (0, import_react43.createElement)("span", null, t(ROOM_MODES.find(([id]) => id === shownMode(room2, roster))?.[1] ?? "Everyone")))
++ (0, import_react46.createElement)("div", { className: "bt-section-title" }, t("Who answers")),
++ (0, import_react46.createElement)("div", { className: "bt-kv" }, (0, import_react46.createElement)("span", null, t(ROOM_MODES.find(([id]) => id === shownMode(room2, roster))?.[1] ?? "Everyone")))
),
- room2.permission ? (0, import_react45.createElement)(
- room2.permission ? (0, import_react43.createElement)(
++ room2.permission ? (0, import_react46.createElement)(
"div",
{ key: "permission" },
- (0, import_react45.createElement)("div", { className: "bt-section-title" }, t("Permissions")),
- (0, import_react45.createElement)("div", { className: "bt-kv" }, (0, import_react45.createElement)("span", { className: presetDanger(room2.permission) ? "bt-perm-danger" : void 0 }, presetName(room2.permission, roster.permissions)))
- (0, import_react43.createElement)("div", { className: "bt-section-title" }, t("Permissions")),
- (0, import_react43.createElement)("div", { className: "bt-kv" }, (0, import_react43.createElement)("span", { className: presetDanger(room2.permission) ? "bt-perm-danger" : void 0 }, presetName(room2.permission, roster.permissions)))
++ (0, import_react46.createElement)("div", { className: "bt-section-title" }, t("Permissions")),
++ (0, import_react46.createElement)("div", { className: "bt-kv" }, (0, import_react46.createElement)("span", { className: presetDanger(room2.permission) ? "bt-perm-danger" : void 0 }, presetName(room2.permission, roster.permissions)))
) : null,
- roster.memory === false ? null : (0, import_react45.createElement)(MemoryRow, { key: "memory", owner: { id: room2.id, name: room2.name, group: true }, actions }),
- usage ? (0, import_react45.createElement)(
- roster.memory === false ? null : (0, import_react43.createElement)(MemoryRow, { key: "memory", owner: { id: room2.id, name: room2.name, group: true }, actions }),
- usage ? (0, import_react43.createElement)(
++ roster.memory === false ? null : (0, import_react46.createElement)(MemoryRow, { key: "memory", owner: { id: room2.id, name: room2.name, group: true }, actions }),
++ usage ? (0, import_react46.createElement)(
"div",
{ key: "usage" },
- (0, import_react45.createElement)("div", { className: "bt-section-title" }, t("Usage")),
- (0, import_react45.createElement)("div", { className: "bt-kv" }, (0, import_react45.createElement)("span", null, room2.name), (0, import_react45.createElement)("span", null, usage))
- (0, import_react43.createElement)("div", { className: "bt-section-title" }, t("Usage")),
- (0, import_react43.createElement)("div", { className: "bt-kv" }, (0, import_react43.createElement)("span", null, room2.name), (0, import_react43.createElement)("span", null, usage))
++ (0, import_react46.createElement)("div", { className: "bt-section-title" }, t("Usage")),
++ (0, import_react46.createElement)("div", { className: "bt-kv" }, (0, import_react46.createElement)("span", null, room2.name), (0, import_react46.createElement)("span", null, usage))
) : null
];
}
@@@ -16851,15 -16691,15 +17048,15 @@@ function DetailsDrawer({ sessionId, sta
const owner = roster.byId[sessionId];
const part = owner ? currentPart(owner) : sessionId;
const isMainBot = isMainOf(roster, owner?.id);
- const [tab, setTab] = (0, import_react45.useState)("details");
- const [tab, setTab] = (0, import_react43.useState)("details");
++ const [tab, setTab] = (0, import_react46.useState)("details");
const room2 = roster.roomsById[sessionId];
- const [view, setView] = (0, import_react45.useState)(startTab === "settings" && (owner || room2) ? "settings" : "overview");
- const [editing, setEditing] = (0, import_react45.useState)(Boolean(startRenaming && (roster.byId[sessionId] || roster.roomsById[sessionId])));
- const [draftName, setDraftName] = (0, import_react45.useState)(roster.byId[sessionId]?.name ?? (roster.roomsById[sessionId]?.named ? roster.roomsById[sessionId].name : ""));
- const [copied, setCopied] = (0, import_react45.useState)(false);
- const [error, setError] = (0, import_react45.useState)("");
- const [view, setView] = (0, import_react43.useState)(startTab === "settings" && (owner || room2) ? "settings" : "overview");
- const [editing, setEditing] = (0, import_react43.useState)(Boolean(startRenaming && (roster.byId[sessionId] || roster.roomsById[sessionId])));
- const [draftName, setDraftName] = (0, import_react43.useState)(roster.byId[sessionId]?.name ?? (roster.roomsById[sessionId]?.named ? roster.roomsById[sessionId].name : ""));
- const [copied, setCopied] = (0, import_react43.useState)(false);
- const [error, setError] = (0, import_react43.useState)("");
++ const [view, setView] = (0, import_react46.useState)(startTab === "settings" && (owner || room2) ? "settings" : "overview");
++ const [editing, setEditing] = (0, import_react46.useState)(Boolean(startRenaming && (roster.byId[sessionId] || roster.roomsById[sessionId])));
++ const [draftName, setDraftName] = (0, import_react46.useState)(roster.byId[sessionId]?.name ?? (roster.roomsById[sessionId]?.named ? roster.roomsById[sessionId].name : ""));
++ const [copied, setCopied] = (0, import_react46.useState)(false);
++ const [error, setError] = (0, import_react46.useState)("");
const glide = useGlide(tab);
- const last = (0, import_react45.useRef)({ view, tab, move: void 0 });
- const last = (0, import_react43.useRef)({ view, tab, move: void 0 });
++ const last = (0, import_react46.useRef)({ view, tab, move: void 0 });
if (last.current.view !== view) last.current = { view, tab, move: view === "settings" ? "in" : "out" };
else if (last.current.tab !== tab) last.current = { view, tab, move: "tab" };
const move = last.current.move;
@@@ -16884,21 -16724,21 +17081,21 @@@
setTimeout(() => setCopied(false), 1600);
});
};
- const errorLine = error ? (0, import_react45.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;
- const errorLine = error ? (0, import_react43.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;
++ const errorLine = error ? (0, import_react46.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;
if ((bot || room2) && view === "settings") {
return [
- (0, import_react45.createElement)(
- (0, import_react43.createElement)(
++ (0, import_react46.createElement)(
"div",
{ key: "head", className: "bt-subhead", "data-move": move },
- (0, import_react45.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to details"), onClick: () => setView("overview") }, (0, import_react45.createElement)(ChevronLeftIcon)),
- (0, import_react45.createElement)("span", { className: "bt-subhead-title" }, bot ? t("Settings") : t("Group settings")),
- hasStrip ? null : (0, import_react45.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close details"), onClick: close }, (0, import_react45.createElement)(CloseIcon))
- (0, import_react43.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to details"), onClick: () => setView("overview") }, (0, import_react43.createElement)(ChevronLeftIcon)),
- (0, import_react43.createElement)("span", { className: "bt-subhead-title" }, bot ? t("Settings") : t("Group settings")),
- hasStrip ? null : (0, import_react43.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close details"), onClick: close }, (0, import_react43.createElement)(CloseIcon))
++ (0, import_react46.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to details"), onClick: () => setView("overview") }, (0, import_react46.createElement)(ChevronLeftIcon)),
++ (0, import_react46.createElement)("span", { className: "bt-subhead-title" }, bot ? t("Settings") : t("Group settings")),
++ hasStrip ? null : (0, import_react46.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close details"), onClick: close }, (0, import_react46.createElement)(CloseIcon))
),
- (0, import_react45.createElement)(
- (0, import_react43.createElement)(
++ (0, import_react46.createElement)(
"div",
{ key: "set-body", className: "bt-drawer-body bt-set-body", "data-move": move },
errorLine,
- bot ? (0, import_react45.createElement)(BotSettingsForm, { bot, roster, actions, run: run2 }) : (0, import_react45.createElement)(GroupSettingsForm, { room: room2, roster, actions, run: run2, onDeleted: close })
- bot ? (0, import_react43.createElement)(BotSettingsForm, { bot, roster, actions, run: run2 }) : (0, import_react43.createElement)(GroupSettingsForm, { room: room2, roster, actions, run: run2, onDeleted: close })
++ bot ? (0, import_react46.createElement)(BotSettingsForm, { bot, roster, actions, run: run2 }) : (0, import_react46.createElement)(GroupSettingsForm, { room: room2, roster, actions, run: run2, onDeleted: close })
)
];
}
@@@ -16909,18 -16749,18 +17106,18 @@@
canTerminal: actions.canOpenTerminal?.() === true,
canFiles: actions.canOpenFiles?.() === true
}).map((key) => menuItemFor(key, actions, sessionId));
- const top = (0, import_react45.createElement)(
- const top = (0, import_react43.createElement)(
++ const top = (0, import_react46.createElement)(
"div",
{ className: "bt-drawer-top", "data-move": side },
- bot || room2 ? (0, import_react45.createElement)("button", { type: "button", className: "bt-round", "aria-label": bot ? t("Edit Bot") : t("Group settings"), title: bot ? t("Edit Bot") : t("Group settings"), "data-info-row": "settings", onClick: () => setView("settings") }, (0, import_react45.createElement)(GearIcon)) : null,
- more.length > 0 ? (0, import_react45.createElement)("span", { "data-info-row": "more" }, (0, import_react45.createElement)(PanelMenu, { items: more, className: "bt-round", "aria-label": t("More") })) : null,
- bot || room2 ? (0, import_react45.createElement)("button", { type: "button", className: "bt-round", "aria-label": copied ? t("Copied conversation") : t("Share conversation"), title: copied ? t("Copied") : t("Copy conversation as Markdown"), onClick: share }, copied ? (0, import_react45.createElement)("span", { key: "copied", className: "bt-pop-in" }, "✓") : (0, import_react45.createElement)(ShareIcon)) : null,
- hasStrip ? null : (0, import_react45.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Close details"), onClick: close }, (0, import_react45.createElement)(CloseIcon))
- bot || room2 ? (0, import_react43.createElement)("button", { type: "button", className: "bt-round", "aria-label": bot ? t("Edit Bot") : t("Group settings"), title: bot ? t("Edit Bot") : t("Group settings"), "data-info-row": "settings", onClick: () => setView("settings") }, (0, import_react43.createElement)(GearIcon)) : null,
- more.length > 0 ? (0, import_react43.createElement)("span", { "data-info-row": "more" }, (0, import_react43.createElement)(PanelMenu, { items: more, className: "bt-round", "aria-label": t("More") })) : null,
- bot || room2 ? (0, import_react43.createElement)("button", { type: "button", className: "bt-round", "aria-label": copied ? t("Copied conversation") : t("Share conversation"), title: copied ? t("Copied") : t("Copy conversation as Markdown"), onClick: share }, copied ? (0, import_react43.createElement)("span", { key: "copied", className: "bt-pop-in" }, "✓") : (0, import_react43.createElement)(ShareIcon)) : null,
- hasStrip ? null : (0, import_react43.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Close details"), onClick: close }, (0, import_react43.createElement)(CloseIcon))
++ bot || room2 ? (0, import_react46.createElement)("button", { type: "button", className: "bt-round", "aria-label": bot ? t("Edit Bot") : t("Group settings"), title: bot ? t("Edit Bot") : t("Group settings"), "data-info-row": "settings", onClick: () => setView("settings") }, (0, import_react46.createElement)(GearIcon)) : null,
++ more.length > 0 ? (0, import_react46.createElement)("span", { "data-info-row": "more" }, (0, import_react46.createElement)(PanelMenu, { items: more, className: "bt-round", "aria-label": t("More") })) : null,
++ bot || room2 ? (0, import_react46.createElement)("button", { type: "button", className: "bt-round", "aria-label": copied ? t("Copied conversation") : t("Share conversation"), title: copied ? t("Copied") : t("Copy conversation as Markdown"), onClick: share }, copied ? (0, import_react46.createElement)("span", { key: "copied", className: "bt-pop-in" }, "✓") : (0, import_react46.createElement)(ShareIcon)) : null,
++ hasStrip ? null : (0, import_react46.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Close details"), onClick: close }, (0, import_react46.createElement)(CloseIcon))
);
if (!bot && !room2) {
return [
- (0, import_react45.createElement)(import_react45.Fragment, { key: "top" }, top),
- (0, import_react45.createElement)("div", { key: "body", className: "bt-drawer-body" }, (0, import_react45.createElement)("div", { className: "bt-muted" }, t("This conversation is not part of your Bot team.")))
- (0, import_react43.createElement)(import_react43.Fragment, { key: "top" }, top),
- (0, import_react43.createElement)("div", { key: "body", className: "bt-drawer-body" }, (0, import_react43.createElement)("div", { className: "bt-muted" }, t("This conversation is not part of your Bot team.")))
++ (0, import_react46.createElement)(import_react46.Fragment, { key: "top" }, top),
++ (0, import_react46.createElement)("div", { key: "body", className: "bt-drawer-body" }, (0, import_react46.createElement)("div", { className: "bt-muted" }, t("This conversation is not part of your Bot team.")))
];
}
const current = bot?.name ?? room2.name;
@@@ -16934,12 -16774,12 +17131,12 @@@
const subtitle = bot ? bot.role : roomSubtitle(room2, roster);
const tabs = bot ? ["details", "browser"] : ["details"];
return [
- (0, import_react45.createElement)(import_react45.Fragment, { key: "top" }, top),
- (0, import_react45.createElement)(
- (0, import_react43.createElement)(import_react43.Fragment, { key: "top" }, top),
- (0, import_react43.createElement)(
++ (0, import_react46.createElement)(import_react46.Fragment, { key: "top" }, top),
++ (0, import_react46.createElement)(
"div",
{ key: "id", className: "bt-drawer-id", "data-move": side },
- bot ? (0, import_react45.createElement)(BotAvatar, { bot, size: 64, state: botState(running, doing, roster.questions?.[part] !== void 0), main: isMainBot, badge: false, gaze: true, pokeable: true }) : (0, import_react45.createElement)(MemberPile, { room: room2, roster }),
- editing ? (0, import_react45.createElement)("input", {
- bot ? (0, import_react43.createElement)(BotAvatar, { bot, size: 64, state: botState(running, doing, roster.questions?.[part] !== void 0), main: isMainBot, badge: false, gaze: true, pokeable: true }) : (0, import_react43.createElement)(MemberPile, { room: room2, roster }),
- editing ? (0, import_react43.createElement)("input", {
++ bot ? (0, import_react46.createElement)(BotAvatar, { bot, size: 64, state: botState(running, doing, roster.questions?.[part] !== void 0), main: isMainBot, badge: false, gaze: true, pokeable: true }) : (0, import_react46.createElement)(MemberPile, { room: room2, roster }),
++ editing ? (0, import_react46.createElement)("input", {
className: "bt-drawer-name-input",
autoFocus: true,
value: draftName,
@@@ -16954,50 -16794,50 +17151,50 @@@
setEditing(false);
}
}
- }) : (0, import_react45.createElement)("button", { type: "button", className: "bt-drawer-name", "aria-label": t("Rename {name}", { name: current }), title: t("Rename"), onClick: () => {
- }) : (0, import_react43.createElement)("button", { type: "button", className: "bt-drawer-name", "aria-label": t("Rename {name}", { name: current }), title: t("Rename"), onClick: () => {
++ }) : (0, import_react46.createElement)("button", { type: "button", className: "bt-drawer-name", "aria-label": t("Rename {name}", { name: current }), title: t("Rename"), onClick: () => {
setDraftName(room2 && !room2.named ? "" : current);
setEditing(true);
} }, current),
- subtitle ? (0, import_react45.createElement)("span", { className: "bt-drawer-role" }, subtitle) : null
- subtitle ? (0, import_react43.createElement)("span", { className: "bt-drawer-role" }, subtitle) : null
++ subtitle ? (0, import_react46.createElement)("span", { className: "bt-drawer-role" }, subtitle) : null
),
- tabs.length > 1 ? (0, import_react45.createElement)(
- tabs.length > 1 ? (0, import_react43.createElement)(
++ tabs.length > 1 ? (0, import_react46.createElement)(
"div",
{ key: "tabs", ref: glide.box, className: "bt-tabs", role: "tablist", "data-move": side },
- (0, import_react45.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
- tabs.map((key) => (0, import_react45.createElement)("button", { key, type: "button", role: "tab", className: "bt-tab", "aria-selected": tab === key, onClick: () => setTab(key) }, t(TAB_LABELS[key])))
- (0, import_react43.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
- tabs.map((key) => (0, import_react43.createElement)("button", { key, type: "button", role: "tab", className: "bt-tab", "aria-selected": tab === key, onClick: () => setTab(key) }, t(TAB_LABELS[key])))
++ (0, import_react46.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
++ tabs.map((key) => (0, import_react46.createElement)("button", { key, type: "button", role: "tab", className: "bt-tab", "aria-selected": tab === key, onClick: () => setTab(key) }, t(TAB_LABELS[key])))
) : null,
- (0, import_react45.createElement)(
- (0, import_react43.createElement)(
++ (0, import_react46.createElement)(
"div",
{ key: `body:${tab}`, className: "bt-drawer-body", "data-move": move },
errorLine,
- room2 && tab === "details" ? (0, import_react45.createElement)(GroupOverview, { room: room2, roster, actions, usage, useWork, openSettings: () => setView("settings") }) : null,
- room2 && tab === "details" ? (0, import_react43.createElement)(GroupOverview, { room: room2, roster, actions, usage, useWork, openSettings: () => setView("settings") }) : null,
++ room2 && tab === "details" ? (0, import_react46.createElement)(GroupOverview, { room: room2, roster, actions, usage, useWork, openSettings: () => setView("settings") }) : null,
bot && tab === "details" ? [
- (0, import_react45.createElement)(RunStats, { key: "stats", bot, part, running, actions }),
- (0, import_react45.createElement)(
- (0, import_react43.createElement)(RunStats, { key: "stats", bot, part, running, actions }),
- (0, import_react43.createElement)(
++ (0, import_react46.createElement)(RunStats, { key: "stats", bot, part, running, actions }),
++ (0, import_react46.createElement)(
"div",
{ key: "model", className: "bt-drawer-model" },
- (0, import_react45.createElement)("div", { className: "bt-section-title" }, t("Model")),
- (0, import_react45.createElement)(ModelMenu, { bot, roster, actions, run: run2, wide: true }),
- modelOf(bot, roster) ? null : (0, import_react45.createElement)("div", { className: "bt-note" }, t("Pick a model and {name} can start.", { name: bot.name }))
- (0, import_react43.createElement)("div", { className: "bt-section-title" }, t("Model")),
- (0, import_react43.createElement)(ModelMenu, { bot, roster, actions, run: run2, wide: true }),
- modelOf(bot, roster) ? null : (0, import_react43.createElement)("div", { className: "bt-note" }, t("Pick a model and {name} can start.", { name: bot.name }))
++ (0, import_react46.createElement)("div", { className: "bt-section-title" }, t("Model")),
++ (0, import_react46.createElement)(ModelMenu, { bot, roster, actions, run: run2, wide: true }),
++ modelOf(bot, roster) ? null : (0, import_react46.createElement)("div", { className: "bt-note" }, t("Pick a model and {name} can start.", { name: bot.name }))
),
- (0, import_react45.createElement)(PermissionRow, { key: "permission", bot, roster, actions, run: run2 }),
- (0, import_react45.createElement)(
- (0, import_react43.createElement)(PermissionRow, { key: "permission", bot, roster, actions, run: run2 }),
- (0, import_react43.createElement)(
++ (0, import_react46.createElement)(PermissionRow, { key: "permission", bot, roster, actions, run: run2 }),
++ (0, import_react46.createElement)(
"div",
{ key: "folder", className: "bt-drawer-model" },
- (0, import_react45.createElement)("div", { className: "bt-section-title" }, t("Working folder")),
- (0, import_react45.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, wide: true, onPick: (workDir) => run2(actions.updateBot(bot.id, { workDir })) })
- (0, import_react43.createElement)("div", { className: "bt-section-title" }, t("Working folder")),
- (0, import_react43.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, wide: true, onPick: (workDir) => run2(actions.updateBot(bot.id, { workDir })) })
++ (0, import_react46.createElement)("div", { className: "bt-section-title" }, t("Working folder")),
++ (0, import_react46.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, wide: true, onPick: (workDir) => run2(actions.updateBot(bot.id, { workDir })) })
),
- bot.instructions ? (0, import_react45.createElement)(About, { key: "about", text: bot.instructions }) : (0, import_react45.createElement)("button", { key: "about", type: "button", className: "bt-more", onClick: () => setView("settings") }, t("Add instructions in Bot settings")),
- roster.memory === false ? null : (0, import_react45.createElement)(MemoryRow, { key: "memory", owner: { id: bot.id, name: bot.name }, actions }),
- usage ? (0, import_react45.createElement)(
- bot.instructions ? (0, import_react43.createElement)(About, { key: "about", text: bot.instructions }) : (0, import_react43.createElement)("button", { key: "about", type: "button", className: "bt-more", onClick: () => setView("settings") }, t("Add instructions in Bot settings")),
- roster.memory === false ? null : (0, import_react43.createElement)(MemoryRow, { key: "memory", owner: { id: bot.id, name: bot.name }, actions }),
- usage ? (0, import_react43.createElement)(
++ bot.instructions ? (0, import_react46.createElement)(About, { key: "about", text: bot.instructions }) : (0, import_react46.createElement)("button", { key: "about", type: "button", className: "bt-more", onClick: () => setView("settings") }, t("Add instructions in Bot settings")),
++ roster.memory === false ? null : (0, import_react46.createElement)(MemoryRow, { key: "memory", owner: { id: bot.id, name: bot.name }, actions }),
++ usage ? (0, import_react46.createElement)(
"div",
{ key: "usage" },
- (0, import_react45.createElement)("div", { className: "bt-section-title" }, t("Usage")),
- (0, import_react45.createElement)("div", { className: "bt-kv" }, (0, import_react45.createElement)("span", null, bot.name), (0, import_react45.createElement)("span", null, usage))
- (0, import_react43.createElement)("div", { className: "bt-section-title" }, t("Usage")),
- (0, import_react43.createElement)("div", { className: "bt-kv" }, (0, import_react43.createElement)("span", null, bot.name), (0, import_react43.createElement)("span", null, usage))
++ (0, import_react46.createElement)("div", { className: "bt-section-title" }, t("Usage")),
++ (0, import_react46.createElement)("div", { className: "bt-kv" }, (0, import_react46.createElement)("span", null, bot.name), (0, import_react46.createElement)("span", null, usage))
) : null,
- (0, import_react45.createElement)(ScheduleSummary, { key: "routines", bot, actions })
- (0, import_react43.createElement)(ScheduleSummary, { key: "routines", bot, actions })
++ (0, import_react46.createElement)(ScheduleSummary, { key: "routines", bot, actions })
] : null,
- bot && tab === "browser" ? (0, import_react45.createElement)(BrowserCards, { bot, sessionId, roster, actions, useBrowserTabs, useBrowserPages }) : null
- bot && tab === "browser" ? (0, import_react43.createElement)(BrowserCards, { bot, sessionId, roster, actions, useBrowserTabs, useBrowserPages }) : null
++ bot && tab === "browser" ? (0, import_react46.createElement)(BrowserCards, { bot, sessionId, roster, actions, useBrowserTabs, useBrowserPages }) : null
)
];
}
@@@ -17008,7 -16848,7 +17205,7 @@@ function rectsOverlap(a, b)
}
// src/client/browser-pane.js
- var import_react46 = require("react");
-var import_react44 = require("react");
++var import_react47 = require("react");
var import_react_dom8 = require("react-dom");
var PANEL_LINGER_MS = 300;
var WIDTH_KEY = STORAGE.browserWidth;
@@@ -17025,10 -16865,10 +17222,10 @@@ var EMPTY_TABS2 = { ids: [], active: nu
var SPRING_LEAD2 = springEasing(576, 39.4);
var SPRING_TRAIL2 = springEasing(144, 19.7);
var icon = (paths) => function BrowserIcon() {
- return (0, import_react46.createElement)(
- return (0, import_react44.createElement)(
++ return (0, import_react47.createElement)(
"svg",
{ width: 16, height: 16, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true },
- paths.map((d, index) => (0, import_react46.createElement)("path", { key: index, d }))
- paths.map((d, index) => (0, import_react44.createElement)("path", { key: index, d }))
++ paths.map((d, index) => (0, import_react47.createElement)("path", { key: index, d }))
);
};
var GlobeIcon2 = icon(["M10 3a7 7 0 1 0 0 14 7 7 0 0 0 0-14z", "M3 10h14", "M10 3c2 2.2 2.9 4.5 2.9 7S12 14.8 10 17c-2-2.2-2.9-4.5-2.9-7S8 5.2 10 3z"]);
@@@ -17043,9 -16883,9 +17240,9 @@@ var ImportIcon = icon(["M10 3.5v8.5", "
var FileIcon = icon(["M6 3.5h5.5L14.5 6.5v10H6z", "M11 3.5v3.5h3.5"]);
var WindowIcon = icon(["M4 5h12v9.5H4z", "M4 7.5h12"]);
function Favicon({ src, className }) {
- const [failed, setFailed] = (0, import_react46.useState)(null);
- if (!src || failed === src) return (0, import_react46.createElement)("span", { className: `${className} bt-ptab-globe` }, (0, import_react46.createElement)(GlobeIcon2));
- return (0, import_react46.createElement)("img", { className, src, alt: "", "aria-hidden": true, onError: () => setFailed(src) });
- const [failed, setFailed] = (0, import_react44.useState)(null);
- if (!src || failed === src) return (0, import_react44.createElement)("span", { className: `${className} bt-ptab-globe` }, (0, import_react44.createElement)(GlobeIcon2));
- return (0, import_react44.createElement)("img", { className, src, alt: "", "aria-hidden": true, onError: () => setFailed(src) });
++ const [failed, setFailed] = (0, import_react47.useState)(null);
++ if (!src || failed === src) return (0, import_react47.createElement)("span", { className: `${className} bt-ptab-globe` }, (0, import_react47.createElement)(GlobeIcon2));
++ return (0, import_react47.createElement)("img", { className, src, alt: "", "aria-hidden": true, onError: () => setFailed(src) });
}
var savedWidth = () => {
try {
@@@ -17100,9 -16940,9 +17297,9 @@@ var shortAddress = (url) => String(url
var reducedMotion2 = () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
var tabLabel = (page) => page.title || shortAddress(page.url) || t("New tab");
function PanelMenu({ items, className, "aria-label": label }) {
- const [open, setOpen] = (0, import_react46.useState)(false);
- const wrap = (0, import_react46.useRef)(null);
- (0, import_react46.useEffect)(() => {
- const [open, setOpen] = (0, import_react44.useState)(false);
- const wrap = (0, import_react44.useRef)(null);
- (0, import_react44.useEffect)(() => {
++ const [open, setOpen] = (0, import_react47.useState)(false);
++ const wrap = (0, import_react47.useRef)(null);
++ (0, import_react47.useEffect)(() => {
if (!open) return void 0;
const onDown = (event) => {
if (wrap.current && !wrap.current.contains(event.target)) setOpen(false);
@@@ -17120,10 -16960,10 +17317,10 @@@
};
}, [open]);
if (items.length === 0) return null;
- return (0, import_react46.createElement)(
- return (0, import_react44.createElement)(
++ return (0, import_react47.createElement)(
"span",
{ className: "bt-pmenu", ref: wrap },
- (0, import_react46.createElement)("button", {
- (0, import_react44.createElement)("button", {
++ (0, import_react47.createElement)("button", {
type: "button",
className,
"aria-label": label,
@@@ -17131,11 -16971,11 +17328,11 @@@
"aria-haspopup": "menu",
"aria-expanded": open,
onClick: () => setOpen((value) => !value)
- }, (0, import_react46.createElement)(DotsIcon)),
- open ? (0, import_react46.createElement)(
- }, (0, import_react44.createElement)(DotsIcon)),
- open ? (0, import_react44.createElement)(
++ }, (0, import_react47.createElement)(DotsIcon)),
++ open ? (0, import_react47.createElement)(
"div",
{ className: "bt-pmenu-pop", role: "menu" },
- items.map((item, index) => item.sep ? (0, import_react46.createElement)("span", { key: `sep-${index}`, className: "bt-pmenu-sep", role: "separator" }) : (0, import_react46.createElement)("button", {
- items.map((item, index) => item.sep ? (0, import_react44.createElement)("span", { key: `sep-${index}`, className: "bt-pmenu-sep", role: "separator" }) : (0, import_react44.createElement)("button", {
++ items.map((item, index) => item.sep ? (0, import_react47.createElement)("span", { key: `sep-${index}`, className: "bt-pmenu-sep", role: "separator" }) : (0, import_react47.createElement)("button", {
key: item.key,
type: "button",
role: "menuitem",
@@@ -17144,7 -16984,7 +17341,7 @@@
setOpen(false);
item.onPick();
}
- }, (0, import_react46.createElement)(item.icon), (0, import_react46.createElement)("span", null, item.label)))
- }, (0, import_react44.createElement)(item.icon), (0, import_react44.createElement)("span", null, item.label)))
++ }, (0, import_react47.createElement)(item.icon), (0, import_react47.createElement)("span", null, item.label)))
) : null
);
}
@@@ -17170,12 -17010,12 +17367,12 @@@ function menuItemFor(key, actions, subj
var sideTitle = (chat) => chat?.entries?.[0]?.question?.trim() || t("Side chat");
function PanelStrip({ bot, subject, view, ids, active, sides, side, canBrowse, reading, onView, actions, useBrowserPages }) {
const pages = useBrowserPages((map) => map);
- const wrap = (0, import_react46.useRef)(null);
- const ind = (0, import_react46.useRef)(null);
- const spot = (0, import_react46.useRef)(null);
- const under = (0, import_react46.useRef)(null);
- const watcher = (0, import_react46.useRef)(null);
- (0, import_react46.useLayoutEffect)(() => {
- const wrap = (0, import_react44.useRef)(null);
- const ind = (0, import_react44.useRef)(null);
- const spot = (0, import_react44.useRef)(null);
- const under = (0, import_react44.useRef)(null);
- const watcher = (0, import_react44.useRef)(null);
- (0, import_react44.useLayoutEffect)(() => {
++ const wrap = (0, import_react47.useRef)(null);
++ const ind = (0, import_react47.useRef)(null);
++ const spot = (0, import_react47.useRef)(null);
++ const under = (0, import_react47.useRef)(null);
++ const watcher = (0, import_react47.useRef)(null);
++ (0, import_react47.useLayoutEffect)(() => {
const box = wrap.current;
const capsule = ind.current;
if (!box || !capsule) return void 0;
@@@ -17208,7 -17048,7 +17405,7 @@@
trail.cancel();
};
});
- (0, import_react46.useEffect)(() => {
- (0, import_react44.useEffect)(() => {
++ (0, import_react47.useEffect)(() => {
const box = wrap.current;
if (!box) return void 0;
const observer = new ResizeObserver(() => {
@@@ -17232,13 -17072,13 +17429,13 @@@
canTerminal: actions.canOpenTerminal?.() === true,
canFiles: actions.canOpenFiles?.() === true
}).map((key) => menuItemFor(key, actions, subject));
- return (0, import_react46.createElement)(
- return (0, import_react44.createElement)(
++ return (0, import_react47.createElement)(
"div",
{ className: "bt-ptabs", role: "tablist", "aria-label": t("Panel tabs") },
- (0, import_react46.createElement)(
- (0, import_react44.createElement)(
++ (0, import_react47.createElement)(
"div",
{ className: "bt-ptabs-in", ref: wrap },
- (0, import_react46.createElement)(
- (0, import_react44.createElement)(
++ (0, import_react47.createElement)(
"button",
{
type: "button",
@@@ -17248,13 -17088,13 +17445,13 @@@
title: bot.name,
onClick: () => onView("details")
},
- (0, import_react46.createElement)(BotMark, { bot, size: 20, state: reading ? "searching" : "idle" }),
- view === "details" ? (0, import_react46.createElement)("span", { className: "bt-ptab-name" }, bot.name) : null
- (0, import_react44.createElement)(BotMark, { bot, size: 20, state: reading ? "searching" : "idle" }),
- view === "details" ? (0, import_react44.createElement)("span", { className: "bt-ptab-name" }, bot.name) : null
++ (0, import_react47.createElement)(BotMark, { bot, size: 20, state: reading ? "searching" : "idle" }),
++ view === "details" ? (0, import_react47.createElement)("span", { className: "bt-ptab-name" }, bot.name) : null
),
ids.map((tabId) => {
const page = pages[tabId] ?? EMPTY_PAGE;
const on = view === "browser" && tabId === active;
- return (0, import_react46.createElement)(
- return (0, import_react44.createElement)(
++ return (0, import_react47.createElement)(
"button",
{
key: tabId,
@@@ -17275,9 -17115,9 +17472,9 @@@
}
}
},
- (0, import_react46.createElement)(Favicon, { src: page.favicon, className: "bt-ptab-fav" }),
- (0, import_react46.createElement)("span", { className: "bt-ptab-title" }, tabLabel(page)),
- (0, import_react46.createElement)("span", {
- (0, import_react44.createElement)(Favicon, { src: page.favicon, className: "bt-ptab-fav" }),
- (0, import_react44.createElement)("span", { className: "bt-ptab-title" }, tabLabel(page)),
- (0, import_react44.createElement)("span", {
++ (0, import_react47.createElement)(Favicon, { src: page.favicon, className: "bt-ptab-fav" }),
++ (0, import_react47.createElement)("span", { className: "bt-ptab-title" }, tabLabel(page)),
++ (0, import_react47.createElement)("span", {
className: "bt-ptab-x",
role: "button",
"aria-label": t("Close tab"),
@@@ -17291,7 -17131,7 +17488,7 @@@
}),
sides.map((chat) => {
const on = view === "side" && chat.id === side;
- return (0, import_react46.createElement)(
- return (0, import_react44.createElement)(
++ return (0, import_react47.createElement)(
"button",
{
key: chat.id,
@@@ -17309,9 -17149,9 +17506,9 @@@
}
}
},
- (0, import_react46.createElement)("span", { className: "bt-ptab-globe", "aria-hidden": true }, (0, import_react46.createElement)(SideIcon)),
- (0, import_react46.createElement)("span", { className: "bt-ptab-title" }, sideTitle(chat)),
- (0, import_react46.createElement)("span", {
- (0, import_react44.createElement)("span", { className: "bt-ptab-globe", "aria-hidden": true }, (0, import_react44.createElement)(SideIcon)),
- (0, import_react44.createElement)("span", { className: "bt-ptab-title" }, sideTitle(chat)),
- (0, import_react44.createElement)("span", {
++ (0, import_react47.createElement)("span", { className: "bt-ptab-globe", "aria-hidden": true }, (0, import_react47.createElement)(SideIcon)),
++ (0, import_react47.createElement)("span", { className: "bt-ptab-title" }, sideTitle(chat)),
++ (0, import_react47.createElement)("span", {
className: "bt-ptab-x",
role: "button",
"aria-label": t("Close side chat"),
@@@ -17323,30 -17163,30 +17520,30 @@@
}, "×")
);
}),
- (0, import_react46.createElement)("span", { ref: ind, className: "bt-ptab-ind", "aria-hidden": true })
- (0, import_react44.createElement)("span", { ref: ind, className: "bt-ptab-ind", "aria-hidden": true })
++ (0, import_react47.createElement)("span", { ref: ind, className: "bt-ptab-ind", "aria-hidden": true })
),
// The `···` and Close stay outside the scrolling tabs, so a narrow panel keeps both.
- (0, import_react46.createElement)(PanelMenu, { items, className: "bt-ptab-new", "aria-label": t("More") }),
- (0, import_react46.createElement)("button", { type: "button", className: "bt-icon-btn bt-ptab-close", "aria-label": t("Close panel"), title: t("Close panel"), onClick: () => actions.closePanel() }, (0, import_react46.createElement)(CloseIcon3))
- (0, import_react44.createElement)(PanelMenu, { items, className: "bt-ptab-new", "aria-label": t("More") }),
- (0, import_react44.createElement)("button", { type: "button", className: "bt-icon-btn bt-ptab-close", "aria-label": t("Close panel"), title: t("Close panel"), onClick: () => actions.closePanel() }, (0, import_react44.createElement)(CloseIcon2))
++ (0, import_react47.createElement)(PanelMenu, { items, className: "bt-ptab-new", "aria-label": t("More") }),
++ (0, import_react47.createElement)("button", { type: "button", className: "bt-icon-btn bt-ptab-close", "aria-label": t("Close panel"), title: t("Close panel"), onClick: () => actions.closePanel() }, (0, import_react47.createElement)(CloseIcon3))
);
}
function BrowserView({ bot, tabId, leaving, landed, actions, useBrowserPages, hold }) {
const page = useBrowserPages((pages) => pages[tabId ?? ""]) ?? EMPTY_PAGE;
- const frame = (0, import_react46.useRef)(null);
- const input = (0, import_react46.useRef)(null);
- const [draft, setDraft] = (0, import_react46.useState)(null);
- const [covered, setCovered] = (0, import_react46.useState)(false);
- const frame = (0, import_react44.useRef)(null);
- const input = (0, import_react44.useRef)(null);
- const [draft, setDraft] = (0, import_react44.useState)(null);
- const [covered, setCovered] = (0, import_react44.useState)(false);
++ const frame = (0, import_react47.useRef)(null);
++ const input = (0, import_react47.useRef)(null);
++ const [draft, setDraft] = (0, import_react47.useState)(null);
++ const [covered, setCovered] = (0, import_react47.useState)(false);
const imports = actions.browserImport;
- const [flow, setFlow] = (0, import_react46.useState)(null);
- const flowRef = (0, import_react46.useRef)(null);
- const [sources, setSources] = (0, import_react46.useState)(null);
- const [busy, setBusy] = (0, import_react46.useState)(false);
- const [flow, setFlow] = (0, import_react44.useState)(null);
- const flowRef = (0, import_react44.useRef)(null);
- const [sources, setSources] = (0, import_react44.useState)(null);
- const [busy, setBusy] = (0, import_react44.useState)(false);
++ const [flow, setFlow] = (0, import_react47.useState)(null);
++ const flowRef = (0, import_react47.useRef)(null);
++ const [sources, setSources] = (0, import_react47.useState)(null);
++ const [busy, setBusy] = (0, import_react47.useState)(false);
const setFlowTracked = (next) => {
flowRef.current = typeof next === "function" ? next(flowRef.current) : next;
setFlow(flowRef.current);
};
const showGuest = landed && !leaving && !covered && Boolean(page.url) && !page.error && flow === null;
- (0, import_react46.useEffect)(() => {
- (0, import_react44.useEffect)(() => {
++ (0, import_react47.useEffect)(() => {
const update = () => {
const panel = frame.current?.getBoundingClientRect();
const overlaps2 = panel && [...document.querySelectorAll('[role="dialog"],[role="menu"],[role="listbox"]')].some((element) => rectsOverlap(panel, element.getBoundingClientRect()));
@@@ -17361,7 -17201,7 +17558,7 @@@
window.removeEventListener("resize", update);
};
}, []);
- (0, import_react46.useEffect)(() => {
- (0, import_react44.useEffect)(() => {
++ (0, import_react47.useEffect)(() => {
setFlowTracked(null);
return () => {
const id = typeof flowRef.current === "object" && flowRef.current !== null ? flowRef.current.id : null;
@@@ -17405,7 -17245,7 +17602,7 @@@
if (id) void imports?.cancel(id).catch(() => {
});
};
- (0, import_react46.useLayoutEffect)(() => {
- (0, import_react44.useLayoutEffect)(() => {
++ (0, import_react47.useLayoutEffect)(() => {
const element = frame.current;
if (!element || leaving || !tabId) {
void actions.browserShow(null);
@@@ -17431,7 -17271,7 +17628,7 @@@
window.removeEventListener("resize", schedule);
};
}, [tabId, showGuest, leaving]);
- (0, import_react46.useEffect)(() => {
- (0, import_react44.useEffect)(() => {
++ (0, import_react47.useEffect)(() => {
setDraft(null);
if (landed && !page.url) input.current?.focus();
}, [tabId, landed]);
@@@ -17447,38 -17287,38 +17644,38 @@@
};
const editing = draft !== null;
const secure = /^https:/i.test(page.url);
- return (0, import_react46.createElement)(
- return (0, import_react44.createElement)(
++ return (0, import_react47.createElement)(
"div",
{ className: "bt-panel-view bt-panel-browser", "aria-label": t("{name}'s browser", { name: bot.name }) },
- actions.browserTakeover ? (0, import_react46.createElement)(
- actions.browserTakeover ? (0, import_react44.createElement)(
++ actions.browserTakeover ? (0, import_react47.createElement)(
"div",
{ className: "bt-browser-takeover", "data-held": hold?.by === "user" || void 0 },
- (0, import_react46.createElement)("span", null, hold?.by === "user" ? t("You control this browser") : hold?.by === "bot" ? t("The Bot handed this browser to you: {reason}", { reason: hold.reason }) : t("The Bot controls this browser")),
- hold?.by ? (0, import_react46.createElement)("button", { type: "button", onClick: () => void actions.browserGiveBack(bot.id) }, t("Give back")) : (0, import_react46.createElement)(
- (0, import_react44.createElement)("span", null, hold?.by === "user" ? t("You control this browser") : hold?.by === "bot" ? t("The Bot handed this browser to you: {reason}", { reason: hold.reason }) : t("The Bot controls this browser")),
- hold?.by ? (0, import_react44.createElement)("button", { type: "button", onClick: () => void actions.browserGiveBack(bot.id) }, t("Give back")) : (0, import_react44.createElement)(
++ (0, import_react47.createElement)("span", null, hold?.by === "user" ? t("You control this browser") : hold?.by === "bot" ? t("The Bot handed this browser to you: {reason}", { reason: hold.reason }) : t("The Bot controls this browser")),
++ hold?.by ? (0, import_react47.createElement)("button", { type: "button", onClick: () => void actions.browserGiveBack(bot.id) }, t("Give back")) : (0, import_react47.createElement)(
"span",
{ className: "bt-browser-takeover-actions" },
- (0, import_react46.createElement)("button", { type: "button", onClick: () => void actions.browserTakeover(bot.id) }, t("Take over")),
- (0, import_react46.createElement)("button", { type: "button", onClick: () => void actions.browserStop(bot.id) }, t("Stop"))
- (0, import_react44.createElement)("button", { type: "button", onClick: () => void actions.browserTakeover(bot.id) }, t("Take over")),
- (0, import_react44.createElement)("button", { type: "button", onClick: () => void actions.browserStop(bot.id) }, t("Stop"))
++ (0, import_react47.createElement)("button", { type: "button", onClick: () => void actions.browserTakeover(bot.id) }, t("Take over")),
++ (0, import_react47.createElement)("button", { type: "button", onClick: () => void actions.browserStop(bot.id) }, t("Stop"))
)
) : null,
- (0, import_react46.createElement)(
- (0, import_react44.createElement)(
++ (0, import_react47.createElement)(
"div",
{ className: "bt-browser-bar" },
- (0, import_react46.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back"), title: t("Back"), disabled: !page.canGoBack, onClick: () => actions.browserCommand(tabId, "back") }, (0, import_react46.createElement)(BackIcon)),
- (0, import_react46.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Forward"), title: t("Forward"), disabled: !page.canGoForward, onClick: () => actions.browserCommand(tabId, "forward") }, (0, import_react46.createElement)(ForwardIcon)),
- (0, import_react46.createElement)("button", {
- (0, import_react44.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back"), title: t("Back"), disabled: !page.canGoBack, onClick: () => actions.browserCommand(tabId, "back") }, (0, import_react44.createElement)(BackIcon)),
- (0, import_react44.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Forward"), title: t("Forward"), disabled: !page.canGoForward, onClick: () => actions.browserCommand(tabId, "forward") }, (0, import_react44.createElement)(ForwardIcon)),
- (0, import_react44.createElement)("button", {
++ (0, import_react47.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back"), title: t("Back"), disabled: !page.canGoBack, onClick: () => actions.browserCommand(tabId, "back") }, (0, import_react47.createElement)(BackIcon)),
++ (0, import_react47.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Forward"), title: t("Forward"), disabled: !page.canGoForward, onClick: () => actions.browserCommand(tabId, "forward") }, (0, import_react47.createElement)(ForwardIcon)),
++ (0, import_react47.createElement)("button", {
type: "button",
className: "bt-icon-btn",
disabled: !page.url,
"aria-label": page.loading ? t("Stop") : t("Reload"),
title: page.loading ? t("Stop") : t("Reload"),
onClick: () => actions.browserCommand(tabId, page.loading ? "stop" : "reload")
- }, (0, import_react46.createElement)(page.loading ? StopIcon : ReloadIcon)),
- (0, import_react46.createElement)(
- }, (0, import_react44.createElement)(page.loading ? StopIcon : ReloadIcon)),
- (0, import_react44.createElement)(
++ }, (0, import_react47.createElement)(page.loading ? StopIcon : ReloadIcon)),
++ (0, import_react47.createElement)(
"form",
{ className: "bt-browser-address", onSubmit: go, "data-editing": editing || void 0 },
- (0, import_react46.createElement)("span", { className: "bt-browser-scheme", "aria-hidden": true }, (0, import_react46.createElement)(secure && !editing ? LockIcon2 : GlobeIcon2)),
- (0, import_react46.createElement)("input", {
- (0, import_react44.createElement)("span", { className: "bt-browser-scheme", "aria-hidden": true }, (0, import_react44.createElement)(secure && !editing ? LockIcon2 : GlobeIcon2)),
- (0, import_react44.createElement)("input", {
++ (0, import_react47.createElement)("span", { className: "bt-browser-scheme", "aria-hidden": true }, (0, import_react47.createElement)(secure && !editing ? LockIcon2 : GlobeIcon2)),
++ (0, import_react47.createElement)("input", {
ref: input,
type: "text",
spellCheck: false,
@@@ -17502,14 -17342,14 +17699,14 @@@
}
})
),
- (0, import_react46.createElement)("button", {
- (0, import_react44.createElement)("button", {
++ (0, import_react47.createElement)("button", {
type: "button",
className: "bt-icon-btn",
"aria-label": t("New browser tab"),
title: t("New browser tab"),
onClick: () => actions.browserNewTab(bot.id)
- }, (0, import_react46.createElement)(PlusTabIcon)),
- imports ? (0, import_react46.createElement)("button", {
- }, (0, import_react44.createElement)(PlusTabIcon)),
- imports ? (0, import_react44.createElement)("button", {
++ }, (0, import_react47.createElement)(PlusTabIcon)),
++ imports ? (0, import_react47.createElement)("button", {
type: "button",
className: "bt-icon-btn bt-import-btn",
"aria-label": t("Import cookies"),
@@@ -17520,29 -17360,29 +17717,29 @@@
if (flow === "menu") setFlowTracked(null);
else openImport();
}
- }, (0, import_react46.createElement)(ImportIcon)) : null,
- page.loading ? (0, import_react46.createElement)("span", { className: "bt-browser-progress", "aria-hidden": true }) : null
- }, (0, import_react44.createElement)(ImportIcon)) : null,
- page.loading ? (0, import_react44.createElement)("span", { className: "bt-browser-progress", "aria-hidden": true }) : null
++ }, (0, import_react47.createElement)(ImportIcon)) : null,
++ page.loading ? (0, import_react47.createElement)("span", { className: "bt-browser-progress", "aria-hidden": true }) : null
),
- (0, import_react46.createElement)(
- (0, import_react44.createElement)(
++ (0, import_react47.createElement)(
"div",
{ ref: frame, className: "bt-browser-frame", "data-guest": showGuest || void 0 },
- flow === "menu" ? (0, import_react46.createElement)(ImportMenu, { sources, busy, onFile: pickFile, onSource: pickSource, onClose: () => setFlowTracked(null) }) : null,
- typeof flow === "object" && flow !== null ? (0, import_react46.createElement)(ImportCard, { flow, page, busy, onApply: applyImport, onCancel: cancelImport, onCloseAndImport: closeAndImport, onDone: () => setFlowTracked(null), onReload: () => actions.browserCommand(tabId, "reload") }) : null,
- flow === null && page.error ? (0, import_react46.createElement)(
- flow === "menu" ? (0, import_react44.createElement)(ImportMenu, { sources, busy, onFile: pickFile, onSource: pickSource, onClose: () => setFlowTracked(null) }) : null,
- typeof flow === "object" && flow !== null ? (0, import_react44.createElement)(ImportCard, { flow, page, busy, onApply: applyImport, onCancel: cancelImport, onCloseAndImport: closeAndImport, onDone: () => setFlowTracked(null), onReload: () => actions.browserCommand(tabId, "reload") }) : null,
- flow === null && page.error ? (0, import_react44.createElement)(
++ flow === "menu" ? (0, import_react47.createElement)(ImportMenu, { sources, busy, onFile: pickFile, onSource: pickSource, onClose: () => setFlowTracked(null) }) : null,
++ typeof flow === "object" && flow !== null ? (0, import_react47.createElement)(ImportCard, { flow, page, busy, onApply: applyImport, onCancel: cancelImport, onCloseAndImport: closeAndImport, onDone: () => setFlowTracked(null), onReload: () => actions.browserCommand(tabId, "reload") }) : null,
++ flow === null && page.error ? (0, import_react47.createElement)(
"div",
{ className: "bt-browser-empty" },
- (0, import_react46.createElement)("div", { className: "bt-browser-empty-title" }, t("This page didn’t load")),
- (0, import_react46.createElement)("div", { className: "bt-browser-empty-text" }, t(page.error)),
- page.url ? (0, import_react46.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => {
- (0, import_react44.createElement)("div", { className: "bt-browser-empty-title" }, t("This page didn’t load")),
- (0, import_react44.createElement)("div", { className: "bt-browser-empty-text" }, t(page.error)),
- page.url ? (0, import_react44.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => {
++ (0, import_react47.createElement)("div", { className: "bt-browser-empty-title" }, t("This page didn’t load")),
++ (0, import_react47.createElement)("div", { className: "bt-browser-empty-text" }, t(page.error)),
++ page.url ? (0, import_react47.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => {
void actions.browserNavigate(tabId, page.url);
} }, t("Try again")) : null
- ) : flow === null && !page.url ? (0, import_react46.createElement)(
- ) : flow === null && !page.url ? (0, import_react44.createElement)(
++ ) : flow === null && !page.url ? (0, import_react47.createElement)(
"div",
{ className: "bt-browser-empty" },
- (0, import_react46.createElement)(BotMark, { bot, size: 48, state: "idle", live: true }),
- (0, import_react46.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),
- (0, import_react46.createElement)("div", { className: "bt-browser-empty-text" }, t("Open a page here and {name} can read it with you. Logins and cookies stay with {name}; other Bots never see them.", { name: bot.name })),
- imports ? (0, import_react46.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: openImport }, t("Import cookies")) : null
- (0, import_react44.createElement)(BotMark, { bot, size: 48, state: "idle", live: true }),
- (0, import_react44.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),
- (0, import_react44.createElement)("div", { className: "bt-browser-empty-text" }, t("Open a page here and {name} can read it with you. Logins and cookies stay with {name}; other Bots never see them.", { name: bot.name })),
- imports ? (0, import_react44.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: openImport }, t("Import cookies")) : null
++ (0, import_react47.createElement)(BotMark, { bot, size: 48, state: "idle", live: true }),
++ (0, import_react47.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),
++ (0, import_react47.createElement)("div", { className: "bt-browser-empty-text" }, t("Open a page here and {name} can read it with you. Logins and cookies stay with {name}; other Bots never see them.", { name: bot.name })),
++ imports ? (0, import_react47.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: openImport }, t("Import cookies")) : null
) : null
)
);
@@@ -17554,25 -17394,25 +17751,25 @@@ function importError(error)
return String(error);
}
function ImportMenu({ sources, busy, onFile, onSource, onClose }) {
- (0, import_react46.useEffect)(() => {
- (0, import_react44.useEffect)(() => {
++ (0, import_react47.useEffect)(() => {
const close = (event) => {
if (event.key === "Escape") onClose();
};
window.addEventListener("keydown", close);
return () => window.removeEventListener("keydown", close);
}, [onClose]);
- return (0, import_react46.createElement)(
- return (0, import_react44.createElement)(
++ return (0, import_react47.createElement)(
"div",
{ className: "bt-import-menu", role: "menu", "aria-label": t("Import cookies") },
- (0, import_react46.createElement)("div", { className: "bt-import-menu-title" }, t("Import cookies")),
- (0, import_react46.createElement)(
- (0, import_react44.createElement)("div", { className: "bt-import-menu-title" }, t("Import cookies")),
- (0, import_react44.createElement)(
++ (0, import_react47.createElement)("div", { className: "bt-import-menu-title" }, t("Import cookies")),
++ (0, import_react47.createElement)(
"button",
{ type: "button", className: "bt-import-item", role: "menuitem", disabled: busy, onClick: onFile },
- (0, import_react46.createElement)(FileIcon, { className: "bt-import-item-icon" }),
- (0, import_react46.createElement)("span", { className: "bt-import-item-name" }, t("From a file…")),
- (0, import_react46.createElement)("span", { className: "bt-import-item-sub" }, t("cookies.txt, JSON, storageState"))
- (0, import_react44.createElement)(FileIcon, { className: "bt-import-item-icon" }),
- (0, import_react44.createElement)("span", { className: "bt-import-item-name" }, t("From a file…")),
- (0, import_react44.createElement)("span", { className: "bt-import-item-sub" }, t("cookies.txt, JSON, storageState"))
++ (0, import_react47.createElement)(FileIcon, { className: "bt-import-item-icon" }),
++ (0, import_react47.createElement)("span", { className: "bt-import-item-name" }, t("From a file…")),
++ (0, import_react47.createElement)("span", { className: "bt-import-item-sub" }, t("cookies.txt, JSON, storageState"))
),
- sources === null ? (0, import_react46.createElement)("div", { className: "bt-import-menu-note" }, t("Loading…")) : sources.length === 0 ? (0, import_react46.createElement)("div", { className: "bt-import-menu-note" }, t("No browsers found")) : sources.map((source) => (0, import_react46.createElement)(
- sources === null ? (0, import_react44.createElement)("div", { className: "bt-import-menu-note" }, t("Loading…")) : sources.length === 0 ? (0, import_react44.createElement)("div", { className: "bt-import-menu-note" }, t("No browsers found")) : sources.map((source) => (0, import_react44.createElement)(
++ sources === null ? (0, import_react47.createElement)("div", { className: "bt-import-menu-note" }, t("Loading…")) : sources.length === 0 ? (0, import_react47.createElement)("div", { className: "bt-import-menu-note" }, t("No browsers found")) : sources.map((source) => (0, import_react47.createElement)(
"button",
{
key: source.id,
@@@ -17582,83 -17422,83 +17779,83 @@@
disabled: busy,
onClick: () => onSource(source)
},
- (0, import_react46.createElement)(WindowIcon, { className: "bt-import-item-icon" }),
- (0, import_react46.createElement)("span", { className: "bt-import-item-name" }, source.label),
- (0, import_react46.createElement)("span", { className: "bt-import-item-sub" }, t("Copy of its cookies"))
- (0, import_react44.createElement)(WindowIcon, { className: "bt-import-item-icon" }),
- (0, import_react44.createElement)("span", { className: "bt-import-item-name" }, source.label),
- (0, import_react44.createElement)("span", { className: "bt-import-item-sub" }, t("Copy of its cookies"))
++ (0, import_react47.createElement)(WindowIcon, { className: "bt-import-item-icon" }),
++ (0, import_react47.createElement)("span", { className: "bt-import-item-name" }, source.label),
++ (0, import_react47.createElement)("span", { className: "bt-import-item-sub" }, t("Copy of its cookies"))
))
);
}
function ImportCard({ flow, page, busy, onApply, onCancel, onCloseAndImport, onDone, onReload }) {
const { stage } = flow;
if (stage === "running") {
- return (0, import_react46.createElement)("div", { className: "bt-import-card" }, (0, import_react46.createElement)(
- return (0, import_react44.createElement)("div", { className: "bt-import-card" }, (0, import_react44.createElement)(
++ return (0, import_react47.createElement)("div", { className: "bt-import-card" }, (0, import_react47.createElement)(
"div",
{ className: "bt-import-box" },
- (0, import_react46.createElement)("div", { className: "bt-import-title" }, t("{name} is running", { name: flow.source.name })),
- (0, import_react46.createElement)("div", { className: "bt-import-text" }, t("It must close for a moment so its cookies can be copied. It will reopen with your tabs.")),
- (0, import_react46.createElement)(
- (0, import_react44.createElement)("div", { className: "bt-import-title" }, t("{name} is running", { name: flow.source.name })),
- (0, import_react44.createElement)("div", { className: "bt-import-text" }, t("It must close for a moment so its cookies can be copied. It will reopen with your tabs.")),
- (0, import_react44.createElement)(
++ (0, import_react47.createElement)("div", { className: "bt-import-title" }, t("{name} is running", { name: flow.source.name })),
++ (0, import_react47.createElement)("div", { className: "bt-import-text" }, t("It must close for a moment so its cookies can be copied. It will reopen with your tabs.")),
++ (0, import_react47.createElement)(
"div",
{ className: "bt-import-actions" },
- (0, import_react46.createElement)("button", { type: "button", className: "bt-import-primary", disabled: busy, onClick: onCloseAndImport }, busy ? t("Closing…") : t("Close {name} and import", { name: flow.source.name })),
- (0, import_react46.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel"))
- (0, import_react44.createElement)("button", { type: "button", className: "bt-import-primary", disabled: busy, onClick: onCloseAndImport }, busy ? t("Closing…") : t("Close {name} and import", { name: flow.source.name })),
- (0, import_react44.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel"))
++ (0, import_react47.createElement)("button", { type: "button", className: "bt-import-primary", disabled: busy, onClick: onCloseAndImport }, busy ? t("Closing…") : t("Close {name} and import", { name: flow.source.name })),
++ (0, import_react47.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel"))
)
));
}
if (stage === "error") {
- return (0, import_react46.createElement)("div", { className: "bt-import-card" }, (0, import_react46.createElement)(
- return (0, import_react44.createElement)("div", { className: "bt-import-card" }, (0, import_react44.createElement)(
++ return (0, import_react47.createElement)("div", { className: "bt-import-card" }, (0, import_react47.createElement)(
"div",
{ className: "bt-import-box" },
- (0, import_react46.createElement)("div", { className: "bt-import-title" }, t("Import failed")),
- (0, import_react46.createElement)("div", { className: "bt-import-text" }, flow.message),
- (0, import_react46.createElement)("div", { className: "bt-import-actions" }, (0, import_react46.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onCancel }, t("Close")))
- (0, import_react44.createElement)("div", { className: "bt-import-title" }, t("Import failed")),
- (0, import_react44.createElement)("div", { className: "bt-import-text" }, flow.message),
- (0, import_react44.createElement)("div", { className: "bt-import-actions" }, (0, import_react44.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onCancel }, t("Close")))
++ (0, import_react47.createElement)("div", { className: "bt-import-title" }, t("Import failed")),
++ (0, import_react47.createElement)("div", { className: "bt-import-text" }, flow.message),
++ (0, import_react47.createElement)("div", { className: "bt-import-actions" }, (0, import_react47.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onCancel }, t("Close")))
));
}
if (stage === "result") {
const { report } = flow;
const problems = [...report.dropped ?? [], ...report.failed ?? []];
- return (0, import_react46.createElement)("div", { className: "bt-import-card" }, (0, import_react46.createElement)(
- return (0, import_react44.createElement)("div", { className: "bt-import-card" }, (0, import_react44.createElement)(
++ return (0, import_react47.createElement)("div", { className: "bt-import-card" }, (0, import_react47.createElement)(
"div",
{ className: "bt-import-box" },
- (0, import_react46.createElement)("div", { className: "bt-import-title" }, report.stored > 0 ? t("Imported {count} cookies", { count: report.stored }) : t("No cookies were stored")),
- flow.label ? (0, import_react46.createElement)("div", { className: "bt-import-sub" }, flow.label) : null,
- problems.length ? (0, import_react46.createElement)(
- (0, import_react44.createElement)("div", { className: "bt-import-title" }, report.stored > 0 ? t("Imported {count} cookies", { count: report.stored }) : t("No cookies were stored")),
- flow.label ? (0, import_react44.createElement)("div", { className: "bt-import-sub" }, flow.label) : null,
- problems.length ? (0, import_react44.createElement)(
++ (0, import_react47.createElement)("div", { className: "bt-import-title" }, report.stored > 0 ? t("Imported {count} cookies", { count: report.stored }) : t("No cookies were stored")),
++ flow.label ? (0, import_react47.createElement)("div", { className: "bt-import-sub" }, flow.label) : null,
++ problems.length ? (0, import_react47.createElement)(
"div",
{ className: "bt-import-list" },
- problems.slice(0, 8).map((item, index) => (0, import_react46.createElement)(
- problems.slice(0, 8).map((item, index) => (0, import_react44.createElement)(
++ problems.slice(0, 8).map((item, index) => (0, import_react47.createElement)(
"div",
{ key: index, className: "bt-import-line" },
- (0, import_react46.createElement)("span", { className: "bt-import-line-name" }, item.name ?? "—"),
- (0, import_react46.createElement)("span", { className: "bt-import-line-reason" }, item.reason)
- (0, import_react44.createElement)("span", { className: "bt-import-line-name" }, item.name ?? "—"),
- (0, import_react44.createElement)("span", { className: "bt-import-line-reason" }, item.reason)
++ (0, import_react47.createElement)("span", { className: "bt-import-line-name" }, item.name ?? "—"),
++ (0, import_react47.createElement)("span", { className: "bt-import-line-reason" }, item.reason)
)),
- problems.length > 8 ? (0, import_react46.createElement)("div", { className: "bt-import-line" }, (0, import_react46.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: problems.length - 8 }))) : null
- problems.length > 8 ? (0, import_react44.createElement)("div", { className: "bt-import-line" }, (0, import_react44.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: problems.length - 8 }))) : null
++ problems.length > 8 ? (0, import_react47.createElement)("div", { className: "bt-import-line" }, (0, import_react47.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: problems.length - 8 }))) : null
) : null,
- (0, import_react46.createElement)(
- (0, import_react44.createElement)(
++ (0, import_react47.createElement)(
"div",
{ className: "bt-import-actions" },
- page.url ? (0, import_react46.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onReload }, t("Reload the page")) : null,
- (0, import_react46.createElement)("button", { type: "button", className: "bt-import-primary", onClick: onDone }, t("Done"))
- page.url ? (0, import_react44.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onReload }, t("Reload the page")) : null,
- (0, import_react44.createElement)("button", { type: "button", className: "bt-import-primary", onClick: onDone }, t("Done"))
++ page.url ? (0, import_react47.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onReload }, t("Reload the page")) : null,
++ (0, import_react47.createElement)("button", { type: "button", className: "bt-import-primary", onClick: onDone }, t("Done"))
)
));
}
const { preview } = flow;
- return (0, import_react46.createElement)("div", { className: "bt-import-card" }, (0, import_react46.createElement)(
- return (0, import_react44.createElement)("div", { className: "bt-import-card" }, (0, import_react44.createElement)(
++ return (0, import_react47.createElement)("div", { className: "bt-import-card" }, (0, import_react47.createElement)(
"div",
{ className: "bt-import-box" },
- (0, import_react46.createElement)("div", { className: "bt-import-title" }, t("Import {count} cookies", { count: preview.cookies })),
- (0, import_react46.createElement)(
- (0, import_react44.createElement)("div", { className: "bt-import-title" }, t("Import {count} cookies", { count: preview.cookies })),
- (0, import_react44.createElement)(
++ (0, import_react47.createElement)("div", { className: "bt-import-title" }, t("Import {count} cookies", { count: preview.cookies })),
++ (0, import_react47.createElement)(
"div",
{ className: "bt-import-sub" },
preview.source?.label ?? "",
flow.restarted ? ` · ${t("the browser was restarted")}` : ""
),
- preview.sites.length ? (0, import_react46.createElement)(
- preview.sites.length ? (0, import_react44.createElement)(
++ preview.sites.length ? (0, import_react47.createElement)(
"div",
{ className: "bt-import-list" },
- preview.sites.map((site) => (0, import_react46.createElement)(
- preview.sites.map((site) => (0, import_react44.createElement)(
++ preview.sites.map((site) => (0, import_react47.createElement)(
"div",
{ key: site.site, className: "bt-import-line" },
- (0, import_react46.createElement)("span", { className: "bt-import-line-name" }, site.site),
- (0, import_react46.createElement)(
- (0, import_react44.createElement)("span", { className: "bt-import-line-name" }, site.site),
- (0, import_react44.createElement)(
++ (0, import_react47.createElement)("span", { className: "bt-import-line-name" }, site.site),
++ (0, import_react47.createElement)(
"span",
{ className: "bt-import-line-count" },
t("{count}", { count: site.cookies }),
@@@ -17666,35 -17506,35 +17863,35 @@@
)
))
) : null,
- preview.skipped.length ? (0, import_react46.createElement)(
- preview.skipped.length ? (0, import_react44.createElement)(
++ preview.skipped.length ? (0, import_react47.createElement)(
"div",
{ className: "bt-import-list" },
- (0, import_react46.createElement)("div", { className: "bt-import-note" }, t("{count} skipped", { count: preview.skipped.length })),
- preview.skipped.slice(0, 5).map((item, index) => (0, import_react46.createElement)(
- (0, import_react44.createElement)("div", { className: "bt-import-note" }, t("{count} skipped", { count: preview.skipped.length })),
- preview.skipped.slice(0, 5).map((item, index) => (0, import_react44.createElement)(
++ (0, import_react47.createElement)("div", { className: "bt-import-note" }, t("{count} skipped", { count: preview.skipped.length })),
++ preview.skipped.slice(0, 5).map((item, index) => (0, import_react47.createElement)(
"div",
{ key: index, className: "bt-import-line" },
- (0, import_react46.createElement)("span", { className: "bt-import-line-name" }, item.name ?? item.where),
- (0, import_react46.createElement)("span", { className: "bt-import-line-reason" }, item.reason)
- (0, import_react44.createElement)("span", { className: "bt-import-line-name" }, item.name ?? item.where),
- (0, import_react44.createElement)("span", { className: "bt-import-line-reason" }, item.reason)
++ (0, import_react47.createElement)("span", { className: "bt-import-line-name" }, item.name ?? item.where),
++ (0, import_react47.createElement)("span", { className: "bt-import-line-reason" }, item.reason)
)),
- preview.skipped.length > 5 ? (0, import_react46.createElement)("div", { className: "bt-import-line" }, (0, import_react46.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: preview.skipped.length - 5 }))) : null
- preview.skipped.length > 5 ? (0, import_react44.createElement)("div", { className: "bt-import-line" }, (0, import_react44.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: preview.skipped.length - 5 }))) : null
++ preview.skipped.length > 5 ? (0, import_react47.createElement)("div", { className: "bt-import-line" }, (0, import_react47.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: preview.skipped.length - 5 }))) : null
) : null,
- preview.warnings.length ? (0, import_react46.createElement)(
- preview.warnings.length ? (0, import_react44.createElement)(
++ preview.warnings.length ? (0, import_react47.createElement)(
"details",
{ className: "bt-import-warns" },
- (0, import_react46.createElement)("summary", null, t("{count} adjusted", { count: preview.warnings.reduce((n, w) => n + w.count, 0) })),
- preview.warnings.map((w, index) => (0, import_react46.createElement)(
- (0, import_react44.createElement)("summary", null, t("{count} adjusted", { count: preview.warnings.reduce((n, w) => n + w.count, 0) })),
- preview.warnings.map((w, index) => (0, import_react44.createElement)(
++ (0, import_react47.createElement)("summary", null, t("{count} adjusted", { count: preview.warnings.reduce((n, w) => n + w.count, 0) })),
++ preview.warnings.map((w, index) => (0, import_react47.createElement)(
"div",
{ key: index, className: "bt-import-line" },
- (0, import_react46.createElement)("span", { className: "bt-import-line-reason" }, `${w.count} × ${w.message}`)
- (0, import_react44.createElement)("span", { className: "bt-import-line-reason" }, `${w.count} × ${w.message}`)
++ (0, import_react47.createElement)("span", { className: "bt-import-line-reason" }, `${w.count} × ${w.message}`)
))
) : null,
- preview.notes.includes("session-cookies") ? (0, import_react46.createElement)("div", { className: "bt-import-note" }, t("Cookies without an expiry stay until the app closes.")) : null,
- preview.notes.includes("local-storage-left") ? (0, import_react46.createElement)("div", { className: "bt-import-note" }, t("Some sites also keep sign-in outside cookies; you may need to sign in again there.")) : null,
- (0, import_react46.createElement)(
- preview.notes.includes("session-cookies") ? (0, import_react44.createElement)("div", { className: "bt-import-note" }, t("Cookies without an expiry stay until the app closes.")) : null,
- preview.notes.includes("local-storage-left") ? (0, import_react44.createElement)("div", { className: "bt-import-note" }, t("Some sites also keep sign-in outside cookies; you may need to sign in again there.")) : null,
- (0, import_react44.createElement)(
++ preview.notes.includes("session-cookies") ? (0, import_react47.createElement)("div", { className: "bt-import-note" }, t("Cookies without an expiry stay until the app closes.")) : null,
++ preview.notes.includes("local-storage-left") ? (0, import_react47.createElement)("div", { className: "bt-import-note" }, t("Some sites also keep sign-in outside cookies; you may need to sign in again there.")) : null,
++ (0, import_react47.createElement)(
"div",
{ className: "bt-import-actions" },
- (0, import_react46.createElement)("button", { type: "button", className: "bt-import-primary", disabled: busy, onClick: onApply }, busy ? t("Importing…") : t("Import")),
- (0, import_react46.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel"))
- (0, import_react44.createElement)("button", { type: "button", className: "bt-import-primary", disabled: busy, onClick: onApply }, busy ? t("Importing…") : t("Import")),
- (0, import_react44.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel"))
++ (0, import_react47.createElement)("button", { type: "button", className: "bt-import-primary", disabled: busy, onClick: onApply }, busy ? t("Importing…") : t("Import")),
++ (0, import_react47.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel"))
)
));
}
@@@ -17708,42 -17548,42 +17905,42 @@@ function BotPanel({ pane, leaving, rost
const active = tabState.active;
const page = useBrowserPages((pages) => (active ? pages[active] : null) ?? EMPTY_PAGE);
const hold = useBrowserHolds?.((map) => bot ? map[bot.id] ?? null : null) ?? null;
- const root = (0, import_react46.useRef)(null);
- const fly = (0, import_react46.useRef)(null);
- const [landed, setLanded] = (0, import_react46.useState)(false);
- const [settling, setSettling] = (0, import_react46.useState)(false);
- const [width, setWidth] = (0, import_react46.useState)(savedWidth);
- const [viewport, setViewport] = (0, import_react46.useState)(() => window.innerWidth);
- const [dragging, setDragging] = (0, import_react46.useState)(false);
- const [resizing, setResizing] = (0, import_react46.useState)(false);
- const root = (0, import_react44.useRef)(null);
- const fly = (0, import_react44.useRef)(null);
- const [landed, setLanded] = (0, import_react44.useState)(false);
- const [settling, setSettling] = (0, import_react44.useState)(false);
- const [width, setWidth] = (0, import_react44.useState)(savedWidth);
- const [viewport, setViewport] = (0, import_react44.useState)(() => window.innerWidth);
- const [dragging, setDragging] = (0, import_react44.useState)(false);
- const [resizing, setResizing] = (0, import_react44.useState)(false);
++ const root = (0, import_react47.useRef)(null);
++ const fly = (0, import_react47.useRef)(null);
++ const [landed, setLanded] = (0, import_react47.useState)(false);
++ const [settling, setSettling] = (0, import_react47.useState)(false);
++ const [width, setWidth] = (0, import_react47.useState)(savedWidth);
++ const [viewport, setViewport] = (0, import_react47.useState)(() => window.innerWidth);
++ const [dragging, setDragging] = (0, import_react47.useState)(false);
++ const [resizing, setResizing] = (0, import_react47.useState)(false);
const instant = dragging || resizing;
- const [reading, setReading] = (0, import_react46.useState)(false);
- const [reading, setReading] = (0, import_react44.useState)(false);
++ const [reading, setReading] = (0, import_react47.useState)(false);
const overlay = overlayAt(view, viewport);
const panelWidth = fitWidth(width ?? (view === "browser" ? DEFAULT_WIDTH : DETAILS_WIDTH), widthRange(view, viewport));
- (0, import_react46.useLayoutEffect)(() => {
- (0, import_react44.useLayoutEffect)(() => {
++ (0, import_react47.useLayoutEffect)(() => {
if (view === "browser" && width === null) setWidth(DEFAULT_WIDTH);
}, [view, width]);
- (0, import_react46.useLayoutEffect)(() => {
- (0, import_react44.useLayoutEffect)(() => {
++ (0, import_react47.useLayoutEffect)(() => {
chatRoom.hold(instant);
}, [instant]);
- const [last, setLast] = (0, import_react46.useState)({ view, width: panelWidth });
- const [last, setLast] = (0, import_react44.useState)({ view, width: panelWidth });
++ const [last, setLast] = (0, import_react47.useState)({ view, width: panelWidth });
if (last.view !== view || last.width !== panelWidth) {
setLast({ view, width: panelWidth });
if (last.view !== view) setSettling(last.width !== panelWidth && !instant);
}
- const shownView = (0, import_react46.useRef)(view);
- (0, import_react46.useLayoutEffect)(() => {
- const shownView = (0, import_react44.useRef)(view);
- (0, import_react44.useLayoutEffect)(() => {
++ const shownView = (0, import_react47.useRef)(view);
++ (0, import_react47.useLayoutEffect)(() => {
const switched = settling && shownView.current !== view;
shownView.current = view;
if (switched) chatRoom.hold(true);
chatRoom.set(leaving || overlay ? null : panelWidth);
if (switched) chatRoom.hold(false);
}, [view, panelWidth, leaving, overlay]);
- (0, import_react46.useEffect)(() => () => {
- (0, import_react44.useEffect)(() => () => {
++ (0, import_react47.useEffect)(() => () => {
chatRoom.set(null);
chatRoom.hold(false);
}, []);
- (0, import_react46.useEffect)(() => {
- (0, import_react44.useEffect)(() => {
++ (0, import_react47.useEffect)(() => {
let timer;
const onResize = () => {
setResizing(true);
@@@ -17757,31 -17597,31 +17954,31 @@@
window.removeEventListener("resize", onResize);
};
}, []);
- (0, import_react46.useEffect)(() => {
- (0, import_react44.useEffect)(() => {
++ (0, import_react47.useEffect)(() => {
if (!settling) return void 0;
const timer = setTimeout(() => setSettling(false), SPRING_SHAPE.duration + 40);
return () => clearTimeout(timer);
}, [settling, view]);
- (0, import_react46.useEffect)(() => {
- (0, import_react44.useEffect)(() => {
++ (0, import_react47.useEffect)(() => {
const timer = setTimeout(() => setLanded(true), 360);
return () => clearTimeout(timer);
}, []);
- (0, import_react46.useEffect)(() => {
- (0, import_react44.useEffect)(() => {
++ (0, import_react47.useEffect)(() => {
if (canBrowse) actions.browserEnsure(bot.id);
}, [bot?.id, canBrowse]);
- (0, import_react46.useEffect)(() => {
- (0, import_react44.useEffect)(() => {
++ (0, import_react47.useEffect)(() => {
if (view === "browser" && (active === null || !tabState.ids.includes(active))) actions.setPanelView("details");
}, [view, active, tabState.ids.length]);
- (0, import_react46.useEffect)(() => {
- (0, import_react44.useEffect)(() => {
++ (0, import_react47.useEffect)(() => {
if (pane.view === "side" && sideChat === void 0) actions.setPanelView("details");
}, [pane.view, sideChat]);
- (0, import_react46.useEffect)(() => {
- (0, import_react44.useEffect)(() => {
++ (0, import_react47.useEffect)(() => {
if (view !== "browser" || leaving) void actions.browserShow?.(null);
}, [view, leaving]);
- (0, import_react46.useEffect)(() => () => {
- (0, import_react44.useEffect)(() => () => {
++ (0, import_react47.useEffect)(() => () => {
void actions.browserShow?.(null);
}, []);
- (0, import_react46.useEffect)(() => {
- (0, import_react44.useEffect)(() => {
++ (0, import_react47.useEffect)(() => {
if (!page.readAt || Date.now() - page.readAt > READ_FLASH_MS) return void 0;
setReading(true);
const timer = setTimeout(() => setReading(false), READ_FLASH_MS);
@@@ -17824,7 -17664,7 +18021,7 @@@
return actions[name](...args);
};
}
- (0, import_react46.useLayoutEffect)(() => {
- (0, import_react44.useLayoutEffect)(() => {
++ (0, import_react47.useLayoutEffect)(() => {
const move = fly.current;
if (!move) return;
fly.current = null;
@@@ -17907,7 -17747,7 +18104,7 @@@
for (const name of ends) grip.addEventListener(name, onEnd);
};
const hasStrip = panelHasStrip(canBrowse, tabState.ids.length, sideChats.length);
- return (0, import_react46.createElement)(
- return (0, import_react44.createElement)(
++ return (0, import_react47.createElement)(
"aside",
{
ref: root,
@@@ -17925,15 -17765,15 +18122,15 @@@
if (event.target === event.currentTarget) setLanded(true);
}
},
- leaving || overlay ? null : (0, import_react46.createElement)("div", { className: "bt-panel-grip", role: "separator", "aria-orientation": "vertical", "aria-label": t("Resize panel"), onPointerDown: startResize }),
- leaving || overlay ? null : (0, import_react44.createElement)("div", { className: "bt-panel-grip", role: "separator", "aria-orientation": "vertical", "aria-label": t("Resize panel"), onPointerDown: startResize }),
++ leaving || overlay ? null : (0, import_react47.createElement)("div", { className: "bt-panel-grip", role: "separator", "aria-orientation": "vertical", "aria-label": t("Resize panel"), onPointerDown: startResize }),
// Over the whole window while dragging: the cursor stays a resize cursor and the
// pages underneath (the chat, the guest) see no pointer.
- dragging ? (0, import_react_dom8.createPortal)((0, import_react46.createElement)("div", { className: "bt-drag-shield", "aria-hidden": true }), document.body) : null,
- hasStrip ? (0, import_react46.createElement)(PanelStrip, { bot, subject: pane.id, view, ids: tabState.ids, active, sides: sideChats, side: pane.side, canBrowse, reading, onView: switchView, actions: panelActions, useBrowserPages }) : null,
- view === "browser" && bot ? (0, import_react46.createElement)(BrowserView, { key: `browser:${active}`, bot, tabId: active, leaving, landed: landed && !settling, actions, useBrowserPages, hold }) : view === "side" && sideChat ? (0, import_react46.createElement)("div", { key: `side:${sideChat.id}`, className: "bt-panel-view" }, (0, import_react46.createElement)(SideChatView, { subject: pane.id, chat: sideChat, actions: panelActions })) : (0, import_react46.createElement)(
- dragging ? (0, import_react_dom8.createPortal)((0, import_react44.createElement)("div", { className: "bt-drag-shield", "aria-hidden": true }), document.body) : null,
- hasStrip ? (0, import_react44.createElement)(PanelStrip, { bot, subject: pane.id, view, ids: tabState.ids, active, sides: sideChats, side: pane.side, canBrowse, reading, onView: switchView, actions: panelActions, useBrowserPages }) : null,
- view === "browser" && bot ? (0, import_react44.createElement)(BrowserView, { key: `browser:${active}`, bot, tabId: active, leaving, landed: landed && !settling, actions, useBrowserPages, hold }) : view === "side" && sideChat ? (0, import_react44.createElement)("div", { key: `side:${sideChat.id}`, className: "bt-panel-view" }, (0, import_react44.createElement)(SideChatView, { subject: pane.id, chat: sideChat, actions: panelActions })) : (0, import_react44.createElement)(
++ dragging ? (0, import_react_dom8.createPortal)((0, import_react47.createElement)("div", { className: "bt-drag-shield", "aria-hidden": true }), document.body) : null,
++ hasStrip ? (0, import_react47.createElement)(PanelStrip, { bot, subject: pane.id, view, ids: tabState.ids, active, sides: sideChats, side: pane.side, canBrowse, reading, onView: switchView, actions: panelActions, useBrowserPages }) : null,
++ view === "browser" && bot ? (0, import_react47.createElement)(BrowserView, { key: `browser:${active}`, bot, tabId: active, leaving, landed: landed && !settling, actions, useBrowserPages, hold }) : view === "side" && sideChat ? (0, import_react47.createElement)("div", { key: `side:${sideChat.id}`, className: "bt-panel-view" }, (0, import_react47.createElement)(SideChatView, { subject: pane.id, chat: sideChat, actions: panelActions })) : (0, import_react47.createElement)(
"div",
{ key: `details:${pane.id}:${pane.renaming ? "rename" : ""}:${pane.tab ?? ""}`, className: "bt-panel-view" },
- (0, import_react46.createElement)(DetailsDrawer, {
- (0, import_react44.createElement)(DetailsDrawer, {
++ (0, import_react47.createElement)(DetailsDrawer, {
sessionId: pane.id,
startRenaming: pane.renaming,
startTab: pane.tab,
@@@ -18074,7 -17914,7 +18271,7 @@@ var BROWSER_CSS =
`;
// src/client/overlays.js
- var import_react47 = require("react");
-var import_react45 = require("react");
++var import_react48 = require("react");
var import_react_dom9 = require("react-dom");
var DIALOG_EXIT_MS = 160;
var MENU_EXIT_MS3 = 120;
@@@ -18083,15 -17923,15 +18280,15 @@@ function Overlays({ useRoster, useUi, u
const ui2 = useUi((value) => value);
useRegistry((value) => value);
const current = useSessions((list) => Object.values(list.byId).find((session) => (session?.retainedBy?.mainView ?? 0) > 0)?.id ?? null);
- const previous = (0, import_react47.useRef)(current);
- (0, import_react47.useEffect)(() => {
- const previous = (0, import_react45.useRef)(current);
- (0, import_react45.useEffect)(() => {
++ const previous = (0, import_react48.useRef)(current);
++ (0, import_react48.useEffect)(() => {
if (previous.current === current) return;
previous.current = current;
if (current) actions.followPanel?.(current);
}, [current]);
const open = ui2.details ? { id: ui2.details, view: ui2.view ?? "details", renaming: ui2.renaming, tab: ui2.tab, side: ui2.side } : null;
- const [kept, setKept] = (0, import_react47.useState)(open);
- (0, import_react47.useEffect)(() => {
- const [kept, setKept] = (0, import_react45.useState)(open);
- (0, import_react45.useEffect)(() => {
++ const [kept, setKept] = (0, import_react48.useState)(open);
++ (0, import_react48.useEffect)(() => {
if (open) {
setKept(open);
return void 0;
@@@ -18110,17 -17950,17 +18307,17 @@@
const [memory, memoryLeaving] = useLinger(ui2.memory && memoryOwner(ui2.memory) ? ui2.memory : null, DIALOG_EXIT_MS);
const owner = memory ? memoryOwner(memory) : null;
const [menu, menuLeaving] = useLinger(ui2.menu, MENU_EXIT_MS3);
- return (0, import_react47.createElement)(
- import_react47.Fragment,
- return (0, import_react45.createElement)(
- import_react45.Fragment,
++ return (0, import_react48.createElement)(
++ import_react48.Fragment,
null,
- pane ? (0, import_react_dom9.createPortal)((0, import_react47.createElement)(BotPanel, { pane, leaving: open === null, roster, actions, useSessions, useSessionStatus, useActivity, useWork, useBrowserTabs, useBrowserPages, useBrowserHolds }), document.body) : null,
- ui2.newChat ? (0, import_react_dom9.createPortal)((0, import_react47.createElement)(NewChat, { key: ui2.newChat, mode: ui2.newChat, roster, actions }), document.body) : null,
- ui2.palette ? (0, import_react_dom9.createPortal)((0, import_react47.createElement)(CommandPalette, { key: ui2.palette.token, start: ui2.palette.query, token: ui2.palette.token, roster, actions, useSessions }), document.body) : null,
- ui2.exchange ? (0, import_react_dom9.createPortal)((0, import_react47.createElement)(ExchangeDialog, { pair: ui2.exchange, roster, actions }), document.body) : null,
- ui2.voice ? (0, import_react_dom9.createPortal)((0, import_react47.createElement)(VoiceMode, { key: ui2.voice, sessionId: ui2.voice, roster, actions, useSessions, useSessionStatus }), document.body) : null,
- menu ? (0, import_react_dom9.createPortal)((0, import_react47.createElement)(ContextMenu, { key: `${menu.kind ?? ""}:${menu.id}:${menu.x}:${menu.y}`, menu, roster, actions, leaving: menuLeaving }), document.body) : null,
- settings ? (0, import_react_dom9.createPortal)((0, import_react47.createElement)(SettingsDialog, { page: settings.page, id: settings.id, roster, actions, useUpdate, leaving: settingsLeaving }), document.body) : null,
- owner ? (0, import_react_dom9.createPortal)((0, import_react47.createElement)(MemoryDialog, { key: owner.id, owner, actions, leaving: memoryLeaving }), document.body) : null
- pane ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(BotPanel, { pane, leaving: open === null, roster, actions, useSessions, useSessionStatus, useActivity, useWork, useBrowserTabs, useBrowserPages, useBrowserHolds }), document.body) : null,
- ui2.newChat ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(NewChat, { key: ui2.newChat, mode: ui2.newChat, roster, actions }), document.body) : null,
- ui2.palette ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(CommandPalette, { key: ui2.palette.token, start: ui2.palette.query, token: ui2.palette.token, roster, actions, useSessions }), document.body) : null,
- ui2.exchange ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(ExchangeDialog, { pair: ui2.exchange, roster, actions }), document.body) : null,
- ui2.voice ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(VoiceMode, { key: ui2.voice, sessionId: ui2.voice, roster, actions, useSessions, useSessionStatus }), document.body) : null,
- menu ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(ContextMenu, { key: `${menu.kind ?? ""}:${menu.id}:${menu.x}:${menu.y}`, menu, roster, actions, leaving: menuLeaving }), document.body) : null,
- settings ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(SettingsDialog, { page: settings.page, id: settings.id, roster, actions, useUpdate, leaving: settingsLeaving }), document.body) : null,
- owner ? (0, import_react_dom9.createPortal)((0, import_react45.createElement)(MemoryDialog, { key: owner.id, owner, actions, leaving: memoryLeaving }), document.body) : null
++ pane ? (0, import_react_dom9.createPortal)((0, import_react48.createElement)(BotPanel, { pane, leaving: open === null, roster, actions, useSessions, useSessionStatus, useActivity, useWork, useBrowserTabs, useBrowserPages, useBrowserHolds }), document.body) : null,
++ ui2.newChat ? (0, import_react_dom9.createPortal)((0, import_react48.createElement)(NewChat, { key: ui2.newChat, mode: ui2.newChat, roster, actions }), document.body) : null,
++ ui2.palette ? (0, import_react_dom9.createPortal)((0, import_react48.createElement)(CommandPalette, { key: ui2.palette.token, start: ui2.palette.query, token: ui2.palette.token, roster, actions, useSessions }), document.body) : null,
++ ui2.exchange ? (0, import_react_dom9.createPortal)((0, import_react48.createElement)(ExchangeDialog, { pair: ui2.exchange, roster, actions }), document.body) : null,
++ ui2.voice ? (0, import_react_dom9.createPortal)((0, import_react48.createElement)(VoiceMode, { key: ui2.voice, sessionId: ui2.voice, roster, actions, useSessions, useSessionStatus }), document.body) : null,
++ menu ? (0, import_react_dom9.createPortal)((0, import_react48.createElement)(ContextMenu, { key: `${menu.kind ?? ""}:${menu.id}:${menu.x}:${menu.y}`, menu, roster, actions, leaving: menuLeaving }), document.body) : null,
++ settings ? (0, import_react_dom9.createPortal)((0, import_react48.createElement)(SettingsDialog, { page: settings.page, id: settings.id, roster, actions, useUpdate, leaving: settingsLeaving }), document.body) : null,
++ owner ? (0, import_react_dom9.createPortal)((0, import_react48.createElement)(MemoryDialog, { key: owner.id, owner, actions, leaving: memoryLeaving }), document.body) : null
);
}
@@@ -19143,7 -18983,7 +19340,7 @@@ function createSwitchWindow(settle)
}
// src/client/user-message.js
- var import_react48 = require("react");
-var import_react46 = require("react");
++var import_react49 = require("react");
var ui = __toESM(require("@deepseek-ai/dsh-client-ui-primitives"), 1);
var canDrawUserMessages = () => typeof ui.projectUserText === "function";
function contentParts(content) {
@@@ -19175,38 -19015,38 +19372,38 @@@ function userTextParts(text, bots, refe
return parts;
}
function UserText({ text, bots, referenceLabels, skillNames, references, actions }) {
- return userTextParts(text, bots, referenceLabels).map((part, index) => part.bot ? (0, import_react48.createElement)(
- return userTextParts(text, bots, referenceLabels).map((part, index) => part.bot ? (0, import_react46.createElement)(
++ return userTextParts(text, bots, referenceLabels).map((part, index) => part.bot ? (0, import_react49.createElement)(
"button",
{ key: index, type: "button", className: "bt-umention", title: `@${part.bot.name}`, onClick: () => actions.openSession(part.bot.id) },
- (0, import_react48.createElement)(BotMark, { bot: part.bot, size: 16 }),
- (0, import_react46.createElement)(BotMark, { bot: part.bot, size: 16 }),
++ (0, import_react49.createElement)(BotMark, { bot: part.bot, size: 16 }),
part.label
- ) : (0, import_react48.createElement)(import_react48.Fragment, { key: index }, ui.projectUserText(part.text, referenceLabels, skillNames, "skill", references)));
- ) : (0, import_react46.createElement)(import_react46.Fragment, { key: index }, ui.projectUserText(part.text, referenceLabels, skillNames, "skill", references)));
++ ) : (0, import_react49.createElement)(import_react49.Fragment, { key: index }, ui.projectUserText(part.text, referenceLabels, skillNames, "skill", references)));
}
function Attachments({ attachments, renderMessageImages }) {
const compact2 = attachments.length > 1;
- return (0, import_react48.createElement)("div", { className: "bt-uattach" }, attachments.map((block, index) => {
- return (0, import_react46.createElement)("div", { className: "bt-uattach" }, attachments.map((block, index) => {
++ return (0, import_react49.createElement)("div", { className: "bt-uattach" }, attachments.map((block, index) => {
if (block.type === "image") {
- return renderMessageImages ? (0, import_react48.createElement)(import_react48.Fragment, { key: index }, renderMessageImages({ images: [{ attachment: block.attachment }], align: "end", compact: compact2 })) : null;
- return renderMessageImages ? (0, import_react46.createElement)(import_react46.Fragment, { key: index }, renderMessageImages({ images: [{ attachment: block.attachment }], align: "end", compact: compact2 })) : null;
++ return renderMessageImages ? (0, import_react49.createElement)(import_react49.Fragment, { key: index }, renderMessageImages({ images: [{ attachment: block.attachment }], align: "end", compact: compact2 })) : null;
}
const file = block.attachment;
const meta = [ui.fileExtension?.(file.name)?.toUpperCase().slice(0, 8), ui.fileSizeText?.(file.bytes)].filter(Boolean).join(" · ");
- return (0, import_react48.createElement)(
- return (0, import_react46.createElement)(
++ return (0, import_react49.createElement)(
"span",
{ key: index, className: "bt-ufile", title: file.name },
- ui.FileTypeIcon ? (0, import_react48.createElement)(ui.FileTypeIcon, { path: file.name, className: "bt-ufile-icon" }) : null,
- (0, import_react48.createElement)("span", { className: "bt-ufile-text" }, (0, import_react48.createElement)("span", { className: "bt-ufile-name" }, file.name), meta ? (0, import_react48.createElement)("span", { className: "bt-ufile-meta" }, meta) : null)
- ui.FileTypeIcon ? (0, import_react46.createElement)(ui.FileTypeIcon, { path: file.name, className: "bt-ufile-icon" }) : null,
- (0, import_react46.createElement)("span", { className: "bt-ufile-text" }, (0, import_react46.createElement)("span", { className: "bt-ufile-name" }, file.name), meta ? (0, import_react46.createElement)("span", { className: "bt-ufile-meta" }, meta) : null)
++ ui.FileTypeIcon ? (0, import_react49.createElement)(ui.FileTypeIcon, { path: file.name, className: "bt-ufile-icon" }) : null,
++ (0, import_react49.createElement)("span", { className: "bt-ufile-text" }, (0, import_react49.createElement)("span", { className: "bt-ufile-name" }, file.name), meta ? (0, import_react49.createElement)("span", { className: "bt-ufile-meta" }, meta) : null)
);
}));
}
function CopyButton({ text }) {
- const [copied, setCopied] = (0, import_react48.useState)(false);
- const [copied, setCopied] = (0, import_react46.useState)(false);
++ const [copied, setCopied] = (0, import_react49.useState)(false);
const copy2 = () => {
void navigator.clipboard?.writeText(text).then(() => {
setCopied(true);
setTimeout(() => setCopied(false), 1e3);
});
};
- return (0, import_react48.createElement)("button", { type: "button", className: "bt-tool", "aria-label": copied ? t("Copied") : t("Copy"), title: copied ? t("Copied") : t("Copy"), onClick: copy2 }, copied ? (0, import_react48.createElement)(CheckIcon) : (0, import_react48.createElement)(CopyIcon));
- return (0, import_react46.createElement)("button", { type: "button", className: "bt-tool", "aria-label": copied ? t("Copied") : t("Copy"), title: copied ? t("Copied") : t("Copy"), onClick: copy2 }, copied ? (0, import_react46.createElement)(CheckIcon) : (0, import_react46.createElement)(CopyIcon));
++ return (0, import_react49.createElement)("button", { type: "button", className: "bt-tool", "aria-label": copied ? t("Copied") : t("Copy"), title: copied ? t("Copied") : t("Copy"), onClick: copy2 }, copied ? (0, import_react49.createElement)(CheckIcon) : (0, import_react49.createElement)(CopyIcon));
}
var clock3 = (time) => typeof time === "number" ? new Date(time).toLocaleTimeString(dateLocale(), { hour: "numeric", minute: "2-digit" }) : void 0;
function UserMessageCell({ node, sessionId, useRoster, actions, renderMessageImages, openFile, openSkill }) {
@@@ -19218,10 -19058,10 +19415,10 @@@
const steering = node.kind === "steering";
const groupTime = roster.roomsById?.[sessionId] && Number.isFinite(data.time) ? messageClock(data.time) : void 0;
const { shown, folded, control } = useFold(text, { markdown: false });
- const body = (0, import_react48.createElement)(UserText, { text: shown, bots: mentionableBots(roster, sessionId), referenceLabels, skillNames: data.skillNames ?? [], references, actions });
- const row = (0, import_react48.useRef)(null);
- const [toolsOpen, setToolsOpen] = (0, import_react48.useState)(false);
- (0, import_react48.useEffect)(() => {
- const body = (0, import_react46.createElement)(UserText, { text: shown, bots: mentionableBots(roster, sessionId), referenceLabels, skillNames: data.skillNames ?? [], references, actions });
- const row = (0, import_react46.useRef)(null);
- const [toolsOpen, setToolsOpen] = (0, import_react46.useState)(false);
- (0, import_react46.useEffect)(() => {
++ const body = (0, import_react49.createElement)(UserText, { text: shown, bots: mentionableBots(roster, sessionId), referenceLabels, skillNames: data.skillNames ?? [], references, actions });
++ const row = (0, import_react49.useRef)(null);
++ const [toolsOpen, setToolsOpen] = (0, import_react49.useState)(false);
++ (0, import_react49.useEffect)(() => {
if (!toolsOpen) return void 0;
const onDown = (event) => {
if (!row.current?.contains(event.target)) setToolsOpen(false);
@@@ -19237,24 -19077,24 +19434,24 @@@
if (!noHover() || event.target instanceof Element && event.target.closest("a,button,input,textarea,select,pre,code,[role=button],[role=link]")) return;
setToolsOpen((value) => !value);
};
- return (0, import_react48.createElement)(
- return (0, import_react46.createElement)(
++ return (0, import_react49.createElement)(
"div",
{ ref: row, className: "bt-umsg", "data-steering": steering || void 0 },
- (0, import_react48.createElement)(
- (0, import_react46.createElement)(
++ (0, import_react49.createElement)(
"div",
{ className: "bt-ustack" },
- attachments.length > 0 ? (0, import_react48.createElement)(Attachments, { attachments, renderMessageImages }) : null,
- text !== "" || rest.length > 0 ? (0, import_react48.createElement)(
- attachments.length > 0 ? (0, import_react46.createElement)(Attachments, { attachments, renderMessageImages }) : null,
- text !== "" || rest.length > 0 ? (0, import_react46.createElement)(
++ attachments.length > 0 ? (0, import_react49.createElement)(Attachments, { attachments, renderMessageImages }) : null,
++ text !== "" || rest.length > 0 ? (0, import_react49.createElement)(
"div",
{ className: "bt-ubody", title: clock3(data.time), "data-folded": folded || void 0, onClick: tapTools },
- control ? (0, import_react48.createElement)("div", { className: "bt-fold-body" }, body) : body,
- control ? (0, import_react46.createElement)("div", { className: "bt-fold-body" }, body) : body,
++ control ? (0, import_react49.createElement)("div", { className: "bt-fold-body" }, body) : body,
control,
- rest.map((block, index) => ui.JsonBlock ? (0, import_react48.createElement)(ui.JsonBlock, { key: index, label: t("Content"), payload: block }) : null)
- rest.map((block, index) => ui.JsonBlock ? (0, import_react46.createElement)(ui.JsonBlock, { key: index, label: t("Content"), payload: block }) : null)
++ rest.map((block, index) => ui.JsonBlock ? (0, import_react49.createElement)(ui.JsonBlock, { key: index, label: t("Content"), payload: block }) : null)
) : null,
- referenceLabels.length > 0 ? (0, import_react48.createElement)("div", { className: "bt-urefs" }, t("Referenced {labels}", { labels: referenceLabels.join(t(", ")) })) : null,
- groupTime ? (0, import_react48.createElement)("div", { className: "bt-utime", title: clockLabel(data.time) }, groupTime) : null
- referenceLabels.length > 0 ? (0, import_react46.createElement)("div", { className: "bt-urefs" }, t("Referenced {labels}", { labels: referenceLabels.join(t(", ")) })) : null,
- groupTime ? (0, import_react46.createElement)("div", { className: "bt-utime", title: clockLabel(data.time) }, groupTime) : null
++ referenceLabels.length > 0 ? (0, import_react49.createElement)("div", { className: "bt-urefs" }, t("Referenced {labels}", { labels: referenceLabels.join(t(", ")) })) : null,
++ groupTime ? (0, import_react49.createElement)("div", { className: "bt-utime", title: clockLabel(data.time) }, groupTime) : null
),
- text === "" ? null : (0, import_react48.createElement)("div", { className: "bt-utools", "data-open": toolsOpen || void 0 }, (0, import_react48.createElement)(CopyButton, { text }))
- text === "" ? null : (0, import_react46.createElement)("div", { className: "bt-utools", "data-open": toolsOpen || void 0 }, (0, import_react46.createElement)(CopyButton, { text }))
++ text === "" ? null : (0, import_react49.createElement)("div", { className: "bt-utools", "data-open": toolsOpen || void 0 }, (0, import_react49.createElement)(CopyButton, { text }))
);
}
var USER_MESSAGE_CSS = `
diff --cc ds-bot/package-lock.json
index 254ae10b,ad4380c6..75292fbc
--- a/ds-bot/package-lock.json
+++ b/ds-bot/package-lock.json
@@@ -6,24 -6,8 +6,24 @@@
"packages": {
"": {
"name": "ds-bot",
- "version": "0.2.2",
+ "version": "0.2.3",
"license": "Apache-2.0",
+ "dependencies": {
+ "deep-view": "file:../../../DeepSeek Bot/deep-view"
+ },
+ "devDependencies": {
+ "esbuild": "0.28.2"
+ },
+ "peerDependencies": {
+ "@deepseek-ai/cordis": "*",
+ "@deepseek-ai/dsh-llm": "*",
+ "@deepseek-ai/dsh-tools": "*",
+ "@deepseek-ai/dsh-web": "*"
+ }
+ },
+ "../../../DeepSeek Bot/deep-view": {
+ "version": "0.1.0",
+ "license": "Apache-2.0",
"devDependencies": {
"esbuild": "0.28.2"
},