Skip to content

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

Mark emptied chat cells and gate seat hiding on the marks

Fei24116fe9337f723b
diff --git a/ds-bot/client.js b/ds-bot/client.js
index 3062e6b1..894df936 100644
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@ -1475,8 +1475,8 @@ function bodyOf(def, paint, flat = false) {
return "";
}
}
-var eyeMarkup = ([cx, cy, w, h49, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><rect class="bt-eye" x="${-w / 2}" y="${-h49 / 2}" width="${w}" height="${h49}" rx="${w / 2}"/></g>`;
-var happyEyeMarkup = ([cx, cy, w, h49, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><path class="bt-eye-happy" opacity="0" d="M${-w * 0.62} ${h49 * 0.14}Q0 ${-h49 * 0.42} ${w * 0.62} ${h49 * 0.14}" fill="none" stroke="#000" stroke-width="${w * 0.5}" stroke-linecap="round"/></g>`;
+var eyeMarkup = ([cx, cy, w, h50, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><rect class="bt-eye" x="${-w / 2}" y="${-h50 / 2}" width="${w}" height="${h50}" rx="${w / 2}"/></g>`;
+var happyEyeMarkup = ([cx, cy, w, h50, tilt]) => `<g transform="translate(${cx} ${cy}) rotate(${tilt})"><path class="bt-eye-happy" opacity="0" d="M${-w * 0.62} ${h50 * 0.14}Q0 ${-h50 * 0.42} ${w * 0.62} ${h50 * 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%";
@@ -2227,12 +2227,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 h49 = dt / steps;
+ const h50 = 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) * h49;
- value.x += value.v * h49;
+ value.v += (-value.k * (value.x - value.to) - value.c * value.v) * h50;
+ value.x += value.v * h50;
}
if (Math.abs(value.x - value.to) < 0.05 && Math.abs(value.v) < 1) {
value.x = value.to;
@@ -3346,11 +3346,13 @@ body[data-bt-layout=flat] .bt-think{max-width:calc(var(--bt-flat-w) * 100%)}
[data-step-process]>div:first-child{display:none!important}
[data-step-process]>[data-step-process-body]{display:block!important;content-visibility:visible!important;max-height:none!important;overflow:visible!important;mask-image:none!important;scrollbar-gutter:auto!important}
:is([data-step-process],[data-turn-process-hidden])[hidden]{content-visibility:visible!important}
-[class*="_flowItem"]:has(> [data-slot="conversation.chat.node"]:empty){display:none!important}
-/* A turn's process seat is a flow child of its own, not a flowItem: an empty one
- (a hidden exchange turn, a turn whose calls draw nothing) still kept its
- margin, stacking a blank band per hidden call. */
-[data-step-process]:not(:has([data-slot="conversation.chat.node"] :not([hidden]))){display:none!important}
+[class*="_flowItem"]:has(> [data-slot="conversation.chat.node"]:empty, > [data-slot="conversation.chat.node"][data-bt-emptied]){display:none!important}
+/* A turn's process seat is a flow child of its own, not a flowItem: a seat whose
+ member cells all emptied themselves (a hidden exchange turn, a turn whose
+ calls draw nothing) still kept its margin, stacking a blank band per hidden
+ call. Only the slot a DS Bot cell marked counts, so a seat another renderer
+ fills — even with plain text and no element child — is never taken for empty. */
+[data-step-process]:has(> [data-step-process-body] [data-slot="conversation.chat.node"][data-bt-emptied]):not(:has(> [data-step-process-body] [data-slot="conversation.chat.node"]:not([data-bt-emptied]))){display:none!important}
[class*="_header"]:has(.bt-head){border-bottom-color:transparent!important;box-shadow:none!important}
/* The transcript runs under a floating header pill. */
header[class*="_header"]:has(.bt-head){position:absolute!important;top:0;left:0;right:0;z-index:8;display:flex!important;padding:10px 0 0!important;background:transparent!important;pointer-events:none;justify-content:center}
@@ -3928,12 +3930,27 @@ var SideIcon = lineIcon(["M4.5 4h11A1.5 1.5 0 0 1 17 5.5v6a1.5 1.5 0 0 1-1.5 1.5
var ChatsIcon = lineIcon(["M3.5 5.5A1.5 1.5 0 0 1 5 4h7a1.5 1.5 0 0 1 1.5 1.5V10A1.5 1.5 0 0 1 12 11.5H8L5 14v-2.5A1.5 1.5 0 0 1 3.5 10z", "M13.5 7.5H15A1.5 1.5 0 0 1 16.5 9v4.5A1.5 1.5 0 0 1 15 15v2l-2.5-2h-3A1.5 1.5 0 0 1 8 13.5V13"]);
var SETTINGS_ICONS = { general: GearIcon, bots: PeopleIcon, groups: ChatsIcon, usage: GaugeIcon };
-// src/client/card-hold.js
+// src/client/cell-empty.js
var import_react4 = require("react");
+function CellEmpty({ className }) {
+ const ref = (0, import_react4.useRef)(null);
+ (0, import_react4.useLayoutEffect)(() => {
+ const slot = ref.current?.closest("[data-slot]");
+ if (!slot) return void 0;
+ slot.dataset.btEmptied = "";
+ return () => {
+ if (slot.querySelectorAll("[data-bt-empty]").length <= 1) delete slot.dataset.btEmptied;
+ };
+ }, []);
+ return (0, import_react4.createElement)("span", { ref, className, hidden: true, "data-bt-empty": true });
+}
+
+// src/client/card-hold.js
+var import_react5 = require("react");
function useDockHold(sessionId, kind, requestId, actions, inline) {
- const release = (0, import_react4.useRef)(null);
+ const release = (0, import_react5.useRef)(null);
const note = actions.noteHeldCard;
- (0, import_react4.useLayoutEffect)(() => () => {
+ (0, import_react5.useLayoutEffect)(() => () => {
const stop = release.current;
release.current = null;
stop?.();
@@ -3946,16 +3963,16 @@ function useDockHold(sessionId, kind, requestId, actions, inline) {
}
// src/client/questions.js
-var import_react5 = require("react");
+var import_react6 = require("react");
var keyLetter = (index) => String.fromCharCode(65 + index);
var optionsOf = (question) => (question?.options ?? []).map((option) => typeof option === "string" ? { label: option } : option);
var isTypingTarget = (node) => node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement || node instanceof HTMLSelectElement || node instanceof HTMLElement && node.isContentEditable;
var optionKeyCards = createSource(0);
function useOptionKeys(count, onPick, ownRef) {
- const pick2 = (0, import_react5.useRef)(onPick);
+ const pick2 = (0, import_react6.useRef)(onPick);
pick2.current = onPick;
- const listening = (0, import_react5.useSyncExternalStore)(optionKeyCards.subscribe, optionKeyCards.getSnapshot);
- (0, import_react5.useEffect)(() => {
+ const listening = (0, import_react6.useSyncExternalStore)(optionKeyCards.subscribe, optionKeyCards.getSnapshot);
+ (0, import_react6.useEffect)(() => {
if (count === 0) return void 0;
optionKeyCards.set((value) => value + 1);
const onKey = (event) => {
@@ -3981,10 +3998,10 @@ function useOptionKeys(count, onPick, ownRef) {
return count > 0 && listening <= 1;
}
function QuestionView({ question, onAnswer, onDismiss, onInteract, busy = false, ownAnswer = false, raised = false }) {
- const [own, setOwn] = (0, import_react5.useState)("");
- const [picked, setPicked] = (0, import_react5.useState)([]);
- const ownRef = (0, import_react5.useRef)(null);
- const titleId = (0, import_react5.useId)();
+ const [own, setOwn] = (0, import_react6.useState)("");
+ const [picked, setPicked] = (0, import_react6.useState)([]);
+ const ownRef = (0, import_react6.useRef)(null);
+ const titleId = (0, import_react6.useId)();
const options = optionsOf(question);
const multi = question.multiSelect === true;
const custom = own.trim();
@@ -4005,7 +4022,7 @@ function QuestionView({ question, onAnswer, onDismiss, onInteract, busy = false,
};
const hints = useOptionKeys(busy ? 0 : options.length, (index) => choose(options[index].label), ownRef);
const ownLetter = options.length > 0 ? keyLetter(options.length) : void 0;
- const field = ownAnswer ? (0, import_react5.createElement)("textarea", {
+ const field = ownAnswer ? (0, import_react6.createElement)("textarea", {
ref: ownRef,
rows: 1,
value: own,
@@ -4030,7 +4047,7 @@ function QuestionView({ question, onAnswer, onDismiss, onInteract, busy = false,
}) : null;
const rows2 = options.map((option, optionIndex) => {
const selected = multi && picked.includes(option.label);
- return (0, import_react5.createElement)(
+ return (0, import_react6.createElement)(
"button",
{
key: option.label,
@@ -4041,36 +4058,36 @@ function QuestionView({ question, onAnswer, onDismiss, onInteract, busy = false,
"aria-keyshortcuts": hints ? keyLetter(optionIndex).toLowerCase() : void 0,
onClick: () => choose(option.label)
},
- hints ? (0, import_react5.createElement)("span", { className: "bt-key", "aria-hidden": true }, keyLetter(optionIndex)) : null,
- (0, import_react5.createElement)(
+ hints ? (0, import_react6.createElement)("span", { className: "bt-key", "aria-hidden": true }, keyLetter(optionIndex)) : null,
+ (0, import_react6.createElement)(
"span",
{ className: "bt-q-body" },
- (0, import_react5.createElement)("span", { className: "bt-q-label" }, option.label),
- option.description ? (0, import_react5.createElement)("span", { className: "bt-q-desc" }, option.description) : null
+ (0, import_react6.createElement)("span", { className: "bt-q-label" }, option.label),
+ option.description ? (0, import_react6.createElement)("span", { className: "bt-q-desc" }, option.description) : null
),
- selected && !raised ? (0, import_react5.createElement)("span", { className: "bt-q-check", title: t("Selected") }, (0, import_react5.createElement)(CheckIcon)) : null
+ selected && !raised ? (0, import_react6.createElement)("span", { className: "bt-q-check", title: t("Selected") }, (0, import_react6.createElement)(CheckIcon)) : null
);
});
if (raised && field) {
- rows2.push((0, import_react5.createElement)(
+ rows2.push((0, import_react6.createElement)(
"label",
{ key: "own", className: "bt-q-opt bt-q-ownrow", "data-filled": custom !== "" ? "" : void 0 },
- hints && ownLetter ? (0, import_react5.createElement)("span", { className: "bt-key", "aria-hidden": true }, ownLetter) : null,
- (0, import_react5.createElement)("span", { className: "bt-q-body" }, field)
+ hints && ownLetter ? (0, import_react6.createElement)("span", { className: "bt-key", "aria-hidden": true }, ownLetter) : null,
+ (0, import_react6.createElement)("span", { className: "bt-q-body" }, field)
));
}
let foot = null;
if (raised && multi) {
- foot = (0, import_react5.createElement)(
+ foot = (0, import_react6.createElement)(
"div",
{ className: "bt-q-foot" },
- (0, import_react5.createElement)("button", { type: "button", className: "bt-q-btn", onClick: onDismiss, disabled: busy }, t("Skip")),
- (0, import_react5.createElement)("button", { type: "submit", className: "bt-q-submit", disabled: !canSubmit || busy }, t("Submit"))
+ (0, import_react6.createElement)("button", { type: "button", className: "bt-q-btn", onClick: onDismiss, disabled: busy }, t("Skip")),
+ (0, import_react6.createElement)("button", { type: "submit", className: "bt-q-submit", disabled: !canSubmit || busy }, t("Submit"))
);
} else if ((raised || multi) && canSubmit) {
- foot = (0, import_react5.createElement)("div", { className: "bt-q-foot" }, (0, import_react5.createElement)("button", { type: "submit", className: "bt-q-submit", disabled: busy }, t("Submit")));
+ foot = (0, import_react6.createElement)("div", { className: "bt-q-foot" }, (0, import_react6.createElement)("button", { type: "submit", className: "bt-q-submit", disabled: busy }, t("Submit")));
}
- return (0, import_react5.createElement)(
+ return (0, import_react6.createElement)(
"form",
{
className: raised ? "bt-q bt-q-raised" : "bt-q",
@@ -4083,24 +4100,24 @@ function QuestionView({ question, onAnswer, onDismiss, onInteract, busy = false,
submit();
}
},
- (0, import_react5.createElement)(
+ (0, import_react6.createElement)(
"div",
{ className: "bt-q-head" },
- (0, import_react5.createElement)(
+ (0, import_react6.createElement)(
"div",
{ className: "bt-q-text" },
- (0, import_react5.createElement)("p", { className: "bt-q-title", id: titleId }, question.header ? `${question.header} · ` : "", question.question),
- question.detail ? (0, import_react5.createElement)("div", { className: "bt-q-detail" }, question.detail) : null,
- raised && multi ? (0, import_react5.createElement)("div", { className: "bt-q-detail" }, t("Choose all that apply")) : null
+ (0, import_react6.createElement)("p", { className: "bt-q-title", id: titleId }, question.header ? `${question.header} · ` : "", question.question),
+ question.detail ? (0, import_react6.createElement)("div", { className: "bt-q-detail" }, question.detail) : null,
+ raised && multi ? (0, import_react6.createElement)("div", { className: "bt-q-detail" }, t("Choose all that apply")) : null
),
- (0, import_react5.createElement)("button", { type: "button", className: "bt-q-x", "aria-label": t("Dismiss question"), title: t("Dismiss"), onClick: onDismiss, disabled: busy }, (0, import_react5.createElement)(CloseIcon))
+ (0, import_react6.createElement)("button", { type: "button", className: "bt-q-x", "aria-label": t("Dismiss question"), title: t("Dismiss"), onClick: onDismiss, disabled: busy }, (0, import_react6.createElement)(CloseIcon))
),
- rows2.length > 0 ? (0, import_react5.createElement)("div", { className: "bt-q-list", role: "group" }, rows2) : null,
- field && !raised ? (0, import_react5.createElement)(
+ rows2.length > 0 ? (0, import_react6.createElement)("div", { className: "bt-q-list", role: "group" }, rows2) : null,
+ field && !raised ? (0, import_react6.createElement)(
"div",
{ className: "bt-q-custom" },
- (0, import_react5.createElement)("label", { className: "bt-q-field" }, field),
- !multi && canSubmit ? (0, import_react5.createElement)("button", { type: "submit", className: "bt-q-submit", disabled: busy }, t("Submit")) : null
+ (0, import_react6.createElement)("label", { className: "bt-q-field" }, field),
+ !multi && canSubmit ? (0, import_react6.createElement)("button", { type: "submit", className: "bt-q-submit", disabled: busy }, t("Submit")) : null
) : null,
foot
);
@@ -4110,29 +4127,29 @@ function SettledQuestion({ question, answer }) {
const prompt = question?.question ?? "";
const chosen = [...answer.selected ?? [], ...answer.custom ? [answer.custom] : []];
if (chosen.length === 0) {
- return (0, import_react5.createElement)(
+ return (0, import_react6.createElement)(
"div",
{ className: "bt-q bt-q-settled bt-q-dismissed", role: "group", "aria-label": prompt },
- (0, import_react5.createElement)(
+ (0, import_react6.createElement)(
"div",
{ className: "bt-q-head" },
- (0, import_react5.createElement)("div", { className: "bt-q-text" }, (0, import_react5.createElement)("p", { className: "bt-q-title" }, prompt)),
- (0, import_react5.createElement)("span", { className: "bt-q-badge" }, t("Dismissed"))
+ (0, import_react6.createElement)("div", { className: "bt-q-text" }, (0, import_react6.createElement)("p", { className: "bt-q-title" }, prompt)),
+ (0, import_react6.createElement)("span", { className: "bt-q-badge" }, t("Dismissed"))
)
);
}
- return (0, import_react5.createElement)(
+ return (0, import_react6.createElement)(
"div",
{ className: "bt-q bt-q-settled", role: "group", "aria-label": prompt },
- prompt ? (0, import_react5.createElement)("div", { className: "bt-q-head" }, (0, import_react5.createElement)("div", { className: "bt-q-text" }, (0, import_react5.createElement)("p", { className: "bt-q-title" }, prompt))) : null,
- (0, import_react5.createElement)("div", { className: "bt-q-list", role: "group", "aria-label": t("Your answer") }, chosen.map((label, index) => {
+ prompt ? (0, import_react6.createElement)("div", { className: "bt-q-head" }, (0, import_react6.createElement)("div", { className: "bt-q-text" }, (0, import_react6.createElement)("p", { className: "bt-q-title" }, prompt))) : null,
+ (0, import_react6.createElement)("div", { className: "bt-q-list", role: "group", "aria-label": t("Your answer") }, chosen.map((label, index) => {
const optionIndex = options.findIndex((option) => option.label === label);
- return (0, import_react5.createElement)(
+ return (0, import_react6.createElement)(
"div",
{ key: `${label}-${index}`, className: "bt-q-opt" },
- optionIndex >= 0 ? (0, import_react5.createElement)("span", { className: "bt-key", "aria-hidden": true }, keyLetter(optionIndex)) : null,
- (0, import_react5.createElement)("span", { className: "bt-q-body" }, (0, import_react5.createElement)("span", { className: "bt-q-label" }, label)),
- (0, import_react5.createElement)("span", { className: "bt-q-check", title: t("Selected") }, (0, import_react5.createElement)(CheckIcon))
+ optionIndex >= 0 ? (0, import_react6.createElement)("span", { className: "bt-key", "aria-hidden": true }, keyLetter(optionIndex)) : null,
+ (0, import_react6.createElement)("span", { className: "bt-q-body" }, (0, import_react6.createElement)("span", { className: "bt-q-label" }, label)),
+ (0, import_react6.createElement)("span", { className: "bt-q-check", title: t("Selected") }, (0, import_react6.createElement)(CheckIcon))
);
}))
);
@@ -4140,8 +4157,8 @@ function SettledQuestion({ question, answer }) {
function QuestionCard({ matched }) {
const pending = matched;
const questions = pending.questions ?? [];
- const [index, setIndex] = (0, import_react5.useState)(0);
- const [answers, setAnswers] = (0, import_react5.useState)([]);
+ const [index, setIndex] = (0, import_react6.useState)(0);
+ const [answers, setAnswers] = (0, import_react6.useState)([]);
const question = questions[index];
if (question === void 0) return null;
const onAnswer = (answer) => {
@@ -4153,14 +4170,14 @@ function QuestionCard({ matched }) {
}
pending.answer({ answers: next });
};
- return (0, import_react5.createElement)(QuestionView, { key: index, question, onAnswer, onDismiss: () => pending.dismiss(), ownAnswer: true, raised: true });
+ return (0, import_react6.createElement)(QuestionView, { key: index, question, onAnswer, onDismiss: () => pending.dismiss(), ownAnswer: true, raised: true });
}
function PendingQuestion({ sessionId, question, actions, inline }) {
- const [answered, setAnswered] = (0, import_react5.useState)(null);
- const [busy, setBusy] = (0, import_react5.useState)(false);
- const busyRef = (0, import_react5.useRef)(false);
+ const [answered, setAnswered] = (0, import_react6.useState)(null);
+ const [busy, setBusy] = (0, import_react6.useState)(false);
+ const busyRef = (0, import_react6.useRef)(false);
const hold = useDockHold(sessionId, "question", question.id, actions, inline);
- if (answered === question.id) return null;
+ if (answered === question.id) return (0, import_react6.createElement)(CellEmpty);
const run2 = (make) => {
if (busyRef.current) return;
hold();
@@ -4173,10 +4190,10 @@ function PendingQuestion({ sessionId, question, actions, inline }) {
};
const onAnswer = (answer) => run2(() => actions.answerQuestion(sessionId, question.id, { selected: answer.selected ?? [], custom: answer.custom ?? "" }));
const onDismiss = () => run2(() => actions.dismissQuestion(sessionId));
- return (0, import_react5.createElement)(
+ return (0, import_react6.createElement)(
"div",
{ className: inline ? "bt-q-inline" : "bt-q-dock" },
- (0, import_react5.createElement)(QuestionView, { key: question.id, question, onAnswer, onDismiss, onInteract: hold, busy, ownAnswer: question.allowCustom === true, raised: !inline })
+ (0, import_react6.createElement)(QuestionView, { key: question.id, question, onAnswer, onDismiss, onInteract: hold, busy, ownAnswer: question.allowCustom === true, raised: !inline })
);
}
function QuestionDock({ sessionId, useRoster, useCards, useHeldCards, actions }) {
@@ -4184,16 +4201,16 @@ function QuestionDock({ sessionId, useRoster, useCards, useHeldCards, actions })
const drawn = useCards?.((state) => state[sessionId]?.[question?.callId] > 0) === true;
const held = useHeldCards?.((state) => state[sessionId]?.[heldCardKey("question", question?.id)] > 0) === true;
if (question === void 0 || question.callId && drawn && !held) return null;
- return (0, import_react5.createElement)(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: false });
+ return (0, import_react6.createElement)(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: false });
}
function AnsweredCell({ node }) {
const data = node.data ?? {};
const questions = Array.isArray(data.questions) ? data.questions : [];
if (questions.length === 0) {
- return data.text ? (0, import_react5.createElement)("div", { className: "bt-urow" }, (0, import_react5.createElement)("div", { className: "bt-ububble" }, data.text)) : null;
+ return data.text ? (0, import_react6.createElement)("div", { className: "bt-urow" }, (0, import_react6.createElement)("div", { className: "bt-ububble" }, data.text)) : (0, import_react6.createElement)(CellEmpty);
}
const answers = Array.isArray(data.answers) ? data.answers : [];
- return (0, import_react5.createElement)("div", { className: "bt-q-inline" }, questions.map((question) => (0, import_react5.createElement)(SettledQuestion, {
+ return (0, import_react6.createElement)("div", { className: "bt-q-inline" }, questions.map((question) => (0, import_react6.createElement)(SettledQuestion, {
key: question.id,
question,
answer: answers.find((answer) => answer.id === question.id) ?? { selected: [] }
@@ -4201,7 +4218,7 @@ function AnsweredCell({ node }) {
}
// src/client/handoff-card.js
-var import_react6 = require("react");
+var import_react7 = require("react");
var titleOf = (reason) => {
switch (reason) {
case "login":
@@ -4227,9 +4244,9 @@ function useSiteHost(hooks, botId) {
return hostOf(url);
}
function PendingHandoff({ sessionId, bot, hold, hooks, actions, inline }) {
- const [closed, setClosed] = (0, import_react6.useState)(false);
- const busyRef = (0, import_react6.useRef)(false);
- const titleId = (0, import_react6.useId)();
+ const [closed, setClosed] = (0, import_react7.useState)(false);
+ const busyRef = (0, import_react7.useRef)(false);
+ const titleId = (0, import_react7.useId)();
const keep = useDockHold(sessionId, "handoff", hold.callId, actions, inline);
const host = useSiteHost(hooks, bot.id);
const taken = hold.by === "user";
@@ -4250,7 +4267,7 @@ function PendingHandoff({ sessionId, bot, hold, hooks, actions, inline }) {
await actions.browserTakeover(bot.id);
actions.openBrowser?.(bot.id);
}, false);
- return (0, import_react6.createElement)(
+ return (0, import_react7.createElement)(
"div",
{
className: inline ? "bt-q-inline" : "bt-q-dock",
@@ -4258,32 +4275,32 @@ function PendingHandoff({ sessionId, bot, hold, hooks, actions, inline }) {
onFocusCapture: keep,
onPointerDownCapture: keep
},
- (0, import_react6.createElement)(
+ (0, import_react7.createElement)(
"section",
{ className: inline ? "bt-q bt-handoff" : "bt-q bt-q-raised bt-handoff", role: "group", "aria-labelledby": titleId },
- (0, import_react6.createElement)(
+ (0, import_react7.createElement)(
"div",
{ className: "bt-q-head" },
- (0, import_react6.createElement)(
+ (0, import_react7.createElement)(
"div",
{ className: "bt-q-text" },
- (0, import_react6.createElement)("p", { className: "bt-q-title", id: titleId }, titleOf(hold.reason)),
- hold.note ? (0, import_react6.createElement)("div", { className: "bt-q-detail" }, hold.note) : null,
- host ? (0, import_react6.createElement)("div", { className: "bt-handoff-site" }, (0, import_react6.createElement)(GlobeIcon), (0, import_react6.createElement)("span", null, host)) : null,
- taken ? (0, import_react6.createElement)(
+ (0, import_react7.createElement)("p", { className: "bt-q-title", id: titleId }, titleOf(hold.reason)),
+ hold.note ? (0, import_react7.createElement)("div", { className: "bt-q-detail" }, hold.note) : null,
+ host ? (0, import_react7.createElement)("div", { className: "bt-handoff-site" }, (0, import_react7.createElement)(GlobeIcon), (0, import_react7.createElement)("span", null, host)) : null,
+ taken ? (0, import_react7.createElement)(
"div",
{ className: "bt-handoff-state", role: "status" },
- (0, import_react6.createElement)("span", { className: "bt-handoff-dot", "aria-hidden": true }),
+ (0, import_react7.createElement)("span", { className: "bt-handoff-dot", "aria-hidden": true }),
t("You control this browser")
) : null
)
),
- (0, import_react6.createElement)(
+ (0, import_react7.createElement)(
"div",
{ className: "bt-q-foot" },
- (0, import_react6.createElement)("button", { type: "button", className: "bt-q-btn", onClick: () => answer("skip") }, t("Skip")),
- taken ? null : (0, import_react6.createElement)("button", { type: "button", className: "bt-q-btn", onClick: takeOver }, t("Take over")),
- (0, import_react6.createElement)("button", { type: "button", className: "bt-q-submit", onClick: () => answer("done") }, t("I'm done"))
+ (0, import_react7.createElement)("button", { type: "button", className: "bt-q-btn", onClick: () => answer("skip") }, t("Skip")),
+ taken ? null : (0, import_react7.createElement)("button", { type: "button", className: "bt-q-btn", onClick: takeOver }, t("Take over")),
+ (0, import_react7.createElement)("button", { type: "button", className: "bt-q-submit", onClick: () => answer("done") }, t("I'm done"))
)
)
);
@@ -4291,9 +4308,9 @@ function PendingHandoff({ sessionId, bot, hold, hooks, actions, inline }) {
function HandoffCall({ sessionId, callId, roster, actions, heldCards, hooks }) {
const bot = roster.byId[sessionId];
const hold = hooks.useBrowserHolds?.((map) => bot ? map[bot.id] : void 0);
- if (!bot || hold?.callId !== callId || !actions.browserGiveBack) return (0, import_react6.createElement)("span", { className: "bt-q-gone", hidden: true });
- if (heldCards?.[heldCardKey("handoff", callId)] > 0) return null;
- return (0, import_react6.createElement)(PendingHandoff, { key: callId, sessionId, bot, hold, hooks, actions, inline: true });
+ if (!bot || hold?.callId !== callId || !actions.browserGiveBack) return (0, import_react7.createElement)(CellEmpty, { className: "bt-q-gone" });
+ if (heldCards?.[heldCardKey("handoff", callId)] > 0) return (0, import_react7.createElement)(CellEmpty);
+ return (0, import_react7.createElement)(PendingHandoff, { key: callId, sessionId, bot, hold, hooks, actions, inline: true });
}
function HandoffDock({ sessionId, useRoster, useCards, useHeldCards, useBrowserHolds, useBrowserTabs, useBrowserPages, actions }) {
const bot = useRoster((value) => value.byId[sessionId]);
@@ -4301,7 +4318,7 @@ function HandoffDock({ sessionId, useRoster, useCards, useHeldCards, useBrowserH
const drawn = useCards?.((state) => state[sessionId]?.[hold?.callId] > 0) === true;
const held = useHeldCards?.((state) => state[sessionId]?.[heldCardKey("handoff", hold?.callId)] > 0) === true;
if (!bot || hold?.callId === void 0 || !actions.browserGiveBack || drawn && !held) return null;
- return (0, import_react6.createElement)(PendingHandoff, {
+ return (0, import_react7.createElement)(PendingHandoff, {
key: JSON.stringify([sessionId, hold.callId]),
sessionId,
bot,
@@ -4315,17 +4332,17 @@ function SettledHandoff({ handoff }) {
const skipped = handoff.outcome === "skipped";
const returned = handoff.outcome === "returned";
const title = titleOf(handoff.reason);
- return (0, import_react6.createElement)(
+ return (0, import_react7.createElement)(
"div",
{ className: "bt-q-inline" },
- (0, import_react6.createElement)(
+ (0, import_react7.createElement)(
"div",
{ className: skipped ? "bt-q bt-q-settled bt-q-dismissed" : "bt-q bt-q-settled", role: "group", "aria-label": title },
- (0, import_react6.createElement)(
+ (0, import_react7.createElement)(
"div",
{ className: "bt-q-head" },
- (0, import_react6.createElement)("div", { className: "bt-q-text" }, (0, import_react6.createElement)("p", { className: "bt-q-title" }, title)),
- skipped || returned ? (0, import_react6.createElement)("span", { className: "bt-q-badge" }, t(skipped ? "Skipped" : "Returned")) : (0, import_react6.createElement)("span", { className: "bt-q-check", title: t("Done") }, (0, import_react6.createElement)(CheckIcon))
+ (0, import_react7.createElement)("div", { className: "bt-q-text" }, (0, import_react7.createElement)("p", { className: "bt-q-title" }, title)),
+ skipped || returned ? (0, import_react7.createElement)("span", { className: "bt-q-badge" }, t(skipped ? "Skipped" : "Returned")) : (0, import_react7.createElement)("span", { className: "bt-q-check", title: t("Done") }, (0, import_react7.createElement)(CheckIcon))
)
)
);
@@ -4342,15 +4359,15 @@ var HANDOFF_CSS = `
`;
// node_modules/deep-view/src/react/ui.js
-var import_react7 = require("react");
-var FallbackMarkdown = ({ text }) => (0, import_react7.createElement)("span", null, String(text ?? ""));
-var ViewUi = (0, import_react7.createContext)({ t: (key) => key, Markdown: FallbackMarkdown });
-var useViewUi = () => (0, import_react7.useContext)(ViewUi);
+var import_react8 = require("react");
+var FallbackMarkdown = ({ text }) => (0, import_react8.createElement)("span", null, String(text ?? ""));
+var ViewUi = (0, import_react8.createContext)({ t: (key) => key, Markdown: FallbackMarkdown });
+var useViewUi = () => (0, import_react8.useContext)(ViewUi);
var lineIcon2 = (paths) => function LineIcon() {
- return (0, import_react7.createElement)(
+ return (0, import_react8.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 },
- paths.map((d, index) => (0, import_react7.createElement)("path", { key: index, d }))
+ paths.map((d, index) => (0, import_react8.createElement)("path", { key: index, d }))
);
};
var DotsIcon2 = lineIcon2(["M5 10h.01M10 10h.01M15 10h.01"]);
@@ -4359,10 +4376,10 @@ var DownloadIcon2 = lineIcon2(["M10 3.5v9", "M6.5 9.5L10 13l3.5-3.5", "M4 16h12"
var CopyIcon2 = lineIcon2(["M8.5 7h6A1.5 1.5 0 0 1 16 8.5v6a1.5 1.5 0 0 1-1.5 1.5h-6A1.5 1.5 0 0 1 7 14.5v-6A1.5 1.5 0 0 1 8.5 7z", "M4 12.5V5.5A1.5 1.5 0 0 1 5.5 4H13"]);
var InfoIcon2 = lineIcon2(["M10 3.5a6.5 6.5 0 1 1 0 13 6.5 6.5 0 0 1 0-13z", "M10 9.25v4", "M10 6.6h.01"]);
function CloseIcon2() {
- return (0, import_react7.createElement)("svg", { width: 16, height: 16, viewBox: "0 0 20 20", "aria-hidden": true }, (0, import_react7.createElement)("path", { d: "M5 5l10 10M15 5L5 15", stroke: "currentColor", strokeWidth: 1.6, strokeLinecap: "round" }));
+ return (0, import_react8.createElement)("svg", { width: 16, height: 16, viewBox: "0 0 20 20", "aria-hidden": true }, (0, import_react8.createElement)("path", { d: "M5 5l10 10M15 5L5 15", stroke: "currentColor", strokeWidth: 1.6, strokeLinecap: "round" }));
}
function Segmented2({ label, value, className, children }) {
- return (0, import_react7.createElement)("div", { className: className ? `dv-seg ${className}` : "dv-seg", role: "group", "aria-label": label, "data-active": value }, children);
+ return (0, import_react8.createElement)("div", { className: className ? `dv-seg ${className}` : "dv-seg", role: "group", "aria-label": label, "data-active": value }, children);
}
var keyLetter2 = (index) => String.fromCharCode(65 + index);
var isTypingTarget2 = (node) => node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement || node instanceof HTMLSelectElement || node instanceof HTMLElement && node.isContentEditable;
@@ -4379,10 +4396,10 @@ var keyCards = /* @__PURE__ */ (() => {
};
})();
function useOptionKeys2(count, onPick, ownRef) {
- const pick2 = (0, import_react7.useRef)(onPick);
+ const pick2 = (0, import_react8.useRef)(onPick);
pick2.current = onPick;
- const listening = (0, import_react7.useSyncExternalStore)(keyCards.subscribe, keyCards.getSnapshot);
- (0, import_react7.useEffect)(() => {
+ const listening = (0, import_react8.useSyncExternalStore)(keyCards.subscribe, keyCards.getSnapshot);
+ (0, import_react8.useEffect)(() => {
if (count === 0) return void 0;
keyCards.set((value) => value + 1);
const onKey = (event) => {
@@ -5310,7 +5327,7 @@ function validateForm(node, values) {
}
// node_modules/deep-view/src/react/chart.js
-var import_react8 = require("react");
+var import_react9 = require("react");
var PALETTE = ["var(--dv-accent)", "var(--dv-ink-tangerine)", "var(--dv-ink-green)", "var(--dv-ink-violet)", "var(--dv-ink-sky)", "var(--dv-ink-rose)", "var(--dv-ink-yellow)", "var(--dv-ink-cyan)", "var(--dv-ink-magenta)"];
var colorAt = (index) => PALETTE[index % PALETTE.length];
var TICK = 10;
@@ -5389,13 +5406,13 @@ function columns({ categories, series, unit, kind }, width, active, shown) {
const band = plot.w / categories.length;
const parts = [];
for (const tick of ticks) {
- parts.push((0, import_react8.createElement)("line", { key: `g${tick}`, className: "dv-chart-grid", x1: plot.x, x2: plot.x + plot.w, y1: y(tick), y2: y(tick) }));
- parts.push((0, import_react8.createElement)("text", { key: `t${tick}`, className: "dv-chart-tick", x: plot.x - 8, y: y(tick) + 3, textAnchor: "end" }, withUnit(tick, unit)));
+ parts.push((0, import_react9.createElement)("line", { key: `g${tick}`, className: "dv-chart-grid", x1: plot.x, x2: plot.x + plot.w, y1: y(tick), y2: y(tick) }));
+ parts.push((0, import_react9.createElement)("text", { key: `t${tick}`, className: "dv-chart-tick", x: plot.x - 8, y: y(tick) + 3, textAnchor: "end" }, withUnit(tick, unit)));
}
const points = [];
categories.forEach((label, at) => {
const cx = plot.x + band * at + band / 2;
- parts.push((0, import_react8.createElement)("text", { key: `c${at}`, className: "dv-chart-label", x: cx, y: height - 7, textAnchor: "middle" }, fit(label, band - 4, LABEL)));
+ parts.push((0, import_react9.createElement)("text", { key: `c${at}`, className: "dv-chart-label", x: cx, y: height - 7, textAnchor: "middle" }, fit(label, band - 4, LABEL)));
points.push({ x: cx, y: y(Math.max(...visible.map((item) => item.values[at]), lo)) });
});
if (kind === "bar") {
@@ -5412,7 +5429,7 @@ function columns({ categories, series, unit, kind }, width, active, shown) {
const r = Math.min(4, barW / 2, tall);
const up = value >= 0;
const d = up ? `M${x},${top2 + tall}V${top2 + r}q0,-${r} ${r},-${r}h${barW - 2 * r}q${r},0 ${r},${r}V${top2 + tall}z` : `M${x},${top2}V${top2 + tall - r}q0,${r} ${r},${r}h${barW - 2 * r}q${r},0 ${r},-${r}V${top2}z`;
- parts.push((0, import_react8.createElement)("path", { key: `b${at}-${row}`, className: "dv-chart-mark", "data-dim": active !== null && active !== at ? "" : void 0, d, style: { fill: item.color } }));
+ parts.push((0, import_react9.createElement)("path", { key: `b${at}-${row}`, className: "dv-chart-mark", "data-dim": active !== null && active !== at ? "" : void 0, d, style: { fill: item.color } }));
});
});
} else {
@@ -5421,14 +5438,14 @@ function columns({ categories, series, unit, kind }, width, active, shown) {
const line = item.values.map((value, at) => `${at === 0 ? "M" : "L"}${xs[at]},${y(value)}`).join("");
if (kind === "area") {
const base = y(Math.max(lo, Math.min(0, hi)));
- parts.push((0, import_react8.createElement)("path", { key: `a${row}`, className: "dv-chart-area", d: `${line}L${xs.at(-1)},${base}L${xs[0]},${base}z`, style: { fill: item.color } }));
+ parts.push((0, import_react9.createElement)("path", { key: `a${row}`, className: "dv-chart-area", d: `${line}L${xs.at(-1)},${base}L${xs[0]},${base}z`, style: { fill: item.color } }));
}
- parts.push((0, import_react8.createElement)("path", { key: `l${row}`, className: "dv-chart-line", d: line, style: { stroke: item.color } }));
+ parts.push((0, import_react9.createElement)("path", { key: `l${row}`, className: "dv-chart-line", d: line, style: { stroke: item.color } }));
item.values.forEach((value, at) => {
- parts.push((0, import_react8.createElement)("circle", { key: `p${row}-${at}`, className: "dv-chart-dot", cx: xs[at], cy: y(value), r: active === at ? 4 : 2.5, style: { fill: item.color } }));
+ parts.push((0, import_react9.createElement)("circle", { key: `p${row}-${at}`, className: "dv-chart-dot", cx: xs[at], cy: y(value), r: active === at ? 4 : 2.5, style: { fill: item.color } }));
});
});
- if (active !== null) parts.unshift((0, import_react8.createElement)("line", { key: "guide", className: "dv-chart-guide", x1: xs[active], x2: xs[active], y1: plot.y, y2: plot.y + plot.h }));
+ if (active !== null) parts.unshift((0, import_react9.createElement)("line", { key: "guide", className: "dv-chart-guide", x1: xs[active], x2: xs[active], y1: plot.y, y2: plot.y + plot.h }));
}
const hits = categories.map((_, at) => ({ x: plot.x + band * at, y: plot.y, w: band, h: plot.h }));
return { parts, height, points, hits };
@@ -5448,21 +5465,21 @@ function rows({ categories, series, unit }, width, active, shown) {
const x = (value) => plot.x + (value - lo) / (hi - lo) * plot.w;
const parts = [];
for (const tick of ticks) {
- parts.push((0, import_react8.createElement)("line", { key: `g${tick}`, className: "dv-chart-grid", x1: x(tick), x2: x(tick), y1: plot.y, y2: plot.y + plot.h }));
- parts.push((0, import_react8.createElement)("text", { key: `t${tick}`, className: "dv-chart-tick", x: x(tick), y: height - 6, textAnchor: "middle" }, withUnit(tick, unit)));
+ parts.push((0, import_react9.createElement)("line", { key: `g${tick}`, className: "dv-chart-grid", x1: x(tick), x2: x(tick), y1: plot.y, y2: plot.y + plot.h }));
+ parts.push((0, import_react9.createElement)("text", { key: `t${tick}`, className: "dv-chart-tick", x: x(tick), y: height - 6, textAnchor: "middle" }, withUnit(tick, unit)));
}
const points = [];
const zero = x(Math.max(lo, Math.min(0, hi)));
categories.forEach((label, at) => {
const rowY = plot.y + rowH * at + 5;
- parts.push((0, import_react8.createElement)("text", { key: `c${at}`, className: "dv-chart-label", x: labelW - 10, y: rowY + (rowH - 10) / 2 + 4, textAnchor: "end" }, fit(label, labelW - 12, LABEL)));
+ parts.push((0, import_react9.createElement)("text", { key: `c${at}`, className: "dv-chart-label", x: labelW - 10, y: rowY + (rowH - 10) / 2 + 4, textAnchor: "end" }, fit(label, labelW - 12, LABEL)));
visible.forEach((item, row) => {
const value = item.values[at];
const by = rowY + row * (barH + 2);
const left = Math.min(x(value), zero);
const long = Math.max(1, Math.abs(x(value) - zero));
- parts.push((0, import_react8.createElement)("rect", { key: `b${at}-${row}`, className: "dv-chart-mark", "data-dim": active !== null && active !== at ? "" : void 0, x: left, y: by, width: long, height: barH, rx: Math.min(4, long / 2), style: { fill: item.color } }));
- parts.push((0, import_react8.createElement)("text", { key: `v${at}-${row}`, className: "dv-chart-value", x: left + long + 6, y: by + barH - 3 }, withUnit(value, unit)));
+ parts.push((0, import_react9.createElement)("rect", { key: `b${at}-${row}`, className: "dv-chart-mark", "data-dim": active !== null && active !== at ? "" : void 0, x: left, y: by, width: long, height: barH, rx: Math.min(4, long / 2), style: { fill: item.color } }));
+ parts.push((0, import_react9.createElement)("text", { key: `v${at}-${row}`, className: "dv-chart-value", x: left + long + 6, y: by + barH - 3 }, withUnit(value, unit)));
});
points.push({ x: Math.max(...visible.map((item) => x(item.values[at])), zero), y: rowY });
});
@@ -5490,15 +5507,15 @@ function donut({ categories, series }, width, active, hover) {
const full2 = sweep >= Math.PI * 2 - 1e-6;
const p = (radius, theta) => `${cx + Math.cos(theta) * radius},${cy + Math.sin(theta) * radius}`;
const d = full2 ? `M${p(r, angle)}A${r},${r} 0 1 1 ${p(r, angle + Math.PI)}A${r},${r} 0 1 1 ${p(r, angle)}M${p(inner, angle)}A${inner},${inner} 0 1 0 ${p(inner, angle + Math.PI)}A${inner},${inner} 0 1 0 ${p(inner, angle)}z` : `M${p(r, angle)}A${r},${r} 0 ${large} 1 ${p(r, end)}L${p(inner, end)}A${inner},${inner} 0 ${large} 0 ${p(inner, angle)}z`;
- parts.push((0, import_react8.createElement)("path", { key: `s${at}`, className: "dv-chart-mark", "data-dim": active !== null && active !== at ? "" : void 0, d, fillRule: "evenodd", style: { fill: colorAt(at) }, onPointerEnter: () => hover(at) }));
+ parts.push((0, import_react9.createElement)("path", { key: `s${at}`, className: "dv-chart-mark", "data-dim": active !== null && active !== at ? "" : void 0, d, fillRule: "evenodd", style: { fill: colorAt(at) }, onPointerEnter: () => hover(at) }));
}
angle = end;
});
return { parts, height: size, size, points, total, values, categories };
}
function useWidth(box, initial) {
- const [width, setWidth] = (0, import_react8.useState)(initial);
- (0, import_react8.useLayoutEffect)(() => {
+ const [width, setWidth] = (0, import_react9.useState)(initial);
+ (0, import_react9.useLayoutEffect)(() => {
const node = box.current;
if (!node || typeof ResizeObserver !== "function") return void 0;
const measure = () => {
@@ -5552,28 +5569,28 @@ function saveImage(svg, name) {
image.onerror = () => URL.revokeObjectURL(url);
image.src = url;
}
-var TableIcon = () => (0, import_react8.createElement)(
+var TableIcon = () => (0, import_react9.createElement)(
"svg",
{ width: 16, height: 16, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.6, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true },
- (0, import_react8.createElement)("path", { d: "M4.5 4h11A1.5 1.5 0 0 1 17 5.5v9a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 14.5v-9A1.5 1.5 0 0 1 4.5 4z" }),
- (0, import_react8.createElement)("path", { d: "M3 8.5h14M8 8.5V16" })
+ (0, import_react9.createElement)("path", { d: "M4.5 4h11A1.5 1.5 0 0 1 17 5.5v9a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 14.5v-9A1.5 1.5 0 0 1 4.5 4z" }),
+ (0, import_react9.createElement)("path", { d: "M3 8.5h14M8 8.5V16" })
);
function ChartTable({ data }) {
const ui2 = useViewUi();
const { categories, series, unit } = data;
const heads = series.map((item, index) => item.name || (series.length === 1 ? unit || ui2.t("Value") : `${ui2.t("Series")} ${index + 1}`));
- return (0, import_react8.createElement)(
+ return (0, import_react9.createElement)(
"div",
{ className: "dv-widget-table" },
- (0, import_react8.createElement)(
+ (0, import_react9.createElement)(
"table",
null,
- (0, import_react8.createElement)("thead", null, (0, import_react8.createElement)("tr", null, (0, import_react8.createElement)("th", { scope: "col" }), heads.map((head, index) => (0, import_react8.createElement)("th", { key: index, scope: "col", className: "dv-num" }, head)))),
- (0, import_react8.createElement)("tbody", null, categories.map((label, at) => (0, import_react8.createElement)(
+ (0, import_react9.createElement)("thead", null, (0, import_react9.createElement)("tr", null, (0, import_react9.createElement)("th", { scope: "col" }), heads.map((head, index) => (0, import_react9.createElement)("th", { key: index, scope: "col", className: "dv-num" }, head)))),
+ (0, import_react9.createElement)("tbody", null, categories.map((label, at) => (0, import_react9.createElement)(
"tr",
{ key: at },
- (0, import_react8.createElement)("th", { scope: "row" }, label),
- series.map((item, index) => (0, import_react8.createElement)("td", { key: index, className: "dv-num" }, withUnit(item.values[at], series.length === 1 && !item.name ? "" : unit)))
+ (0, import_react9.createElement)("th", { scope: "row" }, label),
+ series.map((item, index) => (0, import_react9.createElement)("td", { key: index, className: "dv-num" }, withUnit(item.values[at], series.length === 1 && !item.name ? "" : unit)))
)))
)
);
@@ -5582,16 +5599,16 @@ function WidgetChart({ node, lookup, registerChart, refreshCharts }) {
const ui2 = useViewUi();
const data = chartData(node, lookup);
const { kind, categories, series, unit } = data;
- const box = (0, import_react8.useRef)(null);
- const svg = (0, import_react8.useRef)(null);
+ const box = (0, import_react9.useRef)(null);
+ const svg = (0, import_react9.useRef)(null);
const width = useWidth(box, 520);
- const [active, setActive] = (0, import_react8.useState)(null);
- const [hidden, setHidden] = (0, import_react8.useState)([]);
- const [asTable, setAsTable] = (0, import_react8.useState)(false);
- const [copied, setCopied] = (0, import_react8.useState)(false);
- const labelId = (0, import_react8.useId)();
- const menuKey = (0, import_react8.useId)();
- const table = (0, import_react8.useRef)(asTable);
+ const [active, setActive] = (0, import_react9.useState)(null);
+ const [hidden, setHidden] = (0, import_react9.useState)([]);
+ const [asTable, setAsTable] = (0, import_react9.useState)(false);
+ const [copied, setCopied] = (0, import_react9.useState)(false);
+ const labelId = (0, import_react9.useId)();
+ const menuKey = (0, import_react9.useId)();
+ const table = (0, import_react9.useRef)(asTable);
table.current = asTable;
const shown = series.map((_, index) => !hidden.includes(index));
const toggle = (index) => {
@@ -5627,11 +5644,11 @@ function WidgetChart({ node, lookup, registerChart, refreshCharts }) {
setAsTable(table.current);
};
const menuLabel = typeof node.caption === "string" && node.caption !== "" ? node.caption : null;
- const action = (0, import_react8.useRef)(null);
+ const action = (0, import_react9.useRef)(null);
action.current = { label: menuLabel, copy: copy2, save: () => {
if (svg.current) saveImage(svg.current, "chart.png");
}, toggleTable };
- (0, import_react8.useEffect)(() => registerChart?.(menuKey, {
+ (0, import_react9.useEffect)(() => registerChart?.(menuKey, {
get label() {
return action.current.label;
},
@@ -5642,8 +5659,8 @@ function WidgetChart({ node, lookup, registerChart, refreshCharts }) {
copy: () => action.current.copy(),
save: () => action.current.save()
}), [registerChart, menuKey]);
- (0, import_react8.useEffect)(() => refreshCharts?.(), [refreshCharts, asTable, menuLabel]);
- const legend = isDonut ? (0, import_react8.createElement)("div", { className: "dv-chart-legend dv-chart-legend-list" }, categories.map((name, at) => (0, import_react8.createElement)(
+ (0, import_react9.useEffect)(() => refreshCharts?.(), [refreshCharts, asTable, menuLabel]);
+ const legend = isDonut ? (0, import_react9.createElement)("div", { className: "dv-chart-legend dv-chart-legend-list" }, categories.map((name, at) => (0, import_react9.createElement)(
"div",
{
key: at,
@@ -5652,20 +5669,20 @@ function WidgetChart({ node, lookup, registerChart, refreshCharts }) {
onPointerEnter: () => setActive(at),
onPointerLeave: () => setActive(null)
},
- (0, import_react8.createElement)("i", { style: { background: colorAt(at) } }),
- (0, import_react8.createElement)("span", { className: "dv-chart-key-name" }, name),
- (0, import_react8.createElement)("span", { className: "dv-chart-key-value" }, share(at))
- ))) : series.length > 1 ? (0, import_react8.createElement)("div", { className: "dv-chart-legend" }, series.map((item, index) => (0, import_react8.createElement)("button", {
+ (0, import_react9.createElement)("i", { style: { background: colorAt(at) } }),
+ (0, import_react9.createElement)("span", { className: "dv-chart-key-name" }, name),
+ (0, import_react9.createElement)("span", { className: "dv-chart-key-value" }, share(at))
+ ))) : series.length > 1 ? (0, import_react9.createElement)("div", { className: "dv-chart-legend" }, series.map((item, index) => (0, import_react9.createElement)("button", {
key: index,
type: "button",
className: "dv-chart-key",
"aria-pressed": shown[index],
onClick: () => toggle(index)
- }, (0, import_react8.createElement)("i", { style: { background: item.color } }), item.name || `${ui2.t("Series")} ${index + 1}`))) : null;
- const plot = (0, import_react8.createElement)(
+ }, (0, import_react9.createElement)("i", { style: { background: item.color } }), item.name || `${ui2.t("Series")} ${index + 1}`))) : null;
+ const plot = (0, import_react9.createElement)(
"div",
{ className: "dv-chart-plot", style: isDonut ? { width: svgWidth } : void 0 },
- (0, import_react8.createElement)(
+ (0, import_react9.createElement)(
"svg",
{
ref: svg,
@@ -5681,30 +5698,30 @@ function WidgetChart({ node, lookup, registerChart, refreshCharts }) {
onPointerLeave: () => setActive(null)
},
drawn.parts,
- isDonut ? active === null ? (0, import_react8.createElement)("text", { className: "dv-chart-center", x: svgWidth / 2, y: drawn.height / 2 + 5, textAnchor: "middle" }, unit === "%" ? "" : withUnit(drawn.total, unit)) : (0, import_react8.createElement)(
- import_react8.Fragment,
+ isDonut ? active === null ? (0, import_react9.createElement)("text", { className: "dv-chart-center", x: svgWidth / 2, y: drawn.height / 2 + 5, textAnchor: "middle" }, unit === "%" ? "" : withUnit(drawn.total, unit)) : (0, import_react9.createElement)(
+ import_react9.Fragment,
null,
- (0, import_react8.createElement)("text", { className: "dv-chart-center-name", x: svgWidth / 2, y: drawn.height / 2 - 4, textAnchor: "middle" }, fit(categories[active], drawn.size * 0.56, LABEL)),
- (0, import_react8.createElement)("text", { className: "dv-chart-center", x: svgWidth / 2, y: drawn.height / 2 + 14, textAnchor: "middle" }, share(active))
- ) : drawn.hits.map((hit, at) => (0, import_react8.createElement)("rect", { key: `h${at}`, className: "dv-chart-hit", x: hit.x, y: hit.y, width: hit.w, height: hit.h, onPointerEnter: () => setActive(at) }))
+ (0, import_react9.createElement)("text", { className: "dv-chart-center-name", x: svgWidth / 2, y: drawn.height / 2 - 4, textAnchor: "middle" }, fit(categories[active], drawn.size * 0.56, LABEL)),
+ (0, import_react9.createElement)("text", { className: "dv-chart-center", x: svgWidth / 2, y: drawn.height / 2 + 14, textAnchor: "middle" }, share(active))
+ ) : drawn.hits.map((hit, at) => (0, import_react9.createElement)("rect", { key: `h${at}`, className: "dv-chart-hit", x: hit.x, y: hit.y, width: hit.w, height: hit.h, onPointerEnter: () => setActive(at) }))
),
- point && !asTable && !isDonut ? (0, import_react8.createElement)(
+ point && !asTable && !isDonut ? (0, import_react9.createElement)(
"div",
{ className: "dv-chart-tip", role: "status", style: { left: point.x, top: point.y } },
- (0, import_react8.createElement)("b", null, categories[active]),
- tipRows.map((row, index) => (0, import_react8.createElement)("span", { key: index }, (0, import_react8.createElement)("i", { style: { background: row.color } }), row.name ? `${row.name} ` : "", row.value))
+ (0, import_react9.createElement)("b", null, categories[active]),
+ tipRows.map((row, index) => (0, import_react9.createElement)("span", { key: index }, (0, import_react9.createElement)("i", { style: { background: row.color } }), row.name ? `${row.name} ` : "", row.value))
) : null
);
- const body = asTable ? (0, import_react8.createElement)(ChartTable, { data }) : isDonut ? (0, import_react8.createElement)("div", { className: legendBeside ? "dv-chart-donut dv-chart-donut-beside" : "dv-chart-donut", onPointerLeave: () => setActive(null) }, plot, legend) : (0, import_react8.createElement)(import_react8.Fragment, null, legend, plot);
- return (0, import_react8.createElement)(
+ const body = asTable ? (0, import_react9.createElement)(ChartTable, { data }) : isDonut ? (0, import_react9.createElement)("div", { className: legendBeside ? "dv-chart-donut dv-chart-donut-beside" : "dv-chart-donut", onPointerLeave: () => setActive(null) }, plot, legend) : (0, import_react9.createElement)(import_react9.Fragment, null, legend, plot);
+ return (0, import_react9.createElement)(
"figure",
{ ref: box, className: "dv-chart", "data-kind": kind },
- (0, import_react8.createElement)("span", { id: labelId, hidden: true }, label),
+ (0, import_react9.createElement)("span", { id: labelId, hidden: true }, label),
body,
// The SVG stays mounted under the table, so the image can still be saved from it.
- asTable ? (0, import_react8.createElement)("div", { hidden: true }, plot) : null,
- copied ? (0, import_react8.createElement)("span", { className: "dv-chart-copied", role: "status" }, ui2.t("Copied")) : null,
- typeof node.caption === "string" && node.caption !== "" ? (0, import_react8.createElement)("figcaption", { className: "dv-view-caption" }, node.caption) : null
+ asTable ? (0, import_react9.createElement)("div", { hidden: true }, plot) : null,
+ copied ? (0, import_react9.createElement)("span", { className: "dv-chart-copied", role: "status" }, ui2.t("Copied")) : null,
+ typeof node.caption === "string" && node.caption !== "" ? (0, import_react9.createElement)("figcaption", { className: "dv-view-caption" }, node.caption) : null
);
}
var CHART_CSS = `
@@ -5749,7 +5766,7 @@ var CHART_CSS = `
`;
// node_modules/deep-view/src/react/frame.js
-var import_react9 = require("react");
+var import_react10 = require("react");
var THEME_VARS = [
["--view-ink", "--bt-ink", "--dv-ink"],
["--view-ink-2", "--bt-ink-2", "--dv-ink-2"],
@@ -5790,12 +5807,12 @@ function frameDocument(html, vars = {}) {
}
function HtmlFrame({ node }) {
const ui2 = useViewUi();
- const frame = (0, import_react9.useRef)(null);
- const loads = (0, import_react9.useRef)(0);
- const [height, setHeight] = (0, import_react9.useState)(Number.isFinite(node.height) ? node.height : 120);
- const [stopped, setStopped] = (0, import_react9.useState)(false);
- const doc = (0, import_react9.useMemo)(() => frameDocument(String(node.html ?? ""), themeVars2()), [node.html]);
- (0, import_react9.useEffect)(() => {
+ const frame = (0, import_react10.useRef)(null);
+ const loads = (0, import_react10.useRef)(0);
+ const [height, setHeight] = (0, import_react10.useState)(Number.isFinite(node.height) ? node.height : 120);
+ const [stopped, setStopped] = (0, import_react10.useState)(false);
+ const doc = (0, import_react10.useMemo)(() => frameDocument(String(node.html ?? ""), themeVars2()), [node.html]);
+ (0, import_react10.useEffect)(() => {
const onMessage = (event) => {
if (event.source !== frame.current?.contentWindow || event.data?.type !== HEIGHT) return;
const next = Number(event.data.height);
@@ -5810,8 +5827,8 @@ function HtmlFrame({ node }) {
observer?.disconnect();
};
}, []);
- if (stopped) return (0, import_react9.createElement)("p", { className: "dv-view-frame-stopped" }, ui2.t("This view tried to open a page and was stopped."));
- return (0, import_react9.createElement)("iframe", {
+ if (stopped) return (0, import_react10.createElement)("p", { className: "dv-view-frame-stopped" }, ui2.t("This view tried to open a page and was stopped."));
+ return (0, import_react10.createElement)("iframe", {
ref: frame,
className: "dv-view-frame",
title: String(node.summary ?? ""),
@@ -5831,7 +5848,7 @@ var HTML_CSS = `
`;
// node_modules/deep-view/src/react/card.js
-var import_react10 = require("react");
+var import_react11 = require("react");
var mdLabels = (ui2) => ({ code: { copyLabel: ui2.t("Copy"), copiedLabel: ui2.t("Copied") }, footnotes: ui2.t("Footnotes") });
var TONES2 = ["good", "warn", "bad"];
var CALLOUT_TONES2 = ["info", "good", "warn", "bad"];
@@ -5853,7 +5870,7 @@ var hasControls = (node) => {
var answerValues = (answer, node) => answer?.action === node.id ? answer.values : void 0;
function OptionsInput({ node, onSubmit, keys, busy = false }) {
const ui2 = useViewUi();
- const [picked, setPicked] = (0, import_react10.useState)([]);
+ const [picked, setPicked] = (0, import_react11.useState)([]);
const options = optionsOf2(node);
const multi = node.multi === true;
const choose = (label) => {
@@ -5867,14 +5884,14 @@ function OptionsInput({ node, onSubmit, keys, busy = false }) {
const submit = () => {
if (!busy && picked.length > 0) onSubmit?.(node.id, { selected: picked });
};
- const ownRef = (0, import_react10.useRef)(null);
+ const ownRef = (0, import_react11.useRef)(null);
const hints = useOptionKeys2(busy || !keys ? 0 : options.length, (index) => choose(options[index].label), ownRef);
- return (0, import_react10.createElement)(
- import_react10.Fragment,
+ return (0, import_react11.createElement)(
+ import_react11.Fragment,
null,
- (0, import_react10.createElement)("div", { className: "dv-q-list", role: "group" }, options.map((option, index) => {
+ (0, import_react11.createElement)("div", { className: "dv-q-list", role: "group" }, options.map((option, index) => {
const selected = multi && picked.includes(option.label);
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"button",
{
key: option.label,
@@ -5885,20 +5902,20 @@ function OptionsInput({ node, onSubmit, keys, busy = false }) {
"aria-keyshortcuts": hints ? keyLetter2(index).toLowerCase() : void 0,
onClick: () => choose(option.label)
},
- hints ? (0, import_react10.createElement)("span", { className: "dv-key", "aria-hidden": true }, keyLetter2(index)) : null,
- (0, import_react10.createElement)(
+ hints ? (0, import_react11.createElement)("span", { className: "dv-key", "aria-hidden": true }, keyLetter2(index)) : null,
+ (0, import_react11.createElement)(
"span",
{ className: "dv-q-body" },
- (0, import_react10.createElement)("span", { className: "dv-q-label" }, option.label),
- option.description ? (0, import_react10.createElement)("span", { className: "dv-q-desc" }, option.description) : null
+ (0, import_react11.createElement)("span", { className: "dv-q-label" }, option.label),
+ option.description ? (0, import_react11.createElement)("span", { className: "dv-q-desc" }, option.description) : null
),
- selected ? (0, import_react10.createElement)("span", { className: "dv-q-check", title: ui2.t("Selected") }, (0, import_react10.createElement)(CheckIcon2)) : null
+ selected ? (0, import_react11.createElement)("span", { className: "dv-q-check", title: ui2.t("Selected") }, (0, import_react11.createElement)(CheckIcon2)) : null
);
})),
- multi ? (0, import_react10.createElement)(
+ multi ? (0, import_react11.createElement)(
"div",
{ className: "dv-q-foot" },
- (0, import_react10.createElement)("button", { type: "button", className: "dv-q-submit", disabled: busy || picked.length === 0, onClick: submit }, ui2.t("Submit"))
+ (0, import_react11.createElement)("button", { type: "button", className: "dv-q-submit", disabled: busy || picked.length === 0, onClick: submit }, ui2.t("Submit"))
) : null
);
}
@@ -5906,53 +5923,53 @@ function SettledOptions({ node, answer }) {
const ui2 = useViewUi();
const selected = answerValues(answer, node)?.selected;
const chosen = Array.isArray(selected) ? selected : [];
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-q-list", role: "group", "aria-label": ui2.t("Your answer") },
- optionsOf2(node).map((option) => (0, import_react10.createElement)(
+ optionsOf2(node).map((option) => (0, import_react11.createElement)(
"div",
{ key: option.label, className: "dv-q-opt" },
- (0, import_react10.createElement)(
+ (0, import_react11.createElement)(
"span",
{ className: "dv-q-body" },
- (0, import_react10.createElement)("span", { className: "dv-q-label" }, option.label),
- option.description ? (0, import_react10.createElement)("span", { className: "dv-q-desc" }, option.description) : null
+ (0, import_react11.createElement)("span", { className: "dv-q-label" }, option.label),
+ option.description ? (0, import_react11.createElement)("span", { className: "dv-q-desc" }, option.description) : null
),
- chosen.includes(option.label) ? (0, import_react10.createElement)("span", { className: "dv-q-check", title: ui2.t("Selected") }, (0, import_react10.createElement)(CheckIcon2)) : null
+ chosen.includes(option.label) ? (0, import_react11.createElement)("span", { className: "dv-q-check", title: ui2.t("Selected") }, (0, import_react11.createElement)(CheckIcon2)) : null
))
);
}
function ConfirmInput({ node, onSubmit, busy = false }) {
const ui2 = useViewUi();
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-q-foot" },
- (0, import_react10.createElement)("button", { type: "button", className: "dv-q-btn", disabled: busy, onClick: () => onSubmit?.(node.id, { confirmed: false }) }, node.cancelLabel ?? ui2.t("Cancel")),
- (0, import_react10.createElement)("button", { type: "button", className: "dv-q-submit", disabled: busy, onClick: () => onSubmit?.(node.id, { confirmed: true }) }, node.confirmLabel ?? ui2.t("Confirm"))
+ (0, import_react11.createElement)("button", { type: "button", className: "dv-q-btn", disabled: busy, onClick: () => onSubmit?.(node.id, { confirmed: false }) }, node.cancelLabel ?? ui2.t("Cancel")),
+ (0, import_react11.createElement)("button", { type: "button", className: "dv-q-submit", disabled: busy, onClick: () => onSubmit?.(node.id, { confirmed: true }) }, node.confirmLabel ?? ui2.t("Confirm"))
);
}
function SettledConfirm({ node, answer }) {
const ui2 = useViewUi();
const confirmed = answerValues(answer, node)?.confirmed;
if (confirmed !== true && confirmed !== false) {
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-q-foot" },
- (0, import_react10.createElement)("button", { type: "button", className: "dv-q-btn", disabled: true }, node.cancelLabel ?? ui2.t("Cancel")),
- (0, import_react10.createElement)("button", { type: "button", className: "dv-q-submit", disabled: true }, node.confirmLabel ?? ui2.t("Confirm"))
+ (0, import_react11.createElement)("button", { type: "button", className: "dv-q-btn", disabled: true }, node.cancelLabel ?? ui2.t("Cancel")),
+ (0, import_react11.createElement)("button", { type: "button", className: "dv-q-submit", disabled: true }, node.confirmLabel ?? ui2.t("Confirm"))
);
}
const label = confirmed ? node.confirmLabel ?? ui2.t("Confirm") : node.cancelLabel ?? ui2.t("Cancel");
- return (0, import_react10.createElement)("span", { className: "dv-q-badge" }, label);
+ return (0, import_react11.createElement)("span", { className: "dv-q-badge" }, label);
}
function FormInput({ node, onSubmit, busy = false }) {
const ui2 = useViewUi();
const fields = fieldsOf(node);
- const [draft, setDraft] = (0, import_react10.useState)({});
+ const [draft, setDraft] = (0, import_react11.useState)({});
const submit = () => {
if (!busy) onSubmit?.(node.id, { fields: Object.fromEntries(fields.map((field) => [field.id, draft[field.id] ?? ""])) });
};
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"form",
{
className: "dv-widget-form",
@@ -5961,14 +5978,14 @@ function FormInput({ node, onSubmit, busy = false }) {
submit();
}
},
- fields.map((field) => (0, import_react10.createElement)(
+ fields.map((field) => (0, import_react11.createElement)(
"label",
{ key: field.id, className: "dv-widget-field" },
- (0, import_react10.createElement)("span", { className: "dv-widget-field-label" }, field.label),
- (0, import_react10.createElement)(
+ (0, import_react11.createElement)("span", { className: "dv-widget-field-label" }, field.label),
+ (0, import_react11.createElement)(
"span",
{ className: "dv-q-field" },
- (0, import_react10.createElement)("input", {
+ (0, import_react11.createElement)("input", {
className: "dv-q-input",
type: "text",
value: draft[field.id] ?? "",
@@ -5988,23 +6005,23 @@ function FormInput({ node, onSubmit, busy = false }) {
})
)
)),
- (0, import_react10.createElement)("div", { className: "dv-q-foot" }, (0, import_react10.createElement)("button", { type: "submit", className: "dv-q-submit", disabled: busy }, node.submitLabel ?? ui2.t("Submit")))
+ (0, import_react11.createElement)("div", { className: "dv-q-foot" }, (0, import_react11.createElement)("button", { type: "submit", className: "dv-q-submit", disabled: busy }, node.submitLabel ?? ui2.t("Submit")))
);
}
function SettledForm({ node, answer }) {
const fields = answerValues(answer, node)?.fields;
const values = fields !== null && typeof fields === "object" ? fields : {};
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-widget-form" },
- fieldsOf(node).map((field) => (0, import_react10.createElement)(
+ fieldsOf(node).map((field) => (0, import_react11.createElement)(
"label",
{ key: field.id, className: "dv-widget-field" },
- (0, import_react10.createElement)("span", { className: "dv-widget-field-label" }, field.label),
- (0, import_react10.createElement)(
+ (0, import_react11.createElement)("span", { className: "dv-widget-field-label" }, field.label),
+ (0, import_react11.createElement)(
"span",
{ className: "dv-q-field" },
- (0, import_react10.createElement)("input", { className: "dv-q-input", type: "text", value: values[field.id] ?? "", disabled: true, readOnly: true, "aria-label": field.label })
+ (0, import_react11.createElement)("input", { className: "dv-q-input", type: "text", value: values[field.id] ?? "", disabled: true, readOnly: true, "aria-label": field.label })
)
))
);
@@ -6012,10 +6029,10 @@ function SettledForm({ node, answer }) {
function SubmitInput({ node, ctx }) {
const ui2 = useViewUi();
if (ctx.settled) return null;
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-q-foot" },
- (0, import_react10.createElement)("button", { type: "button", className: "dv-q-submit", disabled: ctx.busy, onClick: () => ctx.onSubmit?.(node.id, {}) }, node.label || ui2.t("Send"))
+ (0, import_react11.createElement)("button", { type: "button", className: "dv-q-submit", disabled: ctx.busy, onClick: () => ctx.onSubmit?.(node.id, {}) }, node.label || ui2.t("Send"))
);
}
function WidgetTable({ node, lookup }) {
@@ -6025,17 +6042,17 @@ function WidgetTable({ node, lookup }) {
const cells = rows2.map((row) => row[index]).filter((cell) => cell !== void 0 && cell !== "");
return cells.length > 0 && cells.every((cell) => typeof cell === "number" || typeof cell === "string" && NUMERIC_CELL.test(cell.trim()));
});
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-widget-table" },
- (0, import_react10.createElement)(
+ (0, import_react11.createElement)(
"table",
null,
- (0, import_react10.createElement)("thead", null, (0, import_react10.createElement)("tr", null, columns2.map((column, index) => (0, import_react10.createElement)("th", { key: column.key ?? index, scope: "col", className: numeric2[index] ? "dv-num" : void 0 }, column.label)))),
- (0, import_react10.createElement)("tbody", null, rows2.map((row, rowIndex) => (0, import_react10.createElement)(
+ (0, import_react11.createElement)("thead", null, (0, import_react11.createElement)("tr", null, columns2.map((column, index) => (0, import_react11.createElement)("th", { key: column.key ?? index, scope: "col", className: numeric2[index] ? "dv-num" : void 0 }, column.label)))),
+ (0, import_react11.createElement)("tbody", null, rows2.map((row, rowIndex) => (0, import_react11.createElement)(
"tr",
{ key: rowIndex },
- columns2.map((column, columnIndex) => (0, import_react10.createElement)("td", { key: column.key ?? columnIndex, className: numeric2[columnIndex] ? "dv-num" : void 0 }, cellText2(row[columnIndex])))
+ columns2.map((column, columnIndex) => (0, import_react11.createElement)("td", { key: column.key ?? columnIndex, className: numeric2[columnIndex] ? "dv-num" : void 0 }, cellText2(row[columnIndex])))
)))
)
);
@@ -6051,11 +6068,11 @@ function WidgetProgress({ node, lookup }) {
percent3 = Math.max(0, Math.min(100, Number.isFinite(percent3) ? percent3 : 0));
const tone = resolve(node.tone, lookup);
const right = node.valueLabel !== void 0 ? asText(resolve(node.valueLabel, lookup, "")) : `${Math.round(percent3)}%`;
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-widget-progress", "data-tone": TONES2.includes(tone) ? tone : void 0 },
- (0, import_react10.createElement)("span", { className: "dv-widget-progress-label" }, (0, import_react10.createElement)("span", { className: "dv-widget-progress-name" }, node.label), (0, import_react10.createElement)("span", null, right)),
- (0, import_react10.createElement)("div", {
+ (0, import_react11.createElement)("span", { className: "dv-widget-progress-label" }, (0, import_react11.createElement)("span", { className: "dv-widget-progress-name" }, node.label), (0, import_react11.createElement)("span", null, right)),
+ (0, import_react11.createElement)("div", {
className: "dv-widget-progress-track",
role: "progressbar",
"aria-valuenow": Math.round(percent3),
@@ -6063,65 +6080,65 @@ function WidgetProgress({ node, lookup }) {
"aria-valuemax": 100,
"aria-label": node.label ?? ui2.t("Progress"),
"aria-valuetext": right
- }, (0, import_react10.createElement)("div", { className: "dv-widget-progress-fill", style: { width: `${percent3}%` } }))
+ }, (0, import_react11.createElement)("div", { className: "dv-widget-progress-fill", style: { width: `${percent3}%` } }))
);
}
function WidgetMetric({ node, lookup }) {
const tone = resolve(node.tone, lookup);
const caption = node.caption === void 0 ? "" : asText(resolve(node.caption, lookup, ""));
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-widget-metric", "data-tone": TONES2.includes(tone) ? tone : void 0 },
- (0, import_react10.createElement)("span", { className: "dv-widget-metric-label" }, node.label),
- (0, import_react10.createElement)("span", { className: "dv-widget-metric-value" }, asText(resolve(node.value, lookup, "—"))),
- caption !== "" ? (0, import_react10.createElement)("span", { className: "dv-view-caption" }, caption) : null
+ (0, import_react11.createElement)("span", { className: "dv-widget-metric-label" }, node.label),
+ (0, import_react11.createElement)("span", { className: "dv-widget-metric-value" }, asText(resolve(node.value, lookup, "—"))),
+ caption !== "" ? (0, import_react11.createElement)("span", { className: "dv-view-caption" }, caption) : null
);
}
function WidgetCallout({ node, lookup }) {
const ui2 = useViewUi();
const tone = resolve(node.tone, lookup);
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-view-callout", "data-tone": CALLOUT_TONES2.includes(tone) ? tone : "info" },
- (0, import_react10.createElement)("span", { className: "dv-view-callout-icon", "aria-hidden": true }, (0, import_react10.createElement)(InfoIcon2)),
- (0, import_react10.createElement)("div", { className: "dv-view-callout-text" }, (0, import_react10.createElement)(ui2.Markdown, { text: asText(resolve(node.text, lookup, "")), labels: mdLabels(ui2), variant: "compact" }))
+ (0, import_react11.createElement)("span", { className: "dv-view-callout-icon", "aria-hidden": true }, (0, import_react11.createElement)(InfoIcon2)),
+ (0, import_react11.createElement)("div", { className: "dv-view-callout-text" }, (0, import_react11.createElement)(ui2.Markdown, { text: asText(resolve(node.text, lookup, "")), labels: mdLabels(ui2), variant: "compact" }))
);
}
-var LinkIcon = () => (0, import_react10.createElement)(
+var LinkIcon = () => (0, import_react11.createElement)(
"svg",
{ width: 12, height: 12, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true },
- (0, import_react10.createElement)("path", { d: "M8.5 11.5l3-3" }),
- (0, import_react10.createElement)("path", { d: "M7 9.5L5.5 11a2.5 2.5 0 0 0 3.5 3.5L10.5 13" }),
- (0, import_react10.createElement)("path", { d: "M13 10.5l1.5-1.5A2.5 2.5 0 0 0 11 5.5L9.5 7" })
+ (0, import_react11.createElement)("path", { d: "M8.5 11.5l3-3" }),
+ (0, import_react11.createElement)("path", { d: "M7 9.5L5.5 11a2.5 2.5 0 0 0 3.5 3.5L10.5 13" }),
+ (0, import_react11.createElement)("path", { d: "M13 10.5l1.5-1.5A2.5 2.5 0 0 0 11 5.5L9.5 7" })
);
function WidgetSources({ node }) {
const ui2 = useViewUi();
const items = (Array.isArray(node.items) ? node.items : []).filter((item) => typeof item?.url === "string" && /^https?:\/\//i.test(item.url));
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-view-sources", role: "list", "aria-label": ui2.t("Sources") },
- items.map((item, index) => (0, import_react10.createElement)("a", { key: index, role: "listitem", className: "dv-view-source", href: item.url, target: "_blank", rel: "noopener noreferrer", title: item.url }, (0, import_react10.createElement)(LinkIcon), item.label))
+ items.map((item, index) => (0, import_react11.createElement)("a", { key: index, role: "listitem", className: "dv-view-source", href: item.url, target: "_blank", rel: "noopener noreferrer", title: item.url }, (0, import_react11.createElement)(LinkIcon), item.label))
);
}
function InputHead({ id, label, value }) {
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-view-input-head" },
- (0, import_react10.createElement)("label", { htmlFor: id, className: "dv-view-input-label" }, label),
- value !== void 0 ? (0, import_react10.createElement)("output", { htmlFor: id, className: "dv-view-input-value" }, value) : null
+ (0, import_react11.createElement)("label", { htmlFor: id, className: "dv-view-input-label" }, label),
+ value !== void 0 ? (0, import_react11.createElement)("output", { htmlFor: id, className: "dv-view-input-value" }, value) : null
);
}
var withUnit2 = (value, unit) => `${asText(value)}${unit ? ` ${unit}` : ""}`;
var grouped2 = (value) => typeof value === "number" && Number.isFinite(value) ? value.toLocaleString("en-US", { maximumFractionDigits: 6 }) : asText(value);
function SliderInput({ node, ctx }) {
- const id = (0, import_react10.useId)();
+ const id = (0, import_react11.useId)();
const value = Number(ctx.values[node.id]);
const percent3 = node.max > node.min ? (value - node.min) / (node.max - node.min) * 100 : 0;
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-view-input" },
- (0, import_react10.createElement)(InputHead, { id, label: node.label, value: withUnit2(grouped2(value), node.unit) }),
- (0, import_react10.createElement)("input", {
+ (0, import_react11.createElement)(InputHead, { id, label: node.label, value: withUnit2(grouped2(value), node.unit) }),
+ (0, import_react11.createElement)("input", {
id,
type: "range",
className: "dv-view-range",
@@ -6136,8 +6153,8 @@ function SliderInput({ node, ctx }) {
);
}
function NumberInput({ node, ctx }) {
- const id = (0, import_react10.useId)();
- const [draft, setDraft] = (0, import_react10.useState)(null);
+ const id = (0, import_react11.useId)();
+ const [draft, setDraft] = (0, import_react11.useState)(null);
const value = ctx.values[node.id];
const accept = (raw) => {
setDraft(raw);
@@ -6146,14 +6163,14 @@ function NumberInput({ node, ctx }) {
if (node.min !== void 0 && next < node.min || node.max !== void 0 && next > node.max) return;
ctx.setInput(node.id, next);
};
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-view-input" },
- (0, import_react10.createElement)(InputHead, { id, label: node.label }),
- (0, import_react10.createElement)(
+ (0, import_react11.createElement)(InputHead, { id, label: node.label }),
+ (0, import_react11.createElement)(
"span",
{ className: "dv-q-field dv-view-number" },
- (0, import_react10.createElement)("input", {
+ (0, import_react11.createElement)("input", {
id,
className: "dv-q-input",
type: "number",
@@ -6166,30 +6183,30 @@ function NumberInput({ node, ctx }) {
onChange: (event) => accept(event.target.value),
onBlur: () => setDraft(null)
}),
- node.unit ? (0, import_react10.createElement)("span", { className: "dv-view-unit" }, node.unit) : null
+ node.unit ? (0, import_react11.createElement)("span", { className: "dv-view-unit" }, node.unit) : null
)
);
}
function ChoiceInput({ node, ctx }) {
- const labelId = (0, import_react10.useId)();
+ const labelId = (0, import_react11.useId)();
const options = optionsOf2(node);
const current = ctx.values[node.id];
const side = options.length <= 4 && options.every((option) => [...option.label].length <= 14);
const pick2 = (option) => () => {
if (!ctx.locked) ctx.setInput(node.id, choiceValue(option));
};
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-view-input" },
- (0, import_react10.createElement)("span", { className: "dv-view-input-label", id: labelId }, node.label),
- side ? (0, import_react10.createElement)(
+ (0, import_react11.createElement)("span", { className: "dv-view-input-label", id: labelId }, node.label),
+ side ? (0, import_react11.createElement)(
Segmented2,
{ label: node.label, value: options.findIndex((option) => choiceValue(option) === current), className: "dv-view-seg" },
- options.map((option) => (0, import_react10.createElement)("button", { key: option.label, type: "button", "aria-pressed": choiceValue(option) === current, disabled: ctx.locked, onClick: pick2(option) }, option.label))
- ) : (0, import_react10.createElement)(
+ options.map((option) => (0, import_react11.createElement)("button", { key: option.label, type: "button", "aria-pressed": choiceValue(option) === current, disabled: ctx.locked, onClick: pick2(option) }, option.label))
+ ) : (0, import_react11.createElement)(
"div",
{ className: "dv-view-radios", role: "radiogroup", "aria-labelledby": labelId },
- options.map((option) => (0, import_react10.createElement)("button", {
+ options.map((option) => (0, import_react11.createElement)("button", {
key: option.label,
type: "button",
role: "radio",
@@ -6197,20 +6214,20 @@ function ChoiceInput({ node, ctx }) {
"aria-checked": choiceValue(option) === current,
disabled: ctx.locked,
onClick: pick2(option)
- }, (0, import_react10.createElement)("span", { className: "dv-view-radio-dot", "aria-hidden": true }), option.label))
+ }, (0, import_react11.createElement)("span", { className: "dv-view-radio-dot", "aria-hidden": true }), option.label))
)
);
}
function ToggleInput({ node, ctx }) {
const on = ctx.values[node.id] === true;
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-view-toggle" },
- (0, import_react10.createElement)("span", { className: "dv-view-input-label" }, node.label),
- (0, import_react10.createElement)(
+ (0, import_react11.createElement)("span", { className: "dv-view-input-label" }, node.label),
+ (0, import_react11.createElement)(
"button",
{ type: "button", role: "switch", className: "dv-switch", "aria-checked": on, "aria-label": node.label, disabled: ctx.locked, onClick: () => ctx.setInput(node.id, !on) },
- (0, import_react10.createElement)("span", { className: "dv-switch-knob", "aria-hidden": true })
+ (0, import_react11.createElement)("span", { className: "dv-switch-knob", "aria-hidden": true })
)
);
}
@@ -6222,53 +6239,53 @@ function WidgetNode({ node, ctx }) {
case "stack":
case "row": {
const children = Array.isArray(node.children) ? node.children : [];
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: node.type === "row" ? "dv-view-row" : "dv-widget-stack" },
- children.map((child, index) => (0, import_react10.createElement)(WidgetNode, { key: child?.id ?? index, node: child, ctx }))
+ children.map((child, index) => (0, import_react11.createElement)(WidgetNode, { key: child?.id ?? index, node: child, ctx }))
);
}
case "text": {
- const text = (0, import_react10.createElement)(ui2.Markdown, { text: asText(resolve(node.text, lookup, "")), labels: mdLabels(ui2), variant: "compact" });
- return node.tone === "muted" ? (0, import_react10.createElement)("div", { className: "dv-view-muted" }, text) : text;
+ const text = (0, import_react11.createElement)(ui2.Markdown, { text: asText(resolve(node.text, lookup, "")), labels: mdLabels(ui2), variant: "compact" });
+ return node.tone === "muted" ? (0, import_react11.createElement)("div", { className: "dv-view-muted" }, text) : text;
}
case "metric":
- return (0, import_react10.createElement)(WidgetMetric, { node, lookup });
+ return (0, import_react11.createElement)(WidgetMetric, { node, lookup });
case "table":
- return (0, import_react10.createElement)(WidgetTable, { node, lookup });
+ return (0, import_react11.createElement)(WidgetTable, { node, lookup });
case "chart":
- return (0, import_react10.createElement)(WidgetChart, { node, lookup, registerChart: ctx.registerChart, refreshCharts: ctx.refreshCharts });
+ return (0, import_react11.createElement)(WidgetChart, { node, lookup, registerChart: ctx.registerChart, refreshCharts: ctx.refreshCharts });
case "progress":
- return (0, import_react10.createElement)(WidgetProgress, { node, lookup });
+ return (0, import_react11.createElement)(WidgetProgress, { node, lookup });
case "callout":
- return (0, import_react10.createElement)(WidgetCallout, { node, lookup });
+ return (0, import_react11.createElement)(WidgetCallout, { node, lookup });
case "sources":
- return (0, import_react10.createElement)(WidgetSources, { node });
+ return (0, import_react11.createElement)(WidgetSources, { node });
case "html":
- return (0, import_react10.createElement)(HtmlFrame, { node });
+ return (0, import_react11.createElement)(HtmlFrame, { node });
case "slider":
- return (0, import_react10.createElement)(SliderInput, { node, ctx });
+ return (0, import_react11.createElement)(SliderInput, { node, ctx });
case "number":
- return (0, import_react10.createElement)(NumberInput, { node, ctx });
+ return (0, import_react11.createElement)(NumberInput, { node, ctx });
case "choice":
- return (0, import_react10.createElement)(ChoiceInput, { node, ctx });
+ return (0, import_react11.createElement)(ChoiceInput, { node, ctx });
case "toggle":
- return (0, import_react10.createElement)(ToggleInput, { node, ctx });
+ return (0, import_react11.createElement)(ToggleInput, { node, ctx });
case "submit":
- return (0, import_react10.createElement)(SubmitInput, { node, ctx });
+ return (0, import_react11.createElement)(SubmitInput, { node, ctx });
case "options":
- return ctx.settled ? (0, import_react10.createElement)(SettledOptions, { node, answer: ctx.answer }) : (0, import_react10.createElement)(OptionsInput, { node, onSubmit: ctx.onSubmit, keys: ctx.keys, busy: ctx.busy });
+ return ctx.settled ? (0, import_react11.createElement)(SettledOptions, { node, answer: ctx.answer }) : (0, import_react11.createElement)(OptionsInput, { node, onSubmit: ctx.onSubmit, keys: ctx.keys, busy: ctx.busy });
case "confirm":
- return ctx.settled ? (0, import_react10.createElement)(SettledConfirm, { node, answer: ctx.answer }) : (0, import_react10.createElement)(ConfirmInput, { node, onSubmit: ctx.onSubmit, busy: ctx.busy });
+ return ctx.settled ? (0, import_react11.createElement)(SettledConfirm, { node, answer: ctx.answer }) : (0, import_react11.createElement)(ConfirmInput, { node, onSubmit: ctx.onSubmit, busy: ctx.busy });
case "form":
- return ctx.settled ? (0, import_react10.createElement)(SettledForm, { node, answer: ctx.answer }) : (0, import_react10.createElement)(FormInput, { node, onSubmit: ctx.onSubmit, busy: ctx.busy });
+ return ctx.settled ? (0, import_react11.createElement)(SettledForm, { node, answer: ctx.answer }) : (0, import_react11.createElement)(FormInput, { node, onSubmit: ctx.onSubmit, busy: ctx.busy });
default:
return null;
}
}
function WidgetView({ view, onSubmit, settled = false, answer = null, busy = false, registerChart, refreshCharts }) {
const inputs = viewInputs(view);
- const [values, setValues] = (0, import_react10.useState)(() => Object.fromEntries(inputs.map((node) => [node.id, inputDefault(node)])));
+ const [values, setValues] = (0, import_react11.useState)(() => Object.fromEntries(inputs.map((node) => [node.id, inputDefault(node)])));
const sent = answer?.values?.inputs;
const current = settled && sent !== null && typeof sent === "object" ? { ...values, ...sent } : values;
const submit = (action, extra) => onSubmit?.(action, inputs.length > 0 ? { ...extra, inputs: current } : extra);
@@ -6285,12 +6302,12 @@ function WidgetView({ view, onSubmit, settled = false, answer = null, busy = fal
registerChart,
refreshCharts
};
- return (0, import_react10.createElement)(WidgetNode, { node: view, ctx });
+ return (0, import_react11.createElement)(WidgetNode, { node: view, ctx });
}
function useChartHandles() {
- const [, bump] = (0, import_react10.useState)(0);
- const charts = (0, import_react10.useRef)(/* @__PURE__ */ new Map());
- const fns = (0, import_react10.useRef)(null);
+ const [, bump] = (0, import_react11.useState)(0);
+ const charts = (0, import_react11.useRef)(/* @__PURE__ */ new Map());
+ const fns = (0, import_react11.useRef)(null);
if (fns.current === null) {
const refresh = () => bump((value) => value + 1);
fns.current = {
@@ -6309,29 +6326,29 @@ function useChartHandles() {
}
function ViewMenuList({ charts, pick: pick2 }) {
const ui2 = useViewUi();
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ className: "dv-menu dv-view-menu", role: "menu" },
- charts.map((chart, index) => (0, import_react10.createElement)(
- import_react10.Fragment,
+ charts.map((chart, index) => (0, import_react11.createElement)(
+ import_react11.Fragment,
{ key: index },
- charts.length > 1 ? (0, import_react10.createElement)(
- import_react10.Fragment,
+ charts.length > 1 ? (0, import_react11.createElement)(
+ import_react11.Fragment,
null,
- index > 0 ? (0, import_react10.createElement)("div", { className: "dv-menu-sep", role: "separator" }) : null,
- (0, import_react10.createElement)("div", { className: "dv-view-menu-label" }, chart.label ?? ui2.t("Chart {n}", { n: index + 1 }))
+ index > 0 ? (0, import_react11.createElement)("div", { className: "dv-menu-sep", role: "separator" }) : null,
+ (0, import_react11.createElement)("div", { className: "dv-view-menu-label" }, chart.label ?? ui2.t("Chart {n}", { n: index + 1 }))
) : null,
- (0, import_react10.createElement)("button", { type: "button", role: "menuitem", onClick: pick2(chart.toggleTable) }, (0, import_react10.createElement)(TableIcon), chart.asTable ? ui2.t("View as chart") : ui2.t("View as table")),
- (0, import_react10.createElement)("button", { type: "button", role: "menuitem", onClick: pick2(chart.copy) }, (0, import_react10.createElement)(CopyIcon2), ui2.t("Copy data")),
- (0, import_react10.createElement)("button", { type: "button", role: "menuitem", onClick: pick2(chart.save) }, (0, import_react10.createElement)(DownloadIcon2), ui2.t("Download image"))
+ (0, import_react11.createElement)("button", { type: "button", role: "menuitem", onClick: pick2(chart.toggleTable) }, (0, import_react11.createElement)(TableIcon), chart.asTable ? ui2.t("View as chart") : ui2.t("View as table")),
+ (0, import_react11.createElement)("button", { type: "button", role: "menuitem", onClick: pick2(chart.copy) }, (0, import_react11.createElement)(CopyIcon2), ui2.t("Copy data")),
+ (0, import_react11.createElement)("button", { type: "button", role: "menuitem", onClick: pick2(chart.save) }, (0, import_react11.createElement)(DownloadIcon2), ui2.t("Download image"))
))
);
}
function ViewMenu({ charts }) {
const ui2 = useViewUi();
- const [open, setOpen] = (0, import_react10.useState)(false);
- const root = (0, import_react10.useRef)(null);
- (0, import_react10.useEffect)(() => {
+ const [open, setOpen] = (0, import_react11.useState)(false);
+ const root = (0, import_react11.useRef)(null);
+ (0, import_react11.useEffect)(() => {
if (!open) return void 0;
const away = (event) => {
if (!root.current?.contains(event.target)) setOpen(false);
@@ -6350,27 +6367,27 @@ function ViewMenu({ charts }) {
setOpen(false);
run2();
};
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{ ref: root, className: "dv-view-tools", "data-open": open ? "" : void 0 },
- (0, import_react10.createElement)("button", { type: "button", className: "dv-view-more", "aria-label": ui2.t("Chart options"), "aria-haspopup": "menu", "aria-expanded": open, onClick: () => setOpen((value) => !value) }, (0, import_react10.createElement)(DotsIcon2)),
- open ? (0, import_react10.createElement)(ViewMenuList, { charts, pick: pick2 }) : null
+ (0, import_react11.createElement)("button", { type: "button", className: "dv-view-more", "aria-label": ui2.t("Chart options"), "aria-haspopup": "menu", "aria-expanded": open, onClick: () => setOpen((value) => !value) }, (0, import_react11.createElement)(DotsIcon2)),
+ open ? (0, import_react11.createElement)(ViewMenuList, { charts, pick: pick2 }) : null
);
}
function WidgetCard({ title, view, onSubmit, onDismiss, busy = false, raised = false, settled = false, answer = null }) {
const ui2 = useViewUi();
- const titleId = (0, import_react10.useId)();
+ const titleId = (0, import_react11.useId)();
const { charts, registerChart, refreshCharts } = useChartHandles();
const framed = raised || hasControls(view);
const className = ["dv-view", framed ? "dv-q" : "dv-view-bare", settled ? "dv-q-settled" : "", raised ? "dv-q-raised" : ""].filter(Boolean).join(" ");
- const head = title || onDismiss || countType(view, "chart") > 0 ? (0, import_react10.createElement)(
+ const head = title || onDismiss || countType(view, "chart") > 0 ? (0, import_react11.createElement)(
"div",
{ className: "dv-view-head" },
- title ? (0, import_react10.createElement)("p", { className: "dv-view-title", id: titleId }, title) : (0, import_react10.createElement)("span", { className: "dv-view-title" }),
- countType(view, "chart") > 0 ? (0, import_react10.createElement)(ViewMenu, { charts }) : null,
- onDismiss ? (0, import_react10.createElement)("button", { type: "button", className: "dv-q-x", "aria-label": ui2.t("Dismiss view"), title: ui2.t("Dismiss"), onClick: onDismiss, disabled: busy }, (0, import_react10.createElement)(CloseIcon2)) : null
+ title ? (0, import_react11.createElement)("p", { className: "dv-view-title", id: titleId }, title) : (0, import_react11.createElement)("span", { className: "dv-view-title" }),
+ countType(view, "chart") > 0 ? (0, import_react11.createElement)(ViewMenu, { charts }) : null,
+ onDismiss ? (0, import_react11.createElement)("button", { type: "button", className: "dv-q-x", "aria-label": ui2.t("Dismiss view"), title: ui2.t("Dismiss"), onClick: onDismiss, disabled: busy }, (0, import_react11.createElement)(CloseIcon2)) : null
) : null;
- return (0, import_react10.createElement)(
+ return (0, import_react11.createElement)(
"div",
{
className,
@@ -6380,7 +6397,7 @@ function WidgetCard({ title, view, onSubmit, onDismiss, busy = false, raised = f
"aria-busy": busy || void 0
},
head,
- (0, import_react10.createElement)("div", { className: "dv-view-body" }, (0, import_react10.createElement)(WidgetView, { view, onSubmit, settled, answer, busy, registerChart, refreshCharts }))
+ (0, import_react11.createElement)("div", { className: "dv-view-body" }, (0, import_react11.createElement)(WidgetView, { view, onSubmit, settled, answer, busy, registerChart, refreshCharts }))
);
}
function AnsweredView({ node }) {
@@ -6399,7 +6416,7 @@ function AnsweredView({ node }) {
if (view === null || typeof view !== "object" || view.view === void 0) return null;
const answers = Array.isArray(payload.answers) ? payload.answers : [];
const answer = answers.find((entry) => entry?.id === view.id) ?? answers[0] ?? null;
- return (0, import_react10.createElement)("div", { className: "dv-q-inline" }, (0, import_react10.createElement)(WidgetCard, { title: view.title ?? "", view: view.view, settled: true, answer }));
+ return (0, import_react11.createElement)("div", { className: "dv-q-inline" }, (0, import_react11.createElement)(WidgetCard, { title: view.title ?? "", view: view.view, settled: true, answer }));
}
var WIDGET_CSS = `
.dv-view{min-width:0}
@@ -6712,16 +6729,16 @@ Answer: ${actionSummary(answer, view.view)}`;
}
// src/client/widget-cell.js
-var import_react11 = require("react");
+var import_react12 = require("react");
var viewT = (key, params) => key === "Send" ? t("Send to Bot") : t(key, params);
var VIEW_UI = { t: viewT, Markdown: import_dsh_client_ui_primitives.MarkdownText };
-var Card = (props) => (0, import_react11.createElement)(ViewUi.Provider, { value: VIEW_UI }, (0, import_react11.createElement)(WidgetCard, props));
-var withUi = (Component) => (props) => (0, import_react11.createElement)(ViewUi.Provider, { value: VIEW_UI }, (0, import_react11.createElement)(Component, props));
+var Card = (props) => (0, import_react12.createElement)(ViewUi.Provider, { value: VIEW_UI }, (0, import_react12.createElement)(WidgetCard, props));
+var withUi = (Component) => (props) => (0, import_react12.createElement)(ViewUi.Provider, { value: VIEW_UI }, (0, import_react12.createElement)(Component, props));
var WidgetView2 = withUi(WidgetView);
var ViewMenuList2 = withUi(ViewMenuList);
function PendingView({ sessionId, view, actions, inline }) {
- const [answered, setAnswered] = (0, import_react11.useState)(null);
- const busyRef = (0, import_react11.useRef)(false);
+ const [answered, setAnswered] = (0, import_react12.useState)(null);
+ const busyRef = (0, import_react12.useRef)(false);
const hold = useDockHold(sessionId, "view", view.id, actions, inline);
const flying = answered === view.id;
const run2 = (make) => {
@@ -6735,31 +6752,31 @@ function PendingView({ sessionId, view, actions, inline }) {
};
const onSubmit = (action, values) => run2(() => actions.answerView(sessionId, view.id, action, values));
const onDismiss = () => run2(() => actions.dismissView(sessionId));
- return (0, import_react11.createElement)(
+ return (0, import_react12.createElement)(
"div",
{ className: inline ? "bt-q-inline" : "bt-q-dock", style: flying ? { display: "none" } : void 0, onFocusCapture: hold, onPointerDownCapture: hold },
- (0, import_react11.createElement)(Card, { key: view.id, title: view.title ?? "", view: view.view, onSubmit, onDismiss, busy: flying, raised: !inline })
+ (0, import_react12.createElement)(Card, { key: view.id, title: view.title ?? "", view: view.view, onSubmit, onDismiss, busy: flying, raised: !inline })
);
}
function WidgetCell({ sessionId, callId, args, done, isError, roster, actions, heldCards }) {
const record = roster.views?.[sessionId];
if (record !== void 0 && record.callId === callId) {
- if (heldCards?.[heldCardKey("view", record.id)] > 0) return null;
- return (0, import_react11.createElement)(PendingView, { sessionId, view: record, actions, inline: true });
+ if (heldCards?.[heldCardKey("view", record.id)] > 0) return (0, import_react12.createElement)(CellEmpty);
+ return (0, import_react12.createElement)(PendingView, { sessionId, view: record, actions, inline: true });
}
- if (done && isError) return (0, import_react11.createElement)("span", { className: "bt-q-gone", hidden: true });
+ if (done && isError) return (0, import_react12.createElement)(CellEmpty, { className: "bt-q-gone" });
const shown = checkShownView(args?.text?.("title"), args?.value?.("view"));
if (shown.error !== void 0 || shown.interactive || args?.value?.("await_reply") === true) {
- return (0, import_react11.createElement)("span", { className: "bt-q-gone", hidden: true });
+ return (0, import_react12.createElement)(CellEmpty, { className: "bt-q-gone" });
}
- return (0, import_react11.createElement)("div", { className: "bt-q-inline" }, (0, import_react11.createElement)(Card, { title: shown.title, view: shown.view }));
+ return (0, import_react12.createElement)("div", { className: "bt-q-inline" }, (0, import_react12.createElement)(Card, { title: shown.title, view: shown.view }));
}
function WidgetDock({ sessionId, useRoster, useCards, useHeldCards, actions }) {
const view = useRoster((value) => value.views?.[sessionId]);
const drawn = useCards?.((state) => state[sessionId]?.[view?.callId] > 0) === true;
const held = useHeldCards?.((state) => state[sessionId]?.[heldCardKey("view", view?.id)] > 0) === true;
if (view === void 0 || view.callId && drawn && !held) return null;
- return (0, import_react11.createElement)(PendingView, { sessionId, view, actions, inline: false });
+ return (0, import_react12.createElement)(PendingView, { sessionId, view, actions, inline: false });
}
function AnsweredView2({ node }) {
const data = node.data ?? {};
@@ -6774,15 +6791,15 @@ function AnsweredView2({ node }) {
if (payload?.kind !== "answer_to_pending_view") payload = null;
}
const view = payload?.views?.[0];
- if (view === null || typeof view !== "object" || view.view === void 0) return null;
+ if (view === null || typeof view !== "object" || view.view === void 0) return (0, import_react12.createElement)(CellEmpty);
const answers = Array.isArray(payload.answers) ? payload.answers : [];
const answer = answers.find((entry) => entry?.id === view.id) ?? answers[0] ?? null;
- return (0, import_react11.createElement)("div", { className: "bt-q-inline" }, (0, import_react11.createElement)(Card, { title: view.title ?? "", view: view.view, settled: true, answer }));
+ return (0, import_react12.createElement)("div", { className: "bt-q-inline" }, (0, import_react12.createElement)(Card, { title: view.title ?? "", view: view.view, settled: true, answer }));
}
function AnsweredReply({ node }) {
const data = node?.data ?? {};
- if (Array.isArray(data.views) && data.views.length > 0) return (0, import_react11.createElement)(AnsweredView2, { node });
- if (typeof data.handoff?.reason === "string") return (0, import_react11.createElement)(SettledHandoff, { handoff: data.handoff });
+ if (Array.isArray(data.views) && data.views.length > 0) return (0, import_react12.createElement)(AnsweredView2, { node });
+ if (typeof data.handoff?.reason === "string") return (0, import_react12.createElement)(SettledHandoff, { handoff: data.handoff });
if (!Array.isArray(data.questions) || data.questions.length === 0) {
let parsed = null;
try {
@@ -6790,12 +6807,12 @@ function AnsweredReply({ node }) {
} catch {
parsed = null;
}
- if (parsed?.kind === "answer_to_pending_view") return (0, import_react11.createElement)(AnsweredView2, { node });
+ if (parsed?.kind === "answer_to_pending_view") return (0, import_react12.createElement)(AnsweredView2, { node });
if (parsed?.kind === "answer_to_pending_handoff" && typeof parsed.reason === "string") {
- return (0, import_react11.createElement)(SettledHandoff, { handoff: { reason: parsed.reason, note: parsed.note ?? "", outcome: parsed.outcome } });
+ return (0, import_react12.createElement)(SettledHandoff, { handoff: { reason: parsed.reason, note: parsed.note ?? "", outcome: parsed.outcome } });
}
}
- return (0, import_react11.createElement)(AnsweredCell, { node });
+ return (0, import_react12.createElement)(AnsweredCell, { node });
}
var WIDGET_CSS2 = `${DEEP_VIEW_CSS}
body{
@@ -6817,26 +6834,26 @@ body[data-bt-layout=flat] .bt-q-inline .dv-view{max-width:calc(var(--bt-flat-w,1
`;
// src/client/secret-card.js
-var import_react13 = require("react");
+var import_react14 = require("react");
var MIN_VALUE = 4;
var NONE = {};
-var KeyIcon = () => (0, import_react13.createElement)(
+var KeyIcon = () => (0, import_react14.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_react13.createElement)("path", { d: "M7 9.5a3.5 3.5 0 1 1 0 .01z" }),
- (0, import_react13.createElement)("path", { d: "M10.4 10.6L17 10.6M14.5 10.6v2.4M16.6 10.6v1.8" })
+ (0, import_react14.createElement)("path", { d: "M7 9.5a3.5 3.5 0 1 1 0 .01z" }),
+ (0, import_react14.createElement)("path", { d: "M10.4 10.6L17 10.6M14.5 10.6v2.4M16.6 10.6v1.8" })
);
-var LockIcon = () => (0, import_react13.createElement)(
+var LockIcon = () => (0, import_react14.createElement)(
"svg",
{ width: 14, height: 14, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true },
- (0, import_react13.createElement)("path", { d: "M6.5 9V7a3.5 3.5 0 0 1 7 0v2" }),
- (0, import_react13.createElement)("rect", { x: 4.5, y: 9, width: 11, height: 8, rx: 2 })
+ (0, import_react14.createElement)("path", { d: "M6.5 9V7a3.5 3.5 0 0 1 7 0v2" }),
+ (0, import_react14.createElement)("rect", { x: 4.5, y: 9, width: 11, height: 8, rx: 2 })
);
-var WarnIcon = () => (0, import_react13.createElement)(
+var WarnIcon = () => (0, import_react14.createElement)(
"svg",
{ width: 14, height: 14, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true },
- (0, import_react13.createElement)("path", { d: "M10 3.5l7 12.5H3z" }),
- (0, import_react13.createElement)("path", { d: "M10 8.5v3.5M10 14.2h.01" })
+ (0, import_react14.createElement)("path", { d: "M10 3.5l7 12.5H3z" }),
+ (0, import_react14.createElement)("path", { d: "M10 8.5v3.5M10 14.2h.01" })
);
var MASK_BY_CSS = typeof CSS !== "undefined" && typeof CSS.supports === "function" && CSS.supports("-webkit-text-security", "disc");
var insecure = () => typeof location !== "undefined" && location.protocol === "http:" && !/^(localhost|127(?:\.\d{1,3}){3}|\[::1\])$/.test(location.hostname);
@@ -6847,7 +6864,7 @@ var scopeLabel = (scope, roster) => {
};
var when = (time) => Number.isFinite(time) ? new Date(time).toLocaleString(dateLocale(), { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" }) : "";
function MaskedInput({ value, onChange, onEnter, label, autoFocus = false }) {
- return (0, import_react13.createElement)("input", {
+ return (0, import_react14.createElement)("input", {
className: "bt-secret-input",
type: MASK_BY_CSS ? "text" : "password",
"data-masked": MASK_BY_CSS ? "" : void 0,
@@ -6873,11 +6890,11 @@ function MaskedInput({ value, onChange, onEnter, label, autoFocus = false }) {
}
function ScopeSwitch({ value, onChange, bot }) {
const options = [["all", t("All Bots")], ["bot", t("Only {name}", { name: bot.name })]];
- return (0, import_react13.createElement)(
+ return (0, import_react14.createElement)(
"div",
{ className: "bt-secret-scope", role: "radiogroup", "aria-label": t("Who may use it") },
- (0, import_react13.createElement)("span", { className: "bt-secret-glide", "data-at": value === "all" ? 0 : 1, "aria-hidden": true }),
- options.map(([id, text]) => (0, import_react13.createElement)("button", {
+ (0, import_react14.createElement)("span", { className: "bt-secret-glide", "data-at": value === "all" ? 0 : 1, "aria-hidden": true }),
+ options.map(([id, text]) => (0, import_react14.createElement)("button", {
key: id,
type: "button",
role: "radio",
@@ -6888,28 +6905,28 @@ function ScopeSwitch({ value, onChange, bot }) {
);
}
function SecretHead({ bot, title, detail, name, onClose }) {
- return (0, import_react13.createElement)(
+ return (0, import_react14.createElement)(
"div",
{ className: "bt-q-head bt-secret-head" },
- (0, import_react13.createElement)("span", { className: "bt-secret-who" }, (0, import_react13.createElement)(BotMark, { bot, size: 28 }), (0, import_react13.createElement)("span", { className: "bt-secret-lock" }, (0, import_react13.createElement)(LockIcon))),
- (0, import_react13.createElement)(
+ (0, import_react14.createElement)("span", { className: "bt-secret-who" }, (0, import_react14.createElement)(BotMark, { bot, size: 28 }), (0, import_react14.createElement)("span", { className: "bt-secret-lock" }, (0, import_react14.createElement)(LockIcon))),
+ (0, import_react14.createElement)(
"div",
{ className: "bt-q-text" },
- (0, import_react13.createElement)("p", { className: "bt-q-title" }, title),
- (0, import_react13.createElement)("div", { className: "bt-q-detail" }, (0, import_react13.createElement)("code", { className: "bt-secret-name" }, name), detail ? ` · ${detail}` : "")
+ (0, import_react14.createElement)("p", { className: "bt-q-title" }, title),
+ (0, import_react14.createElement)("div", { className: "bt-q-detail" }, (0, import_react14.createElement)("code", { className: "bt-secret-name" }, name), detail ? ` · ${detail}` : "")
),
- onClose ? (0, import_react13.createElement)("button", { type: "button", className: "bt-q-x", "aria-label": t("Cancel the request"), title: t("Cancel"), onClick: onClose }, (0, import_react13.createElement)(CloseIcon)) : null
+ onClose ? (0, import_react14.createElement)("button", { type: "button", className: "bt-q-x", "aria-label": t("Cancel the request"), title: t("Cancel"), onClick: onClose }, (0, import_react14.createElement)(CloseIcon)) : null
);
}
function SecretCard({ sessionId, bot, request, roster, actions, inline = false }) {
- const [value, setValue] = (0, import_react13.useState)("");
- const [scope, setScope] = (0, import_react13.useState)("all");
- const [replacing, setReplacing] = (0, import_react13.useState)(false);
- const [busy, setBusy] = (0, import_react13.useState)(false);
- const [error, setError] = (0, import_react13.useState)("");
- const busyRef = (0, import_react13.useRef)(false);
+ const [value, setValue] = (0, import_react14.useState)("");
+ const [scope, setScope] = (0, import_react14.useState)("all");
+ const [replacing, setReplacing] = (0, import_react14.useState)(false);
+ const [busy, setBusy] = (0, import_react14.useState)(false);
+ const [error, setError] = (0, import_react14.useState)("");
+ const busyRef = (0, import_react14.useRef)(false);
const hold = useDockHold(sessionId, "secret", request.id, actions, inline);
- const noteId = (0, import_react13.useId)();
+ const noteId = (0, import_react14.useId)();
const secret = (roster.secrets ?? []).find((entry) => entry.name === request.name);
const run2 = (make) => {
if (busyRef.current) return void 0;
@@ -6931,88 +6948,88 @@ function SecretCard({ sessionId, bot, request, roster, actions, inline = false }
if (!busy) void run2(() => actions.secretAllow(request.id));
};
const filling = request.kind === "fill" || replacing;
- const warn = insecure() ? (0, import_react13.createElement)("div", { className: "bt-secret-warn", role: "note" }, (0, import_react13.createElement)(WarnIcon), t("This page is not on HTTPS: the key crosses the network unencrypted.")) : null;
- return (0, import_react13.createElement)(
+ const warn = insecure() ? (0, import_react14.createElement)("div", { className: "bt-secret-warn", role: "note" }, (0, import_react14.createElement)(WarnIcon), t("This page is not on HTTPS: the key crosses the network unencrypted.")) : null;
+ return (0, import_react14.createElement)(
"div",
{ className: "bt-q bt-secret", role: "group", "aria-describedby": noteId, "data-kind": request.kind, onFocusCapture: hold, onPointerDownCapture: hold },
- (0, import_react13.createElement)(SecretHead, {
+ (0, import_react14.createElement)(SecretHead, {
bot,
title: request.kind === "allow" ? t("Let {bot} use {name}?", { bot: bot.name, name: request.name }) : t("{name} needs a key", { name: bot.name }),
detail: request.purpose,
name: request.name,
onClose: busy ? void 0 : cancel
}),
- request.kind === "allow" ? (0, import_react13.createElement)("div", { className: "bt-secret-saved" }, (0, import_react13.createElement)(KeyIcon), t("Saved for {scope}", { scope: scopeLabel(secret?.scope, roster) })) : null,
- filling ? (0, import_react13.createElement)(
+ request.kind === "allow" ? (0, import_react14.createElement)("div", { className: "bt-secret-saved" }, (0, import_react14.createElement)(KeyIcon), t("Saved for {scope}", { scope: scopeLabel(secret?.scope, roster) })) : null,
+ filling ? (0, import_react14.createElement)(
"div",
{ className: "bt-secret-body" },
- (0, import_react13.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react13.createElement)(MaskedInput, { value, onChange: (next) => {
+ (0, import_react14.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react14.createElement)(MaskedInput, { value, onChange: (next) => {
hold();
setValue(next);
}, onEnter: save, label: t("Value of {name}", { name: request.name }), autoFocus: replacing })),
- request.kind === "fill" ? (0, import_react13.createElement)(ScopeSwitch, { value: scope, onChange: (next) => {
+ request.kind === "fill" ? (0, import_react14.createElement)(ScopeSwitch, { value: scope, onChange: (next) => {
hold();
setScope(next);
}, bot }) : null
) : null,
- (0, import_react13.createElement)(
+ (0, import_react14.createElement)(
"div",
{ className: "bt-secret-note", id: noteId },
t("{bot} never sees the value. It reaches {bot}'s shell as ", { bot: bot.name }),
- (0, import_react13.createElement)("code", null, `$DSH_SECRET_${request.name}`),
+ (0, import_react14.createElement)("code", null, `$DSH_SECRET_${request.name}`),
".",
filling && value !== "" && !long ? t(" At least {count} characters.", { count: MIN_VALUE }) : ""
),
warn,
- error ? (0, import_react13.createElement)("div", { className: "bt-secret-error", role: "alert" }, error) : null,
- (0, import_react13.createElement)(
+ error ? (0, import_react14.createElement)("div", { className: "bt-secret-error", role: "alert" }, error) : null,
+ (0, import_react14.createElement)(
"div",
{ className: "bt-q-foot" },
- request.kind === "allow" && !replacing ? (0, import_react13.createElement)("button", { type: "button", className: "bt-q-btn", disabled: busy, onClick: () => {
+ request.kind === "allow" && !replacing ? (0, import_react14.createElement)("button", { type: "button", className: "bt-q-btn", disabled: busy, onClick: () => {
hold();
setReplacing(true);
} }, t("Replace value")) : null,
- (0, import_react13.createElement)("button", { type: "button", className: "bt-q-btn", disabled: busy, onClick: cancel }, t("Cancel")),
- filling ? (0, import_react13.createElement)("button", { type: "button", className: "bt-q-submit", disabled: !long || busy, onClick: save }, busy ? t("Saving…") : t("Save")) : (0, import_react13.createElement)("button", { type: "button", className: "bt-q-submit", disabled: busy, onClick: allow }, busy ? t("Allowing…") : t("Allow"))
+ (0, import_react14.createElement)("button", { type: "button", className: "bt-q-btn", disabled: busy, onClick: cancel }, t("Cancel")),
+ filling ? (0, import_react14.createElement)("button", { type: "button", className: "bt-q-submit", disabled: !long || busy, onClick: save }, busy ? t("Saving…") : t("Save")) : (0, import_react14.createElement)("button", { type: "button", className: "bt-q-submit", disabled: busy, onClick: allow }, busy ? t("Allowing…") : t("Allow"))
)
);
}
function SettledSecret({ bot, request, roster }) {
const canceled = request.status === "canceled";
const text = canceled ? t("{bot} asked for {name}", { bot: bot.name, name: request.name }) : request.status === "allowed" ? t("Allowed {bot} to use {name}", { bot: bot.name, name: request.name }) : t("Saved {name}", { name: request.name });
- return (0, import_react13.createElement)(
+ return (0, import_react14.createElement)(
"div",
{ className: "bt-q bt-q-settled bt-secret bt-secret-done", role: "group", "aria-label": text, "data-status": request.status },
- (0, import_react13.createElement)(
+ (0, import_react14.createElement)(
"div",
{ className: "bt-q-head" },
- (0, import_react13.createElement)("span", { className: "bt-secret-who" }, (0, import_react13.createElement)(BotMark, { bot, size: 22 })),
- (0, import_react13.createElement)("div", { className: "bt-q-text" }, (0, import_react13.createElement)(
+ (0, import_react14.createElement)("span", { className: "bt-secret-who" }, (0, import_react14.createElement)(BotMark, { bot, size: 22 })),
+ (0, import_react14.createElement)("div", { className: "bt-q-text" }, (0, import_react14.createElement)(
"p",
{ className: "bt-q-title" },
text,
- canceled ? null : (0, import_react13.createElement)("span", { className: "bt-secret-scope-tag" }, ` · ${scopeLabel(request.scope, roster)}`)
+ canceled ? null : (0, import_react14.createElement)("span", { className: "bt-secret-scope-tag" }, ` · ${scopeLabel(request.scope, roster)}`)
)),
- canceled ? (0, import_react13.createElement)("span", { className: "bt-q-badge" }, t("Canceled")) : (0, import_react13.createElement)("span", { className: "bt-q-check bt-secret-check", title: t("Done") }, (0, import_react13.createElement)(CheckIcon))
+ canceled ? (0, import_react14.createElement)("span", { className: "bt-q-badge" }, t("Canceled")) : (0, import_react14.createElement)("span", { className: "bt-q-check bt-secret-check", title: t("Done") }, (0, import_react14.createElement)(CheckIcon))
)
);
}
function RequestView({ sessionId, bot, request, roster, actions }) {
- return request.status === "pending" ? (0, import_react13.createElement)(SecretCard, { key: JSON.stringify([sessionId, request.id, request.kind]), sessionId, bot, request, roster, actions, inline: true }) : (0, import_react13.createElement)(SettledSecret, { bot, request, roster });
+ return request.status === "pending" ? (0, import_react14.createElement)(SecretCard, { key: JSON.stringify([sessionId, request.id, request.kind]), sessionId, bot, request, roster, actions, inline: true }) : (0, import_react14.createElement)(SettledSecret, { bot, request, roster });
}
function SecretToolCell({ sessionId, callId, name, done, content, roster, actions, heldCards = NONE }) {
const bot = roster.byId[sessionId];
- if (!bot) return null;
+ if (!bot) return (0, import_react14.createElement)(CellEmpty);
const request = (roster.secretRequests?.[bot.id] ?? []).find((entry) => entry.callId === callId && (entry.sessionId ?? sessionId) === sessionId);
- if (request?.status === "pending" && heldCards[heldCardKey("secret", request.id)] > 0) return null;
- if (request) return (0, import_react13.createElement)("div", { className: "bt-q-inline" }, (0, import_react13.createElement)(RequestView, { sessionId, bot, request, roster, actions }));
+ if (request?.status === "pending" && heldCards[heldCardKey("secret", request.id)] > 0) return (0, import_react14.createElement)(CellEmpty);
+ if (request) return (0, import_react14.createElement)("div", { className: "bt-q-inline" }, (0, import_react14.createElement)(RequestView, { sessionId, bot, request, roster, actions }));
if (done && /already saved/.test(contentText(content))) {
- return (0, import_react13.createElement)("div", { className: "bt-event" }, (0, import_react13.createElement)("span", { className: "bt-secret-event" }, (0, import_react13.createElement)(KeyIcon), t("{bot} is using {name}", { bot: bot.name, name: name ?? t("a saved key") })));
+ return (0, import_react14.createElement)("div", { className: "bt-event" }, (0, import_react14.createElement)("span", { className: "bt-secret-event" }, (0, import_react14.createElement)(KeyIcon), t("{bot} is using {name}", { bot: bot.name, name: name ?? t("a saved key") })));
}
if (done && contentText(content).startsWith("No card can be shown now")) {
- return (0, import_react13.createElement)("div", { className: "bt-event" }, (0, import_react13.createElement)("span", { className: "bt-secret-event" }, (0, import_react13.createElement)(KeyIcon), t("{bot} could not ask for a key: this window can only view the team", { bot: bot.name })));
+ return (0, import_react14.createElement)("div", { className: "bt-event" }, (0, import_react14.createElement)("span", { className: "bt-secret-event" }, (0, import_react14.createElement)(KeyIcon), t("{bot} could not ask for a key: this window can only view the team", { bot: bot.name })));
}
- return null;
+ return (0, import_react14.createElement)(CellEmpty);
}
function SecretDock({ sessionId, useRoster, useCards, useHeldCards, actions }) {
const roster = useRoster((value) => value);
@@ -7023,59 +7040,59 @@ function SecretDock({ sessionId, useRoster, useCards, useHeldCards, actions }) {
const drawn = (entry) => entry.callId && entry.sessionId === sessionId && shown[entry.callId] > 0 && !(held[heldCardKey("secret", entry.id)] > 0);
const waiting = (roster.secretRequests?.[bot.id] ?? []).filter((entry) => entry.status === "pending" && !drawn(entry));
if (waiting.length === 0) return null;
- return (0, import_react13.createElement)("div", { className: "bt-q-dock bt-secret-dock" }, waiting.map((request) => (0, import_react13.createElement)(SecretCard, { key: JSON.stringify([sessionId, request.id, request.kind]), sessionId, bot, request, roster, actions })));
+ return (0, import_react14.createElement)("div", { className: "bt-q-dock bt-secret-dock" }, waiting.map((request) => (0, import_react14.createElement)(SecretCard, { key: JSON.stringify([sessionId, request.id, request.kind]), sessionId, bot, request, roster, actions })));
}
function ScopeEditor({ secret, roster, onSave }) {
- const [mode, setMode] = (0, import_react13.useState)(secret.scope === "all" ? "all" : "some");
- const [picked, setPicked] = (0, import_react13.useState)(secret.scope === "all" ? [] : secret.scope);
+ const [mode, setMode] = (0, import_react14.useState)(secret.scope === "all" ? "all" : "some");
+ const [picked, setPicked] = (0, import_react14.useState)(secret.scope === "all" ? [] : secret.scope);
const toggle = (id) => setPicked((list) => list.includes(id) ? list.filter((item) => item !== id) : [...list, id]);
const same = mode === "all" ? secret.scope === "all" : secret.scope !== "all" && [...picked].sort().join() === [...secret.scope].sort().join();
- return (0, import_react13.createElement)(
+ return (0, import_react14.createElement)(
"div",
{ className: "bt-secret-edit-block" },
- (0, import_react13.createElement)("div", { className: "bt-secret-edit-label" }, t("Who may use it")),
- (0, import_react13.createElement)(
+ (0, import_react14.createElement)("div", { className: "bt-secret-edit-label" }, t("Who may use it")),
+ (0, import_react14.createElement)(
"div",
{ className: "bt-secret-radios", role: "radiogroup", "aria-label": t("Who may use {name}", { name: secret.name }) },
- [["all", t("All Bots")], ["some", t("Chosen Bots")]].map(([id, text]) => (0, import_react13.createElement)(
+ [["all", t("All Bots")], ["some", t("Chosen Bots")]].map(([id, text]) => (0, import_react14.createElement)(
"label",
{ key: id, className: "bt-secret-radio" },
- (0, import_react13.createElement)("input", { type: "radio", name: `scope-${secret.name}`, checked: mode === id, onChange: () => setMode(id) }),
+ (0, import_react14.createElement)("input", { type: "radio", name: `scope-${secret.name}`, checked: mode === id, onChange: () => setMode(id) }),
text
))
),
- mode === "some" ? (0, import_react13.createElement)("div", { className: "bt-secret-bots" }, roster.bots.map((bot) => (0, import_react13.createElement)("button", {
+ mode === "some" ? (0, import_react14.createElement)("div", { className: "bt-secret-bots" }, roster.bots.map((bot) => (0, import_react14.createElement)("button", {
key: bot.id,
type: "button",
className: "bt-secret-bot",
"aria-pressed": picked.includes(bot.id),
onClick: () => toggle(bot.id)
- }, (0, import_react13.createElement)(BotAvatar, { bot, size: 20, badge: false, live: false }), bot.name, picked.includes(bot.id) ? (0, import_react13.createElement)(CheckIcon) : null))) : null,
- (0, import_react13.createElement)(
+ }, (0, import_react14.createElement)(BotAvatar, { bot, size: 20, badge: false, live: false }), bot.name, picked.includes(bot.id) ? (0, import_react14.createElement)(CheckIcon) : null))) : null,
+ (0, import_react14.createElement)(
"div",
{ className: "bt-secret-row-actions" },
- (0, import_react13.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: same, onClick: () => onSave(mode === "all" ? "all" : picked) }, t("Save access"))
+ (0, import_react14.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: same, onClick: () => onSave(mode === "all" ? "all" : picked) }, t("Save access"))
)
);
}
function PurposeEditor({ secret, onSave }) {
- const [purpose, setPurpose] = (0, import_react13.useState)(secret.purpose ?? "");
+ const [purpose, setPurpose] = (0, import_react14.useState)(secret.purpose ?? "");
const same = purpose.trim() === (secret.purpose ?? "");
- return (0, import_react13.createElement)(
+ return (0, import_react14.createElement)(
"div",
{ className: "bt-secret-edit-block" },
- (0, import_react13.createElement)("div", { className: "bt-secret-edit-label" }, t("What it is for")),
- (0, import_react13.createElement)(
+ (0, import_react14.createElement)("div", { className: "bt-secret-edit-label" }, t("What it is for")),
+ (0, import_react14.createElement)(
"div",
{ className: "bt-secret-inline" },
- (0, import_react13.createElement)("input", { className: "bt-input", "aria-label": t("What it is for"), placeholder: t("What it is for"), value: purpose, spellCheck: false, autoComplete: "off", onChange: (event) => setPurpose(event.target.value) }),
- (0, import_react13.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: same, onClick: () => onSave(purpose.trim()) }, t("Save"))
+ (0, import_react14.createElement)("input", { className: "bt-input", "aria-label": t("What it is for"), placeholder: t("What it is for"), value: purpose, spellCheck: false, autoComplete: "off", onChange: (event) => setPurpose(event.target.value) }),
+ (0, import_react14.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: same, onClick: () => onSave(purpose.trim()) }, t("Save"))
)
);
}
function ValueEditor({ secret, onSave }) {
- const [value, setValue] = (0, import_react13.useState)("");
- const [replaced, setReplaced] = (0, import_react13.useState)(false);
+ const [value, setValue] = (0, import_react14.useState)("");
+ const [replaced, setReplaced] = (0, import_react14.useState)(false);
const long = value.trim().length >= MIN_VALUE;
const save = () => {
if (!long) return;
@@ -7090,67 +7107,67 @@ function ValueEditor({ secret, onSave }) {
setValue(next);
setReplaced(false);
};
- return (0, import_react13.createElement)(
+ return (0, import_react14.createElement)(
"div",
{ className: "bt-secret-edit-block" },
- (0, import_react13.createElement)("div", { className: "bt-secret-edit-label" }, t("Replace the value")),
- (0, import_react13.createElement)(
+ (0, import_react14.createElement)("div", { className: "bt-secret-edit-label" }, t("Replace the value")),
+ (0, import_react14.createElement)(
"div",
{ className: "bt-secret-inline" },
- (0, import_react13.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react13.createElement)(MaskedInput, { value, onChange: edit, onEnter: save, label: t("New value of {name}", { name: secret.name }) })),
- (0, import_react13.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !long, onClick: save }, t("Replace"))
+ (0, import_react14.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react14.createElement)(MaskedInput, { value, onChange: edit, onEnter: save, label: t("New value of {name}", { name: secret.name }) })),
+ (0, import_react14.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !long, onClick: save }, t("Replace"))
),
- value !== "" && !long ? (0, import_react13.createElement)("div", { className: "bt-set-hint" }, t("At least {count} characters.", { count: MIN_VALUE })) : replaced ? (0, import_react13.createElement)("div", { className: "bt-set-hint bt-secret-ok", role: "status" }, (0, import_react13.createElement)(CheckIcon), t("Replaced. Bots get the new value from their next command.")) : null
+ value !== "" && !long ? (0, import_react14.createElement)("div", { className: "bt-set-hint" }, t("At least {count} characters.", { count: MIN_VALUE })) : replaced ? (0, import_react14.createElement)("div", { className: "bt-set-hint bt-secret-ok", role: "status" }, (0, import_react14.createElement)(CheckIcon), t("Replaced. Bots get the new value from their next command.")) : null
);
}
function SecretRow({ secret, roster, actions, run: run2, open, onToggle }) {
- const [confirm, setConfirm] = (0, import_react13.useState)(false);
- (0, import_react13.useEffect)(() => {
+ const [confirm, setConfirm] = (0, import_react14.useState)(false);
+ (0, import_react14.useEffect)(() => {
if (!open) setConfirm(false);
}, [open]);
const asker = secret.requestedBy ? roster.byId[secret.requestedBy]?.name ?? t("a deleted Bot") : t("you");
const allowed2 = secret.scope === "all" ? [] : secret.scope.map((id) => roster.byId[id]).filter(Boolean);
const meta = [t("Asked by {name}", { name: asker }), t("added {time}", { time: when(secret.createdAt) }), secret.lastUsedAt ? t("last used {time}", { time: when(secret.lastUsedAt) }) : t("not used yet")].join(" · ");
- return (0, import_react13.createElement)(
+ return (0, import_react14.createElement)(
"div",
{ className: "bt-secret-item", "data-open": open ? "" : void 0 },
- (0, import_react13.createElement)(
+ (0, import_react14.createElement)(
"button",
{ type: "button", className: "bt-set-row bt-secret-summary", "aria-expanded": open, onClick: onToggle },
- (0, import_react13.createElement)(
+ (0, import_react14.createElement)(
"span",
{ className: "bt-set-copy" },
- (0, import_react13.createElement)("span", { className: "bt-secret-title" }, (0, import_react13.createElement)(KeyIcon), (0, import_react13.createElement)("code", { className: "bt-secret-name" }, secret.name), secret.purpose ? (0, import_react13.createElement)("span", { className: "bt-secret-purpose" }, secret.purpose) : null),
- (0, import_react13.createElement)("span", { className: "bt-set-hint" }, meta)
+ (0, import_react14.createElement)("span", { className: "bt-secret-title" }, (0, import_react14.createElement)(KeyIcon), (0, import_react14.createElement)("code", { className: "bt-secret-name" }, secret.name), secret.purpose ? (0, import_react14.createElement)("span", { className: "bt-secret-purpose" }, secret.purpose) : null),
+ (0, import_react14.createElement)("span", { className: "bt-set-hint" }, meta)
),
- (0, import_react13.createElement)(
+ (0, import_react14.createElement)(
"span",
{ className: "bt-set-control" },
- secret.scope === "all" ? (0, import_react13.createElement)("span", { className: "bt-tag" }, t("All Bots")) : allowed2.length === 0 ? (0, import_react13.createElement)("span", { className: "bt-tag" }, t("No Bot")) : (0, import_react13.createElement)("span", { className: "bt-secret-faces", title: allowed2.map((bot) => bot.name).join(", ") }, allowed2.slice(0, 5).map((bot) => (0, import_react13.createElement)(BotAvatar, { key: bot.id, bot, size: 20, badge: false, live: false })))
+ secret.scope === "all" ? (0, import_react14.createElement)("span", { className: "bt-tag" }, t("All Bots")) : allowed2.length === 0 ? (0, import_react14.createElement)("span", { className: "bt-tag" }, t("No Bot")) : (0, import_react14.createElement)("span", { className: "bt-secret-faces", title: allowed2.map((bot) => bot.name).join(", ") }, allowed2.slice(0, 5).map((bot) => (0, import_react14.createElement)(BotAvatar, { key: bot.id, bot, size: 20, badge: false, live: false })))
)
),
- open ? (0, import_react13.createElement)(
+ open ? (0, import_react14.createElement)(
"div",
{ className: "bt-secret-edit" },
- (0, import_react13.createElement)(ScopeEditor, { key: JSON.stringify(secret.scope), secret, roster, onSave: (scope) => run2(actions.secretUpdate(secret.name, { scope })) }),
- (0, import_react13.createElement)(PurposeEditor, { key: secret.purpose ?? "", secret, onSave: (purpose) => run2(actions.secretUpdate(secret.name, { purpose })) }),
- (0, import_react13.createElement)(ValueEditor, { secret, onSave: (value) => run2(actions.secretSet({ name: secret.name, value })) }),
- (0, import_react13.createElement)(
+ (0, import_react14.createElement)(ScopeEditor, { key: JSON.stringify(secret.scope), secret, roster, onSave: (scope) => run2(actions.secretUpdate(secret.name, { scope })) }),
+ (0, import_react14.createElement)(PurposeEditor, { key: secret.purpose ?? "", secret, onSave: (purpose) => run2(actions.secretUpdate(secret.name, { purpose })) }),
+ (0, import_react14.createElement)(ValueEditor, { secret, onSave: (value) => run2(actions.secretSet({ name: secret.name, value })) }),
+ (0, import_react14.createElement)(
"div",
{ className: "bt-secret-row-actions" },
confirm ? [
- (0, import_react13.createElement)("span", { key: "q", className: "bt-set-hint" }, t("Delete {name}? Bots lose it at once.", { name: secret.name })),
- (0, import_react13.createElement)("button", { key: "no", type: "button", className: "bt-soft bt-soft-sm", onClick: () => setConfirm(false) }, t("Keep")),
- (0, import_react13.createElement)("button", { key: "yes", type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => run2(actions.secretDelete(secret.name)) }, t("Delete"))
- ] : (0, import_react13.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => setConfirm(true) }, (0, import_react13.createElement)(TrashIcon), t("Delete"))
+ (0, import_react14.createElement)("span", { key: "q", className: "bt-set-hint" }, t("Delete {name}? Bots lose it at once.", { name: secret.name })),
+ (0, import_react14.createElement)("button", { key: "no", type: "button", className: "bt-soft bt-soft-sm", onClick: () => setConfirm(false) }, t("Keep")),
+ (0, import_react14.createElement)("button", { key: "yes", type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => run2(actions.secretDelete(secret.name)) }, t("Delete"))
+ ] : (0, import_react14.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => setConfirm(true) }, (0, import_react14.createElement)(TrashIcon), t("Delete"))
)
) : null
);
}
function AddSecret({ actions, run: run2, onDone }) {
- const [name, setName] = (0, import_react13.useState)("");
- const [purpose, setPurpose] = (0, import_react13.useState)("");
- const [value, setValue] = (0, import_react13.useState)("");
+ const [name, setName] = (0, import_react14.useState)("");
+ const [purpose, setPurpose] = (0, import_react14.useState)("");
+ const [value, setValue] = (0, import_react14.useState)("");
const ready = /^[A-Za-z][\w-]{0,63}$/.test(name.trim()) && value.trim().length >= MIN_VALUE;
const save = () => {
if (!ready) return;
@@ -7161,43 +7178,43 @@ function AddSecret({ actions, run: run2, onDone }) {
}
});
};
- return (0, import_react13.createElement)(
+ return (0, import_react14.createElement)(
"div",
{ className: "bt-set-row bt-set-paste bt-secret-add" },
- (0, import_react13.createElement)("input", { className: "bt-input", "aria-label": t("Key name"), placeholder: t("NAME, e.g. GITHUB_TOKEN"), value: name, spellCheck: false, autoComplete: "off", autoFocus: true, onChange: (event) => setName(event.target.value.toUpperCase()) }),
- (0, import_react13.createElement)("input", { className: "bt-input", "aria-label": t("What it is for"), placeholder: t("What it is for"), value: purpose, autoComplete: "off", onChange: (event) => setPurpose(event.target.value) }),
- (0, import_react13.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react13.createElement)(MaskedInput, { value, onChange: setValue, onEnter: save, label: t("Value") })),
- (0, import_react13.createElement)(
+ (0, import_react14.createElement)("input", { className: "bt-input", "aria-label": t("Key name"), placeholder: t("NAME, e.g. GITHUB_TOKEN"), value: name, spellCheck: false, autoComplete: "off", autoFocus: true, onChange: (event) => setName(event.target.value.toUpperCase()) }),
+ (0, import_react14.createElement)("input", { className: "bt-input", "aria-label": t("What it is for"), placeholder: t("What it is for"), value: purpose, autoComplete: "off", onChange: (event) => setPurpose(event.target.value) }),
+ (0, import_react14.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react14.createElement)(MaskedInput, { value, onChange: setValue, onEnter: save, label: t("Value") })),
+ (0, import_react14.createElement)(
"div",
{ className: "bt-secret-row-actions" },
- (0, import_react13.createElement)("span", { className: "bt-set-hint" }, t("New keys are for all Bots; narrow it down afterwards.")),
- (0, import_react13.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onDone }, t("Cancel")),
- (0, import_react13.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: save }, t("Save key"))
+ (0, import_react14.createElement)("span", { className: "bt-set-hint" }, t("New keys are for all Bots; narrow it down afterwards.")),
+ (0, import_react14.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onDone }, t("Cancel")),
+ (0, import_react14.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: save }, t("Save key"))
)
);
}
function SecretsPage({ roster, actions, run: run2, Section }) {
- const [open, setOpen] = (0, import_react13.useState)(null);
- const [adding, setAdding] = (0, import_react13.useState)(false);
+ const [open, setOpen] = (0, import_react14.useState)(null);
+ const [adding, setAdding] = (0, import_react14.useState)(false);
const secrets = roster.secrets ?? [];
return [
- (0, import_react13.createElement)(
+ (0, import_react14.createElement)(
"p",
{ key: "about", className: "bt-secret-about" },
t("Keys your Bots asked for. Bots never see the values: they use them as "),
- (0, import_react13.createElement)("code", null, "$DSH_SECRET_NAME"),
+ (0, import_react14.createElement)("code", null, "$DSH_SECRET_NAME"),
t(" in their shell, and every value is replaced by "),
- (0, import_react13.createElement)("code", null, "[secret:NAME]"),
+ (0, import_react14.createElement)("code", null, "[secret:NAME]"),
t(" before anything goes to a model.")
),
- (0, import_react13.createElement)(
+ (0, import_react14.createElement)(
Section,
{ key: "list", title: t("Secrets · {count}", { count: secrets.length }) },
- secrets.length === 0 && !adding ? (0, import_react13.createElement)("div", { className: "bt-set-row" }, (0, import_react13.createElement)("span", { className: "bt-set-hint" }, t("No keys yet. When a Bot needs one, it shows a card in its chat."))) : null,
- secrets.map((secret) => (0, import_react13.createElement)(SecretRow, { key: secret.name, secret, roster, actions, run: run2, open: open === secret.name, onToggle: () => setOpen(open === secret.name ? null : secret.name) })),
- adding ? (0, import_react13.createElement)(AddSecret, { actions, run: run2, onDone: () => setAdding(false) }) : null
+ secrets.length === 0 && !adding ? (0, import_react14.createElement)("div", { className: "bt-set-row" }, (0, import_react14.createElement)("span", { className: "bt-set-hint" }, t("No keys yet. When a Bot needs one, it shows a card in its chat."))) : null,
+ secrets.map((secret) => (0, import_react14.createElement)(SecretRow, { key: secret.name, secret, roster, actions, run: run2, open: open === secret.name, onToggle: () => setOpen(open === secret.name ? null : secret.name) })),
+ adding ? (0, import_react14.createElement)(AddSecret, { actions, run: run2, onDone: () => setAdding(false) }) : null
),
- adding ? null : (0, import_react13.createElement)("div", { key: "add", className: "bt-actions" }, (0, import_react13.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setAdding(true) }, t("Add a key")))
+ adding ? null : (0, import_react14.createElement)("div", { key: "add", className: "bt-actions" }, (0, import_react14.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setAdding(true) }, t("Add a key")))
];
}
var SECRET_CSS = `
@@ -7282,7 +7299,7 @@ var texts = (step) => step.blocks.filter((block) => block.kind === "text" && blo
var stepReasoning = (step) => step.blocks.filter((block) => block.kind === "reasoning").map((block) => block.text).join("\n").trim();
// src/client/fold.js
-var import_react14 = require("react");
+var import_react15 = require("react");
var FOLD_AT = { chars: 1500, lines: 25 };
var FOLD_HUGE = { chars: 2e4, lines: Infinity };
var ALWAYS = { chars: -1, lines: 0 };
@@ -7343,10 +7360,10 @@ ${open}`;
}
var stripLongNote = (text) => text.replace(/^\[A long message: \d+ characters\.[^\]\n]*\]\n/, "");
function useFold(text, { limit = FOLD_AT, whole, live = false, markdown = true } = {}) {
- const [open, setOpen] = (0, import_react14.useState)(false);
- const [read, setRead] = (0, import_react14.useState)();
+ const [open, setOpen] = (0, import_react15.useState)(false);
+ const [read, setRead] = (0, import_react15.useState)();
const cut = whole !== void 0 && whole.length > text.length;
- const preview = (0, import_react14.useMemo)(() => live ? null : foldPreview(text, cut ? ALWAYS : limit, markdown), [text, live, limit, markdown, cut]);
+ const preview = (0, import_react15.useMemo)(() => live ? null : foldPreview(text, cut ? ALWAYS : limit, markdown), [text, live, limit, markdown, cut]);
if (preview === null) return { shown: text, control: null };
const count = (cut ? whole.length : text.length).toLocaleString();
if (!open) {
@@ -7356,17 +7373,17 @@ function useFold(text, { limit = FOLD_AT, whole, live = false, markdown = true }
setRead("loading");
setRead(await whole.load() ?? { whole: false });
};
- return { shown: preview, folded: true, control: (0, import_react14.createElement)("span", { className: "bt-fold" }, (0, import_react14.createElement)("button", { type: "button", className: "bt-more", onClick: show2 }, t("Show all · {count} characters", { count }))) };
+ return { shown: preview, folded: true, control: (0, import_react15.createElement)("span", { className: "bt-fold" }, (0, import_react15.createElement)("button", { type: "button", className: "bt-more", onClick: show2 }, t("Show all · {count} characters", { count }))) };
}
const loaded = typeof read?.text === "string" ? read : void 0;
const note = !cut || read === void 0 || read === "loading" || loaded?.whole ? null : loaded !== void 0 && loaded.text.length > text.length ? t("Showing the first {count} characters", { count: loaded.text.length.toLocaleString() }) : t("Only the start of this message is kept here");
return {
shown: loaded?.text ?? text,
- control: (0, import_react14.createElement)(
+ control: (0, import_react15.createElement)(
"span",
{ className: "bt-fold" },
- note ? (0, import_react14.createElement)("span", { className: "bt-fold-note" }, note) : null,
- (0, import_react14.createElement)("button", { type: "button", className: "bt-more", onClick: () => setOpen(false) }, t("Show less"))
+ note ? (0, import_react15.createElement)("span", { className: "bt-fold-note" }, note) : null,
+ (0, import_react15.createElement)("button", { type: "button", className: "bt-more", onClick: () => setOpen(false) }, t("Show less"))
)
};
}
@@ -7570,7 +7587,7 @@ function withBtwRows(items, cards) {
}
// src/client/btw.js
-var import_react15 = require("react");
+var import_react16 = require("react");
var mdLabels2 = () => ({ code: { copyLabel: t("Copy"), copiedLabel: t("Copied") }, footnotes: t("Footnotes") });
function failureText(card) {
const raw = typeof card.error === "string" ? card.error : card.error?.message;
@@ -7582,9 +7599,9 @@ function stampOf(card) {
return Number.isFinite(time) ? time : void 0;
}
function BtwCardView({ card, compact: compact2 = false, sessionId, actions, onDeleted }) {
- const [open, setOpen] = (0, import_react15.useState)(card?.status !== "answering");
- const [deleting, setDeleting] = (0, import_react15.useState)(false);
- (0, import_react15.useEffect)(() => {
+ const [open, setOpen] = (0, import_react16.useState)(card?.status !== "answering");
+ const [deleting, setDeleting] = (0, import_react16.useState)(false);
+ (0, import_react16.useEffect)(() => {
if (card?.status && card.status !== "answering") setOpen(true);
}, [card?.status]);
if (!card) return null;
@@ -7604,7 +7621,7 @@ function BtwCardView({ card, compact: compact2 = false, sessionId, actions, onDe
setDeleting(false);
}
};
- return (0, import_react15.createElement)(
+ return (0, import_react16.createElement)(
"div",
{
className: compact2 ? "bt-btw bt-btw-compact" : "bt-btw",
@@ -7613,10 +7630,10 @@ function BtwCardView({ card, compact: compact2 = false, sessionId, actions, onDe
role: "region",
"aria-label": t("Side chat")
},
- (0, import_react15.createElement)(
+ (0, import_react16.createElement)(
"div",
{ className: "bt-btw-head" },
- (0, import_react15.createElement)(
+ (0, import_react16.createElement)(
"button",
{
type: "button",
@@ -7624,13 +7641,13 @@ function BtwCardView({ card, compact: compact2 = false, sessionId, actions, onDe
"aria-expanded": open,
onClick: () => setOpen((value) => !value)
},
- (0, import_react15.createElement)("span", { className: "bt-btw-chevron", "aria-hidden": true }),
- (0, import_react15.createElement)("span", { className: "bt-btw-q" }, question)
+ (0, import_react16.createElement)("span", { className: "bt-btw-chevron", "aria-hidden": true }),
+ (0, import_react16.createElement)("span", { className: "bt-btw-q" }, question)
),
- 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,
- (0, import_react15.createElement)("button", {
+ when3 !== void 0 ? (0, import_react16.createElement)("time", { className: "bt-btw-time", dateTime: new Date(when3).toISOString() }, messageClock(when3)) : null,
+ answering ? (0, import_react16.createElement)("span", { className: "bt-shimmer" }, t("Answering…")) : null,
+ card.status === "cancelled" ? (0, import_react16.createElement)("span", { className: "bt-btw-status" }, t("Cancelled")) : null,
+ (0, import_react16.createElement)("button", {
type: "button",
className: "bt-icon-btn bt-btw-delete",
disabled: deleting,
@@ -7639,20 +7656,20 @@ function BtwCardView({ card, compact: compact2 = false, sessionId, actions, onDe
onClick: () => {
void remove();
}
- }, (0, import_react15.createElement)(CloseIcon))
+ }, (0, import_react16.createElement)(CloseIcon))
),
- (0, import_react15.createElement)("p", { className: "bt-btw-note" }, t("Answered from progress so far; nothing was run")),
- open ? (0, import_react15.createElement)(
+ (0, import_react16.createElement)("p", { className: "bt-btw-note" }, t("Answered from progress so far; nothing was run")),
+ open ? (0, import_react16.createElement)(
"div",
{ className: "bt-btw-body" },
- 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
+ card.status === "failed" ? (0, import_react16.createElement)("p", { className: "bt-btw-fail" }, failureText(card)) : null,
+ answer !== "" ? (0, import_react16.createElement)("div", { className: "bt-btw-answer" }, (0, import_react16.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: answer, labels: mdLabels2(), variant: "compact" })) : null
) : null
);
}
function useTurnFacts(sessionId, actions) {
- const [facts, setFacts] = (0, import_react15.useState)(() => actions.turnFacts(sessionId));
- (0, import_react15.useEffect)(() => {
+ const [facts, setFacts] = (0, import_react16.useState)(() => actions.turnFacts(sessionId));
+ (0, import_react16.useEffect)(() => {
let live = true;
const read = () => {
if (!live) return;
@@ -7673,18 +7690,18 @@ function BtwDock({ sessionId, useRoster, actions }) {
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, sessionId, actions })));
+ return (0, import_react16.createElement)("div", { className: "bt-btw-dock" }, cards.map((card) => (0, import_react16.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, sessionId, actions })));
+ return (0, import_react16.createElement)("div", { className: "bt-btw-stack" }, cards.map((card) => (0, import_react16.createElement)(BtwCardView, { key: card.id, card, sessionId, actions })));
}
// src/client/cells.js
-var import_react16 = require("react");
+var import_react17 = require("react");
var import_react_dom = require("react-dom");
var mdLabels3 = () => ({ code: { copyLabel: t("Copy"), copiedLabel: t("Copied") }, footnotes: t("Footnotes") });
function Bubbles({ texts: texts2, roster, selfId, actions, streaming, sessionId, msgKey, useUi, lead, mentions, fold = FOLD_AT, whole }) {
@@ -7696,12 +7713,12 @@ function Bubbles({ texts: texts2, roster, selfId, actions, streaming, sessionId,
actions.openSession(target);
};
const reactions = useUi ? useUi((state) => msgKey ? state.reactions?.[msgKey] ?? null : null) : null;
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ className: "bt-astack", "data-lead": lead ? "" : void 0, onClickCapture: onClick },
texts2.map((text, index) => {
const last = index === texts2.length - 1;
- return (0, import_react16.createElement)(Bubble, {
+ return (0, import_react17.createElement)(Bubble, {
key: index,
text,
index,
@@ -7723,30 +7740,30 @@ function Bubbles({ texts: texts2, roster, selfId, actions, streaming, sessionId,
function Bubble({ text, index, roster, selfId, actions, sessionId, msgKey, mentions, fold, picked, live, lead, whole }) {
const { shown, folded, control } = useFold(text, { limit: fold, whole, live });
const key = msgKey ? `${msgKey}:${index}` : void 0;
- const body = (0, import_react16.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: linkMentions(shown, roster.bots, selfId), streaming: live, labels: mdLabels3(), variant: "compact", fileMentions: mentions });
- const row = (0, import_react16.useRef)(null);
- const [toolsOpen, setToolsOpen] = (0, import_react16.useState)(false);
+ const body = (0, import_react17.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: linkMentions(shown, roster.bots, selfId), streaming: live, labels: mdLabels3(), variant: "compact", fileMentions: mentions });
+ const row = (0, import_react17.useRef)(null);
+ const [toolsOpen, setToolsOpen] = (0, import_react17.useState)(false);
useDismiss(toolsOpen, () => setToolsOpen(false), [row]);
const tapTools = (event) => {
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_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ ref: row, className: "bt-msg", onClick: tapTools },
- (0, import_react16.createElement)(
+ (0, import_react17.createElement)(
"div",
{ className: "bt-msg-line" },
lead,
- (0, import_react16.createElement)(
+ (0, import_react17.createElement)(
"div",
{ className: "bt-bubble", "data-folded": folded || void 0 },
- control ? (0, import_react16.createElement)("div", { className: "bt-fold-body" }, body) : body,
+ control ? (0, import_react17.createElement)("div", { className: "bt-fold-body" }, body) : body,
control
),
- live ? null : (0, import_react16.createElement)(MessageTools, { text: folded ? text : shown, name: roster.byId[selfId]?.name ?? t("Bot"), sessionId, react: key ? (emoji) => actions.toggleReaction(msgKey, index, emoji) : void 0, actions, open: toolsOpen })
+ live ? null : (0, import_react17.createElement)(MessageTools, { text: folded ? text : shown, name: roster.byId[selfId]?.name ?? t("Bot"), sessionId, react: key ? (emoji) => actions.toggleReaction(msgKey, index, emoji) : void 0, actions, open: toolsOpen })
),
- picked.length ? (0, import_react16.createElement)("div", { className: "bt-reacts" }, picked.map((emoji) => (0, import_react16.createElement)("button", {
+ picked.length ? (0, import_react17.createElement)("div", { className: "bt-reacts" }, picked.map((emoji) => (0, import_react17.createElement)("button", {
key: emoji,
type: "button",
className: "bt-react",
@@ -7758,7 +7775,7 @@ function Bubble({ text, index, roster, selfId, actions, sessionId, msgKey, menti
var REACTIONS = ["👍", "❤️", "😂", "😮", "😢", "🙏"];
var STRIP_HALF = (REACTIONS.length * 34 + 10) / 2 + 8;
function useDismiss(open, close, refs) {
- (0, import_react16.useEffect)(() => {
+ (0, import_react17.useEffect)(() => {
if (!open) return void 0;
const onDown = (event) => {
if (refs.some((ref) => ref.current?.contains(event.target))) return;
@@ -7781,10 +7798,10 @@ function useDismiss(open, close, refs) {
}, [open]);
}
function MessageTools({ text, name, sessionId, react, actions, open: tapped }) {
- const [panel, setPanel] = (0, import_react16.useState)(null);
- const [copied, setCopied] = (0, import_react16.useState)(false);
- const tools = (0, import_react16.useRef)(null);
- const pop = (0, import_react16.useRef)(null);
+ const [panel, setPanel] = (0, import_react17.useState)(null);
+ const [copied, setCopied] = (0, import_react17.useState)(false);
+ const tools = (0, import_react17.useRef)(null);
+ const pop = (0, import_react17.useRef)(null);
const tick = useViewport();
const close = () => setPanel(null);
useDismiss(panel !== null, close, [tools, pop]);
@@ -7795,7 +7812,7 @@ function MessageTools({ text, name, sessionId, react, actions, open: tapped }) {
}
setPanel({ kind, node: event.currentTarget });
};
- const place = (0, import_react16.useMemo)(() => {
+ const place = (0, import_react17.useMemo)(() => {
if (!panel) return null;
const rect = panel.node.getBoundingClientRect();
const below = rect.bottom + 220 < viewBottom();
@@ -7813,25 +7830,25 @@ function MessageTools({ text, name, sessionId, react, actions, open: tapped }) {
link.click();
setTimeout(() => URL.revokeObjectURL(url), 1e3);
};
- const item = (label, Icon, run2) => (0, import_react16.createElement)("button", { key: label, type: "button", role: "menuitem", onClick: () => {
+ const item = (label, Icon, run2) => (0, import_react17.createElement)("button", { key: label, type: "button", role: "menuitem", onClick: () => {
close();
run2();
- } }, (0, import_react16.createElement)(Icon), label);
- return (0, import_react16.createElement)(
+ } }, (0, import_react17.createElement)(Icon), label);
+ return (0, import_react17.createElement)(
"div",
{ ref: tools, className: "bt-tools", "data-open": panel !== null || tapped || void 0 },
- react ? (0, import_react16.createElement)("button", { type: "button", className: "bt-tool", "aria-label": t("Add reaction"), title: t("Add reaction"), "aria-expanded": panel?.kind === "react", onClick: (event) => open("react", event) }, (0, import_react16.createElement)(SmileIcon)) : null,
- sessionId ? (0, import_react16.createElement)("button", { type: "button", className: "bt-tool", "aria-label": t("Reply"), title: t("Reply"), onClick: () => actions.quote(sessionId, text) }, (0, import_react16.createElement)(ReplyIcon)) : null,
- (0, import_react16.createElement)("button", { type: "button", className: "bt-tool", "aria-label": t("More message actions"), title: t("More"), "aria-haspopup": "menu", "aria-expanded": panel?.kind === "more", onClick: (event) => open("more", event) }, copied ? (0, import_react16.createElement)(CheckIcon) : (0, import_react16.createElement)(DotsIcon)),
- panel?.kind === "react" ? (0, import_react_dom.createPortal)((0, import_react16.createElement)(
+ react ? (0, import_react17.createElement)("button", { type: "button", className: "bt-tool", "aria-label": t("Add reaction"), title: t("Add reaction"), "aria-expanded": panel?.kind === "react", onClick: (event) => open("react", event) }, (0, import_react17.createElement)(SmileIcon)) : null,
+ sessionId ? (0, import_react17.createElement)("button", { type: "button", className: "bt-tool", "aria-label": t("Reply"), title: t("Reply"), onClick: () => actions.quote(sessionId, text) }, (0, import_react17.createElement)(ReplyIcon)) : null,
+ (0, import_react17.createElement)("button", { type: "button", className: "bt-tool", "aria-label": t("More message actions"), title: t("More"), "aria-haspopup": "menu", "aria-expanded": panel?.kind === "more", onClick: (event) => open("more", event) }, copied ? (0, import_react17.createElement)(CheckIcon) : (0, import_react17.createElement)(DotsIcon)),
+ panel?.kind === "react" ? (0, import_react_dom.createPortal)((0, import_react17.createElement)(
"div",
{ ref: pop, className: "bt-react-strip", role: "menu", "aria-label": t("Reactions"), style: place },
- REACTIONS.map((emoji) => (0, import_react16.createElement)("button", { key: emoji, type: "button", role: "menuitem", "aria-label": emoji, onClick: () => {
+ REACTIONS.map((emoji) => (0, import_react17.createElement)("button", { key: emoji, type: "button", role: "menuitem", "aria-label": emoji, onClick: () => {
close();
react(emoji);
} }, emoji))
), document.body) : null,
- panel?.kind === "more" ? (0, import_react_dom.createPortal)((0, import_react16.createElement)(
+ panel?.kind === "more" ? (0, import_react_dom.createPortal)((0, import_react17.createElement)(
"div",
{ ref: pop, className: "bt-menu", role: "menu", "aria-label": t("Message actions"), style: place },
item(t("Copy"), CopyIcon, copy2),
@@ -7842,8 +7859,8 @@ function MessageTools({ text, name, sessionId, react, actions, open: tapped }) {
var thinkingTimes = /* @__PURE__ */ new Map();
function useThinkingMs({ sessionId, turn, settledSteps, skip }) {
const key = `${sessionId}:${turn}:${settledSteps}`;
- const [ms, setMs] = (0, import_react16.useState)(() => thinkingTimes.get(key));
- (0, import_react16.useEffect)(() => {
+ const [ms, setMs] = (0, import_react17.useState)(() => thinkingTimes.get(key));
+ (0, import_react17.useEffect)(() => {
if (skip || thinkingTimes.has(key)) {
setMs(thinkingTimes.get(key));
return void 0;
@@ -7860,11 +7877,11 @@ function useThinkingMs({ sessionId, turn, settledSteps, skip }) {
}
var rowViews = /* @__PURE__ */ new Map();
function ThinkingRow({ text, live, at, ms, viewKey }) {
- const box = (0, import_react16.useRef)(null);
- const view = (0, import_react16.useRef)(rowViews.get(viewKey));
- const atEnd = (0, import_react16.useRef)(view.current?.atEnd ?? true);
- const [open, setOpen] = (0, import_react16.useState)(view.current?.open ?? false);
- const [fade, setFade] = (0, import_react16.useState)(void 0);
+ const box = (0, import_react17.useRef)(null);
+ const view = (0, import_react17.useRef)(rowViews.get(viewKey));
+ const atEnd = (0, import_react17.useRef)(view.current?.atEnd ?? true);
+ const [open, setOpen] = (0, import_react17.useState)(view.current?.open ?? false);
+ const [fade, setFade] = (0, import_react17.useState)(void 0);
const remember = (patch) => {
if (viewKey !== void 0) rowViews.set(viewKey, { ...rowViews.get(viewKey), ...patch });
};
@@ -7881,7 +7898,7 @@ function ThinkingRow({ text, live, at, ms, viewKey }) {
remember({ open: next });
setOpen(next);
};
- (0, import_react16.useLayoutEffect)(() => {
+ (0, import_react17.useLayoutEffect)(() => {
if (!open) return;
const el = box.current;
const restore = view.current;
@@ -7891,17 +7908,17 @@ function ThinkingRow({ text, live, at, ms, viewKey }) {
measure();
}, [text, open]);
const title = live ? t("Thinking") : t("Thought it through");
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"details",
{ className: "bt-think", open, onToggle: toggle },
- (0, import_react16.createElement)(
+ (0, import_react17.createElement)(
"summary",
null,
title,
- live && at !== void 0 ? (0, import_react16.createElement)(Elapsed, { at, className: "bt-think-time" }) : null,
- !live && ms !== void 0 ? (0, import_react16.createElement)("span", { className: "bt-think-time" }, `· ${elapsedLabel(Math.max(1e3, ms))}`) : null
+ live && at !== void 0 ? (0, import_react17.createElement)(Elapsed, { at, className: "bt-think-time" }) : null,
+ !live && ms !== void 0 ? (0, import_react17.createElement)("span", { className: "bt-think-time" }, `· ${elapsedLabel(Math.max(1e3, ms))}`) : null
),
- (0, import_react16.createElement)("div", { ref: box, className: "bt-think-text", role: "region", "aria-label": title, tabIndex: 0, "data-fade": fade, onScroll: measure }, text)
+ (0, import_react17.createElement)("div", { ref: box, className: "bt-think-text", role: "region", "aria-label": title, tabIndex: 0, "data-fade": fade, onScroll: measure }, text)
);
}
function useFileMentions({ node, openFile, fileMentions, useTurnData }) {
@@ -7909,7 +7926,7 @@ function useFileMentions({ node, openFile, fileMentions, useTurnData }) {
const location2 = node.location;
const turn = location2?.kind === "turn" || location2?.kind === "step" ? location2.turn : void 0;
const seq = node.data.finalNode?.seq;
- return (0, import_react16.useMemo)(() => {
+ return (0, import_react17.useMemo)(() => {
if (typeof fileMentions !== "function" || turn?.status !== "closed" || seq === void 0) return void 0;
return tail?.closing?.finalNode.seq === seq ? fileMentions({ turn, seq, openFile }) : void 0;
}, [fileMentions, openFile, seq, tail, turn]);
@@ -7929,19 +7946,19 @@ function AssistantCell({ node, groupPart, sessionId, openFile, fileMentions, use
const thinking = groupPart === "response" || !shown ? void 0 : thinkingStep(members);
const ms = useThinkingMs({ sessionId, turn: data.turn, settledSteps: members.filter((step) => step.status !== "running").length, skip: hidden || reasoning === "" });
useLiveNote(actions, sessionId, `text:${node.key ?? data.seq}`, !hidden && running && texts2.length > 0 ? { text: true } : null);
- if (hidden) return null;
+ if (hidden) return (0, import_react17.createElement)(CellEmpty);
const relays = relayPart(data, groupPart) ? relaysBefore(contexts, steps, data) : [];
- if (texts2.length === 0 && !reasoning && relays.length === 0) return null;
+ if (texts2.length === 0 && !reasoning && relays.length === 0) return (0, import_react17.createElement)(CellEmpty);
const selfId = roster.byId[sessionId]?.id ?? sessionId;
const speaker = layoutOf(roster.prefs) === "flat" ? roster.byId[sessionId] : void 0;
const head = speaker !== void 0 && opensReply(steps, data, shown) && (reasoning !== "" || texts2.length > 0 && !(groupPart === "response" && shown && turnReasoning(steps, data) !== ""));
- return (0, import_react16.createElement)(
- import_react16.Fragment,
+ return (0, import_react17.createElement)(
+ import_react17.Fragment,
null,
relays.map((relay) => {
const source = relay.source;
const sender = roster.byId[source.senderSessionId] ?? { id: source.senderSessionId, name: source.senderName ?? t("a Bot"), color: "gray" };
- return (0, import_react16.createElement)(EventLine, {
+ return (0, import_react17.createElement)(EventLine, {
key: relay.seq,
prefix: source.role === "stopped" ? t("Stopped by") : source.role === "reply" ? t("Reply from") : t("Message from"),
bots: [sender],
@@ -7951,8 +7968,8 @@ function AssistantCell({ node, groupPart, sessionId, openFile, fileMentions, use
whole: true
});
}),
- head ? (0, import_react16.createElement)(SpeakerHead, { bot: speaker, time: data.time }) : null,
- reasoning ? (0, import_react16.createElement)(ThinkingRow, {
+ head ? (0, import_react17.createElement)(SpeakerHead, { bot: speaker, time: data.time }) : null,
+ reasoning ? (0, import_react17.createElement)(ThinkingRow, {
text: reasoning,
live: thinking !== void 0,
viewKey: `${sessionId}:${data.turn}`,
@@ -7960,66 +7977,66 @@ function AssistantCell({ node, groupPart, sessionId, openFile, fileMentions, use
// time makes one Elapsed show settled + running.
...thinking !== void 0 ? { at: typeof thinking.time === "number" ? thinking.time - (ms ?? 0) : void 0 } : { ms }
}) : null,
- texts2.length ? (0, import_react16.createElement)(Bubbles, { texts: texts2, roster, selfId, actions, streaming: running, sessionId, msgKey: `${sessionId}:${data.turn}:${node.key ?? data.seq ?? ""}`, useUi, mentions, fold: FOLD_HUGE }) : null
+ texts2.length ? (0, import_react17.createElement)(Bubbles, { texts: texts2, roster, selfId, actions, streaming: running, sessionId, msgKey: `${sessionId}:${data.turn}:${node.key ?? data.seq ?? ""}`, useUi, mentions, fold: FOLD_HUGE }) : null
);
}
function EventLine({ prefix, bots, joiner = t("and"), onOpen, whole = false }) {
if (whole && bots.length === 1) {
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ className: "bt-event" },
- (0, import_react16.createElement)(
+ (0, import_react17.createElement)(
"button",
{ type: "button", className: "bt-event-whole", title: bots[0].name, onClick: () => onOpen?.(bots[0]) },
- (0, import_react16.createElement)("span", null, prefix),
- (0, import_react16.createElement)(BotMark, { bot: bots[0], size: 16 }),
- (0, import_react16.createElement)("span", { className: "bt-event-name" }, bots[0].name)
+ (0, import_react17.createElement)("span", null, prefix),
+ (0, import_react17.createElement)(BotMark, { bot: bots[0], size: 16 }),
+ (0, import_react17.createElement)("span", { className: "bt-event-name" }, bots[0].name)
)
);
}
const parts = [];
- parts.push((0, import_react16.createElement)("span", { key: "p" }, prefix));
+ parts.push((0, import_react17.createElement)("span", { key: "p" }, prefix));
bots.forEach((bot, index) => {
- if (index > 0) parts.push((0, import_react16.createElement)("span", { key: `j${index}` }, joiner));
- parts.push((0, import_react16.createElement)(
+ if (index > 0) parts.push((0, import_react17.createElement)("span", { key: `j${index}` }, joiner));
+ parts.push((0, import_react17.createElement)(
"button",
{ key: bot.id ?? index, type: "button", onClick: () => onOpen?.(bot) },
- (0, import_react16.createElement)(BotMark, { bot, size: 16 }),
+ (0, import_react17.createElement)(BotMark, { bot, size: 16 }),
bot.name
));
});
- return (0, import_react16.createElement)("div", { className: "bt-event" }, parts);
+ return (0, import_react17.createElement)("div", { className: "bt-event" }, parts);
}
function SpeakerHead({ bot, time }) {
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ className: "bt-group-name" },
- (0, import_react16.createElement)("span", { className: "bt-lead" }, (0, import_react16.createElement)(BotMark, { bot, size: 22 })),
+ (0, import_react17.createElement)("span", { className: "bt-lead" }, (0, import_react17.createElement)(BotMark, { bot, size: 22 })),
bot.name,
- Number.isFinite(time) ? (0, import_react16.createElement)("span", { className: "bt-group-time", title: clockLabel(time) }, messageClock(time)) : null
+ Number.isFinite(time) ? (0, import_react17.createElement)("span", { className: "bt-group-time", title: clockLabel(time) }, messageClock(time)) : null
);
}
function GroupMessage({ bot, text, texts: texts2 = [text], room: room2, roster, actions, msgKey, useUi, whole, time, duration }) {
- const lead = (0, import_react16.createElement)(
+ const lead = (0, import_react17.createElement)(
"button",
{ type: "button", className: "bt-lead", "aria-label": t("Open {name}'s chat", { name: bot.name }), onClick: () => actions.openSession(bot.id) },
- (0, import_react16.createElement)(BotMark, { bot, size: 22 })
+ (0, import_react17.createElement)(BotMark, { bot, size: 22 })
);
const flat = layoutOf(roster.prefs) === "flat";
const took = Number.isFinite(duration) ? elapsedLabel(duration) : void 0;
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ className: "bt-group-msg" },
- (0, import_react16.createElement)(
+ (0, import_react17.createElement)(
"span",
{ className: "bt-group-name", style: flat ? void 0 : { color: inkText(colorOf(bot)) } },
flat ? lead : null,
bot.name,
- room2?.admin === bot.id ? (0, import_react16.createElement)("span", { className: "bt-group-role" }, t("Admin")) : null,
- Number.isFinite(time) ? (0, import_react16.createElement)("span", { className: "bt-group-time", title: clockLabel(time) }, messageClock(time)) : null,
- took ? (0, import_react16.createElement)("span", { className: "bt-group-took", title: t("Ran for {duration}", { duration: took }) }, took) : null
+ room2?.admin === bot.id ? (0, import_react17.createElement)("span", { className: "bt-group-role" }, t("Admin")) : null,
+ Number.isFinite(time) ? (0, import_react17.createElement)("span", { className: "bt-group-time", title: clockLabel(time) }, messageClock(time)) : null,
+ took ? (0, import_react17.createElement)("span", { className: "bt-group-took", title: t("Ran for {duration}", { duration: took }) }, took) : null
),
- (0, import_react16.createElement)(Bubbles, { texts: texts2, roster, selfId: bot.id, actions, sessionId: room2?.id, msgKey, useUi, lead: flat ? null : lead, whole })
+ (0, import_react17.createElement)(Bubbles, { texts: texts2, roster, selfId: bot.id, actions, sessionId: room2?.id, msgKey, useUi, lead: flat ? null : lead, whole })
);
}
function stackReplies(replies) {
@@ -8035,11 +8052,11 @@ function stackReplies(replies) {
return items;
}
function GroupEvent({ prefix, room: room2, name, roster, actions }) {
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ className: "bt-event" },
- (0, import_react16.createElement)("span", null, prefix),
- room2 ? (0, import_react16.createElement)("button", { type: "button", onClick: () => actions.openSession(room2.id) }, (0, import_react16.createElement)(RoomAvatar, { room: room2, roster, size: 16 }), room2.name) : name ? (0, import_react16.createElement)("span", null, name) : null
+ (0, import_react17.createElement)("span", null, prefix),
+ room2 ? (0, import_react17.createElement)("button", { type: "button", onClick: () => actions.openSession(room2.id) }, (0, import_react17.createElement)(RoomAvatar, { room: room2, roster, size: 16 }), room2.name) : name ? (0, import_react17.createElement)("span", null, name) : null
);
}
var MEMORY_SAVED = /^(Saved to|Updated in|Removed from) /;
@@ -8071,33 +8088,33 @@ function MemoryEvent({ sessionId, scope, tool, result, failed, code, roster, act
const target = other && other.id !== self?.id ? other : self;
const panel = team ? self?.id : MEMORY_OWN.test(named) ? self?.id : MEMORY_GROUP.test(named) ? room2?.id : named === "" ? room2?.id ?? self?.id : other?.id;
if (!failed && MEMORY_ALREADY.test(result)) {
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ className: "bt-event" },
- panel === void 0 ? (0, import_react16.createElement)("span", null, (0, import_react16.createElement)(MemoryIcon), t("Already saved")) : (0, import_react16.createElement)("button", { type: "button", onClick: () => actions.openMemory(panel) }, (0, import_react16.createElement)(MemoryIcon), t("Already saved"))
+ panel === void 0 ? (0, import_react17.createElement)("span", null, (0, import_react17.createElement)(MemoryIcon), t("Already saved")) : (0, import_react17.createElement)("button", { type: "button", onClick: () => actions.openMemory(panel) }, (0, import_react17.createElement)(MemoryIcon), t("Already saved"))
);
}
if (!failed && MEMORY_SAVED.test(result)) {
- if (!target) return null;
+ if (!target) return (0, import_react17.createElement)(CellEmpty);
const label2 = team ? t("Team memory updated") : target === self ? t("Memory updated") : t("Updated {name}'s memory", { name: target.name });
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ className: "bt-event" },
- (0, import_react16.createElement)("button", { type: "button", title: result, onClick: () => actions.openMemory(target.id) }, (0, import_react16.createElement)(MemoryIcon), label2)
+ (0, import_react17.createElement)("button", { type: "button", title: result, onClick: () => actions.openMemory(target.id) }, (0, import_react17.createElement)(MemoryIcon), label2)
);
}
const reason = memoryFailure(code);
const label = failed ? tool === "forget" ? t("Couldn't remove from memory") : t("Couldn't save to memory") : t("Memory not changed");
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ className: "bt-event bt-event-error", role: "status", title: code },
- (0, import_react16.createElement)("span", null, (0, import_react16.createElement)(MemoryIcon), label),
- reason ? (0, import_react16.createElement)("span", null, ` · ${reason}`) : null,
- panel === void 0 ? null : (0, import_react16.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openMemory(panel) }, t("Manage"))
+ (0, import_react17.createElement)("span", null, (0, import_react17.createElement)(MemoryIcon), label),
+ reason ? (0, import_react17.createElement)("span", null, ` · ${reason}`) : null,
+ panel === void 0 ? null : (0, import_react17.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openMemory(panel) }, t("Manage"))
);
}
function PartLine({ time }) {
- return (0, import_react16.createElement)("div", { className: "bt-part-line", role: "separator" }, Number.isFinite(time) ? (0, import_react16.createElement)("span", null, dayLabel(time)) : null);
+ return (0, import_react17.createElement)("div", { className: "bt-part-line", role: "separator" }, Number.isFinite(time) ? (0, import_react17.createElement)("span", null, dayLabel(time)) : null);
}
var scrollParent = (node) => {
for (let at = node.parentElement; at; at = at.parentElement) {
@@ -8107,21 +8124,21 @@ var scrollParent = (node) => {
};
function EarlierUser({ row }) {
const { shown, folded, control } = useFold(row.text ?? "");
- const body = row.text ? (0, import_react16.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: shown, labels: mdLabels3(), variant: "compact" }) : null;
- return (0, import_react16.createElement)("div", { className: "bt-urow" }, (0, import_react16.createElement)(
+ const body = row.text ? (0, import_react17.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: shown, labels: mdLabels3(), variant: "compact" }) : null;
+ return (0, import_react17.createElement)("div", { className: "bt-urow" }, (0, import_react17.createElement)(
"div",
{ className: "bt-ububble", "data-folded": folded || void 0 },
- control ? (0, import_react16.createElement)("div", { className: "bt-fold-body" }, body) : body,
+ control ? (0, import_react17.createElement)("div", { className: "bt-fold-body" }, body) : body,
control,
- row.images ? (0, import_react16.createElement)("span", { className: "bt-uimages" }, row.images === 1 ? t("1 image") : t("{count} images", { count: row.images })) : null
+ row.images ? (0, import_react17.createElement)("span", { className: "bt-uimages" }, row.images === 1 ? t("1 image") : t("{count} images", { count: row.images })) : null
));
}
function EarlierParts({ sessionId, roster, actions }) {
- const [view, setView] = (0, import_react16.useState)({ pages: [], cursor: void 0, loading: true, failed: false, startedAt: null });
- const top = (0, import_react16.useRef)(null);
- const busy = (0, import_react16.useRef)(false);
- const generation = (0, import_react16.useRef)(0);
- const restore = (0, import_react16.useRef)(null);
+ const [view, setView] = (0, import_react17.useState)({ pages: [], cursor: void 0, loading: true, failed: false, startedAt: null });
+ const top = (0, import_react17.useRef)(null);
+ const busy = (0, import_react17.useRef)(false);
+ const generation = (0, import_react17.useRef)(0);
+ const restore = (0, import_react17.useRef)(null);
const load = (cursor) => {
if (busy.current) return;
const mine = generation.current;
@@ -8149,7 +8166,7 @@ function EarlierParts({ sessionId, roster, actions }) {
setView((current) => ({ ...current, loading: false, failed: true }));
});
};
- (0, import_react16.useEffect)(() => {
+ (0, import_react17.useEffect)(() => {
generation.current += 1;
busy.current = false;
setView({ pages: [], cursor: void 0, loading: true, failed: false, startedAt: null });
@@ -8158,12 +8175,12 @@ function EarlierParts({ sessionId, roster, actions }) {
generation.current += 1;
};
}, [sessionId]);
- (0, import_react16.useLayoutEffect)(() => {
+ (0, import_react17.useLayoutEffect)(() => {
const pending = restore.current;
restore.current = null;
if (pending) pending.scroller.scrollTop = pending.scroller.scrollHeight - pending.fromEnd;
}, [view.pages]);
- (0, import_react16.useEffect)(() => {
+ (0, import_react17.useEffect)(() => {
const node = top.current;
if (!node || view.loading || view.failed || !view.cursor || typeof IntersectionObserver !== "function") return void 0;
const observer = new IntersectionObserver((entries2) => {
@@ -8178,16 +8195,16 @@ function EarlierParts({ sessionId, roster, actions }) {
}));
const items = [];
for (const page of view.pages) items.push(...withBtwRows(page.items, page.btw));
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ className: "bt-earlier", role: "feed", "aria-label": t("Earlier messages"), "aria-busy": view.loading },
- (0, import_react16.createElement)(
+ (0, import_react17.createElement)(
"div",
{ ref: top, className: "bt-earlier-top" },
- 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
+ view.loading ? (0, import_react17.createElement)(Shimmer, null, t("Loading earlier messages…")) : view.failed ? (0, import_react17.createElement)("button", { type: "button", className: "bt-soft", onClick: () => load(view.cursor) }, t("Couldn’t load earlier messages · Retry")) : view.cursor ? (0, import_react17.createElement)("button", { type: "button", className: "bt-soft", onClick: () => load(view.cursor) }, t("Load earlier")) : null
),
- (0, import_react16.createElement)(ChatRows, { items, sessionId, roster, actions, onBtwDelete: removeBtw }),
- (0, import_react16.createElement)(PartLine, { time: view.startedAt })
+ (0, import_react17.createElement)(ChatRows, { items, sessionId, roster, actions, onBtwDelete: removeBtw }),
+ (0, import_react17.createElement)(PartLine, { time: view.startedAt })
);
}
function ChatRows({ items, sessionId, roster, actions, useUi, clock: clock4 = false, onBtwDelete }) {
@@ -8210,32 +8227,32 @@ function ChatRows({ items, sessionId, roster, actions, useUi, clock: clock4 = fa
}
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_react16.createElement)("div", { key: `${key}:clock`, className: "bt-time-sep", role: "separator" }, clockLabel(row.time)), shown] : [shown];
+ return pause ? [(0, import_react17.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, onBtwDelete }) {
switch (row.kind) {
case "divider":
- return (0, import_react16.createElement)(PartLine, { key, time: row.time });
+ return (0, import_react17.createElement)(PartLine, { key, time: row.time });
case "user":
- return (0, import_react16.createElement)(EarlierUser, { key, row });
+ return (0, import_react17.createElement)(EarlierUser, { key, row });
case "answer":
- return (0, import_react16.createElement)(AnsweredReply, { key, node: { data: row } });
+ return (0, import_react17.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_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 });
+ return (0, import_react17.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_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 bubbles = (0, import_react17.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_react16.createElement)(import_react16.Fragment, { key }, (0, import_react16.createElement)(SpeakerHead, { bot: speaker, time: row.time }), bubbles) : bubbles;
+ return speaker ? (0, import_react17.createElement)(import_react17.Fragment, { key }, (0, import_react17.createElement)(SpeakerHead, { bot: speaker, time: row.time }), bubbles) : bubbles;
}
case "btw":
- return (0, import_react16.createElement)(BtwCardView, { key, card: row.card, sessionId, actions, onDeleted: onBtwDelete });
+ return (0, import_react17.createElement)(BtwCardView, { key, card: row.card, sessionId, actions, onDeleted: onBtwDelete });
case "event": {
- 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 });
+ if (row.role === "report") return (0, import_react17.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_react16.createElement)(EventLine, { key, prefix, bots: [other], onOpen: () => {
+ return (0, import_react17.createElement)(EventLine, { key, prefix, bots: [other], onOpen: () => {
if (selfId && other.id) actions.openExchange(selfId, other.id);
}, whole: true });
}
@@ -8251,7 +8268,7 @@ function TriggerCell({ node, sessionId, useRoster, useSessions, useTurnClock, us
const deferred = source.kind === "bot" && source.deferred === true;
const relayed = isRelayContext(data);
const turn = node.location?.turn?.turn ?? data.turn;
- (0, import_react16.useLayoutEffect)(() => {
+ (0, import_react17.useLayoutEffect)(() => {
if (relayed) actions.noteTurnPeer(sessionId, turn, source.senderSessionId);
}, [relayed, sessionId, turn, source.senderSessionId]);
const order = useSessions((list) => {
@@ -8270,13 +8287,13 @@ function TriggerCell({ node, sessionId, useRoster, useSessions, useTurnClock, us
return first?.turn === turn && unseenSince(visit, first.start) ? clockLabel(first.start) : "";
});
const body = triggerBody();
- return unreadOpening ? (0, import_react16.createElement)(import_react16.Fragment, null, (0, import_react16.createElement)("div", { className: "bt-open-new" }, (0, import_react16.createElement)(NewDivider), (0, import_react16.createElement)("div", { className: "bt-time-sep", role: "separator" }, unreadOpening)), body) : body;
+ return unreadOpening ? (0, import_react17.createElement)(import_react17.Fragment, null, (0, import_react17.createElement)("div", { className: "bt-open-new" }, (0, import_react17.createElement)(NewDivider), (0, import_react17.createElement)("div", { className: "bt-time-sep", role: "separator" }, unreadOpening)), body) : body ?? (0, import_react17.createElement)(CellEmpty);
function triggerBody() {
if (source.kind === "bot") {
- if (source.handoff === true) return roster.roomsById[sessionId] ? null : (0, import_react16.createElement)(EarlierParts, { sessionId, roster, actions });
+ if (source.handoff === true) return roster.roomsById[sessionId] ? null : (0, import_react17.createElement)(EarlierParts, { sessionId, roster, actions });
if (source.role === "kickoff" || source.role === "room") return null;
if (source.role === "secret" || deferred) return null;
- if (source.role === "update") return (0, import_react16.createElement)("div", { className: "bt-event" }, t("Profile updated"));
+ if (source.role === "update") return (0, import_react17.createElement)("div", { className: "bt-event" }, t("Profile updated"));
if (source.role === "post") {
if (source.logged !== void 0) return null;
if (source.failed !== void 0 || source.resumed === true || source.stopped === true || source.done === true) return null;
@@ -8284,7 +8301,7 @@ function TriggerCell({ node, sessionId, useRoster, useSessions, useTurnClock, us
const poster = roster.byId[source.senderSessionId] ?? { id: source.senderSessionId, name: source.senderName ?? t("a Bot"), color: "gray" };
const file = source.length === void 0 ? void 0 : (data.content ?? []).find((block) => block?.type === "file")?.attachment;
const text = stripHeader(contentText(data.content));
- return (0, import_react16.createElement)(GroupMessage, {
+ return (0, import_react17.createElement)(GroupMessage, {
bot: poster,
text: file ? stripLongNote(text) : text,
room: room2,
@@ -8297,10 +8314,10 @@ function TriggerCell({ node, sessionId, useRoster, useSessions, useTurnClock, us
});
}
if (source.role === "report") {
- return (0, import_react16.createElement)(GroupEvent, { prefix: t("Replies from"), room: roster.roomsById[source.roomId], name: t("a group chat"), roster, actions });
+ return (0, import_react17.createElement)(GroupEvent, { prefix: t("Replies from"), room: roster.roomsById[source.roomId], name: t("a group chat"), roster, actions });
}
- if (source.role === "resume" || source.resumed === true) return (0, import_react16.createElement)("div", { className: "bt-event" }, t("Picked up its work after a restart"));
- if (source.role === "retry" || source.retried === true) return (0, import_react16.createElement)("div", { className: "bt-event" }, t("Asked to make the tool call it wrote as text"));
+ if (source.role === "resume" || source.resumed === true) return (0, import_react17.createElement)("div", { className: "bt-event" }, t("Picked up its work after a restart"));
+ if (source.role === "retry" || source.retried === true) return (0, import_react17.createElement)("div", { className: "bt-event" }, t("Asked to make the tool call it wrote as text"));
const run2 = relayed ? commRunOf(
order.split(",").filter(Boolean).map(Number),
Object.fromEntries(peers.split(",").filter(Boolean).map((pair) => [Number(pair.slice(0, pair.indexOf(":"))), pair.slice(pair.indexOf(":") + 1)])),
@@ -8314,7 +8331,7 @@ function TriggerCell({ node, sessionId, useRoster, useSessions, useTurnClock, us
for (const peer of (run2?.peerIds ?? []).map((id) => roster.byId[id]).filter(Boolean)) {
if (!bots.some((bot) => bot.id === peer.id)) bots.push(peer);
}
- return (0, import_react16.createElement)(EventLine, {
+ return (0, import_react17.createElement)(EventLine, {
prefix: source.role === "stopped" ? t("Stopped by") : count > 1 ? t("{count} messages with", { count }) : t("Message from"),
bots,
onOpen: (bot) => actions.openExchange(selfId, bot.id),
@@ -8323,24 +8340,24 @@ function TriggerCell({ node, sessionId, useRoster, useSessions, useTurnClock, us
}
if (source.kind === "schedule") {
const prompts = reminderPrompts(contentText(data.content));
- return (0, import_react16.createElement)("div", { className: "bt-event" }, prompts.length > 0 ? t("Scheduled task: {text}", { text: prompts.join(" · ").slice(0, 80) }) : t("Routine started"));
+ return (0, import_react17.createElement)("div", { className: "bt-event" }, prompts.length > 0 ? t("Scheduled task: {text}", { text: prompts.join(" · ").slice(0, 80) }) : t("Routine started"));
}
if (source.kind === "user-question-reply" || source.kind === "goal") return null;
- return (0, import_react16.createElement)("div", { className: "bt-event" }, contentText(data.content).slice(0, 80) || t("Update"));
+ return (0, import_react17.createElement)("div", { className: "bt-event" }, contentText(data.content).slice(0, 80) || t("Update"));
}
}
function NewDivider() {
- return (0, import_react16.createElement)("div", { className: "bt-new-sep", role: "separator", "aria-label": t("New messages") }, (0, import_react16.createElement)("span", null, t("New")));
+ return (0, import_react17.createElement)("div", { className: "bt-new-sep", role: "separator", "aria-label": t("New messages") }, (0, import_react17.createElement)("span", null, t("New")));
}
function TurnProcessCell({ node, sessionId, turnProcess, useRoster, useUi, useTurnClock, actions }) {
const open = turnProcess === void 0 || !turnProcess.foldable || turnProcess.open;
- (0, import_react16.useEffect)(() => {
+ (0, import_react17.useEffect)(() => {
if (!open) turnProcess.setOpen(true);
}, [open, turnProcess]);
const turn = node?.location?.turn?.turn ?? node?.data?.turn;
const start = node?.location?.turn?.start?.time;
const hidden = useRoster((roster) => isHiddenTurn(roster, sessionId, turn));
- (0, import_react16.useEffect)(() => {
+ (0, import_react17.useEffect)(() => {
actions.noteTurnTime(sessionId, turn, "first", start);
}, [sessionId, turn, start]);
const visit = useUi((state) => state.visits?.[sessionId]);
@@ -8348,7 +8365,7 @@ function TurnProcessCell({ node, sessionId, turnProcess, useRoster, useUi, useTu
const own = state[sessionId]?.[turn];
return !hidden && typeof visit?.seen === "number" && own?.first !== void 0 && own.first <= visit.seen && own.end !== void 0 && own.end > visit.seen && own.end <= visit.entered;
});
- return fresh ? (0, import_react16.createElement)(NewDivider) : null;
+ return fresh ? (0, import_react17.createElement)(NewDivider) : (0, import_react17.createElement)(CellEmpty);
}
function Nothing() {
return null;
@@ -8375,7 +8392,7 @@ var unseenSince = (visit, time) => typeof visit?.seen === "number" && time > vis
function TurnTailCell({ turn: location2, sessionId, useTurnClock, useUi, actions }) {
const turn = location2.turn;
const time = location2.end.time;
- (0, import_react16.useEffect)(() => {
+ (0, import_react17.useEffect)(() => {
actions.noteTurnTime(sessionId, turn, "end", time);
}, [sessionId, turn, time]);
const label = useTurnClock((state) => {
@@ -8389,19 +8406,19 @@ function TurnTailCell({ turn: location2, sessionId, useTurnClock, useUi, actions
return start !== void 0 && start > visit.seen && start <= visit.entered;
});
if (!label && !fresh) return null;
- return (0, import_react16.createElement)(
- import_react16.Fragment,
+ return (0, import_react17.createElement)(
+ import_react17.Fragment,
null,
- label ? (0, import_react16.createElement)("div", { className: "bt-time-sep", role: "separator" }, label) : null,
- fresh ? (0, import_react16.createElement)(NewDivider) : null
+ label ? (0, import_react17.createElement)("div", { className: "bt-time-sep", role: "separator" }, label) : null,
+ fresh ? (0, import_react17.createElement)(NewDivider) : null
);
}
function Shimmer({ children }) {
- return (0, import_react16.createElement)("span", { className: "bt-shimmer" }, children);
+ return (0, import_react17.createElement)("span", { className: "bt-shimmer" }, children);
}
function Elapsed({ at, className }) {
- const [now, setNow] = (0, import_react16.useState)(Date.now);
- (0, import_react16.useEffect)(() => {
+ const [now, setNow] = (0, import_react17.useState)(Date.now);
+ (0, import_react17.useEffect)(() => {
let timer = 0;
const tick = () => {
const time = Date.now();
@@ -8411,7 +8428,7 @@ function Elapsed({ at, className }) {
tick();
return () => clearTimeout(timer);
}, [at]);
- return (0, import_react16.createElement)("span", { className }, `· ${elapsedLabel(Math.max(1e3, now - at))}`);
+ return (0, import_react17.createElement)("span", { className }, `· ${elapsedLabel(Math.max(1e3, now - at))}`);
}
var PHRASES = {
thinking: ["Thinking about it", "Weighing the options", "Working out a plan", "Sorting out the details"],
@@ -8482,7 +8499,7 @@ function workPhrase(doing) {
}
function useLiveNote(actions, sessionId, id, entry) {
const key = entry ? JSON.stringify(entry) : "";
- (0, import_react16.useEffect)(() => {
+ (0, import_react17.useEffect)(() => {
if (!key) return void 0;
actions.noteLive(sessionId, id, JSON.parse(key));
return () => actions.noteLive(sessionId, id, null);
@@ -8538,8 +8555,8 @@ function scanReplies(text, start, replies) {
}
}
function GroupReplies({ sessionId, callId, done, content, roster, actions, useUi, useWork }) {
- const [live, setLive] = (0, import_react16.useState)({ replies: [], speaking: null });
- (0, import_react16.useEffect)(() => {
+ const [live, setLive] = (0, import_react17.useState)({ replies: [], speaking: null });
+ (0, import_react17.useEffect)(() => {
if (done) return void 0;
let stop = false;
let timer;
@@ -8572,88 +8589,88 @@ function GroupReplies({ sessionId, callId, done, content, roster, actions, useUi
const speakerTool = useWork?.((work) => work.bots?.[live.speaking]?.tool) ?? void 0;
const speakerDoing = useWork?.((work) => work.bots?.[live.speaking]?.tool ? workPhrase(work.bots[live.speaking]) : void 0) ?? void 0;
if (replies.length === 0 && pending.length === 0) {
- return broken ? (0, import_react16.createElement)("div", { className: "bt-group-replies" }, (0, import_react16.createElement)("div", { className: "bt-event" }, t("The group replies could not be shown"))) : null;
+ return broken ? (0, import_react17.createElement)("div", { className: "bt-group-replies" }, (0, import_react17.createElement)("div", { className: "bt-event" }, t("The group replies could not be shown"))) : (0, import_react17.createElement)(CellEmpty);
}
const room2 = roster.roomsById[sessionId];
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ className: "bt-group-replies" },
stackReplies(replies).map(({ reply, index, texts: texts2, time, duration }) => {
const bot = roster.byId[reply.botId] ?? { id: reply.botId, name: reply.name, color: reply.color ?? "gray" };
if (reply.kind === "user") {
- return (0, import_react16.createElement)("div", { key: `user-${index}`, className: "bt-urow" }, (0, import_react16.createElement)(
+ return (0, import_react17.createElement)("div", { key: `user-${index}`, className: "bt-urow" }, (0, import_react17.createElement)(
"div",
{ className: "bt-ububble" },
- (0, import_react16.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: reply.text, labels: mdLabels3(), variant: "compact" }),
- Number.isFinite(time) ? (0, import_react16.createElement)("div", { className: "bt-utime", title: clockLabel(time) }, messageClock(time)) : null
+ (0, import_react17.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: reply.text, labels: mdLabels3(), variant: "compact" }),
+ Number.isFinite(time) ? (0, import_react17.createElement)("div", { className: "bt-utime", title: clockLabel(time) }, messageClock(time)) : null
));
}
if (reply.kind === "failed") {
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ key: `${reply.botId}-${index}`, className: "bt-event bt-event-error", role: "status", title: [reply.code, reply.status, reply.text].filter(Boolean).join(" · ") },
t("{name} could not answer: {reason}", { name: bot.name, reason: failureLabel(reply.code, reply.text) })
);
}
if (reply.kind === "lookup") {
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ key: `${reply.botId}-${index}`, className: "bt-event" },
reply.text ? t("{name} looked up its own chat for “{text}”", { name: bot.name, text: reply.text }) : t("{name} looked up its own chat", { name: bot.name })
);
}
if (reply.kind === "missed") {
- return (0, import_react16.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("{name} didn't answer in time", { name: bot.name }));
+ return (0, import_react17.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_react16.createElement)(
+ return (0, import_react17.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_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ key: `paused-${index}`, className: "bt-event" },
- (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
+ (0, import_react17.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_react17.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.continueRoom(sessionId) }, t("Continue")) : null
);
}
if (reply.kind === "resumed") {
- return (0, import_react16.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("{name} was cut off by a restart and picked its work back up", { name: bot.name }));
+ return (0, import_react17.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("{name} was cut off by a restart and picked its work back up", { name: bot.name }));
}
if (reply.kind === "cut") {
- return (0, import_react16.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("{name} was cut off by a restart again and stopped", { name: bot.name }));
+ return (0, import_react17.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("{name} was cut off by a restart again and stopped", { name: bot.name }));
}
if (reply.kind === "approval" || reply.kind === "working") {
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ key: `${reply.botId}-${index}`, className: "bt-event" },
- (0, import_react16.createElement)(
+ (0, import_react17.createElement)(
"button",
{ type: "button", className: "bt-event-whole", onClick: () => actions.showDetails(sessionId) },
- (0, import_react16.createElement)(BotMark, { bot, size: 16 }),
- (0, import_react16.createElement)("span", { className: "bt-event-name" }, t(reply.kind === "working" ? "{name} started on it" : "{name} paused for your approval", { name: bot.name }))
+ (0, import_react17.createElement)(BotMark, { bot, size: 16 }),
+ (0, import_react17.createElement)("span", { className: "bt-event-name" }, t(reply.kind === "working" ? "{name} started on it" : "{name} paused for your approval", { name: bot.name }))
)
);
}
if (reply.kind === "stopped") {
- return (0, import_react16.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("You stopped {name}'s work", { name: bot.name }));
+ return (0, import_react17.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("You stopped {name}'s work", { name: bot.name }));
}
if (reply.kind === "done") {
- return (0, import_react16.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("{name} finished its work", { name: bot.name }));
+ return (0, import_react17.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("{name} finished its work", { name: bot.name }));
}
- return (0, import_react16.createElement)(GroupMessage, { key: `${reply.botId}-${index}`, bot, texts: texts2, room: room2, roster, actions, msgKey: callId ? `${sessionId}:${callId}:${index}` : void 0, useUi, time, duration });
+ return (0, import_react17.createElement)(GroupMessage, { key: `${reply.botId}-${index}`, bot, texts: texts2, room: room2, roster, actions, msgKey: callId ? `${sessionId}:${callId}:${index}` : void 0, useUi, time, duration });
}),
pending.map((id) => {
const bot = roster.byId[id];
if (!bot) return null;
- return (0, import_react16.createElement)(
+ return (0, import_react17.createElement)(
"div",
{ key: `pending-${id}`, className: "bt-activity" },
- (0, import_react16.createElement)(BotMark, { bot, size: 22, state: speakerTool ? toolState(speakerTool) : "thinking" }),
- (0, import_react16.createElement)(Shimmer, null, speakerDoing ? `${bot.name} · ${speakerDoing}…` : t("{name} is typing…", { name: bot.name }))
+ (0, import_react17.createElement)(BotMark, { bot, size: 22, state: speakerTool ? toolState(speakerTool) : "thinking" }),
+ (0, import_react17.createElement)(Shimmer, null, speakerDoing ? `${bot.name} · ${speakerDoing}…` : t("{name} is typing…", { name: bot.name }))
);
})
);
@@ -8675,7 +8692,7 @@ function callTree(root) {
}
function useShownCards(actions, sessionId, callIds) {
const key = JSON.stringify(callIds);
- (0, import_react16.useLayoutEffect)(() => {
+ (0, import_react17.useLayoutEffect)(() => {
const ids = JSON.parse(key);
if (ids.length === 0 || !actions.noteCards) return void 0;
actions.noteCards(sessionId, ids, 1);
@@ -8690,25 +8707,25 @@ function renderCall(call2, { sessionId, roster, actions, useUi, useWork, findBot
switch (tool) {
case "message_bot": {
const target = findBot(arg("to")) ?? { name: arg("to") ?? "…", color: "gray" };
- if (done && call2.isError) return (0, import_react16.createElement)("div", { className: "bt-event" }, t("Couldn't message {name}", { name: target.name }));
- return (0, import_react16.createElement)(EventLine, { prefix: t("Messaged"), bots: [target], onOpen: (bot) => bot.id && actions.openExchange(self?.id ?? sessionId, bot.id), whole: true });
+ if (done && call2.isError) return (0, import_react17.createElement)("div", { className: "bt-event" }, t("Couldn't message {name}", { name: target.name }));
+ return (0, import_react17.createElement)(EventLine, { prefix: t("Messaged"), bots: [target], onOpen: (bot) => bot.id && actions.openExchange(self?.id ?? sessionId, bot.id), whole: true });
}
case "stop_bot": {
const target = findBot(arg("bot")) ?? { name: arg("bot") ?? "…", color: "gray" };
- if (done && call2.isError) return (0, import_react16.createElement)("div", { className: "bt-event" }, t("Couldn't stop {name}", { name: target.name }));
- return (0, import_react16.createElement)(EventLine, { prefix: t("Stopped"), bots: [target], onOpen: (bot) => bot.id && actions.openExchange(self?.id ?? sessionId, bot.id), whole: true });
+ if (done && call2.isError) return (0, import_react17.createElement)("div", { className: "bt-event" }, t("Couldn't stop {name}", { name: target.name }));
+ return (0, import_react17.createElement)(EventLine, { prefix: t("Stopped"), bots: [target], onOpen: (bot) => bot.id && actions.openExchange(self?.id ?? sessionId, bot.id), whole: true });
}
case "create_bot": {
const created = findBot(arg("name"));
- if (!done || created === void 0) return null;
- return (0, import_react16.createElement)(EventLine, { prefix: t("Created"), bots: [created], onOpen: (bot) => actions.openSession(bot.id) });
+ if (!done || created === void 0) return (0, import_react17.createElement)(CellEmpty);
+ return (0, import_react17.createElement)(EventLine, { prefix: t("Created"), bots: [created], onOpen: (bot) => actions.openSession(bot.id) });
}
case "update_bot": {
const target = findBot(arg("name")) ?? findBot(arg("bot")) ?? (arg("bot") ? void 0 : self);
- return done && target ? (0, import_react16.createElement)(EventLine, { prefix: t("Updated"), bots: [target], onOpen: (bot) => actions.openSession(bot.id) }) : null;
+ return done && target ? (0, import_react17.createElement)(EventLine, { prefix: t("Updated"), bots: [target], onOpen: (bot) => actions.openSession(bot.id) }) : (0, import_react17.createElement)(CellEmpty);
}
case "group_relay":
- return (0, import_react16.createElement)(GroupReplies, { sessionId, callId: call2.callId, done, content: call2.content, roster, actions, useUi, useWork });
+ return (0, import_react17.createElement)(GroupReplies, { sessionId, callId: call2.callId, done, content: call2.content, roster, actions, useUi, useWork });
case "create_group":
case "update_group":
case "delete_group":
@@ -8719,28 +8736,28 @@ function renderCall(call2, { sessionId, roster, actions, useUi, useWork, findBot
delete_group: ["Deleted group", "Couldn't delete the group"],
post_to_group: ["Posted in", "Couldn't post in the group"]
}[tool];
- if (!done) return null;
+ if (!done) return (0, import_react17.createElement)(CellEmpty);
const result = contentText(call2.content);
const named = /^(Created group|Updated|Nothing changed in|Deleted|Posted in) "([^"]+)"/.exec(result);
- if (call2.isError || !named) return (0, import_react16.createElement)("div", { className: "bt-event", title: result }, t(verbs[1]));
+ if (call2.isError || !named) return (0, import_react17.createElement)("div", { className: "bt-event", title: result }, t(verbs[1]));
const name = named[2];
const room2 = roster.rooms.find((entry) => entry.name === name);
- return (0, import_react16.createElement)(GroupEvent, { prefix: t(verbs[0]), room: tool === "delete_group" ? void 0 : room2, name, roster, actions });
+ return (0, import_react17.createElement)(GroupEvent, { prefix: t(verbs[0]), room: tool === "delete_group" ? void 0 : room2, name, roster, actions });
}
case "ask_user": {
const question = roster.questions?.[sessionId];
- if (!question || question.callId !== call2.callId) return (0, import_react16.createElement)("span", { className: "bt-q-gone", hidden: true });
- if (heldCards?.[heldCardKey("question", question.id)] > 0) return null;
- return (0, import_react16.createElement)(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: true });
+ if (!question || question.callId !== call2.callId) return (0, import_react17.createElement)(CellEmpty, { className: "bt-q-gone" });
+ if (heldCards?.[heldCardKey("question", question.id)] > 0) return (0, import_react17.createElement)(CellEmpty);
+ return (0, import_react17.createElement)(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: true });
}
case "show_view":
- return (0, import_react16.createElement)(WidgetCell, { sessionId, callId: call2.callId, args: { text: arg, value: argValue }, done, isError: call2.isError, roster, actions, heldCards });
+ return (0, import_react17.createElement)(WidgetCell, { sessionId, callId: call2.callId, args: { text: arg, value: argValue }, done, isError: call2.isError, roster, actions, heldCards });
case "request_secret":
- return (0, import_react16.createElement)(SecretToolCell, { sessionId, callId: call2.callId, name: arg("name"), done, content: call2.content, roster, actions, heldCards });
+ return (0, import_react17.createElement)(SecretToolCell, { sessionId, callId: call2.callId, name: arg("name"), done, content: call2.content, roster, actions, heldCards });
case "browser_handoff":
- return (0, import_react16.createElement)(HandoffCall, { sessionId, callId: call2.callId, roster, actions, heldCards, hooks });
+ return (0, import_react17.createElement)(HandoffCall, { sessionId, callId: call2.callId, roster, actions, heldCards, hooks });
case "ask_user_question": {
- if (!done) return null;
+ if (!done) return (0, import_react17.createElement)(CellEmpty);
let parsed = null;
try {
parsed = JSON.parse(contentText(call2.content));
@@ -8749,19 +8766,19 @@ function renderCall(call2, { sessionId, roster, actions, useUi, useWork, findBot
}
const answer = parsed?.answers?.[0];
const question = argValue("questions")?.[0];
- if (!answer) return null;
- return (0, import_react16.createElement)("div", { className: "bt-q-inline" }, (0, import_react16.createElement)(SettledQuestion, { question, answer }));
+ if (!answer) return (0, import_react17.createElement)(CellEmpty);
+ return (0, import_react17.createElement)("div", { className: "bt-q-inline" }, (0, import_react17.createElement)(SettledQuestion, { question, answer }));
}
case "read_group_chat": {
- if (!done) return null;
+ if (!done) return (0, import_react17.createElement)(CellEmpty);
const room2 = roster.rooms.find((entry) => entry.name === arg("group"));
- return room2 ? (0, import_react16.createElement)(GroupEvent, { prefix: t("Read"), room: room2, roster, actions }) : null;
+ return room2 ? (0, import_react17.createElement)(GroupEvent, { prefix: t("Read"), room: room2, roster, actions }) : (0, import_react17.createElement)(CellEmpty);
}
case "remember":
case "forget":
- return done ? (0, import_react16.createElement)(MemoryEvent, { sessionId, scope: arg("scope"), tool, result: contentText(call2.content), failed: call2.isError === true, code: call2.error?.code, roster, actions, findBot }) : null;
+ return done ? (0, import_react17.createElement)(MemoryEvent, { sessionId, scope: arg("scope"), tool, result: contentText(call2.content), failed: call2.isError === true, code: call2.error?.code, roster, actions, findBot }) : (0, import_react17.createElement)(CellEmpty);
default:
- return null;
+ return (0, import_react17.createElement)(CellEmpty);
}
}
function ToolCell({ node, sessionId, useRoster, useUi, useWork, useHeldCards, useBrowserHolds, useBrowserTabs, useBrowserPages, actions }) {
@@ -8777,13 +8794,13 @@ function ToolCell({ node, sessionId, useRoster, useUi, useWork, useHeldCards, us
const note = running ? toolActivity(toolName(running), toolArgs(running).text, findBot, roster.byId[sessionId]) : null;
useLiveNote(actions, sessionId, `tool:${root.callId ?? node.key}`, note);
useShownCards(actions, sessionId, drawn.filter((call2) => CARDS.has(toolName(call2)) && call2.callId).map((call2) => call2.callId));
- if (drawn.length === 0) return null;
+ if (drawn.length === 0) return (0, import_react17.createElement)(CellEmpty);
const env = { sessionId, roster, actions, useUi, useWork, findBot, heldCards, hooks: { useBrowserHolds, useBrowserTabs, useBrowserPages } };
- return (0, import_react16.createElement)(import_react16.Fragment, null, drawn.map((call2, index) => (0, import_react16.createElement)(import_react16.Fragment, { key: call2.callId ?? index }, renderCall(call2, env))));
+ return (0, import_react17.createElement)(import_react17.Fragment, null, drawn.map((call2, index) => (0, import_react17.createElement)(import_react17.Fragment, { key: call2.callId ?? index }, renderCall(call2, env))));
}
// src/client/activity-row.js
-var import_react17 = require("react");
+var import_react18 = require("react");
var import_react_dom2 = require("react-dom");
var PHRASE_HOLD_MS = 800;
var drawPhrase = (pool) => t(pool[Math.min(pool.length - 1, Math.floor(Math.random() * pool.length))]);
@@ -8803,8 +8820,8 @@ function findHost() {
return node;
}
function useRunningHost(active) {
- const [host, setHost] = (0, import_react17.useState)(null);
- (0, import_react17.useEffect)(() => {
+ const [host, setHost] = (0, import_react18.useState)(null);
+ (0, import_react18.useEffect)(() => {
if (!active) {
setHost(null);
return void 0;
@@ -8830,9 +8847,9 @@ function useRunningHost(active) {
return host;
}
function useRowEntrances(replacing) {
- const check = (0, import_react17.useRef)(replacing);
+ const check = (0, import_react18.useRef)(replacing);
check.current = replacing;
- (0, import_react17.useEffect)(() => {
+ (0, import_react18.useEffect)(() => {
const seen = /* @__PURE__ */ new WeakSet();
const started = Date.now();
let column = null;
@@ -8880,7 +8897,7 @@ function ActivityIndicator({ sessionId, useRoster, useSessionStatus, useLive, us
const roster = useRoster((value) => value);
const running = useSessionStatus((map) => map.get(sessionId)?.running === true);
const turnAt = useWork?.((work) => work.turns?.[sessionId]);
- const runAt = (0, import_react17.useRef)(0);
+ const runAt = (0, import_react18.useRef)(0);
if (!running) runAt.current = 0;
else if (runAt.current === 0) runAt.current = Date.now();
const liveKey = useLive((state) => JSON.stringify(state[sessionId] ?? {}));
@@ -8892,21 +8909,21 @@ function ActivityIndicator({ sessionId, useRoster, useSessionStatus, useLive, us
const entry = bot === void 0 ? void 0 : work.bots?.[bot.id];
return entry?.switching === true && entry.folder === true && entry.roomId === void 0 ? entry.since : 0;
}) ?? 0;
- const entries2 = (0, import_react17.useMemo)(() => Object.values(JSON.parse(liveKey)), [liveKey]);
+ const entries2 = (0, import_react18.useMemo)(() => Object.values(JSON.parse(liveKey)), [liveKey]);
const streaming = entries2.some((entry) => entry.text);
const tools = entries2.filter((entry) => !entry.text).sort((a, b) => a.at - b.at);
const relaying = tools.some((entry) => entry.relay);
const visible = moveAt !== 0 || rowVisible({ running, streaming, tools, relaying, bot, room: room2 });
const tool = tools.at(-1);
- const inputRef = (0, import_react17.useRef)(0);
+ const inputRef = (0, import_react18.useRef)(0);
const inputAt = Math.max(inputRef.current, pendingInput);
inputRef.current = inputAt;
const want = !visible ? null : moveAt !== 0 ? { key: "move", label: t("Switching working folder"), state: "thinking" } : inputAt > (tool?.at ?? 0) ? { key: `input:${inputAt}`, pool: PHRASES.thinking, state: "thinking" } : tool ? { key: tool.label ? `tool:${tool.label}` : "working", label: tool.label, pool: PHRASES.working, state: tool.state ?? "working" } : { key: "thinking", pool: PHRASES.thinking, state: "thinking" };
- const [shown, setShown] = (0, import_react17.useState)(null);
+ const [shown, setShown] = (0, import_react18.useState)(null);
const wantKey = want?.key ?? null;
- const markState = (0, import_react17.useRef)("thinking");
+ const markState = (0, import_react18.useRef)("thinking");
if (want) markState.current = want.state;
- (0, import_react17.useEffect)(() => {
+ (0, import_react18.useEffect)(() => {
if (wantKey === null || shown?.key === wantKey) return void 0;
const make = () => setShown({ key: wantKey, text: want.label ?? drawPhrase(want.pool), at: Date.now() });
const wait = shown ? shown.at + PHRASE_HOLD_MS - Date.now() : 0;
@@ -8917,12 +8934,12 @@ function ActivityIndicator({ sessionId, useRoster, useSessionStatus, useLive, us
const timer = setTimeout(make, wait);
return () => clearTimeout(timer);
}, [wantKey, shown]);
- const [phase, setPhase] = (0, import_react17.useState)(null);
- const endedAt = (0, import_react17.useRef)(0);
- const shift = (0, import_react17.useRef)(null);
- const leaving = (0, import_react17.useRef)(false);
+ const [phase, setPhase] = (0, import_react18.useState)(null);
+ const endedAt = (0, import_react18.useRef)(0);
+ const shift = (0, import_react18.useRef)(null);
+ const leaving = (0, import_react18.useRef)(false);
leaving.current = phase !== null && !visible;
- (0, import_react17.useEffect)(() => {
+ (0, import_react18.useEffect)(() => {
if (visible) {
setPhase("in");
return void 0;
@@ -8934,7 +8951,7 @@ function ActivityIndicator({ sessionId, useRoster, useSessionStatus, useLive, us
}, 140);
return () => clearTimeout(timer);
}, [visible]);
- (0, import_react17.useLayoutEffect)(() => {
+ (0, import_react18.useLayoutEffect)(() => {
if (phase !== null) return;
endedAt.current = Date.now();
setShown(null);
@@ -8945,21 +8962,21 @@ function ActivityIndicator({ sessionId, useRoster, useSessionStatus, useLive, us
const delta = before - scroller.scrollTop;
if (delta > 0) scroller.querySelector("[data-chat-flow]")?.animate([{ transform: `translateY(${-delta}px)` }, { transform: "none" }], { duration: 140, easing: "cubic-bezier(.23,1,.32,1)" });
}, [phase]);
- (0, import_react17.useEffect)(() => {
+ (0, import_react18.useEffect)(() => {
if (!running) actions.clearLive(sessionId);
}, [running, sessionId]);
useRowEntrances(() => leaving.current || Date.now() - endedAt.current < 300);
const host = useRunningHost(running || moveAt !== 0);
if (!host || phase === null || !shown) return null;
- return (0, import_react_dom2.createPortal)((0, import_react17.createElement)(
+ return (0, import_react_dom2.createPortal)((0, import_react18.createElement)(
"div",
{ className: "bt-typing", "data-exiting": phase === "out" ? "" : void 0, "aria-hidden": true },
- bot ? (0, import_react17.createElement)(BotMark, { bot, size: 28, state: markState.current, live: true, pokeable: true }) : (0, import_react17.createElement)(RoomAvatar, { room: room2, roster, size: 28 }),
- (0, import_react17.createElement)(
+ bot ? (0, import_react18.createElement)(BotMark, { bot, size: 28, state: markState.current, live: true, pokeable: true }) : (0, import_react18.createElement)(RoomAvatar, { room: room2, roster, size: 28 }),
+ (0, import_react18.createElement)(
"span",
{ className: "bt-typing-text" },
- (0, import_react17.createElement)("span", { key: `${shown.key}:${shown.at}`, className: "bt-typing-label" }, (0, import_react17.createElement)(Shimmer, null, `${shown.text}…`)),
- (0, import_react17.createElement)(Elapsed, { at: moveAt !== 0 ? moveAt : Math.max(turnAt ?? runAt.current, inputAt), className: "bt-typing-time" })
+ (0, import_react18.createElement)("span", { key: `${shown.key}:${shown.at}`, className: "bt-typing-label" }, (0, import_react18.createElement)(Shimmer, null, `${shown.text}…`)),
+ (0, import_react18.createElement)(Elapsed, { at: moveAt !== 0 ? moveAt : Math.max(turnAt ?? runAt.current, inputAt), className: "bt-typing-time" })
)
), host);
}
@@ -9194,14 +9211,14 @@ function installFrameWatch(frame) {
}
// src/client/sidebar.js
-var import_react18 = require("react");
+var import_react19 = require("react");
var import_react_dom3 = require("react-dom");
function useMarkedUnread(id, active, marked, actions) {
- (0, import_react18.useEffect)(() => {
+ (0, import_react19.useEffect)(() => {
if (active && marked) actions.clearUnread(id);
}, [active, marked]);
}
-var PinMark = () => (0, import_react18.createElement)("span", { className: "bt-pin", "aria-hidden": true }, (0, import_react18.createElement)(PinMarkIcon));
+var PinMark = () => (0, import_react19.createElement)("span", { className: "bt-pin", "aria-hidden": true }, (0, import_react19.createElement)(PinMarkIcon));
var nameIfCut = (event) => {
const row = event.currentTarget;
const name = row.querySelector(".bt-row-title");
@@ -9212,8 +9229,8 @@ var useApproval = (useWork, match) => useWork ? useWork((work) => (work.approval
var useGroupWork = (useWork, pick2) => useWork ? useWork((work) => JSON.stringify(pick2(work.rooms ?? {}))) : "[]";
var workKeys = (text) => JSON.parse(text);
var doingOf = ({ tool, said, note, target, switching }) => ({ tool, said, note, target, switching });
-var workLine = (lead, doing, more) => (0, import_react18.createElement)(Shimmer, null, `${lead} · ${workPhrase(doing)}…${more > 0 ? ` +${more}` : ""}`);
-var doingLine = (doing) => (0, import_react18.createElement)(Shimmer, null, `${workPhrase(doing)}…`);
+var workLine = (lead, doing, more) => (0, import_react19.createElement)(Shimmer, null, `${lead} · ${workPhrase(doing)}…${more > 0 ? ` +${more}` : ""}`);
+var doingLine = (doing) => (0, import_react19.createElement)(Shimmer, null, `${workPhrase(doing)}…`);
var waitingFor = (roster, waits) => {
const names = [...(waits?.bots ?? []).map((id) => roster.byId[id]?.name), ...(waits?.rooms ?? []).map((id) => roster.roomsById[id]?.name)].filter(Boolean);
return names.length === 0 ? "" : t("Waiting for {names}", { names: names.join(t(" and ")) });
@@ -9246,7 +9263,7 @@ function BotRow({ bot, roster, actions, useSessions, useSessionStatus, useSessio
const pinned = bot.pinned === true && !tile;
const label = [bot.name, main ? t("Main Bot") : "", pinned ? t("Pinned") : "", running || away ? t("Working") : "", waitsFor, approval ? t("Waiting for your approval") : alert ? t("Waiting for your answer") : "", unread ? t("Unread activity") : ""].filter(Boolean).join(", ");
if (tile && wide) {
- return (0, import_react18.createElement)("div", { className: "bt-tile-wrap" }, (0, import_react18.createElement)(
+ return (0, import_react19.createElement)("div", { className: "bt-tile-wrap" }, (0, import_react19.createElement)(
"button",
{
type: "button",
@@ -9258,12 +9275,12 @@ function BotRow({ bot, roster, actions, useSessions, useSessionStatus, useSessio
onClick: () => actions.openSession(id),
onContextMenu
},
- (0, import_react18.createElement)(BotAvatar, { bot, size: 60, state, main: true }),
- (0, import_react18.createElement)("span", { className: "bt-tile-name" }, bot.name),
- bot.role ? (0, import_react18.createElement)("span", { className: "bt-chip" }, bot.role) : null
+ (0, import_react19.createElement)(BotAvatar, { bot, size: 60, state, main: true }),
+ (0, import_react19.createElement)("span", { className: "bt-tile-name" }, bot.name),
+ bot.role ? (0, import_react19.createElement)("span", { className: "bt-chip" }, bot.role) : null
));
}
- return (0, import_react18.createElement)(
+ return (0, import_react19.createElement)(
"button",
{
type: "button",
@@ -9276,15 +9293,15 @@ function BotRow({ bot, roster, actions, useSessions, useSessionStatus, useSessio
onClick: () => actions.openSession(id),
onContextMenu
},
- (0, import_react18.createElement)(BotAvatar, { bot, size: wide ? 36 : 44, state, main }),
- pinned && !wide ? (0, import_react18.createElement)(PinMark) : null,
- wide ? (0, import_react18.createElement)(
+ (0, import_react19.createElement)(BotAvatar, { bot, size: wide ? 36 : 44, state, main }),
+ pinned && !wide ? (0, import_react19.createElement)(PinMark) : null,
+ wide ? (0, import_react19.createElement)(
"span",
{ className: "bt-row-body" },
- (0, import_react18.createElement)("span", { className: "bt-row-name" }, (0, import_react18.createElement)("span", { className: "bt-row-title" }, bot.name), pinned ? (0, import_react18.createElement)(PinMark) : null),
- runningLine ? (0, import_react18.createElement)("span", { className: "bt-row-preview" }, runningLine) : awayLine ? (0, import_react18.createElement)("span", { className: "bt-row-preview" }, awayLine) : waitsFor ? (0, import_react18.createElement)("span", { className: "bt-row-preview" }, waitsFor) : preview ? (0, import_react18.createElement)("span", { className: "bt-row-preview" }, preview) : null
+ (0, import_react19.createElement)("span", { className: "bt-row-name" }, (0, import_react19.createElement)("span", { className: "bt-row-title" }, bot.name), pinned ? (0, import_react19.createElement)(PinMark) : null),
+ runningLine ? (0, import_react19.createElement)("span", { className: "bt-row-preview" }, runningLine) : awayLine ? (0, import_react19.createElement)("span", { className: "bt-row-preview" }, awayLine) : waitsFor ? (0, import_react19.createElement)("span", { className: "bt-row-preview" }, waitsFor) : preview ? (0, import_react19.createElement)("span", { className: "bt-row-preview" }, preview) : null
) : null,
- wide && unread && !active ? (0, import_react18.createElement)("span", { className: "bt-unread", "aria-hidden": true }) : !wide && !active && (alert || unread) ? (0, import_react18.createElement)("span", { className: `bt-dot${alert ? " bt-dot-wait" : ""}`, "aria-hidden": true }) : null
+ wide && unread && !active ? (0, import_react19.createElement)("span", { className: "bt-unread", "aria-hidden": true }) : !wide && !active && (alert || unread) ? (0, import_react19.createElement)("span", { className: `bt-dot${alert ? " bt-dot-wait" : ""}`, "aria-hidden": true }) : null
);
}
function RoomRow({ room: room2, roster, actions, useSessions, useSessionStatus, useSessionRetainInfo, useWork, wide, marked }) {
@@ -9301,7 +9318,7 @@ function RoomRow({ room: room2, roster, actions, useSessions, useSessionStatus,
if (room2.hidden && !active) return null;
const pinned = room2.pinned === true;
const label = [room2.name, pinned ? t("Pinned") : "", members.length > 0 ? t("Working") : "", approval ? t("Waiting for your approval") : ""].filter(Boolean).join(", ");
- return (0, import_react18.createElement)(
+ return (0, import_react19.createElement)(
"button",
{
type: "button",
@@ -9317,20 +9334,20 @@ function RoomRow({ room: room2, roster, actions, useSessions, useSessionStatus,
actions.openMenu({ kind: "room", id, x: event.clientX, y: event.clientY });
}
},
- (0, import_react18.createElement)(RoomAvatar, { room: room2, roster, size: wide ? 36 : 44 }),
- pinned && !wide ? (0, import_react18.createElement)(PinMark) : null,
- wide ? (0, import_react18.createElement)(
+ (0, import_react19.createElement)(RoomAvatar, { room: room2, roster, size: wide ? 36 : 44 }),
+ pinned && !wide ? (0, import_react19.createElement)(PinMark) : null,
+ wide ? (0, import_react19.createElement)(
"span",
{ className: "bt-row-body" },
- (0, import_react18.createElement)("span", { className: "bt-row-name" }, (0, import_react18.createElement)("span", { className: "bt-row-title" }, room2.name), pinned ? (0, import_react18.createElement)(PinMark) : null),
- workingLine ? (0, import_react18.createElement)("span", { className: "bt-row-preview" }, workingLine) : preview ? (0, import_react18.createElement)("span", { className: "bt-row-preview" }, preview) : null
+ (0, import_react19.createElement)("span", { className: "bt-row-name" }, (0, import_react19.createElement)("span", { className: "bt-row-title" }, room2.name), pinned ? (0, import_react19.createElement)(PinMark) : null),
+ workingLine ? (0, import_react19.createElement)("span", { className: "bt-row-preview" }, workingLine) : preview ? (0, import_react19.createElement)("span", { className: "bt-row-preview" }, preview) : null
) : null,
- wide && approval && !active ? (0, import_react18.createElement)("span", { className: "bt-unread bt-unread-wait", "aria-hidden": true }) : wide && unread && !active ? (0, import_react18.createElement)("span", { className: "bt-unread", "aria-hidden": true }) : !wide && !active && (approval || unread) ? (0, import_react18.createElement)("span", { className: `bt-dot${approval ? " bt-dot-wait" : ""}`, "aria-hidden": true }) : null
+ wide && approval && !active ? (0, import_react19.createElement)("span", { className: "bt-unread bt-unread-wait", "aria-hidden": true }) : wide && unread && !active ? (0, import_react19.createElement)("span", { className: "bt-unread", "aria-hidden": true }) : !wide && !active && (approval || unread) ? (0, import_react19.createElement)("span", { className: `bt-dot${approval ? " bt-dot-wait" : ""}`, "aria-hidden": true }) : null
);
}
function AgentSessionRow({ session, agent, actions, renaming, index }) {
- const input = (0, import_react18.useRef)(null);
- (0, import_react18.useLayoutEffect)(() => {
+ const input = (0, import_react19.useRef)(null);
+ (0, import_react19.useLayoutEffect)(() => {
if (!renaming) return;
input.current?.focus();
input.current?.select();
@@ -9351,10 +9368,10 @@ function AgentSessionRow({ session, agent, actions, renaming, index }) {
}
})();
};
- return (0, import_react18.createElement)(
+ return (0, import_react19.createElement)(
"div",
{ className: "bt-agent-sub-row bt-agent-edit", style: { "--i": index } },
- (0, import_react18.createElement)("input", {
+ (0, import_react19.createElement)("input", {
ref: input,
defaultValue: session.title,
"aria-label": t("Rename"),
@@ -9367,7 +9384,7 @@ function AgentSessionRow({ session, agent, actions, renaming, index }) {
})
);
}
- return (0, import_react18.createElement)(
+ return (0, import_react19.createElement)(
"button",
{
type: "button",
@@ -9381,8 +9398,8 @@ function AgentSessionRow({ session, agent, actions, renaming, index }) {
actions.openMenu({ kind: "agent-session", id: session.id, agentId: agent.id, x: event.clientX, y: event.clientY });
}
},
- (0, import_react18.createElement)("span", { className: "bt-agent-sub-title" }, session.title),
- (0, import_react18.createElement)("span", { className: "bt-agent-sub-time" }, session.at > 0 ? relativeShort(session.at) : "")
+ (0, import_react19.createElement)("span", { className: "bt-agent-sub-title" }, session.title),
+ (0, import_react19.createElement)("span", { className: "bt-agent-sub-time" }, session.at > 0 ? relativeShort(session.at) : "")
);
}
function AgentRow({ agent, actions, useSessions, useSessionStatus, useUi, wide, marked }) {
@@ -9417,10 +9434,10 @@ function AgentRow({ agent, actions, useSessions, useSessionStatus, useUi, wide,
const preview = sessions[0]?.title ?? t("New session");
const label = ["DSH Agent", running ? t("Working") : "", unread ? t("Unread activity") : ""].filter(Boolean).join(", ");
const open = active && wide;
- return (0, import_react18.createElement)(
+ return (0, import_react19.createElement)(
"div",
{ className: "bt-agent" },
- (0, import_react18.createElement)(
+ (0, import_react19.createElement)(
"button",
{
type: "button",
@@ -9435,30 +9452,30 @@ function AgentRow({ agent, actions, useSessions, useSessionStatus, useUi, wide,
actions.openMenu({ kind: "agent", id: agent.id, x: event.clientX, y: event.clientY });
}
},
- (0, import_react18.createElement)("span", { className: `bt-agent-ava${running ? " bt-run" : ""}` }, (0, import_react18.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: wide ? 22 : 24 })),
- wide ? (0, import_react18.createElement)(
+ (0, import_react19.createElement)("span", { className: `bt-agent-ava${running ? " bt-run" : ""}` }, (0, import_react19.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: wide ? 22 : 24 })),
+ wide ? (0, import_react19.createElement)(
"span",
{ className: "bt-row-body" },
- (0, import_react18.createElement)("span", { className: "bt-row-name" }, "DSH Agent"),
- preview ? (0, import_react18.createElement)("span", { className: "bt-row-preview" }, preview) : null
+ (0, import_react19.createElement)("span", { className: "bt-row-name" }, "DSH Agent"),
+ preview ? (0, import_react19.createElement)("span", { className: "bt-row-preview" }, preview) : null
) : null,
- wide && unread && !active ? (0, import_react18.createElement)("span", { className: "bt-unread", "aria-hidden": true }) : !wide && unread && !active ? (0, import_react18.createElement)("span", { className: "bt-dot", "aria-hidden": true }) : null
+ wide && unread && !active ? (0, import_react19.createElement)("span", { className: "bt-unread", "aria-hidden": true }) : !wide && unread && !active ? (0, import_react19.createElement)("span", { className: "bt-dot", "aria-hidden": true }) : null
),
- (0, import_react18.createElement)(
+ (0, import_react19.createElement)(
"div",
{ className: "bt-agent-sub", "data-open": open || void 0 },
- (0, import_react18.createElement)(
+ (0, import_react19.createElement)(
"div",
{ className: "bt-agent-sub-in" },
- (0, import_react18.createElement)(
+ (0, import_react19.createElement)(
"button",
{ type: "button", className: "bt-agent-sub-row bt-agent-new", style: { "--i": 0 }, onClick: () => {
void actions.newAgentSession(agent.id).catch((error) => actions.reportError(error, "agent-session"));
} },
- (0, import_react18.createElement)(PlusIcon),
- (0, import_react18.createElement)("span", { className: "bt-agent-sub-title" }, t("New session"))
+ (0, import_react19.createElement)(PlusIcon),
+ (0, import_react19.createElement)("span", { className: "bt-agent-sub-title" }, t("New session"))
),
- sessions.map((session, index) => (0, import_react18.createElement)(AgentSessionRow, {
+ sessions.map((session, index) => (0, import_react19.createElement)(AgentSessionRow, {
key: session.id,
session,
agent,
@@ -9472,8 +9489,8 @@ function AgentRow({ agent, actions, useSessions, useSessionStatus, useUi, wide,
}
var GLIDE = springEasing(1e3, 63);
function useListGlide(listRef, layout, key) {
- const tops = (0, import_react18.useRef)({ layout, map: /* @__PURE__ */ new Map() });
- (0, import_react18.useLayoutEffect)(() => {
+ const tops = (0, import_react19.useRef)({ layout, map: /* @__PURE__ */ new Map() });
+ (0, import_react19.useLayoutEffect)(() => {
const list = listRef.current;
if (!list) return;
const next = /* @__PURE__ */ new Map();
@@ -9491,11 +9508,11 @@ function useListGlide(listRef, layout, key) {
}, [layout, key]);
}
function LeftColumn({ mode, width, onGrip, children }) {
- return (0, import_react_dom3.createPortal)((0, import_react18.createElement)(
+ return (0, import_react_dom3.createPortal)((0, import_react19.createElement)(
"div",
{ className: "bt-leftcol", "data-left": mode, style: { width: `${width}px` } },
children,
- (0, import_react18.createElement)("div", { className: "bt-leftcol-grip", role: "separator", "aria-orientation": "vertical", "aria-label": t("Resize sidebar"), title: t("Resize sidebar"), onPointerDown: onGrip })
+ (0, import_react19.createElement)("div", { className: "bt-leftcol-grip", role: "separator", "aria-orientation": "vertical", "aria-label": t("Resize sidebar"), title: t("Resize sidebar"), onPointerDown: onGrip })
), document.body);
}
function TitleToggle({ hidden, onToggle }) {
@@ -9503,17 +9520,17 @@ function TitleToggle({ hidden, onToggle }) {
const titlebar = document.documentElement.hasAttribute("data-windows-titlebar");
if (!titlebar && !hidden) return null;
const label = t(hidden ? "Expand sidebar" : "Collapse sidebar");
- return (0, import_react_dom3.createPortal)((0, import_react18.createElement)("button", {
+ return (0, import_react_dom3.createPortal)((0, import_react19.createElement)("button", {
type: "button",
className: titlebar ? "bt-title-toggle" : "bt-round bt-title-toggle",
"aria-label": label,
title: label,
onClick: onToggle
- }, (0, import_react18.createElement)(SidebarIcon)), document.body);
+ }, (0, import_react19.createElement)(SidebarIcon)), document.body);
}
function TeamSidebar(props) {
const { wide, useRoster, useUi, useSessions, actions } = props;
- const listRef = (0, import_react18.useRef)(null);
+ const listRef = (0, import_react19.useRef)(null);
const roster = useRoster((value) => value);
const markedUnread = useUi((value) => value.unread);
const uiNow = useUi((value) => value);
@@ -9527,7 +9544,7 @@ function TeamSidebar(props) {
drawer: uiNow.leftDrawer === true,
panel: uiNow.details ? { view: uiNow.view, yielded: uiNow.panelYield === true } : null
});
- const [drag, setDrag] = (0, import_react18.useState)(null);
+ const [drag, setDrag] = (0, import_react19.useState)(null);
const mode = drag?.left ?? layout.left;
const wideContent = mode !== "rail";
const updated = useSessions((list) => {
@@ -9535,7 +9552,7 @@ function TeamSidebar(props) {
for (const id of list.ids) stamps[id] = list.byId[id]?.updatedAt ?? 0;
return JSON.stringify(stamps);
});
- const order = (0, import_react18.useMemo)(() => {
+ const order = (0, import_react19.useMemo)(() => {
const stamps = JSON.parse(updated);
const entries2 = [
...roster.bots.filter((bot) => bot.id !== roster.mainBotId).map((bot) => ({ kind: "bot", item: bot, at: stamps[currentPart(bot)] ?? bot.createdAt })),
@@ -9551,11 +9568,11 @@ function TeamSidebar(props) {
const openWidth = drag?.width ?? frameSnap.sidebarWidth;
const ourWidth = mode === "rail" ? RAIL_WIDTH : openWidth;
const pushed = mode === "open" ? openWidth : mode === "hidden" ? 0 : RAIL_WIDTH;
- (0, import_react18.useLayoutEffect)(() => {
+ (0, import_react19.useLayoutEffect)(() => {
if (typeof document === "undefined") return;
chatRoom.setLeft(Math.max(0, pushed - (frameSnap.collapsedWidth ?? 0)));
}, [pushed, frameSnap.collapsedWidth]);
- (0, import_react18.useEffect)(() => () => {
+ (0, import_react19.useEffect)(() => () => {
if (typeof document !== "undefined") chatRoom.setLeft(null);
}, []);
const startDrag = (event) => {
@@ -9593,13 +9610,13 @@ function TeamSidebar(props) {
grip.addEventListener("pointermove", onMove);
for (const name of ends) grip.addEventListener(name, onEnd);
};
- const dsh = (0, import_react18.useRef)(null);
- const requested = (0, import_react18.useRef)(false);
- const requestLapse = (0, import_react18.useRef)(0);
- const [lapsed, setLapsed] = (0, import_react18.useState)(0);
- (0, import_react18.useEffect)(() => () => clearTimeout(requestLapse.current), []);
- const resizedAt = (0, import_react18.useRef)(0);
- (0, import_react18.useEffect)(() => {
+ const dsh = (0, import_react19.useRef)(null);
+ const requested = (0, import_react19.useRef)(false);
+ const requestLapse = (0, import_react19.useRef)(0);
+ const [lapsed, setLapsed] = (0, import_react19.useState)(0);
+ (0, import_react19.useEffect)(() => () => clearTimeout(requestLapse.current), []);
+ const resizedAt = (0, import_react19.useRef)(0);
+ (0, import_react19.useEffect)(() => {
const onResize = () => {
resizedAt.current = performance.now();
};
@@ -9610,8 +9627,8 @@ function TeamSidebar(props) {
if (on) document.documentElement.setAttribute("data-bt-collapsing", "");
else document.documentElement.removeAttribute("data-bt-collapsing");
};
- (0, import_react18.useEffect)(() => () => quiet(false), []);
- (0, import_react18.useLayoutEffect)(() => {
+ (0, import_react19.useEffect)(() => () => quiet(false), []);
+ (0, import_react19.useLayoutEffect)(() => {
if (typeof document === "undefined" || typeof actions.toggleSidebar !== "function") return void 0;
const collapsed = dshCollapsed() ?? !wide;
const prev = dsh.current;
@@ -9640,7 +9657,7 @@ function TeamSidebar(props) {
}, 300);
return void 0;
}, [wide, frameSnap.viewport, lapsed]);
- (0, import_react18.useEffect)(() => {
+ (0, import_react19.useEffect)(() => {
if (mode !== "drawer") return void 0;
const onDown = (event) => {
if (event.target instanceof Element && event.target.closest(".bt-leftcol")) return;
@@ -9678,9 +9695,9 @@ function TeamSidebar(props) {
actions.openPalette(event.key);
};
const onToggle = () => actions.toggleLeftHidden?.();
- const toggleRef = (0, import_react18.useRef)(onToggle);
+ const toggleRef = (0, import_react19.useRef)(onToggle);
toggleRef.current = onToggle;
- (0, import_react18.useEffect)(() => {
+ (0, import_react19.useEffect)(() => {
const onKey = (event) => {
if (event.defaultPrevented || event.isComposing || !pressesShellShortcut(event, "sidebar.left.toggle")) return;
if (event.target instanceof Element && event.target.closest(".xterm")) return;
@@ -9692,56 +9709,56 @@ function TeamSidebar(props) {
document.addEventListener("keydown", onKey, true);
return () => document.removeEventListener("keydown", onKey, true);
}, []);
- const top = wideContent ? (0, import_react18.createElement)(
+ const top = wideContent ? (0, import_react19.createElement)(
"div",
{ className: "bt-side-top" },
- (0, import_react18.createElement)("span", { className: "bt-brand" }, (0, import_react18.createElement)(BrandMark, { size: 22 }), (0, import_react18.createElement)(BrandName)),
- (0, import_react18.createElement)(UpdateButton, { useUpdate: props.useUpdate, actions }),
- (0, import_react18.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Search"), title: t("Search"), onClick: () => actions.openPalette() }, (0, import_react18.createElement)(SearchIcon)),
- (0, import_react18.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("New…"), title: t("New…"), onClick: () => actions.openNewChat("new") }, (0, import_react18.createElement)(PlusIcon)),
- (0, import_react18.createElement)("button", { type: "button", className: "bt-round bt-side-collapse", "aria-label": t("Collapse sidebar"), title: t("Collapse sidebar"), onClick: onToggle }, (0, import_react18.createElement)(SidebarIcon))
- ) : (0, import_react18.createElement)(
+ (0, import_react19.createElement)("span", { className: "bt-brand" }, (0, import_react19.createElement)(BrandMark, { size: 22 }), (0, import_react19.createElement)(BrandName)),
+ (0, import_react19.createElement)(UpdateButton, { useUpdate: props.useUpdate, actions }),
+ (0, import_react19.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Search"), title: t("Search"), onClick: () => actions.openPalette() }, (0, import_react19.createElement)(SearchIcon)),
+ (0, import_react19.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("New…"), title: t("New…"), onClick: () => actions.openNewChat("new") }, (0, import_react19.createElement)(PlusIcon)),
+ (0, import_react19.createElement)("button", { type: "button", className: "bt-round bt-side-collapse", "aria-label": t("Collapse sidebar"), title: t("Collapse sidebar"), onClick: onToggle }, (0, import_react19.createElement)(SidebarIcon))
+ ) : (0, import_react19.createElement)(
"div",
{ className: "bt-rail-top" },
- (0, import_react18.createElement)(UpdateButton, { useUpdate: props.useUpdate, actions }),
- (0, import_react18.createElement)("button", { type: "button", className: "bt-round bt-side-collapse", "aria-label": t("Collapse sidebar"), title: t("Collapse sidebar"), onClick: onToggle }, (0, import_react18.createElement)(SidebarIcon)),
- main ? (0, import_react18.createElement)(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : (0, import_react18.createElement)("div", { className: "bt-hint" }, t("Setting up your Main Bot…")),
- (0, import_react18.createElement)("span", { className: "bt-rail-sep", "aria-hidden": true })
+ (0, import_react19.createElement)(UpdateButton, { useUpdate: props.useUpdate, actions }),
+ (0, import_react19.createElement)("button", { type: "button", className: "bt-round bt-side-collapse", "aria-label": t("Collapse sidebar"), title: t("Collapse sidebar"), onClick: onToggle }, (0, import_react19.createElement)(SidebarIcon)),
+ main ? (0, import_react19.createElement)(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : (0, import_react19.createElement)("div", { className: "bt-hint" }, t("Setting up your Main Bot…")),
+ (0, import_react19.createElement)("span", { className: "bt-rail-sep", "aria-hidden": true })
);
- const foot = wideContent ? (0, import_react18.createElement)("div", { className: "bt-leftcol-foot" }, (0, import_react18.createElement)(AccountLauncher, { seat: false, actions })) : (0, import_react18.createElement)(
+ const foot = wideContent ? (0, import_react19.createElement)("div", { className: "bt-leftcol-foot" }, (0, import_react19.createElement)(AccountLauncher, { seat: false, actions })) : (0, import_react19.createElement)(
"div",
{ className: "bt-leftcol-foot bt-leftcol-foot-rail" },
- (0, import_react18.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("New…"), title: t("New…"), onClick: () => actions.openNewChat("new") }, (0, import_react18.createElement)(PlusIcon)),
- (0, import_react18.createElement)(AccountLauncher, { seat: false, actions })
+ (0, import_react19.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("New…"), title: t("New…"), onClick: () => actions.openNewChat("new") }, (0, import_react19.createElement)(PlusIcon)),
+ (0, import_react19.createElement)(AccountLauncher, { seat: false, actions })
);
- const content = (0, import_react18.createElement)(
+ const content = (0, import_react19.createElement)(
"div",
{ className: wideContent ? "bt-side" : "bt-side bt-rail", onKeyDown: typeToSearch },
top,
- wideContent && roster.readOnly ? (0, import_react18.createElement)("div", { className: "bt-hint bt-read-only", role: "status" }, hostText(roster.readOnly)) : null,
- (0, import_react18.createElement)(
+ wideContent && roster.readOnly ? (0, import_react19.createElement)("div", { className: "bt-hint bt-read-only", role: "status" }, hostText(roster.readOnly)) : null,
+ (0, import_react19.createElement)(
"div",
{ ref: listRef, className: "bt-list", role: "region", "aria-label": t("Bot list") },
- wideContent ? main ? (0, import_react18.createElement)(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : (0, import_react18.createElement)("div", { className: "bt-hint" }, t("Setting up your Main Bot…")) : null,
- order.map((entry) => entry.kind === "bot" ? (0, import_react18.createElement)(BotRow, { key: entry.item.id, ...rowProps, bot: entry.item, marked: markedUnread[entry.item.id] === true }) : entry.kind === "room" ? (0, import_react18.createElement)(RoomRow, { key: entry.item.id, ...rowProps, room: entry.item, marked: markedUnread[entry.item.id] === true }) : (0, import_react18.createElement)(AgentRow, { key: entry.item.id, ...rowProps, agent: entry.item, marked: markedUnread[entry.item.id] === true }))
+ wideContent ? main ? (0, import_react19.createElement)(BotRow, { ...rowProps, bot: main, marked: markedUnread[main.id] === true }) : roster.ready ? null : (0, import_react19.createElement)("div", { className: "bt-hint" }, t("Setting up your Main Bot…")) : null,
+ order.map((entry) => entry.kind === "bot" ? (0, import_react19.createElement)(BotRow, { key: entry.item.id, ...rowProps, bot: entry.item, marked: markedUnread[entry.item.id] === true }) : entry.kind === "room" ? (0, import_react19.createElement)(RoomRow, { key: entry.item.id, ...rowProps, room: entry.item, marked: markedUnread[entry.item.id] === true }) : (0, import_react19.createElement)(AgentRow, { key: entry.item.id, ...rowProps, agent: entry.item, marked: markedUnread[entry.item.id] === true }))
),
foot
);
- return (0, import_react18.createElement)(
- import_react18.Fragment,
+ return (0, import_react19.createElement)(
+ import_react19.Fragment,
null,
- (0, import_react18.createElement)(TitleToggle, { hidden: mode === "hidden", onToggle }),
- mode === "hidden" ? null : (0, import_react18.createElement)(LeftColumn, { mode, width: ourWidth, onGrip: startDrag }, content)
+ (0, import_react19.createElement)(TitleToggle, { hidden: mode === "hidden", onToggle }),
+ mode === "hidden" ? null : (0, import_react19.createElement)(LeftColumn, { mode, width: ourWidth, onGrip: startDrag }, content)
);
}
function UpdateButton({ useUpdate, actions }) {
const update = useUpdate((value) => value);
- const [open, setOpen] = (0, import_react18.useState)(false);
- const [box, setBox] = (0, import_react18.useState)(null);
- const [error, setError] = (0, import_react18.useState)("");
- const [dshError, setDshError] = (0, import_react18.useState)("");
- const button = (0, import_react18.useRef)(null);
- (0, import_react18.useEffect)(() => {
+ const [open, setOpen] = (0, import_react19.useState)(false);
+ const [box, setBox] = (0, import_react19.useState)(null);
+ const [error, setError] = (0, import_react19.useState)("");
+ const [dshError, setDshError] = (0, import_react19.useState)("");
+ const button = (0, import_react19.useRef)(null);
+ (0, import_react19.useEffect)(() => {
if (!open) return void 0;
const onDown = (event) => {
if (event.target instanceof Element && (event.target.closest(".bt-update-pop") || button.current?.contains(event.target))) return;
@@ -9766,7 +9783,7 @@ function UpdateButton({ useUpdate, actions }) {
const dshPhase = dsh?.phase ?? "idle";
const dshRow = showsDshRow(dsh, update?.app);
const tick = useViewport();
- (0, import_react18.useLayoutEffect)(() => {
+ (0, import_react19.useLayoutEffect)(() => {
if (!open) return;
const rect = button.current?.getBoundingClientRect();
if (rect) setBox({ left: Math.max(8, Math.min(rect.left, window.innerWidth - 288)), top: rect.bottom + 6 });
@@ -9786,10 +9803,10 @@ function UpdateButton({ useUpdate, actions }) {
const message = error || (phase === "failed" ? update.error : "");
const dshMessage = dshError || (dshPhase === "failed" ? dsh?.error : "");
const dshText = dshPhase === "installed" ? t("Restart DSH to start using DSH {version}.", { version: dsh.installed ?? dsh.verified }) : dsh?.available === false && dsh?.blockedBy ? t("Update DS Bot {version} first.", { version: dsh.blockedBy }) : t("You have {version}.", { version: dsh?.current });
- return (0, import_react18.createElement)(
- import_react18.Fragment,
+ return (0, import_react19.createElement)(
+ import_react19.Fragment,
null,
- (0, import_react18.createElement)("button", {
+ (0, import_react19.createElement)("button", {
ref: button,
type: "button",
className: "bt-round bt-update",
@@ -9799,21 +9816,21 @@ function UpdateButton({ useUpdate, actions }) {
"aria-haspopup": "dialog",
"aria-expanded": open,
onClick: toggle
- }, (0, import_react18.createElement)(CloudDownloadIcon, { done: phase === "installed" || phase === "updated" }), phase === "failed" || dshPhase === "failed" ? (0, import_react18.createElement)("span", { className: "bt-update-dot", "aria-hidden": true }) : null),
- open && box ? (0, import_react_dom3.createPortal)((0, import_react18.createElement)(
+ }, (0, import_react19.createElement)(CloudDownloadIcon, { done: phase === "installed" || phase === "updated" }), phase === "failed" || dshPhase === "failed" ? (0, import_react19.createElement)("span", { className: "bt-update-dot", "aria-hidden": true }) : null),
+ open && box ? (0, import_react_dom3.createPortal)((0, import_react19.createElement)(
"div",
{ className: "bt-update-pop", role: "dialog", "aria-label": update?.available || phase !== "idle" ? t("DS Bot update") : t("DSH update"), style: box },
- update?.available || phase !== "idle" ? (0, import_react18.createElement)(
- import_react18.Fragment,
+ update?.available || phase !== "idle" ? (0, import_react19.createElement)(
+ import_react19.Fragment,
null,
- (0, import_react18.createElement)("div", { className: "bt-update-title" }, phase === "installed" || phase === "updated" ? t("Update installed") : t("DS Bot {version}", { version: update.latest })),
- (0, import_react18.createElement)("div", { className: "bt-update-text" }, phase === "installed" ? t("Restart DSH to start using DS Bot {version}.", { version: update.installed ?? update.latest }) : phase === "updated" ? t("DS Bot {version} is installed.", { version: update.installed ?? update.latest }) : t("You have {version}.", { version: update.current })),
- message ? (0, import_react18.createElement)("div", { className: "bt-update-error", role: "alert" }, t("The update did not finish: {reason}", { reason: message })) : null,
- (0, import_react18.createElement)(
+ (0, import_react19.createElement)("div", { className: "bt-update-title" }, phase === "installed" || phase === "updated" ? t("Update installed") : t("DS Bot {version}", { version: update.latest })),
+ (0, import_react19.createElement)("div", { className: "bt-update-text" }, phase === "installed" ? t("Restart DSH to start using DS Bot {version}.", { version: update.installed ?? update.latest }) : phase === "updated" ? t("DS Bot {version} is installed.", { version: update.installed ?? update.latest }) : t("You have {version}.", { version: update.current })),
+ message ? (0, import_react19.createElement)("div", { className: "bt-update-error", role: "alert" }, t("The update did not finish: {reason}", { reason: message })) : null,
+ (0, import_react19.createElement)(
"div",
{ className: "bt-update-actions" },
- update.notesUrl ? (0, import_react18.createElement)("a", { className: "bt-update-notes", href: update.notesUrl, target: "_blank", rel: "noopener noreferrer" }, t("What's new")) : null,
- phase === "installed" || phase === "updated" ? null : (0, import_react18.createElement)("button", {
+ update.notesUrl ? (0, import_react19.createElement)("a", { className: "bt-update-notes", href: update.notesUrl, target: "_blank", rel: "noopener noreferrer" }, t("What's new")) : null,
+ phase === "installed" || phase === "updated" ? null : (0, import_react19.createElement)("button", {
type: "button",
className: "bt-update-go",
disabled: phase === "installing",
@@ -9821,17 +9838,17 @@ function UpdateButton({ useUpdate, actions }) {
}, phase === "installing" ? t("Updating…") : phase === "failed" ? t("Try again") : t("Update"))
)
) : null,
- dshRow ? (0, import_react18.createElement)(
+ dshRow ? (0, import_react19.createElement)(
"div",
{ className: "bt-update-dsh" },
- (0, import_react18.createElement)("div", { className: "bt-update-title" }, t("DSH {version}", { version: dsh.verified })),
- (0, import_react18.createElement)("div", { className: "bt-update-text" }, dshText),
- dshMessage ? (0, import_react18.createElement)("div", { className: "bt-update-error", role: "alert" }, t("The update did not finish: {reason}", { reason: dshMessage })) : null,
- (0, import_react18.createElement)(
+ (0, import_react19.createElement)("div", { className: "bt-update-title" }, t("DSH {version}", { version: dsh.verified })),
+ (0, import_react19.createElement)("div", { className: "bt-update-text" }, dshText),
+ dshMessage ? (0, import_react19.createElement)("div", { className: "bt-update-error", role: "alert" }, t("The update did not finish: {reason}", { reason: dshMessage })) : null,
+ (0, import_react19.createElement)(
"div",
{ className: "bt-update-actions" },
- dsh.kind === "app" ? dsh.available ? (0, import_react18.createElement)("button", { type: "button", className: "bt-update-go", onClick: () => void actions.openAppUpdates(dsh.verified).catch(() => {
- }) }, t("Open updates")) : null : !dsh.available && dshPhase === "idle" ? null : dshPhase === "installed" ? null : (0, import_react18.createElement)("button", {
+ dsh.kind === "app" ? dsh.available ? (0, import_react19.createElement)("button", { type: "button", className: "bt-update-go", onClick: () => void actions.openAppUpdates(dsh.verified).catch(() => {
+ }) }, t("Open updates")) : null : !dsh.available && dshPhase === "idle" ? null : dshPhase === "installed" ? null : (0, import_react19.createElement)("button", {
type: "button",
className: "bt-update-go",
disabled: dshPhase === "installing",
@@ -9843,11 +9860,11 @@ function UpdateButton({ useUpdate, actions }) {
);
}
function YouAvatar() {
- return (0, import_react18.createElement)(
+ return (0, import_react19.createElement)(
"span",
{ className: "bt-you-wrap" },
- (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"))
+ (0, import_react19.createElement)("span", { className: "bt-you", "aria-hidden": true }, (0, import_react19.createElement)(BotMark, { look: MAIN_LOOK, size: 24 })),
+ (0, import_react19.createElement)("span", { style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clip: "rect(0 0 0 0)" } }, t("Settings"))
);
}
var openShellSettings = null;
@@ -9914,32 +9931,32 @@ var NO_SUBSCRIBE = () => () => {
};
var NO_SNAPSHOT = () => null;
function AccountLauncher({ seat = true, settingsOpen, openSettings, openOnboarding, actions }) {
- const [open, setOpen] = (0, import_react18.useState)(false);
- (0, import_react18.useLayoutEffect)(() => {
+ const [open, setOpen] = (0, import_react19.useState)(false);
+ (0, import_react19.useLayoutEffect)(() => {
if (!seat) return void 0;
actions.seatAccount(true);
return () => actions.seatAccount(false);
}, [seat]);
- const [box, setBox] = (0, import_react18.useState)(null);
- const button = (0, import_react18.useRef)(null);
- (0, import_react18.useEffect)(() => {
+ const [box, setBox] = (0, import_react19.useState)(null);
+ const button = (0, import_react19.useRef)(null);
+ (0, import_react19.useEffect)(() => {
if (settingsOpen) setOpen(false);
}, [settingsOpen]);
- (0, import_react18.useEffect)(() => {
+ (0, import_react19.useEffect)(() => {
if (!openSettings) return void 0;
openShellSettings = openSettings;
return () => {
if (openShellSettings === openSettings) openShellSettings = null;
};
}, [openSettings]);
- (0, import_react18.useEffect)(() => {
+ (0, import_react19.useEffect)(() => {
if (!openOnboarding) return void 0;
openShellOnboarding = openOnboarding;
return () => {
if (openShellOnboarding === openOnboarding) openShellOnboarding = null;
};
}, [openOnboarding]);
- (0, import_react18.useEffect)(() => {
+ (0, import_react19.useEffect)(() => {
if (!open) return void 0;
const onDown = (event) => {
if (event.target instanceof Element && (event.target.closest(".bt-account-menu") || button.current?.contains(event.target))) return;
@@ -9960,14 +9977,14 @@ function AccountLauncher({ seat = true, settingsOpen, openSettings, openOnboardi
};
}, [open]);
const signIn = actions.signInEntry?.() ?? null;
- const ops = (0, import_react18.useMemo)(() => signIn?.inject?.() ?? {}, [signIn]);
+ const ops = (0, import_react19.useMemo)(() => signIn?.inject?.() ?? {}, [signIn]);
const accountSource = ops.hooks?.account;
- const account = (0, import_react18.useSyncExternalStore)(accountSource?.subscribe ?? NO_SUBSCRIBE, accountSource ? () => accountSource.getSnapshot() : NO_SNAPSHOT);
+ const account = (0, import_react19.useSyncExternalStore)(accountSource?.subscribe ?? NO_SUBSCRIBE, accountSource ? () => accountSource.getSnapshot() : NO_SNAPSHOT);
const signedIn = signIn !== null && typeof ops.signOut === "function" && account?.view?.status === "credential-stored";
const accountT = actions.accountT?.() ?? ((key) => key);
- const [confirm, setConfirm] = (0, import_react18.useState)(null);
- const [busy, setBusy] = (0, import_react18.useState)(false);
- const [signOutError, setSignOutError] = (0, import_react18.useState)("");
+ const [confirm, setConfirm] = (0, import_react19.useState)(null);
+ const [busy, setBusy] = (0, import_react19.useState)(false);
+ const [signOutError, setSignOutError] = (0, import_react19.useState)("");
const askSignOut = async () => {
setSignOutError("");
let state = "none";
@@ -10000,14 +10017,14 @@ function AccountLauncher({ seat = true, settingsOpen, openSettings, openOnboardi
const rect = button.current?.getBoundingClientRect();
if (rect) setBox({ left: rect.left, bottom: viewBottom() - rect.top + 5 });
};
- (0, import_react18.useLayoutEffect)(() => {
+ (0, import_react19.useLayoutEffect)(() => {
if (open) anchor();
}, [open, tick]);
const toggle = () => {
if (!open) anchor();
setOpen((value) => !value);
};
- (0, import_react18.useEffect)(() => {
+ (0, import_react19.useEffect)(() => {
if (open) return;
setConfirm(null);
setSignOutError("");
@@ -10025,35 +10042,35 @@ function AccountLauncher({ seat = true, settingsOpen, openSettings, openOnboardi
]
];
if (signedIn) groups.push([[accountT("signOut"), SignOutIcon, askSignOut, void 0, true]]);
- return (0, import_react18.createElement)(
- import_react18.Fragment,
+ return (0, import_react19.createElement)(
+ import_react19.Fragment,
null,
- (0, import_react18.createElement)(
+ (0, import_react19.createElement)(
"button",
{ ref: button, type: "button", className: "bt-account", "aria-label": t("Account"), "aria-haspopup": "menu", "aria-expanded": open, onClick: toggle },
- (0, import_react18.createElement)("span", { className: "bt-you", "aria-hidden": true }, (0, import_react18.createElement)(BotMark, { look: MAIN_LOOK, size: 24 }))
+ (0, import_react19.createElement)("span", { className: "bt-you", "aria-hidden": true }, (0, import_react19.createElement)(BotMark, { look: MAIN_LOOK, size: 24 }))
),
- open && box ? (0, import_react_dom3.createPortal)((0, import_react18.createElement)(
+ open && box ? (0, import_react_dom3.createPortal)((0, import_react19.createElement)(
"div",
{ className: "bt-menu bt-menu-up bt-account-menu", role: "menu", "aria-label": t("Account"), style: box },
- confirm !== null ? (0, import_react18.createElement)(
+ confirm !== null ? (0, import_react19.createElement)(
"div",
{ className: "bt-confirm", role: "alertdialog", "aria-label": accountT("signOut") },
- (0, import_react18.createElement)("p", { className: "bt-confirm-text" }, accountT(confirm === "running" ? "signOutRunningDescription" : confirm === "unknown" ? "signOutUnknownDescription" : "signOutDescription")),
- signOutError !== "" ? (0, import_react18.createElement)("p", { className: "bt-confirm-error", role: "alert" }, signOutError) : null,
- (0, import_react18.createElement)(
+ (0, import_react19.createElement)("p", { className: "bt-confirm-text" }, accountT(confirm === "running" ? "signOutRunningDescription" : confirm === "unknown" ? "signOutUnknownDescription" : "signOutDescription")),
+ signOutError !== "" ? (0, import_react19.createElement)("p", { className: "bt-confirm-error", role: "alert" }, signOutError) : null,
+ (0, import_react19.createElement)(
"div",
{ className: "bt-confirm-row" },
- (0, import_react18.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: cancelSignOut }, t("Cancel")),
- (0, import_react18.createElement)("button", { type: "button", className: "bt-confirm-go", disabled: busy, onClick: () => {
+ (0, import_react19.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: cancelSignOut }, t("Cancel")),
+ (0, import_react19.createElement)("button", { type: "button", className: "bt-confirm-go", disabled: busy, onClick: () => {
void runSignOut();
} }, accountT("signOut"))
)
- ) : groups.map((group, index) => (0, import_react18.createElement)(
- import_react18.Fragment,
+ ) : groups.map((group, index) => (0, import_react19.createElement)(
+ import_react19.Fragment,
{ key: index },
- index > 0 ? (0, import_react18.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,
- group.map(([label, Icon, run2, hint, stay]) => (0, import_react18.createElement)("button", {
+ index > 0 ? (0, import_react19.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,
+ group.map(([label, Icon, run2, hint, stay]) => (0, import_react19.createElement)("button", {
key: label,
type: "button",
role: "menuitem",
@@ -10061,7 +10078,7 @@ function AccountLauncher({ seat = true, settingsOpen, openSettings, openOnboardi
if (stay !== true) setOpen(false);
void Promise.resolve(run2()).catch((error) => actions.reportError(error, "menu"));
}
- }, (0, import_react18.createElement)(Icon), (0, import_react18.createElement)("span", { className: "bt-menu-label" }, label), hint ? (0, import_react18.createElement)("span", { className: "bt-menu-hint" }, hint) : null))
+ }, (0, import_react19.createElement)(Icon), (0, import_react19.createElement)("span", { className: "bt-menu-label" }, label), hint ? (0, import_react19.createElement)("span", { className: "bt-menu-hint" }, hint) : null))
))
), document.body) : null
);
@@ -10071,8 +10088,8 @@ function useLandOnMainBot(roster, useSessions, actions) {
const row = Object.values(list.byId).find((session) => (session?.retainedBy?.mainView ?? 0) > 0);
return row ? `${row.id}|${row.blank ? 1 : 0}` : "";
});
- const lastBot = (0, import_react18.useRef)(null);
- (0, import_react18.useEffect)(() => {
+ const lastBot = (0, import_react19.useRef)(null);
+ (0, import_react19.useEffect)(() => {
if (!roster.ready || !roster.mainBotId) return void 0;
const [id, blank3] = mainView.split("|");
const bot = id === "" ? void 0 : roster.byId[id];
@@ -10093,16 +10110,16 @@ function useLandOnMainBot(roster, useSessions, actions) {
function FooterAccount(props) {
const seated = props.useUi((value) => value.accountSeated === true);
if (seated) return null;
- return (0, import_react18.createElement)("span", { className: "bt-foot-account" }, (0, import_react18.createElement)(AccountLauncher, { ...props, seat: false }));
+ return (0, import_react19.createElement)("span", { className: "bt-foot-account" }, (0, import_react19.createElement)(AccountLauncher, { ...props, seat: false }));
}
function BotReturn({ wide, useSurface, actions }) {
const mode = useSurface((value) => value.mode);
if (mode !== "agent") return null;
- return (0, import_react18.createElement)(
+ return (0, import_react19.createElement)(
"button",
{ type: "button", className: "bt-return", "aria-label": t("DS Bot"), title: t("DS Bot"), onClick: () => actions.setSurface("bot") },
- (0, import_react18.createElement)(BotMark, { look: MAIN_LOOK, size: 20 }),
- wide ? (0, import_react18.createElement)("span", { className: "bt-return-name" }, t("DS Bot")) : null
+ (0, import_react19.createElement)(BotMark, { look: MAIN_LOOK, size: 20 }),
+ wide ? (0, import_react19.createElement)("span", { className: "bt-return-name" }, t("DS Bot")) : null
);
}
var RETURN_CSS = `
@@ -10116,10 +10133,10 @@ var RETURN_CSS = `
.bt-return-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
`;
function BrandMark({ size = 24 }) {
- return (0, import_react18.createElement)("span", { className: "bt-brand-whale" }, (0, import_react18.createElement)(BotMark, { look: MAIN_LOOK, size }));
+ return (0, import_react19.createElement)("span", { className: "bt-brand-whale" }, (0, import_react19.createElement)(BotMark, { look: MAIN_LOOK, size }));
}
function BrandName() {
- return (0, import_react18.createElement)("span", { style: { fontWeight: 600, fontSize: 14 } }, "DS Bot");
+ return (0, import_react19.createElement)("span", { style: { fontWeight: 600, fontSize: 14 } }, "DS Bot");
}
var SIDEBAR_CSS = `
.bt-confirm{width:260px;max-width:72vw;padding:10px 12px 12px;display:flex;flex-direction:column;gap:10px}
@@ -10189,15 +10206,15 @@ var SIDEBAR_CSS = `
`;
// src/client/header.js
-var import_react19 = require("react");
+var import_react20 = require("react");
var import_react_dom4 = require("react-dom");
-var GoArrow = () => (0, import_react19.createElement)("svg", { width: 14, height: 14, viewBox: "-12 -12 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true }, (0, import_react19.createElement)("path", { d: "M-7 0H7M2 -5L7 0L2 5" }));
+var GoArrow = () => (0, import_react20.createElement)("svg", { width: 14, height: 14, viewBox: "-12 -12 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true }, (0, import_react20.createElement)("path", { d: "M-7 0H7M2 -5L7 0L2 5" }));
var MEMORY_NOTICE_MS = 3200;
var noNews = (select) => select({});
function useMemoryNotice(ids, useMemoryNews) {
const seen = useMemoryNews((map) => Math.max(0, ...ids.map((id) => map?.[id]?.seen ?? 0)));
- const [shown, setShown] = (0, import_react19.useState)(false);
- (0, import_react19.useEffect)(() => {
+ const [shown, setShown] = (0, import_react20.useState)(false);
+ (0, import_react20.useEffect)(() => {
const left = seen + MEMORY_NOTICE_MS - Date.now();
setShown(seen > 0 && left > 0);
if (seen === 0 || left <= 0) return void 0;
@@ -10207,16 +10224,16 @@ function useMemoryNotice(ids, useMemoryNews) {
return shown;
}
function MemoryNotice({ shown }) {
- const inner = (0, import_react19.useRef)(null);
- const [width, setWidth] = (0, import_react19.useState)(0);
+ const inner = (0, import_react20.useRef)(null);
+ const [width, setWidth] = (0, import_react20.useState)(0);
const label = t("Memory updated");
- (0, import_react19.useLayoutEffect)(() => {
+ (0, import_react20.useLayoutEffect)(() => {
if (shown) setWidth(inner.current?.scrollWidth ?? 0);
}, [label, shown]);
- return (0, import_react19.createElement)(
+ return (0, import_react20.createElement)(
"span",
{ className: "bt-pill-mem", "aria-hidden": true, style: { "--bt-mem-w": `${width}px` } },
- (0, import_react19.createElement)("span", { className: "bt-pill-mem-in", ref: inner }, (0, import_react19.createElement)("span", { className: "bt-pill-mem-ico" }, (0, import_react19.createElement)(MemoryIcon)), label)
+ (0, import_react20.createElement)("span", { className: "bt-pill-mem-in", ref: inner }, (0, import_react20.createElement)("span", { className: "bt-pill-mem-ico" }, (0, import_react20.createElement)(MemoryIcon)), label)
);
}
function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatus, useSession, useActivity, useMemoryNews, useTurnClock, useUi, useLive, useWork, useStore, useConversationViews, selectView, actions }) {
@@ -10234,7 +10251,7 @@ function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatus, useSe
const first = openingTurn(state[sessionId], firstTurns, hiddenTurns);
return first && !unseenSince(visit, first.start) ? clockLabel(first.start) : "";
});
- (0, import_react19.useEffect)(() => {
+ (0, import_react20.useEffect)(() => {
if (opening) document.body.style.setProperty("--bt-first-sep", JSON.stringify(opening));
else document.body.style.removeProperty("--bt-first-sep");
return () => document.body.style.removeProperty("--bt-first-sep");
@@ -10250,17 +10267,17 @@ function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatus, useSe
const memoryIds = bot ? [bot.id] : room2 ? [room2.id, ...room2.members] : [];
const notice = useMemoryNotice(memoryIds, useNews);
const changed = useNews((map) => latestMemoryChange(map, memoryIds));
- (0, import_react19.useEffect)(() => {
+ (0, import_react20.useEffect)(() => {
document.body.style.setProperty("--bt-placeholder", JSON.stringify(name ? t("Message {name}", { name }) : t("Message")));
}, [name, t("Message")]);
- (0, import_react19.useEffect)(() => {
+ (0, import_react20.useEffect)(() => {
document.body.style.setProperty("--bt-steer-unread", JSON.stringify(t("Not read yet")));
}, [t("Not read yet")]);
- (0, import_react19.useEffect)(() => {
+ (0, import_react20.useEffect)(() => {
actions.beginVisit(sessionId);
return () => actions.endVisit(sessionId);
}, [sessionId]);
- (0, import_react19.useEffect)(() => {
+ (0, import_react20.useEffect)(() => {
if (room2) document.body.dataset.btRoom = "";
else delete document.body.dataset.btRoom;
return () => {
@@ -10268,10 +10285,10 @@ function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatus, useSe
};
}, [Boolean(room2)]);
const memoryNotice = !away && notice && changed !== null && roster.memory !== false;
- return (0, import_react19.createElement)(
+ return (0, import_react20.createElement)(
"div",
{ className: "bt-head" },
- (0, import_react19.createElement)(
+ (0, import_react20.createElement)(
"button",
{
type: "button",
@@ -10282,19 +10299,19 @@ function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatus, useSe
title: away ? name : void 0,
onClick: () => away ? selectView("chat") : memoryNotice ? actions.openMemory(changed) : actions.toggleDetails(sessionId)
},
- bot ? (0, import_react19.createElement)(BotAvatar, { bot, size: 24, state: botState(running, doing, roster.questions?.[currentPart(bot)] !== void 0), badge: false }) : room2 ? (0, import_react19.createElement)(RoomAvatar, { room: room2, roster, size: 24 }) : null,
- (0, import_react19.createElement)("span", { className: "bt-pill-name" }, away ? t("Back to chat") : bot?.name ?? room2?.name ?? (title || t("New chat"))),
- (0, import_react19.createElement)(MemoryNotice, { shown: memoryNotice }),
- (0, import_react19.createElement)("span", { className: "bt-pill-go", "aria-hidden": true }, (0, import_react19.createElement)(GoArrow))
+ bot ? (0, import_react20.createElement)(BotAvatar, { bot, size: 24, state: botState(running, doing, roster.questions?.[currentPart(bot)] !== void 0), badge: false }) : room2 ? (0, import_react20.createElement)(RoomAvatar, { room: room2, roster, size: 24 }) : null,
+ (0, import_react20.createElement)("span", { className: "bt-pill-name" }, away ? t("Back to chat") : bot?.name ?? room2?.name ?? (title || t("New chat"))),
+ (0, import_react20.createElement)(MemoryNotice, { shown: memoryNotice }),
+ (0, import_react20.createElement)("span", { className: "bt-pill-go", "aria-hidden": true }, (0, import_react20.createElement)(GoArrow))
),
- (0, import_react19.createElement)("span", { className: "bt-sr", role: "status" }, memoryNotice ? t("Memory updated") : ""),
- (0, import_react19.createElement)(NewMessagePills, { key: sessionId, sessionId, useSessions, useUi, useTurnClock }),
- (0, import_react19.createElement)(ActivityIndicator, { key: `activity:${sessionId}`, sessionId, useRoster, useSessionStatus, useSession, useLive, useWork, actions })
+ (0, import_react20.createElement)("span", { className: "bt-sr", role: "status" }, memoryNotice ? t("Memory updated") : ""),
+ (0, import_react20.createElement)(NewMessagePills, { key: sessionId, sessionId, useSessions, useUi, useTurnClock }),
+ (0, import_react20.createElement)(ActivityIndicator, { key: `activity:${sessionId}`, sessionId, useRoster, useSessionStatus, useSession, useLive, useWork, actions })
);
}
function useTranscriptView() {
- const [view, setView] = (0, import_react19.useState)(null);
- (0, import_react19.useEffect)(() => {
+ const [view, setView] = (0, import_react20.useState)(null);
+ (0, import_react20.useEffect)(() => {
let frame = 0;
let watched = null;
const observer = new MutationObserver(() => schedule());
@@ -10363,18 +10380,18 @@ function NewMessagePills({ sessionId, useSessions, useUi, useTurnClock }) {
});
const view = useTranscriptView();
const unpinned = view?.unpinned === true;
- const [release, setRelease] = (0, import_react19.useState)({ base: null, dismissed: false });
- const [above, setAbove] = (0, import_react19.useState)({ seen: false, dismissed: false });
- (0, import_react19.useEffect)(() => {
+ const [release, setRelease] = (0, import_react20.useState)({ base: null, dismissed: false });
+ const [above, setAbove] = (0, import_react20.useState)({ seen: false, dismissed: false });
+ (0, import_react20.useEffect)(() => {
setRelease({ base: unpinned ? replies : null, dismissed: false });
}, [unpinned]);
- (0, import_react19.useEffect)(() => {
+ (0, import_react20.useEffect)(() => {
if (view?.divider === "in-view") setAbove((state) => state.seen ? state : { ...state, seen: true });
}, [view?.divider]);
const fresh = release.base === null ? 0 : replies - release.base;
const showDown = unpinned && fresh > 0 && !release.dismissed;
const showUp = view?.divider === "above" && !above.seen && !above.dismissed;
- (0, import_react19.useEffect)(() => {
+ (0, import_react20.useEffect)(() => {
const scroller = document.querySelector("[data-conversation-scroll]");
if (!scroller) return void 0;
scroller.toggleAttribute("data-bt-news", showDown);
@@ -10382,16 +10399,16 @@ function NewMessagePills({ sessionId, useSessions, useUi, useTurnClock }) {
}, [showDown]);
if (!view || !showDown && !showUp) return null;
const label = (count) => count === 1 ? t("1 new message") : count > 0 ? t("{count} new messages", { count }) : t("New messages");
- const pill = (direction, count, style, onJump, onDismiss) => (0, import_react19.createElement)(
+ const pill = (direction, count, style, onJump, onDismiss) => (0, import_react20.createElement)(
"div",
{ className: "bt-news", "data-direction": direction, style },
- (0, import_react19.createElement)(
+ (0, import_react20.createElement)(
"button",
{ type: "button", className: "bt-news-jump", onClick: onJump },
- (0, import_react19.createElement)("span", { className: "bt-news-ico" }, (0, import_react19.createElement)(direction === "up" ? ArrowUpIcon : ArrowDownIcon)),
+ (0, import_react20.createElement)("span", { className: "bt-news-ico" }, (0, import_react20.createElement)(direction === "up" ? ArrowUpIcon : ArrowDownIcon)),
label(count)
),
- (0, import_react19.createElement)("button", {
+ (0, import_react20.createElement)("button", {
type: "button",
className: "bt-news-x",
"aria-label": t("Dismiss new messages"),
@@ -10399,7 +10416,7 @@ function NewMessagePills({ sessionId, useSessions, useUi, useTurnClock }) {
event.stopPropagation();
onDismiss();
}
- }, (0, import_react19.createElement)(CloseIcon))
+ }, (0, import_react20.createElement)(CloseIcon))
);
const toLatest = () => {
const scroller = document.querySelector("[data-conversation-scroll]");
@@ -10409,8 +10426,8 @@ function NewMessagePills({ sessionId, useSessions, useUi, useTurnClock }) {
};
const toDivider = () => document.querySelector("[data-conversation-scroll] .bt-new-sep")?.scrollIntoView({ block: "center", behavior: "smooth" });
return (0, import_react_dom4.createPortal)(
- (0, import_react19.createElement)(
- import_react19.Fragment,
+ (0, import_react20.createElement)(
+ import_react20.Fragment,
null,
showUp ? pill("up", unread, { left: view.center, top: view.top }, toDivider, () => setAbove((state) => ({ ...state, dismissed: true }))) : null,
showDown ? pill("down", fresh, { left: view.center, bottom: view.bottom }, toLatest, () => setRelease((state) => ({ ...state, dismissed: true }))) : null
@@ -10420,18 +10437,18 @@ function NewMessagePills({ sessionId, useSessions, useUi, useTurnClock }) {
}
// src/client/composer.js
-var import_react20 = require("react");
+var import_react21 = require("react");
var import_react_dom5 = require("react-dom");
var speechApi = () => window.SpeechRecognition ?? window.webkitSpeechRecognition;
var keepComposerFocus = (event) => event.preventDefault();
function useDictation(onText) {
- const [listening, setListening] = (0, import_react20.useState)(false);
- const [note, setNote] = (0, import_react20.useState)("");
- const recognition = (0, import_react20.useRef)(null);
- const latest = (0, import_react20.useRef)(onText);
+ const [listening, setListening] = (0, import_react21.useState)(false);
+ const [note, setNote] = (0, import_react21.useState)("");
+ const recognition = (0, import_react21.useRef)(null);
+ const latest = (0, import_react21.useRef)(onText);
latest.current = onText;
- (0, import_react20.useEffect)(() => () => recognition.current?.abort(), []);
- (0, import_react20.useEffect)(() => {
+ (0, import_react21.useEffect)(() => () => recognition.current?.abort(), []);
+ (0, import_react21.useEffect)(() => {
if (!note) return void 0;
const timer = setTimeout(() => setNote(""), 2600);
return () => clearTimeout(timer);
@@ -10484,7 +10501,7 @@ function ComposerVoice({ sessionId, inputActions, actions, useUi }) {
if (final && inputActions) inputActions.insertText(text, inputActions.captureInsertion());
});
const quote = useUi((state) => state.quote?.sessionId === sessionId ? state.quote : null);
- (0, import_react20.useEffect)(() => {
+ (0, import_react21.useEffect)(() => {
if (!quote || !inputActions) return;
actions.clearQuote(quote.token);
const excerpt = quote.text.replace(/\s+/g, " ").trim();
@@ -10502,10 +10519,10 @@ function ComposerVoice({ sessionId, inputActions, actions, useUi }) {
}, [quote?.token]);
if (sessionId === void 0) return null;
const pluginMic = actions.speech() !== void 0;
- return (0, import_react20.createElement)(
- import_react20.Fragment,
+ return (0, import_react21.createElement)(
+ import_react21.Fragment,
null,
- pluginMic ? null : (0, import_react20.createElement)("button", {
+ pluginMic ? null : (0, import_react21.createElement)("button", {
type: "button",
className: "bt-mic",
"aria-label": dictation.listening ? t("Stop dictation") : t("Dictate"),
@@ -10513,16 +10530,16 @@ function ComposerVoice({ sessionId, inputActions, actions, useUi }) {
title: dictation.listening ? t("Stop dictation") : t("Dictate"),
onMouseDown: keepComposerFocus,
onClick: () => dictation.listening ? dictation.stop() : dictation.start()
- }, (0, import_react20.createElement)(MicIcon)),
- (0, import_react20.createElement)("button", {
+ }, (0, import_react21.createElement)(MicIcon)),
+ (0, import_react21.createElement)("button", {
type: "button",
className: "bt-voice",
"aria-label": t("Start voice chat"),
title: t("Voice chat"),
onMouseDown: keepComposerFocus,
onClick: () => actions.openVoice(sessionId)
- }, (0, import_react20.createElement)(WaveIcon, { size: 18 })),
- dictation.note ? (0, import_react20.createElement)("span", { className: "bt-mic-note", role: "status" }, dictation.note) : null
+ }, (0, import_react21.createElement)(WaveIcon, { size: 18 })),
+ dictation.note ? (0, import_react21.createElement)("span", { className: "bt-mic-note", role: "status" }, dictation.note) : null
);
}
function menuIcons(roster) {
@@ -10530,18 +10547,18 @@ function menuIcons(roster) {
return (row) => {
if (!row.bot) return PeopleIcon;
const id = row.bot.id;
- if (!marks.has(id)) marks.set(id, ({ size = 14 }) => (0, import_react20.createElement)(BotMark, { bot: roster.getSnapshot().byId[id] ?? row.bot, size }));
+ if (!marks.has(id)) marks.set(id, ({ size = 14 }) => (0, import_react21.createElement)(BotMark, { bot: roster.getSnapshot().byId[id] ?? row.bot, size }));
return marks.get(id);
};
}
function ComposerPlus({ sessionId, inputActions, useRoster, actions }) {
const roster = useRoster((value) => value);
- const [open, setOpen] = (0, import_react20.useState)(null);
+ const [open, setOpen] = (0, import_react21.useState)(null);
const [shown, leaving] = useLinger(open, 120);
- const button = (0, import_react20.useRef)(null);
- const menu = (0, import_react20.useRef)(null);
+ const button = (0, import_react21.useRef)(null);
+ const menu = (0, import_react21.useRef)(null);
const tick = useViewport();
- (0, import_react20.useEffect)(() => {
+ (0, import_react21.useEffect)(() => {
if (!open) return void 0;
const onDown = (event) => {
if (![button.current, menu.current].some((node) => node?.contains(event.target))) setOpen(null);
@@ -10582,15 +10599,15 @@ function ComposerPlus({ sessionId, inputActions, useRoster, actions }) {
actions.referenceChat(sessionId, inputActions?.captureInsertion?.());
};
const canReference = typeof inputActions?.captureInsertion === "function" && actions.canReferenceChat();
- const place = (0, import_react20.useMemo)(() => {
+ const place = (0, import_react21.useMemo)(() => {
if (!shown || !button.current) return null;
const rect = button.current.getBoundingClientRect();
return { left: rect.left, bottom: viewBottom() - rect.top + 8 };
}, [shown, open, tick]);
- return (0, import_react20.createElement)(
- import_react20.Fragment,
+ return (0, import_react21.createElement)(
+ import_react21.Fragment,
null,
- (0, import_react20.createElement)("button", {
+ (0, import_react21.createElement)("button", {
ref: button,
type: "button",
className: "bt-plus",
@@ -10600,8 +10617,8 @@ function ComposerPlus({ sessionId, inputActions, useRoster, actions }) {
"aria-expanded": Boolean(open),
onMouseDown: keepComposerFocus,
onClick: toggle
- }, (0, import_react20.createElement)(PlusIcon)),
- shown ? (0, import_react_dom5.createPortal)((0, import_react20.createElement)(
+ }, (0, import_react21.createElement)(PlusIcon)),
+ shown ? (0, import_react_dom5.createPortal)((0, import_react21.createElement)(
"div",
{
ref: menu,
@@ -10611,9 +10628,9 @@ function ComposerPlus({ sessionId, inputActions, useRoster, actions }) {
style: place ?? {},
"data-leaving": leaving || void 0
},
- shown.files ? (0, import_react20.createElement)("button", { type: "button", role: "menuitem", onClick: attach }, (0, import_react20.createElement)(PaperclipIcon), (0, import_react20.createElement)("span", { className: "bt-menu-label" }, t("Add files"))) : null,
- canReference ? (0, import_react20.createElement)("button", { type: "button", role: "menuitem", onMouseDown: keepComposerFocus, onClick: reference }, (0, import_react20.createElement)(ChatsIcon), (0, import_react20.createElement)("span", { className: "bt-menu-label" }, t("Reference a chat"))) : null,
- (0, import_react20.createElement)("button", { type: "button", role: "menuitem", onClick: schedule }, (0, import_react20.createElement)(ClockIcon), (0, import_react20.createElement)("span", { className: "bt-menu-label" }, t("Scheduled task")))
+ shown.files ? (0, import_react21.createElement)("button", { type: "button", role: "menuitem", onClick: attach }, (0, import_react21.createElement)(PaperclipIcon), (0, import_react21.createElement)("span", { className: "bt-menu-label" }, t("Add files"))) : null,
+ canReference ? (0, import_react21.createElement)("button", { type: "button", role: "menuitem", onMouseDown: keepComposerFocus, onClick: reference }, (0, import_react21.createElement)(ChatsIcon), (0, import_react21.createElement)("span", { className: "bt-menu-label" }, t("Reference a chat"))) : null,
+ (0, import_react21.createElement)("button", { type: "button", role: "menuitem", onClick: schedule }, (0, import_react21.createElement)(ClockIcon), (0, import_react21.createElement)("span", { className: "bt-menu-label" }, t("Scheduled task")))
), document.body) : null
);
}
@@ -10839,9 +10856,9 @@ function drawerMenuKeys({ bot, room: room2, canBrowse, canTerminal, canFiles })
}
// src/client/side-chat.js
-var import_react21 = require("react");
+var import_react22 = require("react");
function SideEntry({ chatId, entry, actions }) {
- const [cancelling, setCancelling] = (0, import_react21.useState)(false);
+ const [cancelling, setCancelling] = (0, import_react22.useState)(false);
const question = typeof entry.question === "string" ? entry.question : "";
const answer = typeof entry.answer === "string" ? entry.answer : "";
const cancel = () => {
@@ -10850,15 +10867,15 @@ function SideEntry({ chatId, entry, actions }) {
Promise.resolve(actions.cancelSide(chatId, entry.id)).catch(() => {
}).finally(() => setCancelling(false));
};
- return (0, import_react21.createElement)(
+ return (0, import_react22.createElement)(
"div",
{ className: "bt-side-pair", "data-status": entry.status },
- (0, import_react21.createElement)("div", { className: "bt-side-qrow" }, (0, import_react21.createElement)("div", { className: "bt-side-q" }, question)),
- entry.status === "answering" ? (0, import_react21.createElement)(
+ (0, import_react22.createElement)("div", { className: "bt-side-qrow" }, (0, import_react22.createElement)("div", { className: "bt-side-q" }, question)),
+ entry.status === "answering" ? (0, import_react22.createElement)(
"div",
{ className: "bt-side-a" },
- (0, import_react21.createElement)("span", { className: "bt-shimmer" }, t("Answering…")),
- (0, import_react21.createElement)("button", {
+ (0, import_react22.createElement)("span", { className: "bt-shimmer" }, t("Answering…")),
+ (0, import_react22.createElement)("button", {
type: "button",
className: "bt-soft bt-soft-sm",
disabled: cancelling,
@@ -10866,23 +10883,23 @@ function SideEntry({ chatId, entry, actions }) {
"aria-label": t("Cancel this side question"),
onClick: cancel
}, t("Cancel"))
- ) : (0, import_react21.createElement)(
+ ) : (0, import_react22.createElement)(
"div",
{ className: "bt-side-a" },
- entry.status === "cancelled" ? (0, import_react21.createElement)("p", { className: "bt-side-status" }, t("Cancelled")) : null,
- entry.status === "failed" ? (0, import_react21.createElement)("p", { className: "bt-side-fail" }, failureText(entry)) : null,
- answer !== "" ? (0, import_react21.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: answer, labels: mdLabels2(), variant: "compact" }) : null
+ entry.status === "cancelled" ? (0, import_react22.createElement)("p", { className: "bt-side-status" }, t("Cancelled")) : null,
+ entry.status === "failed" ? (0, import_react22.createElement)("p", { className: "bt-side-fail" }, failureText(entry)) : null,
+ answer !== "" ? (0, import_react22.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: answer, labels: mdLabels2(), variant: "compact" }) : null
)
);
}
function SideChatView({ subject, chat, actions }) {
- const scroll = (0, import_react21.useRef)(null);
- const [draft, setDraft] = (0, import_react21.useState)("");
- const [fail2, setFail] = (0, import_react21.useState)(null);
+ const scroll = (0, import_react22.useRef)(null);
+ const [draft, setDraft] = (0, import_react22.useState)("");
+ const [fail2, setFail] = (0, import_react22.useState)(null);
const entries2 = Array.isArray(chat?.entries) ? chat.entries : [];
const busy = entries2.some((entry) => entry?.status === "answering");
const last = entries2.at(-1);
- (0, import_react21.useEffect)(() => {
+ (0, import_react22.useEffect)(() => {
const node = scroll.current;
if (node) node.scrollTop = node.scrollHeight;
}, [chat?.id, entries2.length, last?.status]);
@@ -10897,19 +10914,19 @@ function SideChatView({ subject, chat, actions }) {
setFail(hostText(error?.message ?? ""));
});
};
- return (0, import_react21.createElement)(
+ return (0, import_react22.createElement)(
"div",
{ className: "bt-side" },
- (0, import_react21.createElement)("p", { className: "bt-side-note" }, t("Answered from progress so far; nothing was run")),
- (0, import_react21.createElement)(
+ (0, import_react22.createElement)("p", { className: "bt-side-note" }, t("Answered from progress so far; nothing was run")),
+ (0, import_react22.createElement)(
"div",
{ className: "bt-side-scroll", ref: scroll },
- entries2.map((entry) => (0, import_react21.createElement)(SideEntry, { key: entry.id, chatId: chat.id, entry, actions }))
+ entries2.map((entry) => (0, import_react22.createElement)(SideEntry, { key: entry.id, chatId: chat.id, entry, actions }))
),
- (0, import_react21.createElement)(
+ (0, import_react22.createElement)(
"div",
{ className: "bt-side-form" },
- (0, import_react21.createElement)("textarea", {
+ (0, import_react22.createElement)("textarea", {
className: "bt-side-input",
rows: 1,
value: draft,
@@ -10926,7 +10943,7 @@ function SideChatView({ subject, chat, actions }) {
ask();
}
}),
- fail2 !== null ? (0, import_react21.createElement)("p", { className: "bt-side-fail" }, fail2) : null
+ fail2 !== null ? (0, import_react22.createElement)("p", { className: "bt-side-fail" }, fail2) : null
)
);
}
@@ -11248,15 +11265,15 @@ function installHeaderNavigation(slots, face, component, priority) {
}
// src/client/overlay-hooks.js
-var import_react22 = require("react");
+var import_react23 = require("react");
var escapeLayers = [];
var onEscapeKey = (event) => {
if (event.key === "Escape") escapeLayers.at(-1)?.current();
};
function useEscape(onClose) {
- const ref = (0, import_react22.useRef)(onClose);
+ const ref = (0, import_react23.useRef)(onClose);
ref.current = onClose;
- (0, import_react22.useEffect)(() => {
+ (0, import_react23.useEffect)(() => {
if (escapeLayers.length === 0) window.addEventListener("keydown", onEscapeKey);
escapeLayers.push(ref);
return () => {
@@ -11266,8 +11283,8 @@ function useEscape(onClose) {
}, []);
}
function usePaneLeft() {
- const [paneLeft, setPaneLeft] = (0, import_react22.useState)(280);
- (0, import_react22.useLayoutEffect)(() => {
+ const [paneLeft, setPaneLeft] = (0, import_react23.useState)(280);
+ (0, import_react23.useLayoutEffect)(() => {
const column = document.querySelector('[class*="_footArea"]')?.parentElement;
if (column) setPaneLeft(Math.round(column.getBoundingClientRect().right));
}, []);
@@ -11275,12 +11292,12 @@ function usePaneLeft() {
}
// src/client/palette.js
-var import_react23 = require("react");
+var import_react24 = require("react");
var PALETTE_EXIT_MS = 160;
function CommandPalette({ start, token, roster, actions, useSessions }) {
- const [query, setQuery] = (0, import_react23.useState)(start ?? "");
- const [cursor, setCursor] = (0, import_react23.useState)(0);
- const [leaving, setLeaving] = (0, import_react23.useState)(false);
+ const [query, setQuery] = (0, import_react24.useState)(start ?? "");
+ const [cursor, setCursor] = (0, import_react24.useState)(0);
+ const [leaving, setLeaving] = (0, import_react24.useState)(false);
const wanted = query.trim().toLowerCase();
const close = () => {
if (leaving) return;
@@ -11316,7 +11333,7 @@ function CommandPalette({ start, token, roster, actions, useSessions }) {
const people = [
...roster.bots.filter((bot) => matchesName(bot.name, bot.role)).map((bot) => ({
key: bot.id,
- avatar: (0, import_react23.createElement)(BotAvatar, { bot, size: 24, badge: false, live: false }),
+ avatar: (0, import_react24.createElement)(BotAvatar, { bot, size: 24, badge: false, live: false }),
title: bot.name,
subtitle: [bot.role, isMainOf(roster, bot.id) ? t("Main Bot") : ""].filter(Boolean).join(" · "),
badge: bot.hidden ? t("Hidden") : void 0,
@@ -11327,7 +11344,7 @@ function CommandPalette({ start, token, roster, actions, useSessions }) {
})),
...roster.rooms.filter((room2) => matchesName(room2.name)).map((room2) => ({
key: room2.id,
- avatar: (0, import_react23.createElement)(RoomAvatar, { room: room2, roster, size: 24 }),
+ avatar: (0, import_react24.createElement)(RoomAvatar, { room: room2, roster, size: 24 }),
title: room2.name,
subtitle: t("{count} members", { count: room2.members.length }),
badge: room2.hidden ? t("Hidden") : void 0,
@@ -11340,7 +11357,7 @@ function CommandPalette({ start, token, roster, actions, useSessions }) {
if (people.length) sections.push([t("Bots"), people]);
const agents = (roster.agents ?? []).filter(() => matchesName("DSH Agent")).map((agent) => ({
key: agent.id,
- avatar: (0, import_react23.createElement)("span", { className: "bt-palette-agent" }, (0, import_react23.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: 18 })),
+ avatar: (0, import_react24.createElement)("span", { className: "bt-palette-agent" }, (0, import_react24.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: 18 })),
title: "DSH Agent",
subtitle: t("Plain dsh session"),
run: () => actions.openAgent(agent.id)
@@ -11353,16 +11370,16 @@ function CommandPalette({ start, token, roster, actions, useSessions }) {
key: `${id}:${turn}`,
title: bot?.name ?? room2?.name ?? t("Bot"),
subtitle: snippet,
- avatar: bot ? (0, import_react23.createElement)(BotAvatar, { bot, size: 24, badge: false, live: false }) : (0, import_react23.createElement)(RoomAvatar, { room: room2, roster, size: 24 }),
+ avatar: bot ? (0, import_react24.createElement)(BotAvatar, { bot, size: 24, badge: false, live: false }) : (0, import_react24.createElement)(RoomAvatar, { room: room2, roster, size: 24 }),
run: () => actions.openSession(id)
};
});
if (messages.length) sections.push([t("Messages"), messages]);
const commands = [
- { key: "cmd:new", icon: (0, import_react23.createElement)(PlusIcon), title: t("New chat"), run: () => actions.openNewChat("new") },
- { key: "cmd:bot", icon: (0, import_react23.createElement)(PlusIcon), title: t("Create Bot"), run: () => actions.openNewChat("create") },
- { key: "cmd:group", icon: (0, import_react23.createElement)(PeopleIcon), title: t("Create group chat"), run: () => actions.openNewChat("group") },
- { key: "cmd:settings", icon: (0, import_react23.createElement)(GearIcon), title: t("Bot settings"), run: () => actions.openSettings("general") }
+ { key: "cmd:new", icon: (0, import_react24.createElement)(PlusIcon), title: t("New chat"), run: () => actions.openNewChat("new") },
+ { key: "cmd:bot", icon: (0, import_react24.createElement)(PlusIcon), title: t("Create Bot"), run: () => actions.openNewChat("create") },
+ { key: "cmd:group", icon: (0, import_react24.createElement)(PeopleIcon), title: t("Create group chat"), run: () => actions.openNewChat("group") },
+ { key: "cmd:settings", icon: (0, import_react24.createElement)(GearIcon), title: t("Bot settings"), run: () => actions.openSettings("general") }
].filter((command) => matchesName(command.title));
if (commands.length) sections.push([t("Commands"), commands]);
const rows2 = sections.flatMap(([, items]) => items);
@@ -11372,7 +11389,7 @@ function CommandPalette({ start, token, roster, actions, useSessions }) {
${shown}`, { axis: "y", ...QUICK_EDGES });
const listRef = glide.box;
useFlip(listRef, shown, "[data-flip]");
- (0, import_react23.useEffect)(() => {
+ (0, import_react24.useEffect)(() => {
listRef.current?.querySelector("[aria-selected=true]")?.scrollIntoView({ block: "nearest" });
}, [active, query]);
const choose = (row) => {
@@ -11381,18 +11398,18 @@ ${shown}`, { axis: "y", ...QUICK_EDGES });
close();
};
let index = -1;
- return (0, import_react23.createElement)(
+ return (0, import_react24.createElement)(
"div",
{ className: "bt-palette-layer", "data-leaving": leaving || void 0 },
- (0, import_react23.createElement)("div", { className: "bt-backdrop", onMouseDown: close }),
- (0, import_react23.createElement)(
+ (0, import_react24.createElement)("div", { className: "bt-backdrop", onMouseDown: close }),
+ (0, import_react24.createElement)(
"div",
{ className: "bt-palette", role: "dialog", "aria-label": t("Search"), "aria-modal": true },
- (0, import_react23.createElement)(
+ (0, import_react24.createElement)(
"div",
{ className: "bt-palette-head" },
- (0, import_react23.createElement)("span", { className: "bt-palette-glyph", "aria-hidden": true }, (0, import_react23.createElement)(SearchIcon)),
- (0, import_react23.createElement)("input", {
+ (0, import_react24.createElement)("span", { className: "bt-palette-glyph", "aria-hidden": true }, (0, import_react24.createElement)(SearchIcon)),
+ (0, import_react24.createElement)("input", {
autoFocus: true,
value: query,
placeholder: t("Search Bots, chats and messages"),
@@ -11418,29 +11435,29 @@ ${shown}`, { axis: "y", ...QUICK_EDGES });
}
}
}),
- query ? (0, import_react23.createElement)("button", { type: "button", className: "bt-palette-clear", "aria-label": t("Clear search"), onClick: () => {
+ query ? (0, import_react24.createElement)("button", { type: "button", className: "bt-palette-clear", "aria-label": t("Clear search"), onClick: () => {
setQuery("");
setCursor(0);
- } }, (0, import_react23.createElement)(CloseIcon)) : null
+ } }, (0, import_react24.createElement)(CloseIcon)) : null
),
- (0, import_react23.createElement)(
+ (0, import_react24.createElement)(
"div",
{ ref: listRef, id: "bt-palette-list", className: "bt-palette-list", role: "listbox", "aria-label": t("Results") },
- (0, import_react23.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
- rows2.length === 0 ? (0, import_react23.createElement)(
+ (0, import_react24.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
+ rows2.length === 0 ? (0, import_react24.createElement)(
"div",
{ className: "bt-palette-empty" },
- (0, import_react23.createElement)("span", { className: "bt-palette-empty-icon", "aria-hidden": true }, (0, import_react23.createElement)(SearchIcon)),
- (0, import_react23.createElement)("span", { className: "bt-palette-empty-label" }, t("No results")),
- (0, import_react23.createElement)("span", { className: "bt-palette-empty-hint" }, t("Try a Bot name or words from a message"))
- ) : sections.map(([title, items]) => (0, import_react23.createElement)(
- import_react23.Fragment,
+ (0, import_react24.createElement)("span", { className: "bt-palette-empty-icon", "aria-hidden": true }, (0, import_react24.createElement)(SearchIcon)),
+ (0, import_react24.createElement)("span", { className: "bt-palette-empty-label" }, t("No results")),
+ (0, import_react24.createElement)("span", { className: "bt-palette-empty-hint" }, t("Try a Bot name or words from a message"))
+ ) : sections.map(([title, items]) => (0, import_react24.createElement)(
+ import_react24.Fragment,
{ key: title },
- (0, import_react23.createElement)("div", { className: "bt-palette-section", role: "presentation", "data-flip": `section:${title}` }, title),
+ (0, import_react24.createElement)("div", { className: "bt-palette-section", role: "presentation", "data-flip": `section:${title}` }, title),
items.map((row) => {
index += 1;
const at = index;
- return (0, import_react23.createElement)(
+ return (0, import_react24.createElement)(
"button",
{
key: row.key,
@@ -11454,14 +11471,14 @@ ${shown}`, { axis: "y", ...QUICK_EDGES });
},
onClick: () => choose(row)
},
- (0, import_react23.createElement)("span", { className: "bt-palette-lead" }, row.avatar ?? (0, import_react23.createElement)("span", { className: "bt-palette-cmd" }, row.icon)),
- (0, import_react23.createElement)(
+ (0, import_react24.createElement)("span", { className: "bt-palette-lead" }, row.avatar ?? (0, import_react24.createElement)("span", { className: "bt-palette-cmd" }, row.icon)),
+ (0, import_react24.createElement)(
"span",
{ className: "bt-palette-text" },
- (0, import_react23.createElement)("span", { className: "bt-palette-title" }, row.title),
- row.subtitle ? (0, import_react23.createElement)("span", { className: "bt-palette-sub" }, row.subtitle) : null
+ (0, import_react24.createElement)("span", { className: "bt-palette-title" }, row.title),
+ row.subtitle ? (0, import_react24.createElement)("span", { className: "bt-palette-sub" }, row.subtitle) : null
),
- row.badge ? (0, import_react23.createElement)("span", { className: "bt-palette-badge" }, row.badge) : null
+ row.badge ? (0, import_react24.createElement)("span", { className: "bt-palette-badge" }, row.badge) : null
);
})
))
@@ -11471,7 +11488,7 @@ ${shown}`, { axis: "y", ...QUICK_EDGES });
}
// src/client/model-menu.js
-var import_react24 = require("react");
+var import_react25 = require("react");
var import_react_dom6 = require("react-dom");
var MENU_EXIT_MS = 120;
function groupModels(models) {
@@ -11501,8 +11518,8 @@ function modelOf(bot, roster) {
}
var effortCache = /* @__PURE__ */ new Map();
function useEfforts(served, ref, actions) {
- const [fetched, setFetched] = (0, import_react24.useState)(void 0);
- (0, import_react24.useEffect)(() => {
+ const [fetched, setFetched] = (0, import_react25.useState)(void 0);
+ (0, import_react25.useEffect)(() => {
setFetched(void 0);
if (ref === void 0 || served?.reasoning !== void 0 || actions?.efforts === void 0) return void 0;
let live = true;
@@ -11527,12 +11544,12 @@ function effortRows(reasoning) {
];
}
function EffortRows({ reasoning, current, onPick }) {
- return (0, import_react24.createElement)(
- import_react24.Fragment,
+ return (0, import_react25.createElement)(
+ import_react25.Fragment,
null,
- (0, import_react24.createElement)("div", { className: "bt-menu-sep", role: "separator" }),
- (0, import_react24.createElement)("div", { className: "bt-model-group", role: "presentation" }, t("Thinking level")),
- effortRows(reasoning).map((row) => (0, import_react24.createElement)(
+ (0, import_react25.createElement)("div", { className: "bt-menu-sep", role: "separator" }),
+ (0, import_react25.createElement)("div", { className: "bt-model-group", role: "presentation" }, t("Thinking level")),
+ effortRows(reasoning).map((row) => (0, import_react25.createElement)(
"button",
{
key: row.effort ?? "default",
@@ -11541,17 +11558,17 @@ function EffortRows({ reasoning, current, onPick }) {
"aria-checked": (row.effort ?? null) === (current ?? null),
onClick: () => onPick(row.effort)
},
- (0, import_react24.createElement)("span", { className: "bt-menu-label" }, row.label),
- (0, import_react24.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, (row.effort ?? null) === (current ?? null) ? (0, import_react24.createElement)(CheckIcon) : null)
+ (0, import_react25.createElement)("span", { className: "bt-menu-label" }, row.label),
+ (0, import_react25.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, (row.effort ?? null) === (current ?? null) ? (0, import_react25.createElement)(CheckIcon) : null)
))
);
}
function ModelRows({ roster, current, onPick }) {
- return groupModels(roster.models).map(([provider, list]) => (0, import_react24.createElement)(
- import_react24.Fragment,
+ return groupModels(roster.models).map(([provider, list]) => (0, import_react25.createElement)(
+ import_react25.Fragment,
{ key: list[0].provider ?? provider },
- (0, import_react24.createElement)("div", { className: "bt-model-group", role: "presentation" }, provider),
- list.map((model) => (0, import_react24.createElement)(
+ (0, import_react25.createElement)("div", { className: "bt-model-group", role: "presentation" }, provider),
+ list.map((model) => (0, import_react25.createElement)(
"button",
{
key: model.ref,
@@ -11561,25 +11578,25 @@ function ModelRows({ roster, current, onPick }) {
title: model.ref,
onClick: () => onPick(model.ref)
},
- (0, import_react24.createElement)("span", { className: "bt-menu-label" }, model.name),
- model.ref === roster.defaultModel ? (0, import_react24.createElement)("span", { className: "bt-menu-hint" }, t("Default")) : null,
- (0, import_react24.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, model.ref === current ? (0, import_react24.createElement)(CheckIcon) : null)
+ (0, import_react25.createElement)("span", { className: "bt-menu-label" }, model.name),
+ model.ref === roster.defaultModel ? (0, import_react25.createElement)("span", { className: "bt-menu-hint" }, t("Default")) : null,
+ (0, import_react25.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, model.ref === current ? (0, import_react25.createElement)(CheckIcon) : null)
))
));
}
-var Caret = () => (0, import_react24.createElement)("svg", { className: "bt-model-caret", width: 12, height: 12, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true }, (0, import_react24.createElement)("path", { d: "M5.5 8l4.5 4.5L14.5 8" }));
+var Caret = () => (0, import_react25.createElement)("svg", { className: "bt-model-caret", width: 12, height: 12, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true }, (0, import_react25.createElement)("path", { d: "M5.5 8l4.5 4.5L14.5 8" }));
function useAnchoredMenu() {
- const [anchor, setAnchor] = (0, import_react24.useState)(null);
- const [place, setPlace] = (0, import_react24.useState)(null);
+ const [anchor, setAnchor] = (0, import_react25.useState)(null);
+ const [place, setPlace] = (0, import_react25.useState)(null);
const [shownPlace, leaving] = useLinger(place, MENU_EXIT_MS);
- const button = (0, import_react24.useRef)(null);
- const menu = (0, import_react24.useRef)(null);
+ const button = (0, import_react25.useRef)(null);
+ const menu = (0, import_react25.useRef)(null);
const tick = useViewport();
const close = () => {
setAnchor(null);
setPlace(null);
};
- (0, import_react24.useEffect)(() => {
+ (0, import_react25.useEffect)(() => {
if (place === null) return void 0;
const onDown = (event) => {
if (menu.current?.contains(event.target) || button.current?.contains(event.target)) return;
@@ -11605,7 +11622,7 @@ function useAnchoredMenu() {
};
}, [place]);
const open = () => setAnchor({});
- (0, import_react24.useLayoutEffect)(() => {
+ (0, import_react25.useLayoutEffect)(() => {
if (anchor === null || !button.current) return;
const rect = button.current.getBoundingClientRect();
const width = Math.max(240, rect.width);
@@ -11644,10 +11661,10 @@ function ModelMenu({ bot, roster, actions, run: run2, wide = false, onPick, onPi
};
const models = roster.models ?? [];
const manage = manageModels(actions);
- return (0, import_react24.createElement)(
- import_react24.Fragment,
+ return (0, import_react25.createElement)(
+ import_react25.Fragment,
null,
- (0, import_react24.createElement)(
+ (0, import_react25.createElement)(
"button",
{
ref: button,
@@ -11660,34 +11677,34 @@ function ModelMenu({ bot, roster, actions, run: run2, wide = false, onPick, onPi
"data-missing": shown !== void 0 && !shown.served && models.length > 0 ? "" : void 0,
onClick: toggle
},
- (0, import_react24.createElement)(
+ (0, import_react25.createElement)(
"span",
{ className: "bt-model-copy" },
- (0, import_react24.createElement)("span", { className: "bt-model-name" }, shown?.name ?? t("Choose a model")),
- shown ? (0, import_react24.createElement)("span", { className: "bt-model-provider" }, shown.served || models.length === 0 ? effortLabel === void 0 ? shown.provider : `${shown.provider} · ${effortLabel}` : t("{provider} · not available", { provider: shown.provider })) : null
+ (0, import_react25.createElement)("span", { className: "bt-model-name" }, shown?.name ?? t("Choose a model")),
+ shown ? (0, import_react25.createElement)("span", { className: "bt-model-provider" }, shown.served || models.length === 0 ? effortLabel === void 0 ? shown.provider : `${shown.provider} · ${effortLabel}` : t("{provider} · not available", { provider: shown.provider })) : null
),
- (0, import_react24.createElement)(Caret)
+ (0, import_react25.createElement)(Caret)
),
- shownPlace ? (0, import_react_dom6.createPortal)((0, import_react24.createElement)(
+ shownPlace ? (0, import_react_dom6.createPortal)((0, import_react25.createElement)(
"div",
{ ref: menu, className: `bt-menu bt-model-menu${shownPlace.bottom !== void 0 ? " bt-menu-up" : ""}`, role: "menu", "aria-label": t("Model for {name}", { name: bot.name }), style: shownPlace, "data-leaving": leaving || void 0 },
- models.length > 0 ? (0, import_react24.createElement)(ModelRows, { roster, current, onPick: pick2 }) : (0, import_react24.createElement)("div", { className: "bt-model-none" }, t("No models are set up in DeepSeek Harness yet.")),
- effortRows(reasoning).length > 0 ? (0, import_react24.createElement)(EffortRows, { reasoning, current: picked, onPick: pickEffort }) : null,
- manage ? (0, import_react24.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,
- manage ? (0, import_react24.createElement)("button", { type: "button", role: "menuitem", onClick: () => {
+ models.length > 0 ? (0, import_react25.createElement)(ModelRows, { roster, current, onPick: pick2 }) : (0, import_react25.createElement)("div", { className: "bt-model-none" }, t("No models are set up in DeepSeek Harness yet.")),
+ effortRows(reasoning).length > 0 ? (0, import_react25.createElement)(EffortRows, { reasoning, current: picked, onPick: pickEffort }) : null,
+ manage ? (0, import_react25.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,
+ manage ? (0, import_react25.createElement)("button", { type: "button", role: "menuitem", onClick: () => {
close();
manage();
- } }, (0, import_react24.createElement)(SlidersIcon), (0, import_react24.createElement)("span", { className: "bt-menu-label" }, t("Models and providers…"))) : null
+ } }, (0, import_react25.createElement)(SlidersIcon), (0, import_react25.createElement)("span", { className: "bt-menu-label" }, t("Models and providers…"))) : null
), document.body) : null
);
}
function ModelChoiceDock({ sessionId, useRoster, actions }) {
const roster = useRoster((value) => value);
const bot = roster.byId[sessionId];
- const [busy, setBusy] = (0, import_react24.useState)("");
- const [error, setError] = (0, import_react24.useState)("");
+ const [busy, setBusy] = (0, import_react25.useState)("");
+ const [error, setError] = (0, import_react25.useState)("");
const shown = Boolean(bot) && currentPart(bot) === sessionId && roster.ready;
- (0, import_react24.useEffect)(() => {
+ (0, import_react25.useEffect)(() => {
if (shown) void actions.refreshModels?.();
}, [shown, sessionId]);
if (!bot || currentPart(bot) !== sessionId || !roster.ready) return null;
@@ -11706,12 +11723,12 @@ function ModelChoiceDock({ sessionId, useRoster, actions }) {
}).finally(() => setBusy(""));
};
const text = lost ? t("{model} is not available anymore. Pick another model for me.", { model: bot.model.split("/").slice(1).join("/") }) : keyFor ? t("Hi, I'm {name}. I need a {provider} API key before I can start.", { name: bot.name, provider: keyFor.providerName ?? keyFor.provider }) : usable.length === 0 ? t("Hi, I'm {name}. I don't have a model yet. How do you want to set one up?", { name: bot.name }) : t("Hi, I'm {name}. Pick a model for me first. You can change it later in my details.", { name: bot.name });
- const choices = usable.length === 0 ? setupChoices(actions).map(([label, run2]) => (0, import_react24.createElement)("button", { key: label, type: "button", className: "bt-model-chip", onClick: run2 }, label)) : [
- ...groupModels(usable).map(([provider, list]) => (0, import_react24.createElement)(
+ const choices = usable.length === 0 ? setupChoices(actions).map(([label, run2]) => (0, import_react25.createElement)("button", { key: label, type: "button", className: "bt-model-chip", onClick: run2 }, label)) : [
+ ...groupModels(usable).map(([provider, list]) => (0, import_react25.createElement)(
"div",
{ key: list[0].provider ?? provider, className: "bt-model-choice-group", role: "group", "aria-label": provider },
- (0, import_react24.createElement)("div", { className: "bt-model-choice-provider", "aria-hidden": true }, provider),
- (0, import_react24.createElement)("div", { className: "bt-model-choice-chips" }, list.map((model) => (0, import_react24.createElement)("button", {
+ (0, import_react25.createElement)("div", { className: "bt-model-choice-provider", "aria-hidden": true }, provider),
+ (0, import_react25.createElement)("div", { className: "bt-model-choice-chips" }, list.map((model) => (0, import_react25.createElement)("button", {
key: model.ref,
type: "button",
className: "bt-model-chip",
@@ -11720,35 +11737,35 @@ function ModelChoiceDock({ sessionId, useRoster, actions }) {
"aria-label": `${model.name} · ${provider}`,
title: model.ref === roster.defaultModel ? `${model.ref} · ${t("Harness default")}` : model.ref,
onClick: () => pick2(model.ref)
- }, model.name, busy === model.ref ? (0, import_react24.createElement)("span", { className: "bt-model-spin", "aria-label": t("Saving…") }) : null)))
+ }, model.name, busy === model.ref ? (0, import_react25.createElement)("span", { className: "bt-model-spin", "aria-label": t("Saving…") }) : null)))
)),
- manage ? (0, import_react24.createElement)("button", { key: "manage", type: "button", className: "bt-model-chip bt-model-chip-quiet", onClick: manage }, (0, import_react24.createElement)(SlidersIcon), t("Manage models")) : null
+ manage ? (0, import_react25.createElement)("button", { key: "manage", type: "button", className: "bt-model-chip bt-model-chip-quiet", onClick: manage }, (0, import_react25.createElement)(SlidersIcon), t("Manage models")) : null
];
- return (0, import_react24.createElement)(
+ return (0, import_react25.createElement)(
"div",
{ className: "bt-model-dock" },
- (0, import_react24.createElement)(
+ (0, import_react25.createElement)(
"div",
{ className: "bt-astack", "data-lead": "" },
- (0, import_react24.createElement)(
+ (0, import_react25.createElement)(
"div",
{ className: "bt-msg" },
- (0, import_react24.createElement)(
+ (0, import_react25.createElement)(
"div",
{ className: "bt-msg-line" },
- (0, import_react24.createElement)(BotMark, { bot, size: 22 }),
- (0, import_react24.createElement)("div", { className: "bt-bubble" }, text)
+ (0, import_react25.createElement)(BotMark, { bot, size: 22 }),
+ (0, import_react25.createElement)("div", { className: "bt-bubble" }, text)
)
)
),
- keyFor ? (0, import_react24.createElement)(ModelKeyCard, { key: keyFor.provider, model: keyFor, actions }) : (0, import_react24.createElement)("div", { className: "bt-model-chips", role: "group", "aria-label": t("Choose a model") }, choices),
- error ? (0, import_react24.createElement)("div", { className: "bt-secret-error bt-model-error", role: "alert" }, error) : null
+ keyFor ? (0, import_react25.createElement)(ModelKeyCard, { key: keyFor.provider, model: keyFor, actions }) : (0, import_react25.createElement)("div", { className: "bt-model-chips", role: "group", "aria-label": t("Choose a model") }, choices),
+ error ? (0, import_react25.createElement)("div", { className: "bt-secret-error bt-model-error", role: "alert" }, error) : null
);
}
function ModelKeyCard({ model, actions }) {
- const [value, setValue] = (0, import_react24.useState)("");
- const [busy, setBusy] = (0, import_react24.useState)(false);
- const [error, setError] = (0, import_react24.useState)("");
+ const [value, setValue] = (0, import_react25.useState)("");
+ const [busy, setBusy] = (0, import_react25.useState)(false);
+ const [error, setError] = (0, import_react25.useState)("");
const label = t("{provider} API key", { provider: model.providerName ?? model.provider });
const ready = value.trim() !== "" && !busy;
const save = () => {
@@ -11757,17 +11774,17 @@ function ModelKeyCard({ model, actions }) {
setError("");
void Promise.resolve(actions.setProviderKey(model.provider, value)).then(() => setValue(""), (failure) => setError(hostText(failure?.message ?? String(failure)))).finally(() => setBusy(false));
};
- return (0, import_react24.createElement)(
+ return (0, import_react25.createElement)(
"div",
{ className: "bt-q bt-model-key", role: "group", "aria-label": label },
- (0, import_react24.createElement)("div", { className: "bt-model-key-title" }, (0, import_react24.createElement)(KeyIcon), label),
- (0, import_react24.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react24.createElement)(MaskedInput, { value, onChange: setValue, onEnter: save, label, autoFocus: true })),
- error ? (0, import_react24.createElement)("div", { className: "bt-secret-error", role: "alert" }, error) : null,
- (0, import_react24.createElement)(
+ (0, import_react25.createElement)("div", { className: "bt-model-key-title" }, (0, import_react25.createElement)(KeyIcon), label),
+ (0, import_react25.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react25.createElement)(MaskedInput, { value, onChange: setValue, onEnter: save, label, autoFocus: true })),
+ error ? (0, import_react25.createElement)("div", { className: "bt-secret-error", role: "alert" }, error) : null,
+ (0, import_react25.createElement)(
"div",
{ className: "bt-q-foot" },
- actions.openModels ? (0, import_react24.createElement)("button", { type: "button", className: "bt-q-btn bt-model-key-other", onClick: actions.openModels }, t("Another provider")) : null,
- (0, import_react24.createElement)("button", { type: "button", className: "bt-q-submit", disabled: !ready, onClick: save }, busy ? t("Saving…") : t("Save"))
+ actions.openModels ? (0, import_react25.createElement)("button", { type: "button", className: "bt-q-btn bt-model-key-other", onClick: actions.openModels }, t("Another provider")) : null,
+ (0, import_react25.createElement)("button", { type: "button", className: "bt-q-submit", disabled: !ready, onClick: save }, busy ? t("Saving…") : t("Save"))
)
);
}
@@ -11783,14 +11800,14 @@ function DeepSeekSignIn({ useUi, actions }) {
const open = useUi((state) => state.signIn);
const entry = open ? actions.signInEntry?.() : null;
if (!entry) return null;
- return (0, import_react24.createElement)(SignInHost, { key: open, entry, actions });
+ return (0, import_react25.createElement)(SignInHost, { key: open, entry, actions });
}
function SignInHost({ entry, actions }) {
- const [ops] = (0, import_react24.useState)(() => entry.inject?.() ?? {});
+ const [ops] = (0, import_react25.useState)(() => entry.inject?.() ?? {});
const close = () => actions.closeSignIn();
- const useHook = (source) => (selector) => (0, import_react24.useSyncExternalStore)(source.subscribe, () => selector(source.getSnapshot()));
- const [hooks] = (0, import_react24.useState)(() => ({ useAccount: useHook(ops.hooks.account), useTheme: useHook(ops.hooks.theme) }));
- return (0, import_react24.createElement)(entry.component, {
+ const useHook = (source) => (selector) => (0, import_react25.useSyncExternalStore)(source.subscribe, () => selector(source.getSnapshot()));
+ const [hooks] = (0, import_react25.useState)(() => ({ useAccount: useHook(ops.hooks.account), useTheme: useHook(ops.hooks.theme) }));
+ return (0, import_react25.createElement)(entry.component, {
...ops,
...hooks,
t: actions.accountT(),
@@ -11844,17 +11861,17 @@ var MODEL_CSS = `
`;
// src/client/folder-menu.js
-var import_react25 = require("react");
+var import_react26 = require("react");
var import_react_dom7 = require("react-dom");
var folderName = (path) => String(path).replace(/[\\/]+$/, "").split(/[\\/]/).pop() || String(path);
-var Tick = ({ on }) => (0, import_react25.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, on ? (0, import_react25.createElement)(CheckIcon) : null);
+var Tick = ({ on }) => (0, import_react26.createElement)("span", { className: "bt-model-tick", "aria-hidden": true }, on ? (0, import_react26.createElement)(CheckIcon) : null);
function FolderMenu({ value, group = false, team = false, actions, run: run2, onPick, wide = false, disabled = false }) {
const { isOpen, shownPlace, leaving, button, menu, open, close } = useAnchoredMenu();
- const [info, setInfo] = (0, import_react25.useState)(null);
- const [view, setView] = (0, import_react25.useState)("list");
- const [draft, setDraft] = (0, import_react25.useState)("");
- const [listing, setListing] = (0, import_react25.useState)(null);
- const [problem, setProblem] = (0, import_react25.useState)("");
+ const [info, setInfo] = (0, import_react26.useState)(null);
+ const [view, setView] = (0, import_react26.useState)("list");
+ const [draft, setDraft] = (0, import_react26.useState)("");
+ const [listing, setListing] = (0, import_react26.useState)(null);
+ const [problem, setProblem] = (0, import_react26.useState)("");
const fallback = group ? t("Each Bot's own folder") : t("Team workspace");
const toggle = () => {
if (isOpen) {
@@ -11887,35 +11904,35 @@ function FolderMenu({ value, group = false, team = false, actions, run: run2, on
};
const known = info?.folders ?? [];
const folders = value && !known.some((folder) => folder.path === value) ? [{ path: value, title: folderName(value) }, ...known] : known;
- const listView = (0, import_react25.createElement)(
+ const listView = (0, import_react26.createElement)(
"div",
{ key: "list", className: "bt-folder-view" },
- team ? null : (0, import_react25.createElement)(
+ team ? null : (0, import_react26.createElement)(
"button",
{ type: "button", role: "menuitemradio", "aria-checked": !value, title: group ? void 0 : info?.team ?? void 0, onClick: () => choose("") },
- (0, import_react25.createElement)("span", { className: "bt-menu-label" }, fallback),
- (0, import_react25.createElement)(Tick, { on: !value })
+ (0, import_react26.createElement)("span", { className: "bt-menu-label" }, fallback),
+ (0, import_react26.createElement)(Tick, { on: !value })
),
- folders.length > 0 ? (0, import_react25.createElement)("div", { className: "bt-model-group", role: "presentation" }, t("Folders")) : null,
- folders.map((folder) => (0, import_react25.createElement)(
+ folders.length > 0 ? (0, import_react26.createElement)("div", { className: "bt-model-group", role: "presentation" }, t("Folders")) : null,
+ folders.map((folder) => (0, import_react26.createElement)(
"button",
{ key: folder.path, type: "button", role: "menuitemradio", "aria-checked": folder.path === value, title: folder.path, onClick: () => choose(folder.path) },
- (0, import_react25.createElement)("span", { className: "bt-folder-copy" }, (0, import_react25.createElement)("span", { className: "bt-menu-label" }, folder.title), (0, import_react25.createElement)("span", { className: "bt-folder-path" }, folder.path)),
- (0, import_react25.createElement)(Tick, { on: folder.path === value })
+ (0, import_react26.createElement)("span", { className: "bt-folder-copy" }, (0, import_react26.createElement)("span", { className: "bt-menu-label" }, folder.title), (0, import_react26.createElement)("span", { className: "bt-folder-path" }, folder.path)),
+ (0, import_react26.createElement)(Tick, { on: folder.path === value })
)),
- (0, import_react25.createElement)("div", { className: "bt-menu-sep", role: "separator" }),
- info?.picker === "native" ? (0, import_react25.createElement)("button", { type: "button", role: "menuitem", onClick: pickNative }, (0, import_react25.createElement)(FolderIcon), (0, import_react25.createElement)("span", { className: "bt-menu-label" }, t("Choose a folder…"))) : null,
- info?.picker === "browse" ? (0, import_react25.createElement)("button", { type: "button", role: "menuitem", onClick: () => browse(value) }, (0, import_react25.createElement)(FolderIcon), (0, import_react25.createElement)("span", { className: "bt-menu-label" }, t("Browse folders…"))) : null,
- (0, import_react25.createElement)("button", { type: "button", role: "menuitem", onClick: () => {
+ (0, import_react26.createElement)("div", { className: "bt-menu-sep", role: "separator" }),
+ info?.picker === "native" ? (0, import_react26.createElement)("button", { type: "button", role: "menuitem", onClick: pickNative }, (0, import_react26.createElement)(FolderIcon), (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("Choose a folder…"))) : null,
+ info?.picker === "browse" ? (0, import_react26.createElement)("button", { type: "button", role: "menuitem", onClick: () => browse(value) }, (0, import_react26.createElement)(FolderIcon), (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("Browse folders…"))) : null,
+ (0, import_react26.createElement)("button", { type: "button", role: "menuitem", onClick: () => {
setDraft(value ?? "");
setView("type");
- } }, (0, import_react25.createElement)(PencilIcon), (0, import_react25.createElement)("span", { className: "bt-menu-label" }, t("Enter a path…")))
+ } }, (0, import_react26.createElement)(PencilIcon), (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("Enter a path…")))
);
- const typeView = (0, import_react25.createElement)(
+ const typeView = (0, import_react26.createElement)(
"div",
{ key: "type", className: "bt-folder-view" },
- (0, import_react25.createElement)("button", { type: "button", className: "bt-folder-back", onClick: () => setView("list") }, (0, import_react25.createElement)(ChevronLeftIcon), (0, import_react25.createElement)("span", { className: "bt-menu-label" }, t("Back"))),
- (0, import_react25.createElement)("input", {
+ (0, import_react26.createElement)("button", { type: "button", className: "bt-folder-back", onClick: () => setView("list") }, (0, import_react26.createElement)(ChevronLeftIcon), (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("Back"))),
+ (0, import_react26.createElement)("input", {
className: "bt-folder-input",
autoFocus: true,
value: draft,
@@ -11927,33 +11944,33 @@ function FolderMenu({ value, group = false, team = false, actions, run: run2, on
if (event.key === "Enter" && !event.nativeEvent.isComposing) typed();
}
}),
- (0, import_react25.createElement)("button", { type: "button", className: "bt-folder-use", disabled: draft.trim() === "", onClick: typed }, t("Use this folder"))
+ (0, import_react26.createElement)("button", { type: "button", className: "bt-folder-use", disabled: draft.trim() === "", onClick: typed }, t("Use this folder"))
);
const parent = listing?.crumbs?.length > 1 ? listing.crumbs.at(-2) : void 0;
const inside = listing?.entries?.filter((entry) => !entry.hidden) ?? [];
- const browseView = listing ? (0, import_react25.createElement)(
+ const browseView = listing ? (0, import_react26.createElement)(
"div",
{ key: `browse:${listing.path}`, className: "bt-folder-view" },
- (0, import_react25.createElement)("button", { type: "button", className: "bt-folder-back", onClick: () => setView("list") }, (0, import_react25.createElement)(ChevronLeftIcon), (0, import_react25.createElement)("span", { className: "bt-menu-label" }, t("Back"))),
- (0, import_react25.createElement)("div", { className: "bt-folder-path bt-folder-here" }, listing.path),
- parent ? (0, import_react25.createElement)("button", { type: "button", role: "menuitem", title: parent.path, onClick: () => browse(parent.path) }, (0, import_react25.createElement)(FolderIcon), (0, import_react25.createElement)("span", { className: "bt-menu-label" }, t("Up one level"))) : null,
- inside.map((entry) => (0, import_react25.createElement)(
+ (0, import_react26.createElement)("button", { type: "button", className: "bt-folder-back", onClick: () => setView("list") }, (0, import_react26.createElement)(ChevronLeftIcon), (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("Back"))),
+ (0, import_react26.createElement)("div", { className: "bt-folder-path bt-folder-here" }, listing.path),
+ parent ? (0, import_react26.createElement)("button", { type: "button", role: "menuitem", title: parent.path, onClick: () => browse(parent.path) }, (0, import_react26.createElement)(FolderIcon), (0, import_react26.createElement)("span", { className: "bt-menu-label" }, t("Up one level"))) : null,
+ inside.map((entry) => (0, import_react26.createElement)(
"button",
{ key: entry.path, type: "button", role: "menuitem", onClick: () => browse(entry.path) },
- (0, import_react25.createElement)(FolderIcon),
- (0, import_react25.createElement)("span", { className: "bt-menu-label" }, entry.name),
- (0, import_react25.createElement)(ChevronRightIcon)
+ (0, import_react26.createElement)(FolderIcon),
+ (0, import_react26.createElement)("span", { className: "bt-menu-label" }, entry.name),
+ (0, import_react26.createElement)(ChevronRightIcon)
)),
- inside.length === 0 ? (0, import_react25.createElement)("div", { className: "bt-model-none" }, t("No folders inside.")) : null,
- listing.truncated ? (0, import_react25.createElement)("div", { className: "bt-folder-path bt-folder-here" }, t("Some folders are not shown.")) : null,
- (0, import_react25.createElement)("div", { className: "bt-menu-sep", role: "separator" }),
- (0, import_react25.createElement)("button", { type: "button", className: "bt-folder-use", onClick: () => choose(listing.path) }, t("Use this folder"))
+ inside.length === 0 ? (0, import_react26.createElement)("div", { className: "bt-model-none" }, t("No folders inside.")) : null,
+ listing.truncated ? (0, import_react26.createElement)("div", { className: "bt-folder-path bt-folder-here" }, t("Some folders are not shown.")) : null,
+ (0, import_react26.createElement)("div", { className: "bt-menu-sep", role: "separator" }),
+ (0, import_react26.createElement)("button", { type: "button", className: "bt-folder-use", onClick: () => choose(listing.path) }, t("Use this folder"))
) : null;
const shownView = view === "type" ? typeView : view === "browse" && browseView ? browseView : listView;
- return (0, import_react25.createElement)(
- import_react25.Fragment,
+ return (0, import_react26.createElement)(
+ import_react26.Fragment,
null,
- (0, import_react25.createElement)(
+ (0, import_react26.createElement)(
"button",
{
ref: button,
@@ -11967,19 +11984,19 @@ function FolderMenu({ value, group = false, team = false, actions, run: run2, on
onClick: toggle,
disabled
},
- (0, import_react25.createElement)(
+ (0, import_react26.createElement)(
"span",
{ className: "bt-model-copy" },
- (0, import_react25.createElement)("span", { className: "bt-model-name" }, value ? folderName(value) : fallback),
- value ? (0, import_react25.createElement)("span", { className: "bt-model-provider" }, value) : null
+ (0, import_react26.createElement)("span", { className: "bt-model-name" }, value ? folderName(value) : fallback),
+ value ? (0, import_react26.createElement)("span", { className: "bt-model-provider" }, value) : null
),
- (0, import_react25.createElement)(Caret)
+ (0, import_react26.createElement)(Caret)
),
- shownPlace ? (0, import_react_dom7.createPortal)((0, import_react25.createElement)(
+ shownPlace ? (0, import_react_dom7.createPortal)((0, import_react26.createElement)(
"div",
{ ref: menu, className: `bt-menu bt-model-menu bt-folder-menu${shownPlace.bottom !== void 0 ? " bt-menu-up" : ""}`, role: "menu", "aria-label": team ? t("Team workspace") : t("Working folder"), style: shownPlace, "data-leaving": leaving || void 0 },
shownView,
- problem ? (0, import_react25.createElement)("div", { className: "bt-folder-error", role: "alert" }, problem) : null
+ problem ? (0, import_react26.createElement)("div", { className: "bt-folder-error", role: "alert" }, problem) : null
), document.body) : null
);
}
@@ -12000,7 +12017,7 @@ var FOLDER_CSS = `
`;
// src/client/schedules.js
-var import_react26 = require("react");
+var import_react27 = require("react");
var POLL_MS = 3e4;
var shared = null;
var listeners = /* @__PURE__ */ new Set();
@@ -12009,8 +12026,8 @@ function publish(view) {
for (const listener of listeners) listener(view);
}
function useSchedules(actions) {
- const [view, setView] = (0, import_react26.useState)(shared);
- (0, import_react26.useEffect)(() => {
+ const [view, setView] = (0, import_react27.useState)(shared);
+ (0, import_react27.useEffect)(() => {
listeners.add(setView);
let stopped = false;
let timer;
@@ -12068,9 +12085,9 @@ function timingText(task) {
}
var nextText = (task) => task.status === "active" ? t("Next: {time}", { time: dayAndTime(Date.parse(task.scheduledAt)) }) : t("Finished");
function TaskRow({ task, actions, onView, showBot, roster }) {
- 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_react27.useState)(false);
+ const [busy, setBusy] = (0, import_react27.useState)(false);
+ (0, import_react27.useEffect)(() => {
if (!confirming) return void 0;
const timer = setTimeout(() => setConfirming(false), 3e3);
return () => clearTimeout(timer);
@@ -12084,19 +12101,19 @@ function TaskRow({ task, actions, onView, showBot, roster }) {
void actions.scheduleDelete(task.sessionId, task.id).then(onView, () => setBusy(false));
};
const room2 = task.roomId ? roster.roomsById[task.roomId] : void 0;
- return (0, import_react26.createElement)(
+ return (0, import_react27.createElement)(
"div",
{ className: "bt-set-row bt-task", "data-done": task.status === "active" ? void 0 : "", "data-busy": busy || void 0 },
- showBot ? (0, import_react26.createElement)(BotAvatar, { bot: roster.byId[task.botId], size: 28, badge: false, live: false }) : null,
- (0, import_react26.createElement)(
+ showBot ? (0, import_react27.createElement)(BotAvatar, { bot: roster.byId[task.botId], size: 28, badge: false, live: false }) : null,
+ (0, import_react27.createElement)(
"span",
{ className: "bt-set-copy" },
- (0, import_react26.createElement)("span", { className: "bt-task-title" }, task.title),
- (0, import_react26.createElement)("span", { className: "bt-set-hint" }, [timingText(task), room2 ? t("in {name}", { name: room2.name }) : ""].filter(Boolean).join(" · ")),
- task.prompt && task.prompt !== task.title ? (0, import_react26.createElement)("span", { className: "bt-task-prompt" }, task.prompt) : null
+ (0, import_react27.createElement)("span", { className: "bt-task-title" }, task.title),
+ (0, import_react27.createElement)("span", { className: "bt-set-hint" }, [timingText(task), room2 ? t("in {name}", { name: room2.name }) : ""].filter(Boolean).join(" · ")),
+ task.prompt && task.prompt !== task.title ? (0, import_react27.createElement)("span", { className: "bt-task-prompt" }, task.prompt) : null
),
- (0, import_react26.createElement)("span", { className: "bt-task-next" }, nextText(task)),
- (0, import_react26.createElement)("button", {
+ (0, import_react27.createElement)("span", { className: "bt-task-next" }, nextText(task)),
+ (0, import_react27.createElement)("button", {
type: "button",
className: "bt-mini bt-task-remove",
"data-confirm": confirming || void 0,
@@ -12104,7 +12121,7 @@ function TaskRow({ task, actions, onView, showBot, roster }) {
"aria-label": confirming ? t("Click again to delete") : t("Delete task"),
title: confirming ? void 0 : t("Delete task"),
onClick: remove
- }, confirming ? t("Delete") : (0, import_react26.createElement)(TrashIcon))
+ }, confirming ? t("Delete") : (0, import_react27.createElement)(TrashIcon))
);
}
var pad = (number) => String(number).padStart(2, "0");
@@ -12116,17 +12133,17 @@ function inAnHour() {
var KINDS = [["at", "Once"], ["daily", "Every day"], ["weekly", "Every week"], ["every", "Repeat"]];
var UNITS = [["minutes", 1, "minutes"], ["hours", 60, "hours"], ["days", 1440, "days"]];
function TaskForm({ roster, actions, start, onDone, onCancel }) {
- const [target, setTarget] = (0, import_react26.useState)(start ?? roster.bots[0]?.id ?? "");
- const [title, setTitle] = (0, import_react26.useState)("");
- const [prompt, setPrompt] = (0, import_react26.useState)("");
- const [kind, setKind] = (0, import_react26.useState)("daily");
- const [at, setAt] = (0, import_react26.useState)(inAnHour);
- const [time, setTime] = (0, import_react26.useState)("09:00");
- const [weekdays, setWeekdays] = (0, import_react26.useState)([1, 2, 3, 4, 5]);
- const [count, setCount] = (0, import_react26.useState)(1);
- const [unit, setUnit] = (0, import_react26.useState)("hours");
- const [busy, setBusy] = (0, import_react26.useState)(false);
- const [error, setError] = (0, import_react26.useState)("");
+ const [target, setTarget] = (0, import_react27.useState)(start ?? roster.bots[0]?.id ?? "");
+ const [title, setTitle] = (0, import_react27.useState)("");
+ const [prompt, setPrompt] = (0, import_react27.useState)("");
+ const [kind, setKind] = (0, import_react27.useState)("daily");
+ const [at, setAt] = (0, import_react27.useState)(inAnHour);
+ const [time, setTime] = (0, import_react27.useState)("09:00");
+ const [weekdays, setWeekdays] = (0, import_react27.useState)([1, 2, 3, 4, 5]);
+ const [count, setCount] = (0, import_react27.useState)(1);
+ const [unit, setUnit] = (0, import_react27.useState)("hours");
+ const [busy, setBusy] = (0, import_react27.useState)(false);
+ const [error, setError] = (0, import_react27.useState)("");
const timing = () => {
if (kind === "at") return { kind, at: new Date(at).toISOString() };
if (kind === "every") return { kind, minutes: Math.round(Number(count) * UNITS.find(([id]) => id === unit)[1]) };
@@ -12151,101 +12168,101 @@ function TaskForm({ roster, actions, start, onDone, onCancel }) {
});
};
const toggleDay = (day) => setWeekdays((days) => days.includes(day) ? days.filter((item) => item !== day) : [...days, day].sort());
- return (0, import_react26.createElement)(
+ return (0, import_react27.createElement)(
"form",
{ className: "bt-set-card bt-task-form", onSubmit: submit },
- (0, import_react26.createElement)(
+ (0, import_react27.createElement)(
"label",
{ className: "bt-set-row bt-bs-row" },
- (0, import_react26.createElement)("span", { className: "bt-set-copy" }, (0, import_react26.createElement)("span", { className: "bt-bs-label" }, t("Send to"))),
- (0, import_react26.createElement)(
+ (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t("Send to"))),
+ (0, import_react27.createElement)(
"select",
{ className: "bt-select bt-task-bot", value: target, onChange: (event) => setTarget(event.target.value) },
- (0, import_react26.createElement)("optgroup", { label: t("Bots") }, roster.bots.map((bot) => (0, import_react26.createElement)("option", { key: bot.id, value: bot.id }, bot.name))),
- roster.rooms.length > 0 ? (0, import_react26.createElement)("optgroup", { label: t("Group chats") }, roster.rooms.map((room2) => (0, import_react26.createElement)("option", { key: room2.id, value: room2.id }, room2.name))) : null
+ (0, import_react27.createElement)("optgroup", { label: t("Bots") }, roster.bots.map((bot) => (0, import_react27.createElement)("option", { key: bot.id, value: bot.id }, bot.name))),
+ roster.rooms.length > 0 ? (0, import_react27.createElement)("optgroup", { label: t("Group chats") }, roster.rooms.map((room2) => (0, import_react27.createElement)("option", { key: room2.id, value: room2.id }, room2.name))) : null
)
),
- (0, import_react26.createElement)(
+ (0, import_react27.createElement)(
"label",
{ className: "bt-set-row bt-bs-row" },
- (0, import_react26.createElement)("span", { className: "bt-set-copy" }, (0, import_react26.createElement)("span", { className: "bt-bs-label" }, t("Name"))),
- (0, import_react26.createElement)("input", { className: "bt-bs-input", value: title, maxLength: 120, placeholder: t("Morning briefing"), autoFocus: true, onChange: (event) => setTitle(event.target.value) })
+ (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t("Name"))),
+ (0, import_react27.createElement)("input", { className: "bt-bs-input", value: title, maxLength: 120, placeholder: t("Morning briefing"), autoFocus: true, onChange: (event) => setTitle(event.target.value) })
),
- (0, import_react26.createElement)(
+ (0, import_react27.createElement)(
"label",
{ className: "bt-set-row bt-bs-row bt-bs-stack" },
- (0, import_react26.createElement)("span", { className: "bt-set-copy" }, (0, import_react26.createElement)("span", { className: "bt-bs-label" }, t("What to do"))),
- (0, import_react26.createElement)("textarea", { className: "bt-bs-input bt-bs-area", value: prompt, rows: 3, placeholder: t("Sum up what changed since yesterday and what needs me today."), onChange: (event) => setPrompt(event.target.value) })
+ (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t("What to do"))),
+ (0, import_react27.createElement)("textarea", { className: "bt-bs-input bt-bs-area", value: prompt, rows: 3, placeholder: t("Sum up what changed since yesterday and what needs me today."), onChange: (event) => setPrompt(event.target.value) })
),
- (0, import_react26.createElement)(
+ (0, import_react27.createElement)(
"div",
{ className: "bt-set-row bt-bs-row bt-bs-stack" },
- (0, import_react26.createElement)("span", { className: "bt-set-copy" }, (0, import_react26.createElement)("span", { className: "bt-bs-label" }, t("When"))),
- (0, import_react26.createElement)(Segmented, { label: t("When"), value: kind }, KINDS.map(([id, label]) => (0, import_react26.createElement)("button", { key: id, type: "button", "aria-pressed": kind === id, onClick: () => setKind(id) }, t(label)))),
- (0, import_react26.createElement)(
+ (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t("When"))),
+ (0, import_react27.createElement)(Segmented, { label: t("When"), value: kind }, KINDS.map(([id, label]) => (0, import_react27.createElement)("button", { key: id, type: "button", "aria-pressed": kind === id, onClick: () => setKind(id) }, t(label)))),
+ (0, import_react27.createElement)(
"div",
{ key: kind, className: "bt-task-when bt-veil" },
- kind === "at" ? (0, import_react26.createElement)("input", { className: "bt-input", type: "datetime-local", value: at, "aria-label": t("Date and time"), onChange: (event) => setAt(event.target.value) }) : null,
- kind === "weekly" ? (0, import_react26.createElement)("div", { className: "bt-task-days", role: "group", "aria-label": t("Days") }, [1, 2, 3, 4, 5, 6, 7].map((day) => (0, import_react26.createElement)("button", {
+ kind === "at" ? (0, import_react27.createElement)("input", { className: "bt-input", type: "datetime-local", value: at, "aria-label": t("Date and time"), onChange: (event) => setAt(event.target.value) }) : null,
+ kind === "weekly" ? (0, import_react27.createElement)("div", { className: "bt-task-days", role: "group", "aria-label": t("Days") }, [1, 2, 3, 4, 5, 6, 7].map((day) => (0, import_react27.createElement)("button", {
key: day,
type: "button",
className: "bt-task-day",
"aria-pressed": weekdays.includes(day),
onClick: () => toggleDay(day)
}, when2(Date.UTC(2024, 0, day), { weekday: "narrow", timeZone: "UTC" })))) : null,
- kind === "daily" || kind === "weekly" ? (0, import_react26.createElement)("input", { className: "bt-input bt-task-time", type: "time", value: time, "aria-label": t("Time"), onChange: (event) => setTime(event.target.value) }) : null,
- kind === "every" ? (0, import_react26.createElement)(
- import_react26.Fragment,
+ kind === "daily" || kind === "weekly" ? (0, import_react27.createElement)("input", { className: "bt-input bt-task-time", type: "time", value: time, "aria-label": t("Time"), onChange: (event) => setTime(event.target.value) }) : null,
+ kind === "every" ? (0, import_react27.createElement)(
+ import_react27.Fragment,
null,
- (0, import_react26.createElement)("span", { className: "bt-task-every" }, t("Every")),
- (0, import_react26.createElement)("input", { className: "bt-input bt-task-count", type: "number", min: 1, value: count, "aria-label": t("How many"), onChange: (event) => setCount(event.target.value) }),
- (0, import_react26.createElement)(
+ (0, import_react27.createElement)("span", { className: "bt-task-every" }, t("Every")),
+ (0, import_react27.createElement)("input", { className: "bt-input bt-task-count", type: "number", min: 1, value: count, "aria-label": t("How many"), onChange: (event) => setCount(event.target.value) }),
+ (0, import_react27.createElement)(
"select",
{ className: "bt-select bt-task-unit", value: unit, "aria-label": t("Unit"), onChange: (event) => setUnit(event.target.value) },
- UNITS.map(([id, , label]) => (0, import_react26.createElement)("option", { key: id, value: id }, t(label)))
+ UNITS.map(([id, , label]) => (0, import_react27.createElement)("option", { key: id, value: id }, t(label)))
)
) : null
)
),
- error ? (0, import_react26.createElement)("div", { className: "bt-set-row" }, (0, import_react26.createElement)("span", { className: "bt-danger bt-set-hint" }, error)) : null,
- (0, import_react26.createElement)(
+ error ? (0, import_react27.createElement)("div", { className: "bt-set-row" }, (0, import_react27.createElement)("span", { className: "bt-danger bt-set-hint" }, error)) : null,
+ (0, import_react27.createElement)(
"div",
{ className: "bt-set-row bt-task-foot" },
- (0, import_react26.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),
- (0, import_react26.createElement)("button", { type: "submit", className: "bt-send bt-soft-sm", disabled: busy || !target || title.trim() === "" || prompt.trim() === "" }, busy ? t("Creating…") : t("Create task"))
+ (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),
+ (0, import_react27.createElement)("button", { type: "submit", className: "bt-send bt-soft-sm", disabled: busy || !target || title.trim() === "" || prompt.trim() === "" }, busy ? t("Creating…") : t("Create task"))
)
);
}
function AutomationOff({ actions }) {
- return (0, import_react26.createElement)(
+ return (0, import_react27.createElement)(
"div",
{ className: "bt-set-card bt-task-off" },
- (0, import_react26.createElement)("span", { className: "bt-task-off-mark" }, (0, import_react26.createElement)(ClockIcon)),
- (0, import_react26.createElement)("span", { className: "bt-task-off-title" }, t("Turn on Automation tasks in DSH")),
- (0, import_react26.createElement)("span", { className: "bt-set-hint" }, t("Switch on Automation tasks on the Plugins page in Harness settings.")),
- actions.openHarnessSettings ? (0, import_react26.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: actions.openHarnessSettings }, t("Open Harness settings")) : null
+ (0, import_react27.createElement)("span", { className: "bt-task-off-mark" }, (0, import_react27.createElement)(ClockIcon)),
+ (0, import_react27.createElement)("span", { className: "bt-task-off-title" }, t("Turn on Automation tasks in DSH")),
+ (0, import_react27.createElement)("span", { className: "bt-set-hint" }, t("Switch on Automation tasks on the Plugins page in Harness settings.")),
+ actions.openHarnessSettings ? (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: actions.openHarnessSettings }, t("Open Harness settings")) : null
);
}
function SchedulesPage({ roster, actions, start }) {
const view = useSchedules(actions);
- const [adding, setAdding] = (0, import_react26.useState)(Boolean(start));
- if (view === null) return (0, import_react26.createElement)("div", { className: "bt-set-hint" }, t("Loading…"));
- if (!view.available) return (0, import_react26.createElement)(AutomationOff, { actions });
+ const [adding, setAdding] = (0, import_react27.useState)(Boolean(start));
+ if (view === null) return (0, import_react27.createElement)("div", { className: "bt-set-hint" }, t("Loading…"));
+ if (!view.available) return (0, import_react27.createElement)(AutomationOff, { actions });
const shown = (next) => {
publish(next);
setAdding(false);
};
const byChat = [
- ...roster.bots.map((bot) => [bot.id, (0, import_react26.createElement)(BotAvatar, { bot, size: 18, badge: false, live: false }), bot.name, view.tasks.filter((task) => task.botId === bot.id)]),
- ...roster.rooms.map((room2) => [room2.id, (0, import_react26.createElement)(RoomAvatar, { room: room2, roster, size: 18 }), room2.name, view.tasks.filter((task) => task.botId === void 0 && task.roomId === room2.id)])
+ ...roster.bots.map((bot) => [bot.id, (0, import_react27.createElement)(BotAvatar, { bot, size: 18, badge: false, live: false }), bot.name, view.tasks.filter((task) => task.botId === bot.id)]),
+ ...roster.rooms.map((room2) => [room2.id, (0, import_react27.createElement)(RoomAvatar, { room: room2, roster, size: 18 }), room2.name, view.tasks.filter((task) => task.botId === void 0 && task.roomId === room2.id)])
].filter(([, , , tasks]) => tasks.length > 0);
return [
- adding ? (0, import_react26.createElement)(TaskForm, { key: "form", roster, actions, start, onDone: shown, onCancel: () => setAdding(false) }) : (0, import_react26.createElement)("div", { key: "add", className: "bt-actions" }, (0, import_react26.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", onClick: () => setAdding(true) }, (0, import_react26.createElement)(PlusIcon), t("New task"))),
- byChat.length === 0 && !adding ? (0, import_react26.createElement)("div", { key: "none", className: "bt-set-card" }, (0, import_react26.createElement)("div", { className: "bt-set-row" }, (0, import_react26.createElement)("span", { className: "bt-set-hint" }, t("No scheduled tasks yet.")))) : byChat.map(([id, avatar, name, tasks]) => (0, import_react26.createElement)(
+ adding ? (0, import_react27.createElement)(TaskForm, { key: "form", roster, actions, start, onDone: shown, onCancel: () => setAdding(false) }) : (0, import_react27.createElement)("div", { key: "add", className: "bt-actions" }, (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", onClick: () => setAdding(true) }, (0, import_react27.createElement)(PlusIcon), t("New task"))),
+ byChat.length === 0 && !adding ? (0, import_react27.createElement)("div", { key: "none", className: "bt-set-card" }, (0, import_react27.createElement)("div", { className: "bt-set-row" }, (0, import_react27.createElement)("span", { className: "bt-set-hint" }, t("No scheduled tasks yet.")))) : byChat.map(([id, avatar, name, tasks]) => (0, import_react27.createElement)(
"section",
{ key: id, className: "bt-set-section" },
- (0, import_react26.createElement)("h3", { className: "bt-task-head" }, avatar, name),
- (0, import_react26.createElement)("div", { className: "bt-set-card" }, tasks.map((task) => (0, import_react26.createElement)(TaskRow, { key: task.id, task, actions, roster, onView: publish })))
+ (0, import_react27.createElement)("h3", { className: "bt-task-head" }, avatar, name),
+ (0, import_react27.createElement)("div", { className: "bt-set-card" }, tasks.map((task) => (0, import_react27.createElement)(TaskRow, { key: task.id, task, actions, roster, onView: publish })))
))
];
}
@@ -12253,21 +12270,21 @@ function BotSchedules({ bot, roster, actions }) {
const view = useSchedules(actions);
if (view === null) return null;
const tasks = view.available ? view.tasks.filter((task) => task.botId === bot.id) : [];
- return (0, import_react26.createElement)(
+ return (0, import_react27.createElement)(
"section",
{ className: "bt-set-section" },
- (0, import_react26.createElement)("h3", null, t("Scheduled tasks")),
- (0, import_react26.createElement)(
+ (0, import_react27.createElement)("h3", null, t("Scheduled tasks")),
+ (0, import_react27.createElement)(
"div",
{ className: "bt-set-card" },
- !view.available ? (0, import_react26.createElement)(
+ !view.available ? (0, import_react27.createElement)(
"div",
{ className: "bt-set-row bt-bs-row" },
- (0, import_react26.createElement)("span", { className: "bt-set-copy" }, (0, import_react26.createElement)("span", { className: "bt-set-hint" }, t("Switch on Automation tasks on the Plugins page in Harness settings."))),
- actions.openHarnessSettings ? (0, import_react26.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: actions.openHarnessSettings }, t("Open Harness settings")) : null
+ (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-set-hint" }, t("Switch on Automation tasks on the Plugins page in Harness settings."))),
+ actions.openHarnessSettings ? (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: actions.openHarnessSettings }, t("Open Harness settings")) : null
) : [
- ...tasks.map((task) => (0, import_react26.createElement)(TaskRow, { key: task.id, task, actions, roster, onView: publish })),
- (0, import_react26.createElement)("button", { key: "new", type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => actions.openSettings("schedules", bot.id) }, (0, import_react26.createElement)(PlusIcon), t("New task"))
+ ...tasks.map((task) => (0, import_react27.createElement)(TaskRow, { key: task.id, task, actions, roster, onView: publish })),
+ (0, import_react27.createElement)("button", { key: "new", type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => actions.openSettings("schedules", bot.id) }, (0, import_react27.createElement)(PlusIcon), t("New task"))
]
)
);
@@ -12275,16 +12292,16 @@ function BotSchedules({ bot, roster, actions }) {
function ScheduleSummary({ bot, actions }) {
const view = useSchedules(actions);
const tasks = view?.available ? view.tasks.filter((task) => task.botId === bot.id && task.status === "active") : [];
- return (0, import_react26.createElement)(
+ return (0, import_react27.createElement)(
"div",
null,
- (0, import_react26.createElement)("div", { className: "bt-section-title" }, t("Scheduled tasks")),
- tasks.length === 0 ? (0, import_react26.createElement)("button", { type: "button", className: "bt-more", onClick: () => actions.openSettings("schedules", bot.id) }, view?.available === false ? t("Switch on Automation tasks on the Plugins page in Harness settings.") : t("No scheduled tasks yet. Add one")) : (0, import_react26.createElement)("div", { className: "bt-task-list" }, tasks.slice(0, 3).map((task) => (0, import_react26.createElement)(
+ (0, import_react27.createElement)("div", { className: "bt-section-title" }, t("Scheduled tasks")),
+ tasks.length === 0 ? (0, import_react27.createElement)("button", { type: "button", className: "bt-more", onClick: () => actions.openSettings("schedules", bot.id) }, view?.available === false ? t("Switch on Automation tasks on the Plugins page in Harness settings.") : t("No scheduled tasks yet. Add one")) : (0, import_react27.createElement)("div", { className: "bt-task-list" }, tasks.slice(0, 3).map((task) => (0, import_react27.createElement)(
"button",
{ key: task.id, type: "button", className: "bt-task-line", onClick: () => actions.openSettings("schedules") },
- (0, import_react26.createElement)(ClockIcon),
- (0, import_react26.createElement)("span", { className: "bt-task-line-title" }, task.title),
- (0, import_react26.createElement)("span", { className: "bt-task-line-when" }, timingText(task))
+ (0, import_react27.createElement)(ClockIcon),
+ (0, import_react27.createElement)("span", { className: "bt-task-line-title" }, task.title),
+ (0, import_react27.createElement)("span", { className: "bt-task-line-when" }, timingText(task))
)))
);
}
@@ -12335,7 +12352,7 @@ var SCHEDULE_CSS = `
`;
// src/client/capability-settings.js
-var import_react27 = require("react");
+var import_react28 = require("react");
var blank = () => ({ name: "", kind: "mcp", description: "", transport: "stdio", command: "", argsText: "", envText: "{}", url: "", headersText: "{}", content: "", items: [] });
var parseMap = (text, label) => {
let value;
@@ -12349,11 +12366,11 @@ var parseMap = (text, label) => {
};
var statusText = (status) => !status ? void 0 : status.state === "ready" ? t("Ready") : status.state === "needs-approval" ? t("Needs approval") : status.state === "error" ? t("Could not connect: {error}", { error: status.error ?? "" }) : t("Connecting…");
function Field({ label, value, onChange, multiline = false, disabled = false, placeholder }) {
- return (0, import_react27.createElement)(
+ return (0, import_react28.createElement)(
"label",
{ className: "bt-set-row bt-bs-row bt-bs-stack" },
- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t(label))),
- (0, import_react27.createElement)(multiline ? "textarea" : "input", {
+ (0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-bs-label" }, t(label))),
+ (0, import_react28.createElement)(multiline ? "textarea" : "input", {
className: multiline ? "bt-input bt-input-area" : "bt-input",
value,
disabled,
@@ -12365,7 +12382,7 @@ function Field({ label, value, onChange, multiline = false, disabled = false, pl
);
}
function CapabilityForm({ draft, setDraft, items, actions, onClose }) {
- const [error, setError] = (0, import_react27.useState)("");
+ const [error, setError] = (0, import_react28.useState)("");
const set = (key, value) => setDraft((previous) => ({ ...previous, [key]: value }));
const submit = async (event) => {
event.preventDefault();
@@ -12396,95 +12413,95 @@ function CapabilityForm({ draft, setDraft, items, actions, onClose }) {
}
};
const available = items.filter((item) => item.name !== draft.name && ["mcp", "skill"].includes(item.kind));
- return (0, import_react27.createElement)(
+ return (0, import_react28.createElement)(
"form",
{ className: "bt-connector-form", onSubmit: submit },
- (0, import_react27.createElement)(Field, { label: "Name", value: draft.name, disabled: draft.originalName !== void 0, onChange: (value) => set("name", value), placeholder: "my-tool" }),
- (0, import_react27.createElement)(
+ (0, import_react28.createElement)(Field, { label: "Name", value: draft.name, disabled: draft.originalName !== void 0, onChange: (value) => set("name", value), placeholder: "my-tool" }),
+ (0, import_react28.createElement)(
"label",
{ className: "bt-set-row bt-bs-row bt-bs-stack" },
- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t("Type"))),
- (0, import_react27.createElement)(
+ (0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-bs-label" }, t("Type"))),
+ (0, import_react28.createElement)(
"select",
{ className: "bt-input", value: draft.kind, disabled: draft.originalName !== void 0, onChange: (event) => set("kind", event.target.value) },
- ["mcp", "skill", "pack"].map((kind) => (0, import_react27.createElement)("option", { key: kind, value: kind }, t(kind === "mcp" ? "MCP server" : kind === "skill" ? "Skill" : "Pack")))
+ ["mcp", "skill", "pack"].map((kind) => (0, import_react28.createElement)("option", { key: kind, value: kind }, t(kind === "mcp" ? "MCP server" : kind === "skill" ? "Skill" : "Pack")))
)
),
- (0, import_react27.createElement)(Field, { label: "Description", value: draft.description, onChange: (value) => set("description", value) }),
- draft.kind === "mcp" ? (0, import_react27.createElement)(
+ (0, import_react28.createElement)(Field, { label: "Description", value: draft.description, onChange: (value) => set("description", value) }),
+ draft.kind === "mcp" ? (0, import_react28.createElement)(
"label",
{ className: "bt-set-row bt-bs-row bt-bs-stack" },
- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, t("Connection"))),
- (0, import_react27.createElement)(
+ (0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-bs-label" }, t("Connection"))),
+ (0, import_react28.createElement)(
"select",
{ className: "bt-input", value: draft.transport, onChange: (event) => set("transport", event.target.value) },
- (0, import_react27.createElement)("option", { value: "stdio" }, t("Local command")),
- (0, import_react27.createElement)("option", { value: "streamable-http" }, t("HTTP server"))
+ (0, import_react28.createElement)("option", { value: "stdio" }, t("Local command")),
+ (0, import_react28.createElement)("option", { value: "streamable-http" }, t("HTTP server"))
)
) : null,
- draft.kind === "mcp" && draft.transport === "stdio" ? (0, import_react27.createElement)(
+ draft.kind === "mcp" && draft.transport === "stdio" ? (0, import_react28.createElement)(
"div",
null,
- (0, import_react27.createElement)(Field, { label: "Command", value: draft.command, onChange: (value) => set("command", value) }),
- (0, import_react27.createElement)(Field, { label: "Arguments (one per line)", value: draft.argsText, onChange: (value) => set("argsText", value), multiline: true }),
- (0, import_react27.createElement)(Field, { label: "Environment (JSON)", value: draft.envText, onChange: (value) => set("envText", value), multiline: true, placeholder: t('{"API_KEY": "$DSH_SECRET_MY_KEY"}') })
+ (0, import_react28.createElement)(Field, { label: "Command", value: draft.command, onChange: (value) => set("command", value) }),
+ (0, import_react28.createElement)(Field, { label: "Arguments (one per line)", value: draft.argsText, onChange: (value) => set("argsText", value), multiline: true }),
+ (0, import_react28.createElement)(Field, { label: "Environment (JSON)", value: draft.envText, onChange: (value) => set("envText", value), multiline: true, placeholder: t('{"API_KEY": "$DSH_SECRET_MY_KEY"}') })
) : null,
- draft.kind === "mcp" && draft.transport === "streamable-http" ? (0, import_react27.createElement)(
+ draft.kind === "mcp" && draft.transport === "streamable-http" ? (0, import_react28.createElement)(
"div",
null,
- (0, import_react27.createElement)(Field, { label: "URL", value: draft.url, onChange: (value) => set("url", value) }),
- (0, import_react27.createElement)(Field, { label: "Headers (JSON)", value: draft.headersText, onChange: (value) => set("headersText", value), multiline: true, placeholder: t('{"API_KEY": "$DSH_SECRET_MY_KEY"}') })
+ (0, import_react28.createElement)(Field, { label: "URL", value: draft.url, onChange: (value) => set("url", value) }),
+ (0, import_react28.createElement)(Field, { label: "Headers (JSON)", value: draft.headersText, onChange: (value) => set("headersText", value), multiline: true, placeholder: t('{"API_KEY": "$DSH_SECRET_MY_KEY"}') })
) : null,
- draft.kind === "skill" ? (0, import_react27.createElement)(Field, { label: "Skill instructions", value: draft.content, onChange: (value) => set("content", value), multiline: true }) : null,
- draft.kind === "pack" ? (0, import_react27.createElement)(
+ draft.kind === "skill" ? (0, import_react28.createElement)(Field, { label: "Skill instructions", value: draft.content, onChange: (value) => set("content", value), multiline: true }) : null,
+ draft.kind === "pack" ? (0, import_react28.createElement)(
"div",
{ className: "bt-set-card" },
- available.length === 0 ? (0, import_react27.createElement)("div", { className: "bt-set-row" }, (0, import_react27.createElement)("span", { className: "bt-set-hint" }, t("Save an MCP server or skill first."))) : available.map((item) => (0, import_react27.createElement)(
+ available.length === 0 ? (0, import_react28.createElement)("div", { className: "bt-set-row" }, (0, import_react28.createElement)("span", { className: "bt-set-hint" }, t("Save an MCP server or skill first."))) : available.map((item) => (0, import_react28.createElement)(
"label",
{ key: item.name, className: "bt-set-row bt-bs-row" },
- (0, import_react27.createElement)("span", { className: "bt-set-copy" }, (0, import_react27.createElement)("span", { className: "bt-bs-label" }, item.name)),
- (0, import_react27.createElement)("input", { type: "checkbox", checked: draft.items.includes(item.name), onChange: (event) => set("items", event.target.checked ? [...draft.items, item.name] : draft.items.filter((name) => name !== item.name)) })
+ (0, import_react28.createElement)("span", { className: "bt-set-copy" }, (0, import_react28.createElement)("span", { className: "bt-bs-label" }, item.name)),
+ (0, import_react28.createElement)("input", { type: "checkbox", checked: draft.items.includes(item.name), onChange: (event) => set("items", event.target.checked ? [...draft.items, item.name] : draft.items.filter((name) => name !== item.name)) })
))
) : null,
- error ? (0, import_react27.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null,
- (0, import_react27.createElement)(
+ error ? (0, import_react28.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null,
+ (0, import_react28.createElement)(
"div",
{ className: "bt-connector-form-row" },
- (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onClose }, t("Cancel")),
- (0, import_react27.createElement)("button", { type: "submit", className: "bt-soft bt-soft-sm" }, draft.originalName ? t("Save changes") : t("Add capability"))
+ (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onClose }, t("Cancel")),
+ (0, import_react28.createElement)("button", { type: "submit", className: "bt-soft bt-soft-sm" }, draft.originalName ? t("Save changes") : t("Add capability"))
)
);
}
function CapabilityRow({ item, onEdit, onDelete, onApprove, confirming }) {
const detail = item.kind === "pack" ? `${t("Pack")}: ${(item.items ?? []).join(", ") || t("No items")}` : item.kind === "mcp" ? item.transport === "stdio" ? t("Local command") : t("HTTP server") : t("Skill");
const secondary = item.kind === "pack" ? [item.description, (item.items ?? []).join(", ") || t("No items")].filter(Boolean).join(" · ") : item.description || detail;
- return (0, import_react27.createElement)(
+ return (0, import_react28.createElement)(
"div",
{ className: "bt-connector" },
- (0, import_react27.createElement)(
+ (0, import_react28.createElement)(
"div",
{ className: "bt-connector-head" },
- (0, import_react27.createElement)(
+ (0, import_react28.createElement)(
"span",
{ className: "bt-connector-text" },
- (0, import_react27.createElement)("span", { className: "bt-connector-name" }, item.name),
- (0, import_react27.createElement)("span", { className: "bt-connector-status" }, secondary)
+ (0, import_react28.createElement)("span", { className: "bt-connector-name" }, item.name),
+ (0, import_react28.createElement)("span", { className: "bt-connector-status" }, secondary)
),
- (0, import_react27.createElement)(
+ (0, import_react28.createElement)(
"span",
{ className: "bt-connector-actions" },
- item.kind === "mcp" && item.transport === "stdio" && !item.approved ? (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onApprove }, t("Allow")) : null,
- (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onEdit }, t("Edit")),
- (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onDelete }, confirming ? t("Click again to delete.") : t("Delete"))
+ item.kind === "mcp" && item.transport === "stdio" && !item.approved ? (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onApprove }, t("Allow")) : null,
+ (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onEdit }, t("Edit")),
+ (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onDelete }, confirming ? t("Click again to delete.") : t("Delete"))
)
)
);
}
function CapabilitiesPage({ roster, actions, run: run2 }) {
const items = [...roster.capabilities ?? []].sort((a, b) => a.name.localeCompare(b.name));
- const [draft, setDraft] = (0, import_react27.useState)(null);
- const [confirming, setConfirming] = (0, import_react27.useState)("");
- (0, import_react27.useEffect)(() => {
+ const [draft, setDraft] = (0, import_react28.useState)(null);
+ const [confirming, setConfirming] = (0, import_react28.useState)("");
+ (0, import_react28.useEffect)(() => {
if (!confirming) return void 0;
const timer = setTimeout(() => setConfirming(""), 4e3);
return () => clearTimeout(timer);
@@ -12507,20 +12524,20 @@ function CapabilitiesPage({ roster, actions, run: run2 }) {
setConfirming("");
void run2(actions.deleteCapability(item.name));
};
- return (0, import_react27.createElement)(
+ return (0, import_react28.createElement)(
"section",
{ className: "bt-set-section" },
- (0, import_react27.createElement)("h3", null, t("Shared capabilities")),
- (0, import_react27.createElement)(
+ (0, import_react28.createElement)("h3", null, t("Shared capabilities")),
+ (0, import_react28.createElement)(
"div",
{ className: "bt-actions" },
- (0, import_react27.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: startNew }, t("Add capability"))
+ (0, import_react28.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: startNew }, t("Add capability"))
),
- draft ? (0, import_react27.createElement)(CapabilityForm, { draft, setDraft, items, actions, onClose: () => setDraft(null) }) : null,
- (0, import_react27.createElement)(
+ draft ? (0, import_react28.createElement)(CapabilityForm, { draft, setDraft, items, actions, onClose: () => setDraft(null) }) : null,
+ (0, import_react28.createElement)(
"div",
{ className: "bt-set-card bt-connectors-card" },
- items.length === 0 ? (0, import_react27.createElement)("div", { className: "bt-set-row" }, (0, import_react27.createElement)("span", { className: "bt-set-hint" }, t("No capabilities saved"))) : items.map((item) => (0, import_react27.createElement)(CapabilityRow, {
+ items.length === 0 ? (0, import_react28.createElement)("div", { className: "bt-set-row" }, (0, import_react28.createElement)("span", { className: "bt-set-hint" }, t("No capabilities saved"))) : items.map((item) => (0, import_react28.createElement)(CapabilityRow, {
key: item.name,
item,
confirming: confirming === item.name,
@@ -12536,10 +12553,10 @@ function BotCapabilitiesCard({ bot, roster, actions, run: run2, Card: Card3, Swi
const attached = new Set(bot.capabilities ?? []);
const statuses = roster.capabilityStatuses?.[bot.id] ?? {};
if (items.length === 0) return null;
- return (0, import_react27.createElement)(
+ return (0, import_react28.createElement)(
Card3,
{ title: t("Capabilities") },
- items.map((item) => (0, import_react27.createElement)(SwitchRow2, {
+ items.map((item) => (0, import_react28.createElement)(SwitchRow2, {
key: item.name,
label: item.name,
hint: attached.has(item.name) ? statusText(statuses[item.name]) : void 0,
@@ -12550,7 +12567,7 @@ function BotCapabilitiesCard({ bot, roster, actions, run: run2, Card: Card3, Swi
}
// src/client/avatar-library.js
-var import_react28 = require("react");
+var import_react29 = require("react");
var CHUNK = 20;
var PAGE = 24;
async function avatarImage(file) {
@@ -12597,14 +12614,14 @@ async function loadLibrary(actions, { offset = 0, limit = PAGE } = {}) {
return { items, total: value?.total ?? items.length, next: value?.next ?? offset + items.length };
}
function AvatarLibraryPanel({ actions, onPick }) {
- 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) => {
+ const [items, setItems] = (0, import_react29.useState)(null);
+ const [total, setTotal] = (0, import_react29.useState)(0);
+ const [offset, setOffset] = (0, import_react29.useState)(0);
+ const [busy, setBusy] = (0, import_react29.useState)(false);
+ const [error, setError] = (0, import_react29.useState)("");
+ const [report, setReport] = (0, import_react29.useState)(null);
+ const fileRef = (0, import_react29.useRef)(null);
+ const load = (0, import_react29.useCallback)(async (from = 0, append = false) => {
try {
const page = await loadLibrary(actions, { offset: from });
setItems((previous) => append ? [...previous ?? [], ...page.items] : page.items);
@@ -12614,7 +12631,7 @@ function AvatarLibraryPanel({ actions, onPick }) {
setError(failure?.message ?? String(failure));
}
}, [actions]);
- (0, import_react28.useEffect)(() => {
+ (0, import_react29.useEffect)(() => {
void load();
}, [load]);
const importFiles = async (files) => {
@@ -12649,18 +12666,18 @@ function AvatarLibraryPanel({ actions, onPick }) {
}
};
const shown = items?.length ?? 0;
- return (0, import_react28.createElement)(
+ return (0, import_react29.createElement)(
"div",
{ className: "bt-lib" },
- (0, import_react28.createElement)(
+ (0, import_react29.createElement)(
"div",
{ className: "bt-lib-bar" },
- (0, import_react28.createElement)(
+ (0, import_react29.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_react28.createElement)("input", {
+ (0, import_react29.createElement)("input", {
ref: fileRef,
type: "file",
accept: "image/png,image/jpeg,image/webp,image/gif",
@@ -12673,35 +12690,35 @@ function AvatarLibraryPanel({ actions, onPick }) {
}
})
),
- 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)(
+ error ? (0, import_react29.createElement)("div", { className: "bt-error", role: "alert" }, error) : null,
+ items === null ? (0, import_react29.createElement)("div", { className: "bt-note" }, t("Loading…")) : null,
+ items?.length === 0 && !error ? (0, import_react29.createElement)("div", { className: "bt-note" }, t("No photos in the library yet.")) : null,
+ items?.length ? (0, import_react29.createElement)("div", { className: "bt-lib-grid" }, items.map((entry) => (0, import_react29.createElement)(
"div",
{ key: entry.id, className: "bt-lib-cell" },
- (0, import_react28.createElement)(
+ (0, import_react29.createElement)(
"button",
{ type: "button", className: "bt-lib-pick", title: entry.name, "aria-label": t("Use this photo"), onClick: () => onPick(entry) },
- (0, import_react28.createElement)("img", { src: entry.image, alt: "" })
+ (0, import_react29.createElement)("img", { src: entry.image, alt: "" })
),
- (0, import_react28.createElement)(
+ (0, import_react29.createElement)(
"button",
{ type: "button", className: "bt-lib-del", "aria-label": t("Remove photo from the library"), onClick: () => void remove(entry) },
- (0, import_react28.createElement)(TrashIcon)
+ (0, import_react29.createElement)(TrashIcon)
)
))) : null,
- shown < total ? (0, import_react28.createElement)(
+ shown < total ? (0, import_react29.createElement)(
"div",
{ className: "bt-lib-more" },
- (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 }))
+ (0, import_react29.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => void load(offset, true) }, t("Show more photos")),
+ (0, import_react29.createElement)("span", { className: "bt-note" }, t("Showing {shown} of {total} photos", { shown, total }))
) : null,
- report ? (0, import_react28.createElement)(
+ report ? (0, import_react29.createElement)(
"div",
{ className: "bt-lib-report" },
- 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)(
+ report.imported.length ? (0, import_react29.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_react29.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_react29.createElement)(
"div",
{ key: index, className: "bt-note bt-danger" },
t("{name}: {reason}", { name: item.name || t("photo"), reason: hostText(item.message) })
@@ -12725,7 +12742,7 @@ var AVATAR_LIBRARY_CSS = `
`;
// src/client/memory-panel.js
-var import_react29 = require("react");
+var import_react30 = require("react");
var POLL_MS2 = 1500;
var MENU_EXIT_MS2 = 120;
var counts = /* @__PURE__ */ new Map();
@@ -12736,8 +12753,8 @@ function noteCount(id, count) {
for (const listener of countListeners) listener();
}
function useMemoryCount(id, actions) {
- const [count, setCount] = (0, import_react29.useState)(counts.get(id) ?? null);
- (0, import_react29.useEffect)(() => {
+ const [count, setCount] = (0, import_react30.useState)(counts.get(id) ?? null);
+ (0, import_react30.useEffect)(() => {
const listener = () => setCount(counts.get(id) ?? null);
countListeners.add(listener);
listener();
@@ -12756,16 +12773,16 @@ function useMemoryCount(id, actions) {
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_react29.createElement)(
+ return (0, import_react30.createElement)(
"div",
null,
- (0, import_react29.createElement)("div", { className: "bt-section-title" }, t("Memory")),
- (0, import_react29.createElement)(
+ (0, import_react30.createElement)("div", { className: "bt-section-title" }, t("Memory")),
+ (0, import_react30.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_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))
+ (0, import_react30.createElement)(MemoryIcon),
+ (0, import_react30.createElement)("span", { className: "bt-mem-row-copy" }, label),
+ (0, import_react30.createElement)("span", { className: "bt-mem-row-go" }, t("Manage"), (0, import_react30.createElement)(ChevronRightIcon))
)
);
}
@@ -12780,45 +12797,45 @@ function ago(at, now) {
return format.format(-Math.round(hours / 24), "day");
}
function Skeleton({ label }) {
- return (0, import_react29.createElement)(
+ return (0, import_react30.createElement)(
"div",
{ className: "bt-mem-skel", "aria-busy": true },
- [0, 1].map((block) => (0, import_react29.createElement)(
+ [0, 1].map((block) => (0, import_react30.createElement)(
"div",
{ key: block, className: "bt-mem-skel-block" },
- (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%" } })
+ (0, import_react30.createElement)("span", { className: "bt-mem-skel-head" }),
+ (0, import_react30.createElement)("span", null),
+ (0, import_react30.createElement)("span", null),
+ (0, import_react30.createElement)("span", { style: { width: block === 0 ? "62%" : "48%" } })
)),
- label ? (0, import_react29.createElement)("div", { className: "bt-mem-skel-label" }, label) : null
+ label ? (0, import_react30.createElement)("div", { className: "bt-mem-skel-label" }, label) : null
);
}
function Summary({ owner, view, regenerate }) {
if (view.entries.length === 0) {
- return (0, import_react29.createElement)(
+ return (0, import_react30.createElement)(
"div",
{ className: "bt-mem-empty" },
- (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 }))
+ (0, import_react30.createElement)("div", { className: "bt-mem-empty-mark" }, (0, import_react30.createElement)(MemoryIcon)),
+ (0, import_react30.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_react30.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_react29.createElement)(
+ const failed = view.error && !view.summarizing ? (0, import_react30.createElement)(
"div",
{ className: "bt-mem-failed", role: "alert" },
- (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"))
+ (0, import_react30.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_react30.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: regenerate }, t("Try again"))
) : null;
- 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,
+ if (!view.summary) return (0, import_react30.createElement)(import_react30.Fragment, null, failed, failed ? null : (0, import_react30.createElement)(Skeleton, { label: t("Writing the summary…") }));
+ return (0, import_react30.createElement)(
+ import_react30.Fragment,
null,
failed,
- (0, import_react29.createElement)(
+ (0, import_react30.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_react29.createElement)("h3", { key: index }, block.text) : (0, import_react29.createElement)("p", { key: index }, block.text))
+ summaryBlocks(view.summary.text).map((block, index) => block.kind === "h" ? (0, import_react30.createElement)("h3", { key: index }, block.text) : (0, import_react30.createElement)("p", { key: index }, block.text))
)
);
}
@@ -12830,9 +12847,9 @@ var groupEntries = (entries2) => entries2.reduce((groups, entry) => {
return groups;
}, []);
function EntryRow({ entry, remove }) {
- const [confirming, setConfirming] = (0, import_react29.useState)(false);
- const [busy, setBusy] = (0, import_react29.useState)(false);
- (0, import_react29.useEffect)(() => {
+ const [confirming, setConfirming] = (0, import_react30.useState)(false);
+ const [busy, setBusy] = (0, import_react30.useState)(false);
+ (0, import_react30.useEffect)(() => {
if (!confirming) return void 0;
const timer = setTimeout(() => setConfirming(false), 3e3);
return () => clearTimeout(timer);
@@ -12847,16 +12864,16 @@ function EntryRow({ entry, remove }) {
setBusy(true);
if (!await remove(entry)) setBusy(false);
};
- return (0, import_react29.createElement)(
+ return (0, import_react30.createElement)(
"li",
{ className: "bt-mem-entry", "data-busy": busy || void 0 },
- (0, import_react29.createElement)(
+ (0, import_react30.createElement)(
"div",
{ className: "bt-mem-entry-copy" },
- (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_react30.createElement)("span", { className: "bt-mem-entry-text" }, entry.text),
+ meta ? (0, import_react30.createElement)("span", { className: "bt-mem-entry-meta" }, meta) : null
),
- (0, import_react29.createElement)("button", {
+ (0, import_react30.createElement)("button", {
type: "button",
className: "bt-mem-remove",
"data-confirm": confirming || void 0,
@@ -12864,7 +12881,7 @@ function EntryRow({ entry, remove }) {
"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_react29.createElement)(TrashIcon))
+ }, confirming ? t("Remove") : (0, import_react30.createElement)(TrashIcon))
);
}
function Entries({ owner, view, remove }) {
@@ -12873,25 +12890,25 @@ function Entries({ owner, view, remove }) {
{ 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_react29.createElement)(
+ return (0, import_react30.createElement)(
"div",
{ className: "bt-mem-entries" },
- sections.map((section) => (0, import_react29.createElement)(
+ sections.map((section) => (0, import_react30.createElement)(
"section",
{ key: section.scope, className: "bt-mem-section" },
- (0, import_react29.createElement)(
+ (0, import_react30.createElement)(
"div",
{ className: "bt-mem-section-head" },
- (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()) }))
+ (0, import_react30.createElement)("h3", null, section.title),
+ section.hint ? (0, import_react30.createElement)("span", null, section.hint) : null,
+ (0, import_react30.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_react29.createElement)(
- import_react29.Fragment,
+ groups.some((group) => group.scope === section.scope) ? groups.filter((group) => group.scope === section.scope).map((group) => (0, import_react30.createElement)(
+ import_react30.Fragment,
{ key: group.key },
- 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"))
+ group.topic ? (0, import_react30.createElement)("div", { className: "bt-mem-topic" }, group.topic) : null,
+ (0, import_react30.createElement)("ul", { className: "bt-mem-list" }, group.entries.map((entry) => (0, import_react30.createElement)(EntryRow, { key: `${entry.topic ?? ""}:${entry.text}`, entry, remove })))
+ )) : (0, import_react30.createElement)("div", { className: "bt-mem-none" }, t("Nothing saved yet"))
))
);
}
@@ -12903,40 +12920,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_react29.createElement)(
+ return (0, import_react30.createElement)(
"div",
{ className: "bt-mem-reply", role: "status" },
- (0, import_react29.createElement)(
+ (0, import_react30.createElement)(
"div",
{ className: "bt-mem-reply-head" },
- (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))
+ (0, import_react30.createElement)("span", { className: "bt-mem-reply-asked" }, answer.asked),
+ answer.pending ? null : (0, import_react30.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Dismiss"), onClick: dismiss }, (0, import_react30.createElement)(CloseIcon))
),
- 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,
+ answer.pending ? (0, import_react30.createElement)("div", { className: "bt-mem-reply-text bt-shimmer" }, t("Thinking…")) : answer.error ? (0, import_react30.createElement)("div", { className: "bt-mem-reply-text bt-danger" }, hostText(answer.error)) : (0, import_react30.createElement)(
+ import_react30.Fragment,
null,
- 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)(
+ answer.reply ? (0, import_react30.createElement)("div", { className: "bt-mem-reply-text" }, answer.reply) : null,
+ answer.changes.length > 0 ? (0, import_react30.createElement)("ul", { className: "bt-mem-changes" }, answer.changes.map((change, index) => (0, import_react30.createElement)(
"li",
{ key: index, "data-ok": change.ok || void 0 },
- change.ok ? (0, import_react29.createElement)(CheckIcon) : (0, import_react29.createElement)(CloseIcon),
- (0, import_react29.createElement)("span", null, changeLine(change))
+ change.ok ? (0, import_react30.createElement)(CheckIcon) : (0, import_react30.createElement)(CloseIcon),
+ (0, import_react30.createElement)("span", null, changeLine(change))
))) : null
)
);
}
function useMemoryView(id, actions) {
- 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) => {
+ const [view, setView] = (0, import_react30.useState)(null);
+ const [error, setError] = (0, import_react30.useState)("");
+ const timer = (0, import_react30.useRef)(0);
+ const latest = (0, import_react30.useRef)(0);
+ const alive = (0, import_react30.useRef)(true);
+ const show2 = (0, import_react30.useCallback)((next) => {
setView(next);
setError("");
noteCount(id, next.entries.length);
}, [id]);
- const load = (0, import_react29.useCallback)(async (flags = {}) => {
+ const load = (0, import_react30.useCallback)(async (flags = {}) => {
clearTimeout(timer.current);
const ticket = ++latest.current;
try {
@@ -12948,7 +12965,7 @@ function useMemoryView(id, actions) {
if (alive.current && ticket === latest.current) setError(failure?.message ?? String(failure));
}
}, [id]);
- (0, import_react29.useEffect)(() => {
+ (0, import_react30.useEffect)(() => {
alive.current = true;
void load({ summarize: true });
return () => {
@@ -12959,8 +12976,8 @@ function useMemoryView(id, actions) {
return { view, error, load, show: show2 };
}
function useNow(every) {
- const [now, setNow] = (0, import_react29.useState)(Date.now());
- (0, import_react29.useEffect)(() => {
+ const [now, setNow] = (0, import_react30.useState)(Date.now());
+ (0, import_react30.useEffect)(() => {
const id = setInterval(() => setNow(Date.now()), every);
return () => clearInterval(id);
}, [every]);
@@ -12968,18 +12985,18 @@ function useNow(every) {
}
function MemoryDialog({ owner, actions, leaving = false }) {
const { view, error, load, show: show2 } = useMemoryView(owner.id, actions);
- const [page, setPage] = (0, import_react29.useState)("summary");
- const [menu, setMenu] = (0, import_react29.useState)(false);
+ const [page, setPage] = (0, import_react30.useState)("summary");
+ const [menu, setMenu] = (0, import_react30.useState)(false);
const [menuShown, menuLeaving] = useLinger(menu, MENU_EXIT_MS2);
- 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 [text, setText] = (0, import_react30.useState)("");
+ const [answer, setAnswer] = (0, import_react30.useState)(null);
+ const menuRef = (0, import_react30.useRef)(null);
+ const dotsRef = (0, import_react30.useRef)(null);
+ const inputRef = (0, import_react30.useRef)(null);
const now = useNow(3e4);
- const close = (0, import_react29.useCallback)(() => actions.closeMemory(), []);
+ const close = (0, import_react30.useCallback)(() => actions.closeMemory(), []);
useEscape(close);
- (0, import_react29.useEffect)(() => {
+ (0, import_react30.useEffect)(() => {
if (!menu) return void 0;
const onDown = (event) => {
if (menuRef.current?.contains(event.target) || dotsRef.current?.contains(event.target)) return;
@@ -13041,52 +13058,52 @@ function MemoryDialog({ owner, actions, leaving = false }) {
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_react29.createElement)(
+ return (0, import_react30.createElement)(
"div",
{ className: "bt-mem-layer", "data-leaving": leaving || void 0 },
- (0, import_react29.createElement)("div", { className: "bt-scrim bt-mem-scrim", onMouseDown: close }),
- (0, import_react29.createElement)(
+ (0, import_react30.createElement)("div", { className: "bt-scrim bt-mem-scrim", onMouseDown: close }),
+ (0, import_react30.createElement)(
"div",
{ className: "bt-mem", role: "dialog", "aria-modal": true, "aria-label": t("{name}'s memory", { name: owner.name }) },
- (0, import_react29.createElement)(
+ (0, import_react30.createElement)(
"div",
{ className: "bt-mem-head" },
- 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)(
+ page === "entries" ? (0, import_react30.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to the summary"), onClick: backToSummary }, (0, import_react30.createElement)(ChevronLeftIcon)) : null,
+ (0, import_react30.createElement)("h2", null, page === "entries" ? t("All entries") : t("Memory summary")),
+ (0, import_react30.createElement)("span", { className: "bt-mem-status" }, page === "summary" ? [owner.name, status].filter(Boolean).join(" · ") : status),
+ (0, import_react30.createElement)("span", { className: "bt-mem-head-gap" }),
+ (0, import_react30.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_react30.createElement)(DotsIcon)),
+ (0, import_react30.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close memory"), onClick: close }, (0, import_react30.createElement)(CloseIcon)),
+ menuShown ? (0, import_react30.createElement)(
"div",
{ ref: menuRef, className: "bt-menu bt-mem-menu", role: "menu", "aria-label": t("Memory options"), "data-leaving": menuLeaving || void 0 },
- (0, import_react29.createElement)(
+ (0, import_react30.createElement)(
"button",
{ type: "button", role: "menuitem", onClick: openEntries },
- (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_react30.createElement)("span", { className: "bt-menu-label" }, t("All entries")),
+ (0, import_react30.createElement)("span", { className: "bt-menu-hint" }, String(count))
),
- (0, import_react29.createElement)(
+ (0, import_react30.createElement)(
"button",
{ type: "button", role: "menuitem", disabled: count === 0 || view?.summarizing, onClick: regenerate },
- (0, import_react29.createElement)("span", { className: "bt-menu-label" }, t("Regenerate summary"))
+ (0, import_react30.createElement)("span", { className: "bt-menu-label" }, t("Regenerate summary"))
)
) : null
),
- (0, import_react29.createElement)(
+ (0, import_react30.createElement)(
"div",
{ className: "bt-mem-body" },
- 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 })
+ error ? (0, import_react30.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, hostText(error)) : null,
+ view === null ? error ? null : (0, import_react30.createElement)(Skeleton) : page === "entries" ? (0, import_react30.createElement)(Entries, { owner, view, remove }) : (0, import_react30.createElement)(Summary, { owner, view, regenerate })
),
- (0, import_react29.createElement)(
+ (0, import_react30.createElement)(
"div",
{ className: "bt-mem-foot" },
- answer ? (0, import_react29.createElement)(Reply, { answer, dismiss: () => setAnswer(null) }) : null,
- (0, import_react29.createElement)(
+ answer ? (0, import_react30.createElement)(Reply, { answer, dismiss: () => setAnswer(null) }) : null,
+ (0, import_react30.createElement)(
"form",
{ className: "bt-mem-ask", onSubmit: ask },
- (0, import_react29.createElement)("input", {
+ (0, import_react30.createElement)("input", {
ref: inputRef,
className: "bt-mem-input",
value: text,
@@ -13096,10 +13113,10 @@ function MemoryDialog({ owner, actions, leaving = false }) {
"aria-label": t("Ask about or update {name}'s memory", { name: owner.name }),
onChange: (event) => setText(event.target.value)
}),
- (0, import_react29.createElement)(
+ (0, import_react30.createElement)(
"button",
{ type: "submit", className: "bt-mem-send", disabled: busy || text.trim() === "", "aria-label": t("Send") },
- busy ? (0, import_react29.createElement)("span", { className: "bt-mem-spin", "aria-hidden": true }) : (0, import_react29.createElement)(ArrowUpIcon)
+ busy ? (0, import_react30.createElement)("span", { className: "bt-mem-spin", "aria-hidden": true }) : (0, import_react30.createElement)(ArrowUpIcon)
)
)
)
@@ -13108,11 +13125,11 @@ function MemoryDialog({ owner, actions, leaving = false }) {
}
// src/client/bot-settings.js
-var import_react30 = require("react");
+var import_react31 = require("react");
var capitalize = (word) => word[0].toUpperCase() + word.slice(1);
function InlineText({ label, value, placeholder, required = false, maxLength, multiline = false, onSave }) {
- const [draft, setDraft] = (0, import_react30.useState)(null);
- const reverting = (0, import_react30.useRef)(false);
+ const [draft, setDraft] = (0, import_react31.useState)(null);
+ const reverting = (0, import_react31.useRef)(false);
const commit = () => {
const next = draft?.trim();
setDraft(null);
@@ -13123,7 +13140,7 @@ function InlineText({ label, value, placeholder, required = false, maxLength, mu
if (next === void 0 || next === (value ?? "") || required && next === "") return;
void onSave(next);
};
- return (0, import_react30.createElement)(multiline ? "textarea" : "input", {
+ return (0, import_react31.createElement)(multiline ? "textarea" : "input", {
className: multiline ? "bt-bs-input bt-bs-area" : "bt-bs-input",
value: draft ?? value ?? "",
placeholder,
@@ -13144,29 +13161,29 @@ function InlineText({ label, value, placeholder, required = false, maxLength, mu
});
}
function Row({ label, hint, stack = false, children }) {
- return (0, import_react30.createElement)(
+ return (0, import_react31.createElement)(
"label",
{ className: stack ? "bt-set-row bt-bs-row bt-bs-stack" : "bt-set-row bt-bs-row" },
- (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_react31.createElement)("span", { className: "bt-set-copy" }, (0, import_react31.createElement)("span", { className: "bt-bs-label" }, label), hint ? (0, import_react31.createElement)("span", { className: "bt-set-hint" }, hint) : null),
children
);
}
function Card2({ title, 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));
+ return (0, import_react31.createElement)("section", { className: "bt-set-section" }, title ? (0, import_react31.createElement)("h3", null, title) : null, (0, import_react31.createElement)("div", { className: "bt-set-card" }, children));
}
function Switch({ on, label, disabled, onChange }) {
- return (0, import_react30.createElement)(
+ return (0, import_react31.createElement)(
"button",
{ type: "button", role: "switch", className: "bt-switch", "aria-checked": on, "aria-label": label, disabled, onClick: () => onChange(!on) },
- (0, import_react30.createElement)("span", { className: "bt-switch-knob", "aria-hidden": true })
+ (0, import_react31.createElement)("span", { className: "bt-switch-knob", "aria-hidden": true })
);
}
function SwitchRow({ label, hint, on, disabled, onChange }) {
- return (0, import_react30.createElement)(
+ return (0, import_react31.createElement)(
"div",
{ className: "bt-set-row bt-bs-row" },
- (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 })
+ (0, import_react31.createElement)("span", { className: "bt-set-copy" }, (0, import_react31.createElement)("span", { className: "bt-bs-label" }, label), hint ? (0, import_react31.createElement)("span", { className: "bt-set-hint" }, hint) : null),
+ (0, import_react31.createElement)(Switch, { on, label, disabled, onChange })
);
}
function modelHint(bot, roster) {
@@ -13177,22 +13194,22 @@ function modelHint(bot, roster) {
return t("Applies from the next message.");
}
function ShapeRing({ shape, size }) {
- const maskId = (0, import_react30.useRef)("");
+ const maskId = (0, import_react31.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_react30.createElement)("svg", { className: "bt-ring", viewBox: `0 0 ${def.size} ${def.size}`, "aria-hidden": true, dangerouslySetInnerHTML: { __html: markup } });
+ return (0, import_react31.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_react30.createElement)(
- import_react30.Fragment,
+ return (0, import_react31.createElement)(
+ import_react31.Fragment,
null,
- (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", {
+ (0, import_react31.createElement)("div", { className: "bt-shapes", role: "group", "aria-label": t("Character shape") }, rows2.map((row, index) => (0, import_react31.createElement)("div", { key: index, className: "bt-shape-row" }, row.map((id) => (0, import_react31.createElement)("button", {
key: id,
type: "button",
className: "bt-shape",
@@ -13200,8 +13217,8 @@ function CharacterGrid({ look, hasPhoto = false, onShape, onColor }) {
title: t(shapeOf(id).label),
"aria-pressed": !hasPhoto && look.shape === id,
onClick: () => onShape(id)
- }, (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", {
+ }, (0, import_react31.createElement)(ShapeRing, { shape: id, size: 36 }), (0, import_react31.createElement)(BotMark, { look: { shape: id, color: look.color }, size: 36 })))))),
+ (0, import_react31.createElement)("div", { className: "bt-colors", role: "group", "aria-label": t("Character color") }, CHARACTER_COLORS.map((color) => (0, import_react31.createElement)("button", {
key: color,
type: "button",
className: "bt-color",
@@ -13209,19 +13226,19 @@ function CharacterGrid({ look, hasPhoto = false, onShape, onColor }) {
title: t(capitalize(color)),
"aria-pressed": look.color === color,
onClick: () => onColor(color)
- }, (0, import_react30.createElement)("span", { style: { background: paintCss(color) } }))))
+ }, (0, import_react31.createElement)("span", { style: { background: paintCss(color) } }))))
);
}
function AvatarEditor({ bot, actions, run: run2, onClose }) {
const look = lookOf(bot);
- 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 [tab, setTab] = (0, import_react31.useState)(look.image ? "upload" : "bot");
+ const [over, setOver] = (0, import_react31.useState)(false);
+ const ref = (0, import_react31.useRef)(null);
+ const fileRef = (0, import_react31.useRef)(null);
const upload = (file) => {
if (file) void run2(avatarImage(file).then((image) => actions.updateBot(bot.id, { avatar: { ...bot.avatar ?? {}, image } })));
};
- (0, import_react30.useEffect)(() => {
+ (0, import_react31.useEffect)(() => {
const onDown = (event) => {
if (!(event.target instanceof Element) || ref.current?.contains(event.target) || event.target.closest(".bt-avatar-trigger")) return;
onClose();
@@ -13239,7 +13256,7 @@ function AvatarEditor({ bot, actions, run: run2, onClose }) {
window.removeEventListener("keydown", onKey, true);
};
}, [onClose]);
- (0, import_react30.useEffect)(() => {
+ (0, import_react31.useEffect)(() => {
if (tab !== "upload") return void 0;
const onPaste = (event) => {
const file = [...event.clipboardData?.files ?? []].find((item) => item.type.startsWith("image/"));
@@ -13253,32 +13270,32 @@ function AvatarEditor({ bot, actions, run: run2, onClose }) {
}, [tab, bot]);
const hasPhoto = Boolean(look.image);
const glide = useGlide(tab);
- return (0, import_react30.createElement)(
+ return (0, import_react31.createElement)(
"div",
{ ref, className: "bt-avedit", role: "dialog", "aria-label": t("Avatar editor") },
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
"div",
{ className: "bt-avedit-top" },
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
"div",
{ ref: glide.box, role: "tablist", "aria-label": t("Avatar source"), className: "bt-avedit-tabs" },
- (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_react31.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
+ [["bot", "Bot"], ["upload", "Upload"], ["library", "Library"]].map(([id, label]) => (0, import_react31.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)("button", {
+ (0, import_react31.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_react30.createElement)(CharacterGrid, {
+ tab === "bot" ? (0, import_react31.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_react30.createElement)(
+ tab === "upload" ? (0, import_react31.createElement)(
"div",
{
className: "bt-dropzone",
@@ -13294,15 +13311,15 @@ function AvatarEditor({ bot, actions, run: run2, onClose }) {
upload(event.dataTransfer.files?.[0]);
}
},
- 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)(
+ hasPhoto ? (0, import_react31.createElement)("img", { src: look.image, alt: "" }) : null,
+ (0, import_react31.createElement)("div", null, t("Drag, drop, or paste an image")),
+ (0, import_react31.createElement)(
"div",
{ className: "bt-actions", style: { justifyContent: "center" } },
- (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_react31.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => fileRef.current?.click() }, hasPhoto ? t("Replace") : t("Browse files")),
+ hasPhoto ? (0, import_react31.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)("input", { ref: fileRef, type: "file", accept: "image/png,image/jpeg,image/webp,image/gif", hidden: true, onChange: (event) => {
+ (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);
@@ -13310,7 +13327,7 @@ function AvatarEditor({ bot, actions, run: run2, onClose }) {
) : 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_react30.createElement)(AvatarLibraryPanel, {
+ tab === "library" ? (0, import_react31.createElement)(AvatarLibraryPanel, {
actions,
onPick: (entry) => run2(actions.updateBot(bot.id, { avatar: { ...bot.avatar, image: entry.image } }))
}) : null
@@ -13319,22 +13336,22 @@ function AvatarEditor({ bot, actions, run: run2, onClose }) {
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_react30.createElement)(
+ return (0, import_react31.createElement)(
Card2,
{ title: t("Memory") },
- (0, import_react30.createElement)(
+ (0, import_react31.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_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))
+ (0, import_react31.createElement)("span", { className: "bt-set-copy" }, (0, import_react31.createElement)("span", { className: "bt-bs-label" }, label)),
+ (0, import_react31.createElement)("span", { className: "bt-mem-row-go" }, t("Manage"), (0, import_react31.createElement)(ChevronRightIcon))
)
);
}
function BotSettingsForm({ bot, roster, actions, run: run2 }) {
- 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)(() => {
+ const [editing, setEditing] = (0, import_react31.useState)(false);
+ const [confirming, setConfirming] = (0, import_react31.useState)(false);
+ const closeEditor = (0, import_react31.useCallback)(() => setEditing(false), []);
+ (0, import_react31.useEffect)(() => {
if (!confirming) return void 0;
const timer = setTimeout(() => setConfirming(false), 4e3);
return () => clearTimeout(timer);
@@ -13351,63 +13368,63 @@ function BotSettingsForm({ bot, roster, actions, run: run2 }) {
if (confirming) void run2(actions.deleteBot(bot.id));
else setConfirming(true);
};
- (0, import_react30.useEffect)(() => {
+ (0, import_react31.useEffect)(() => {
void actions.refreshModels?.();
}, [bot.id]);
- return (0, import_react30.createElement)(
+ return (0, import_react31.createElement)(
"div",
{ className: "bt-bs" },
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
"div",
{ className: "bt-bs-hero" },
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
"div",
{ className: "bt-avatar-anchor" },
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
"button",
{ type: "button", className: "bt-avatar-trigger", "aria-label": t("Edit Bot avatar"), "aria-expanded": editing, onClick: () => setEditing((value) => !value) },
- (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))
+ (0, import_react31.createElement)(BotMark, { bot, size: 64, live: true }),
+ (0, import_react31.createElement)("span", { className: "bt-avatar-pencil", "aria-hidden": true }, (0, import_react31.createElement)(PencilIcon))
),
- editing ? (0, import_react30.createElement)(AvatarEditor, { bot, actions, run: run2, onClose: closeEditor }) : null
+ editing ? (0, import_react31.createElement)(AvatarEditor, { bot, actions, run: run2, onClose: closeEditor }) : null
),
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
"div",
{ className: "bt-bs-who" },
- (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_react31.createElement)("span", { className: "bt-bs-name" }, bot.name),
+ (0, import_react31.createElement)("span", { className: "bt-bs-sub" }, [bot.role, isMainBot ? t("Main Bot") : ""].filter(Boolean).join(" · ") || t("Bot"))
)
),
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
Card2,
{ title: t("Profile") },
- (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_react31.createElement)(Row, { label: t("Name") }, (0, import_react31.createElement)(InlineText, { label: t("Name"), value: bot.name, placeholder: "Bob", required: true, maxLength: 40, onSave: (name) => save({ name }) })),
+ (0, import_react31.createElement)(Row, { label: t("Label"), hint: t("Optional. Shown under the name.") }, (0, import_react31.createElement)(InlineText, { label: t("Label"), value: bot.role, placeholder: t("Research, admin…"), maxLength: 24, onSave: (role) => save({ role }) }))
),
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
Card2,
{ title: t("Model") },
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
"div",
{ className: "bt-set-row bt-bs-row" },
- (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_react31.createElement)("span", { className: "bt-set-copy" }, (0, import_react31.createElement)("span", { className: "bt-bs-label" }, t("Model")), (0, import_react31.createElement)("span", { className: "bt-set-hint" }, modelHint(bot, roster))),
+ (0, import_react31.createElement)(ModelMenu, { bot, roster, actions, run: run2 })
)
),
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
Card2,
{ title: t("Working folder") },
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
"div",
{ className: "bt-set-row bt-bs-row" },
- (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_react31.createElement)("span", { className: "bt-set-copy" }, (0, import_react31.createElement)("span", { className: "bt-bs-label" }, t("Folder"))),
+ (0, import_react31.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, onPick: (workDir) => save({ workDir }) })
)
),
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
Card2,
{ title: t("Privacy") },
- (0, import_react30.createElement)(SwitchRow, {
+ (0, import_react31.createElement)(SwitchRow, {
label: t("Private"),
hint: privacyHint,
on: bot.private === true,
@@ -13415,32 +13432,32 @@ function BotSettingsForm({ bot, roster, actions, run: run2 }) {
onChange: (value) => save({ private: value })
})
),
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
Card2,
{ title: t("Instructions") },
- (0, import_react30.createElement)(
+ (0, import_react31.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_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_react31.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)(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)(
+ (0, import_react31.createElement)(BotCapabilitiesCard, { bot, roster, actions, run: run2, Card: Card2, SwitchRow }),
+ roster.memory === false ? null : (0, import_react31.createElement)(MemoryCard, { bot, actions }),
+ (0, import_react31.createElement)(BotSchedules, { bot, roster, actions }),
+ (0, import_react31.createElement)(
Card2,
{ title: t("Main Bot") },
- onlyMain ? (0, import_react30.createElement)(
+ onlyMain ? (0, import_react31.createElement)(
"div",
{ className: "bt-set-row bt-bs-row" },
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
"span",
{ className: "bt-set-copy" },
- (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_react31.createElement)("span", { className: "bt-bs-label" }, t("Main Bot")),
+ (0, import_react31.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)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("bots") }, t("Change"))
- ) : (0, import_react30.createElement)(SwitchRow, {
+ (0, import_react31.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("bots") }, t("Change"))
+ ) : (0, import_react31.createElement)(SwitchRow, {
label: t("Main Bot"),
hint: bot.private === true ? t("A private Bot cannot be a Main Bot.") : t("Can create and change Bots, and runs every group chat."),
on: isMainBot,
@@ -13449,31 +13466,31 @@ function BotSettingsForm({ bot, roster, actions, run: run2 }) {
})
),
// The Main Bot tile is always first and always shown, like in the context menu.
- isTile ? null : (0, import_react30.createElement)(
+ isTile ? null : (0, import_react31.createElement)(
Card2,
{ title: t("Sidebar") },
- (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_react31.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_react31.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)(
+ (0, import_react31.createElement)(
Card2,
{ title: t("Manage") },
- bot.private === true ? null : (0, import_react30.createElement)(
+ bot.private === true ? null : (0, import_react31.createElement)(
"button",
{ type: "button", className: "bt-set-row bt-bs-row", onClick: duplicate },
- (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))
+ (0, import_react31.createElement)("span", { className: "bt-set-copy" }, (0, import_react31.createElement)("span", { className: "bt-bs-label" }, t("Duplicate")), (0, import_react31.createElement)("span", { className: "bt-set-hint" }, t("A copy with the same job and model, and fresh memory."))),
+ (0, import_react31.createElement)("span", { className: "bt-chevron" }, (0, import_react31.createElement)(ChevronRightIcon))
),
- isMainBot ? null : (0, import_react30.createElement)(
+ isMainBot ? null : (0, import_react31.createElement)(
"button",
{ type: "button", className: "bt-set-row bt-bs-row bt-bs-danger", "data-confirm": confirming || void 0, onClick: remove },
- (0, import_react30.createElement)(
+ (0, import_react31.createElement)(
"span",
{ className: "bt-set-copy" },
- (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_react31.createElement)("span", { className: "bt-bs-label" }, confirming ? t("Delete {name}?", { name: bot.name }) : t("Delete Bot")),
+ (0, import_react31.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-chevron" }, (0, import_react30.createElement)(ChevronRightIcon))
+ (0, import_react31.createElement)("span", { className: "bt-chevron" }, (0, import_react31.createElement)(ChevronRightIcon))
)
)
);
@@ -13534,7 +13551,7 @@ function createPayload({ name, look, image, model, effort, brief }) {
}
// src/client/create-bot.js
-var import_react31 = require("react");
+var import_react32 = require("react");
var pick = (list) => list[Math.floor(Math.random() * list.length)];
var randomLook = (avoid = {}) => {
const shapes = DEFAULT_SHAPES.filter((shape) => shape !== avoid.shape);
@@ -13542,18 +13559,18 @@ var randomLook = (avoid = {}) => {
return { shape: pick(shapes), color: pick(colors) };
};
function CreateBot({ roster, actions, start, brief = "", onBack, canGoBack, onCreated, inline = false }) {
- 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);
+ const [look, setLook] = (0, import_react32.useState)(() => randomLook());
+ const [image, setImage] = (0, import_react32.useState)(null);
+ const [library, setLibrary] = (0, import_react32.useState)(false);
+ const [name, setName] = (0, import_react32.useState)(start?.name ?? "");
+ const [model, setModel] = (0, import_react32.useState)(() => startModel(roster));
+ const [effort, setEffort] = (0, import_react32.useState)(void 0);
+ const [busy, setBusy] = (0, import_react32.useState)(false);
+ const [error, setError] = (0, import_react32.useState)("");
+ const fileRef = (0, import_react32.useRef)(null);
+ const frame = (0, import_react32.useRef)(null);
useEscape(onBack);
- (0, import_react31.useEffect)(() => {
+ (0, import_react32.useEffect)(() => {
if (inline) frame.current?.scrollIntoView({ block: "start", behavior: "smooth" });
}, []);
const fallbackName = freshBotName(roster, t("New Bot"));
@@ -13578,25 +13595,25 @@ function CreateBot({ roster, actions, start, brief = "", onBack, canGoBack, onCr
avatarImage(file).then(setImage, (failure) => setError(failure?.message ?? String(failure)));
};
const previewLook = image ? { ...look, image } : look;
- const card = (0, import_react31.createElement)(
+ const card = (0, import_react32.createElement)(
"div",
{ className: "bt-create-card" },
- (0, import_react31.createElement)(
+ (0, import_react32.createElement)(
"div",
{ className: "bt-create-preview" },
// The key remounts the mark, so every new pick plays the pop.
- (0, import_react31.createElement)(
+ (0, import_react32.createElement)(
"span",
{ key: `${look.shape}:${look.color}:${image ? "photo" : ""}`, className: "bt-create-pop" },
- (0, import_react31.createElement)(BotMark, { look: previewLook, bot: { id: "new-bot" }, size: 88, live: true, gaze: true, pokeable: true })
+ (0, import_react32.createElement)(BotMark, { look: previewLook, bot: { id: "new-bot" }, size: 88, live: true, gaze: true, pokeable: true })
),
- (0, import_react31.createElement)("span", { className: "bt-create-name" }, finalName)
+ (0, import_react32.createElement)("span", { className: "bt-create-name" }, finalName)
),
- (0, import_react31.createElement)("div", { className: "bt-create-step" }, t("Look")),
- (0, import_react31.createElement)(
+ (0, import_react32.createElement)("div", { className: "bt-create-step" }, t("Look")),
+ (0, import_react32.createElement)(
"div",
{ className: "bt-create-looks" },
- (0, import_react31.createElement)(CharacterGrid, {
+ (0, import_react32.createElement)(CharacterGrid, {
look,
hasPhoto: Boolean(image),
onShape: (shape) => {
@@ -13608,17 +13625,17 @@ function CreateBot({ roster, actions, start, brief = "", onBack, canGoBack, onCr
setLook((current) => ({ ...current, color }));
}
}),
- (0, import_react31.createElement)(
+ (0, import_react32.createElement)(
"div",
{ className: "bt-actions bt-create-lookbar" },
- (0, import_react31.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => {
+ (0, import_react32.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => {
setImage(null);
setLook((current) => randomLook(current));
} }, t("Shuffle")),
- (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) => {
+ (0, import_react32.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => fileRef.current?.click() }, image ? t("Replace photo") : t("Upload photo")),
+ (0, import_react32.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", "aria-expanded": library, onClick: () => setLibrary((value) => !value) }, t("Library")),
+ image ? (0, import_react32.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setImage(null) }, t("Remove photo")) : null,
+ (0, import_react32.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);
@@ -13626,15 +13643,15 @@ function CreateBot({ roster, actions, start, brief = "", onBack, canGoBack, onCr
)
),
// The library is a block of its own under the look, not a part of the button row.
- library ? (0, import_react31.createElement)(AvatarLibraryPanel, { actions, onPick: (entry) => {
+ library ? (0, import_react32.createElement)(AvatarLibraryPanel, { actions, onPick: (entry) => {
setImage(entry.image);
setLibrary(false);
} }) : null,
- (0, import_react31.createElement)(
+ (0, import_react32.createElement)(
"label",
{ className: "bt-field" },
- (0, import_react31.createElement)("span", { className: "bt-field-label" }, t("Name")),
- (0, import_react31.createElement)("input", {
+ (0, import_react32.createElement)("span", { className: "bt-field-label" }, t("Name")),
+ (0, import_react32.createElement)("input", {
className: "bt-input",
autoFocus: !inline,
value: name,
@@ -13649,54 +13666,54 @@ function CreateBot({ roster, actions, start, brief = "", onBack, canGoBack, onCr
}
}
}),
- 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
+ problem ? (0, import_react32.createElement)("span", { className: "bt-note bt-danger" }, hostText(problem)) : clash ? (0, import_react32.createElement)("span", { className: "bt-note bt-danger" }, t("A Bot named {name} already exists", { name: finalName })) : null
),
- (0, import_react31.createElement)(
+ (0, import_react32.createElement)(
"div",
{ className: "bt-field" },
- (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) => {
+ (0, import_react32.createElement)("span", { className: "bt-field-label" }, t("Model")),
+ (0, import_react32.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_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."))
+ (0, import_react32.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_react31.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,
- (0, import_react31.createElement)(
+ error ? (0, import_react32.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,
+ (0, import_react32.createElement)(
"div",
{ className: "bt-create-foot" },
- (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"))
+ (0, import_react32.createElement)("button", { type: "button", className: "bt-soft", onClick: onBack }, canGoBack ? t("Back") : t("Cancel")),
+ (0, import_react32.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_react31.createElement)("div", { ref: frame, className: "bt-create-inline", role: "group", "aria-label": t("Create Bot") }, card);
- return (0, import_react31.createElement)(
+ if (inline) return (0, import_react32.createElement)("div", { ref: frame, className: "bt-create-inline", role: "group", "aria-label": t("Create Bot") }, card);
+ return (0, import_react32.createElement)(
"div",
{ className: "bt-create", role: "dialog", "aria-label": t("Create Bot") },
- (0, import_react31.createElement)(
+ (0, import_react32.createElement)(
"div",
{ className: "bt-create-head" },
- 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))
+ canGoBack ? (0, import_react32.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to new chat"), onClick: onBack }, (0, import_react32.createElement)(ChevronLeftIcon)) : (0, import_react32.createElement)("span", { className: "bt-create-gap" }),
+ (0, import_react32.createElement)("span", { className: "bt-create-title" }, t("Create Bot")),
+ (0, import_react32.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close"), onClick: () => actions.closeOverlay() }, (0, import_react32.createElement)(CloseIcon))
),
- (0, import_react31.createElement)("div", { className: "bt-create-body" }, card)
+ (0, import_react32.createElement)("div", { className: "bt-create-body" }, card)
);
}
// src/client/new-chat.js
-var import_react32 = require("react");
+var import_react33 = require("react");
function NewChat({ mode, roster, actions }) {
- 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 [query, setQuery] = (0, import_react33.useState)("");
+ const [picked, setPicked] = (0, import_react33.useState)([]);
+ const [group, setGroup] = (0, import_react33.useState)(mode === "group");
+ const [admin, setAdmin] = (0, import_react33.useState)(null);
+ const [message, setMessage] = (0, import_react33.useState)("");
+ const [busy, setBusy] = (0, import_react33.useState)(false);
+ const [error, setError] = (0, import_react33.useState)("");
+ const [cursor, setCursor] = (0, import_react33.useState)(0);
+ const [draft, setDraft] = (0, import_react33.useState)(mode === "create" ? { name: "", fromList: false } : null);
+ const inputRef = (0, import_react33.useRef)(null);
const close = () => actions.closeOverlay();
useEscape(close);
const paneLeft = usePaneLeft();
@@ -13782,14 +13799,14 @@ function NewChat({ mode, roster, actions }) {
});
const options = [];
if (!group && picked.length === 0 && mode !== "search" && wanted === "") {
- 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: () => {
+ options.push({ key: "new", icon: (0, import_react33.createElement)(PlusIcon), label: t("Create new Bot"), run: createBot });
+ options.push({ key: "group", icon: (0, import_react33.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_react32.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: 16 }), label: t("Add DSH Agent"), run: () => run2(async () => {
+ options.push({ key: "agent", icon: (0, import_react33.createElement)(import_dsh_client_ui_primitives.FishLogo, { size: 16 }), label: t("Add DSH Agent"), run: () => run2(async () => {
await actions.addAgent();
close();
}) });
@@ -13798,19 +13815,19 @@ function NewChat({ mode, roster, actions }) {
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_react32.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_react33.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_react32.useRef)(null);
+ const drop = (0, import_react33.useRef)(null);
useMorph(drop, listed);
if (draft) {
- return (0, import_react32.createElement)(
+ return (0, import_react33.createElement)(
"div",
{ className: "bt-pane", style: { left: paneLeft } },
- (0, import_react32.createElement)(CreateBot, {
+ (0, import_react33.createElement)(CreateBot, {
roster,
actions,
start: draft,
@@ -13831,33 +13848,33 @@ ${listed}`, { axis: "y", ...QUICK_EDGES });
if (picked.length > 0) setPicked((current) => current.slice(0, -1));
else if (admin !== null) setAdmin(null);
};
- return (0, import_react32.createElement)(
+ return (0, import_react33.createElement)(
"div",
{ className: "bt-pane", style: { left: paneLeft } },
- (0, import_react32.createElement)(
+ (0, import_react33.createElement)(
"div",
{ className: "bt-newchat", role: "dialog", "aria-label": mode === "search" ? t("Search") : t("New chat") },
- (0, import_react32.createElement)(
+ (0, import_react33.createElement)(
"div",
{ className: "bt-to" },
- (0, import_react32.createElement)("span", { className: "bt-to-label" }, t("To:")),
- adminBot ? (0, import_react32.createElement)(
+ (0, import_react33.createElement)("span", { className: "bt-to-label" }, t("To:")),
+ adminBot ? (0, import_react33.createElement)(
"span",
{ key: adminBot.id, className: "bt-token bt-token-admin", title: t("Admin") },
- (0, import_react32.createElement)(BotMark, { bot: adminBot, size: 16 }),
+ (0, import_react33.createElement)(BotMark, { bot: adminBot, size: 16 }),
adminBot.name,
- (0, import_react32.createElement)(AdminStar),
- (0, import_react32.createElement)("button", { type: "button", "aria-label": t("Remove {name}", { name: adminBot.name }), onClick: () => setAdmin(null) }, "×")
+ (0, import_react33.createElement)(AdminStar),
+ (0, import_react33.createElement)("button", { type: "button", "aria-label": t("Remove {name}", { name: adminBot.name }), onClick: () => setAdmin(null) }, "×")
) : null,
- 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)(
+ choosingAdmin ? (0, import_react33.createElement)("span", { className: "bt-to-star", "aria-hidden": true }, (0, import_react33.createElement)(AdminStar)) : null,
+ pickedBots.map((bot) => (0, import_react33.createElement)(
"span",
{ key: bot.id, className: "bt-token" },
- (0, import_react32.createElement)(BotMark, { bot, size: 16 }),
+ (0, import_react33.createElement)(BotMark, { bot, size: 16 }),
bot.name,
- (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_react33.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)("input", {
+ (0, import_react33.createElement)("input", {
ref: inputRef,
autoFocus: true,
value: query,
@@ -13881,20 +13898,20 @@ ${listed}`, { axis: "y", ...QUICK_EDGES });
} else if (event.key === "Backspace" && query === "") unpick();
}
}),
- group && admin !== null ? (0, import_react32.createElement)("button", {
+ group && admin !== null ? (0, import_react33.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_react32.createElement)("button", { type: "button", className: "bt-x", "aria-label": t("Close new chat"), onClick: close }, "×")
+ (0, import_react33.createElement)("button", { type: "button", className: "bt-x", "aria-label": t("Close new chat"), onClick: close }, "×")
),
- (0, import_react32.createElement)("div", { ref: drop, className: "bt-drop" }, (0, import_react32.createElement)(
+ (0, import_react33.createElement)("div", { ref: drop, className: "bt-drop" }, (0, import_react33.createElement)(
"div",
{ ref: glide.box, role: "listbox", "aria-label": t("Recipients"), className: "bt-drop-list" },
- (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)(
+ (0, import_react33.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
+ options.length === 0 ? (0, import_react33.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_react33.createElement)(
"button",
{
key: option.key,
@@ -13906,21 +13923,21 @@ ${listed}`, { axis: "y", ...QUICK_EDGES });
onMouseEnter: () => setCursor(index),
onClick: option.run
},
- 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
+ option.bot ? (0, import_react33.createElement)(BotMark, { bot: option.bot, size: 22 }) : (0, import_react33.createElement)("span", { className: "bt-option-icon" }, option.icon),
+ (0, import_react33.createElement)("span", { className: "bt-option-label" }, option.label),
+ option.hint && index === active ? (0, import_react33.createElement)("span", { className: "bt-option-hint" }, option.hint) : null
))
)),
- (0, import_react32.createElement)("div", { className: "bt-nc-spacer" }),
- error ? (0, import_react32.createElement)("div", { className: "bt-error" }, error) : null,
- (0, import_react32.createElement)(
+ (0, import_react33.createElement)("div", { className: "bt-nc-spacer" }),
+ error ? (0, import_react33.createElement)("div", { className: "bt-error" }, error) : null,
+ (0, import_react33.createElement)(
"div",
{ className: "bt-nc-compose" },
- (0, import_react32.createElement)(
+ (0, import_react33.createElement)(
"div",
{ className: "bt-nc-card" },
- (0, import_react32.createElement)("span", { className: "bt-nc-plus", "aria-hidden": true }, (0, import_react32.createElement)(PlusIcon)),
- (0, import_react32.createElement)("textarea", {
+ (0, import_react33.createElement)("span", { className: "bt-nc-plus", "aria-hidden": true }, (0, import_react33.createElement)(PlusIcon)),
+ (0, import_react33.createElement)("textarea", {
rows: 1,
value: message,
placeholder,
@@ -13933,7 +13950,7 @@ ${listed}`, { axis: "y", ...QUICK_EDGES });
}
}
}),
- (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))
+ (0, import_react33.createElement)("button", { type: "button", className: "bt-nc-send", "aria-label": t("Send message"), disabled: busy || message.trim() === "" || picked.length === 0, onClick: sendMessage }, (0, import_react33.createElement)(ArrowUpIcon))
)
)
)
@@ -13941,14 +13958,14 @@ ${listed}`, { axis: "y", ...QUICK_EDGES });
}
// src/client/exchange.js
-var import_react33 = require("react");
+var import_react34 = require("react");
var SHEET_EXIT_MS = 220;
function ExchangeDialog({ pair, roster, actions }) {
- 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)(() => {
+ const [entries2, setEntries] = (0, import_react34.useState)(null);
+ const [leaving, setLeaving] = (0, import_react34.useState)(false);
+ const log = (0, import_react34.useRef)(null);
+ const atEnd = (0, import_react34.useRef)(true);
+ (0, import_react34.useLayoutEffect)(() => {
if (entries2 !== null && atEnd.current && log.current) log.current.scrollTop = log.current.scrollHeight;
}, [entries2]);
const close = () => {
@@ -13957,7 +13974,7 @@ function ExchangeDialog({ pair, roster, actions }) {
setTimeout(() => actions.closeOverlay(), SHEET_EXIT_MS);
};
useEscape(close);
- (0, import_react33.useEffect)(() => {
+ (0, import_react34.useEffect)(() => {
let stop = false;
let timer;
let seen = null;
@@ -13984,53 +14001,53 @@ function ExchangeDialog({ pair, roster, actions }) {
const flat = layoutOf(roster.prefs) === "flat";
let lastDay = 0;
const paneLeft = usePaneLeft();
- return (0, import_react33.createElement)(
+ return (0, import_react34.createElement)(
"div",
{ className: "bt-pane bt-exchange", style: { left: paneLeft }, "data-leaving": leaving || void 0 },
- (0, import_react33.createElement)(
+ (0, import_react34.createElement)(
"div",
{ className: "bt-dialog", role: "dialog", "aria-label": t("Bot exchange") },
- (0, import_react33.createElement)("div", { className: "bt-head" }, (0, import_react33.createElement)(
+ (0, import_react34.createElement)("div", { className: "bt-head" }, (0, import_react34.createElement)(
"span",
{ className: "bt-pill", style: { cursor: "default" } },
- left ? (0, import_react33.createElement)(BotMark, { bot: left, size: 22 }) : null,
+ left ? (0, import_react34.createElement)(BotMark, { bot: left, size: 22 }) : null,
left?.name ?? "?",
- (0, import_react33.createElement)("span", { className: "bt-swap" }, "⇄"),
- right ? (0, import_react33.createElement)(BotMark, { bot: right, size: 22 }) : null,
+ (0, import_react34.createElement)("span", { className: "bt-swap" }, "⇄"),
+ right ? (0, import_react34.createElement)(BotMark, { bot: right, size: 22 }) : null,
right?.name ?? "?"
)),
- (0, import_react33.createElement)(
+ (0, import_react34.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_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) => {
+ entries2 === null ? (0, import_react34.createElement)("div", { className: "bt-hint" }, t("Loading…")) : entries2.length === 0 ? (0, import_react34.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_react33.createElement)("span", { className: "bt-lead" }, (0, import_react33.createElement)(BotMark, { bot, size: 22 }));
- return (0, import_react33.createElement)(
- import_react33.Fragment,
+ const lead = (0, import_react34.createElement)("span", { className: "bt-lead" }, (0, import_react34.createElement)(BotMark, { bot, size: 22 }));
+ return (0, import_react34.createElement)(
+ import_react34.Fragment,
{ key: entry.id },
- showDay ? (0, import_react33.createElement)("time", { className: "bt-time" }, dayLabel(entry.time)) : null,
- (0, import_react33.createElement)(
+ showDay ? (0, import_react34.createElement)("time", { className: "bt-time" }, dayLabel(entry.time)) : null,
+ (0, import_react34.createElement)(
"div",
{ className: "bt-group-msg" },
- (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_react34.createElement)("span", { className: "bt-group-name", style: flat ? void 0 : { color: inkText(colorOf(bot)) } }, flat ? lead : null, bot.name),
+ (0, import_react34.createElement)(Bubbles, { texts: [stripLongNote(entry.text)], roster, selfId: bot.id, actions, whole, lead: flat ? null : lead })
)
);
})
),
- (0, import_react33.createElement)("div", { className: "bt-dialog-foot" }, (0, import_react33.createElement)("button", { type: "button", className: "bt-soft", onClick: close }, t("Close Chat")))
+ (0, import_react34.createElement)("div", { className: "bt-dialog-foot" }, (0, import_react34.createElement)("button", { type: "button", className: "bt-soft", onClick: close }, t("Close Chat")))
)
);
}
// src/client/voice.js
-var import_react34 = require("react");
+var import_react35 = 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",
@@ -14042,8 +14059,8 @@ var VOICE_LABELS = {
};
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_react34.useState)(0);
- (0, import_react34.useEffect)(() => {
+ const [level, setLevel] = (0, import_react35.useState)(0);
+ (0, import_react35.useEffect)(() => {
if (!enabled || !navigator.mediaDevices?.getUserMedia) return void 0;
let stream = null;
let audio = null;
@@ -14093,18 +14110,18 @@ function VoiceMode({ sessionId, roster, actions, useSessions, useSessionStatus }
const entry = Array.isArray(outline) ? outline[outline.length - 1] : void 0;
return entry ? `${outline.length}|${entry.response ?? ""}` : "0|";
});
- 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);
+ const [speech] = (0, import_react35.useState)(() => actions.speech());
+ const [phase, setPhase] = (0, import_react35.useState)(speech ? "starting" : speechApi() ? "listening" : "unsupported");
+ const [catalog, setCatalog] = (0, import_react35.useState)(null);
+ const [heard, setHeard] = (0, import_react35.useState)("");
+ const [said, setSaid] = (0, import_react35.useState)("");
+ const [note, setNote] = (0, import_react35.useState)("");
+ const [serviceLevel, setServiceLevel] = (0, import_react35.useState)(0);
+ const [cycle, setCycle] = (0, import_react35.useState)(0);
+ const waiting = (0, import_react35.useRef)(null);
+ const reply = (0, import_react35.useRef)(lastReply);
reply.current = lastReply;
- const turn = (0, import_react34.useRef)(0);
+ const turn = (0, import_react35.useRef)(0);
const paneLeft = usePaneLeft();
const close = () => {
turn.current += 1;
@@ -14124,12 +14141,12 @@ function VoiceMode({ sessionId, roster, actions, useSessions, useSessionStatus }
dictation.stop();
submit(text);
});
- (0, import_react34.useEffect)(() => {
+ (0, import_react35.useEffect)(() => {
if (!note) return void 0;
const timer = setTimeout(() => setNote(""), 2600);
return () => clearTimeout(timer);
}, [note]);
- (0, import_react34.useEffect)(() => {
+ (0, import_react35.useEffect)(() => {
if (!speech) return void 0;
let live = true;
speechCatalog(speech).then(({ catalog: next, usable }) => {
@@ -14144,16 +14161,16 @@ function VoiceMode({ sessionId, roster, actions, useSessions, useSessionStatus }
};
}, [speech]);
const listen = phase === "listening";
- (0, import_react34.useEffect)(() => {
+ (0, import_react35.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_react34.useEffect)(() => {
+ (0, import_react35.useEffect)(() => {
if (phase !== "listening") dictation.stop();
}, [phase]);
- (0, import_react34.useEffect)(() => {
+ (0, import_react35.useEffect)(() => {
if (!speech || !catalog || !listen) return void 0;
const own = turn.current;
let capture = null;
@@ -14215,7 +14232,7 @@ function VoiceMode({ sessionId, roster, actions, useSessions, useSessionStatus }
setServiceLevel(0);
};
}, [speech, catalog, listen, cycle]);
- (0, import_react34.useEffect)(() => {
+ (0, import_react35.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;
@@ -14235,7 +14252,7 @@ function VoiceMode({ sessionId, roster, actions, useSessions, useSessionStatus }
window.speechSynthesis.cancel();
window.speechSynthesis.speak(utterance);
}, [phase, running, lastReply]);
- (0, import_react34.useEffect)(() => () => window.speechSynthesis?.cancel(), []);
+ (0, import_react35.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";
@@ -14252,58 +14269,58 @@ function VoiceMode({ sessionId, roster, actions, useSessions, useSessionStatus }
const openSetup = phase === "setup" ? actions.voiceSetup() : null;
const caption = phase === "speaking" ? said : heard;
const shownNote = note || dictation.note;
- return (0, import_react34.createElement)(
+ return (0, import_react35.createElement)(
"div",
{ className: "bt-pane bt-voice-pane", style: { left: paneLeft } },
- (0, import_react34.createElement)(
+ (0, import_react35.createElement)(
"div",
{ className: "bt-voice-stage", role: "dialog", "aria-label": t("Voice chat with {name}", { name }), "data-phase": phase === "transcribing" ? "thinking" : phase },
- (0, import_react34.createElement)(
+ (0, import_react35.createElement)(
"div",
{ className: "bt-voice-orb", style: { "--bt-level": level } },
- (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_react35.createElement)("span", { className: "bt-voice-ring", "aria-hidden": true }),
+ (0, import_react35.createElement)("span", { className: "bt-voice-ring bt-voice-ring-2", "aria-hidden": true }),
+ bot ? (0, import_react35.createElement)(BotMark, { bot, size: 112, state: markState, live: true, gaze: phase === "listening" }) : room2 ? (0, import_react35.createElement)(RoomAvatar, { room: room2, roster, size: 112 }) : null
),
- (0, import_react34.createElement)("div", { className: "bt-voice-name" }, name),
- (0, import_react34.createElement)(
+ (0, import_react35.createElement)("div", { className: "bt-voice-name" }, name),
+ (0, import_react35.createElement)(
"div",
{ className: "bt-voice-status", role: "status" },
- 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]) : ""
+ phase === "thinking" ? (0, import_react35.createElement)(Shimmer, null, t("Thinking…")) : phase === "transcribing" ? (0, import_react35.createElement)(Shimmer, null, t("Recognizing…")) : VOICE_LABELS[phase] ? t(VOICE_LABELS[phase]) : ""
),
- (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: () => {
+ (0, import_react35.createElement)("div", { className: "bt-voice-caption", key: `${phase}:${caption.slice(0, 12)}` }, caption),
+ openSetup ? (0, import_react35.createElement)("button", { type: "button", className: "bt-voice-setup", onClick: () => {
close();
openSetup();
} }, t("Set up voice input")) : null,
- shownNote ? (0, import_react34.createElement)("div", { className: "bt-voice-note" }, shownNote) : null
+ shownNote ? (0, import_react35.createElement)("div", { className: "bt-voice-note" }, shownNote) : null
),
- (0, import_react34.createElement)(
+ (0, import_react35.createElement)(
"div",
{ className: "bt-voice-bar" },
- (0, import_react34.createElement)("button", {
+ (0, import_react35.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_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))
+ }, (0, import_react35.createElement)(MicIcon, { size: 20 }), phase === "paused" ? (0, import_react35.createElement)("span", { className: "bt-voice-slash", "aria-hidden": true }) : null),
+ (0, import_react35.createElement)("button", { type: "button", className: "bt-voice-btn bt-voice-end", "aria-label": t("End voice chat"), onClick: close }, (0, import_react35.createElement)(CloseIcon))
)
);
}
// src/client/permission-picker.js
-var import_react35 = require("react");
+var import_react36 = 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_react35.useState)(null);
- const flight = (0, import_react35.useRef)({ value: void 0, latest: void 0 });
- (0, import_react35.useEffect)(() => {
+ const [pending, setPending] = (0, import_react36.useState)(null);
+ const flight = (0, import_react36.useRef)({ value: void 0, latest: void 0 });
+ (0, import_react36.useEffect)(() => {
const flying = flight.current.value;
if (pending === saved && (flying === void 0 || flying === pending)) setPending(null);
}, [pending, saved]);
@@ -14330,10 +14347,10 @@ function PermissionPicker({ catalog, saved, onPick, repick = false }) {
}
send(value);
};
- return (0, import_react35.createElement)(
+ return (0, import_react36.createElement)(
Segmented,
{ label: t("Permissions"), value: current },
- catalog.options.map((option) => (0, import_react35.createElement)("button", {
+ catalog.options.map((option) => (0, import_react36.createElement)("button", {
key: option.value,
type: "button",
"aria-pressed": option.value === current,
@@ -14345,7 +14362,7 @@ function PermissionPicker({ catalog, saved, onPick, repick = false }) {
}
// src/client/group-settings.js
-var import_react36 = require("react");
+var import_react37 = 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."]
@@ -14356,8 +14373,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_react36.useState)(room2.relayLimit ?? "");
- (0, import_react36.useEffect)(() => setDraft(room2.relayLimit ?? ""), [room2.relayLimit]);
+ const [draft, setDraft] = (0, import_react37.useState)(room2.relayLimit ?? "");
+ (0, import_react37.useEffect)(() => setDraft(room2.relayLimit ?? ""), [room2.relayLimit]);
const save = () => {
const text = String(draft).trim();
if (text === "") {
@@ -14371,10 +14388,10 @@ function RelayLimitRow({ room: room2, update }) {
}
update({ relayLimit: limit });
};
- return (0, import_react36.createElement)(
+ return (0, import_react37.createElement)(
Row,
{ label: t("Pause Bot relays after"), hint: t("Counted since your last message in this group.") },
- (0, import_react36.createElement)("input", {
+ (0, import_react37.createElement)("input", {
className: "bt-bs-input bt-bs-num",
type: "number",
min: 1,
@@ -14396,26 +14413,26 @@ function RelayLimitRow({ room: room2, update }) {
function GroupPermission({ room: room2, catalog, update }) {
if (!catalog?.options?.length) return null;
const shared2 = room2.permission !== void 0;
- return (0, import_react36.createElement)(
+ return (0, import_react37.createElement)(
Card2,
{ title: t("Permissions") },
- (0, import_react36.createElement)(SwitchRow, {
+ (0, import_react37.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_react36.createElement)(
+ shared2 ? (0, import_react37.createElement)(
"div",
{ className: "bt-set-row bt-bs-row bt-bs-stack bt-gs-perm bt-veil" },
- (0, import_react36.createElement)(PermissionPicker, { catalog, saved: room2.permission, onPick: (permission) => update({ permission }) })
+ (0, import_react37.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_react36.useState)(false);
- const [confirming, setConfirming] = (0, import_react36.useState)(false);
- (0, import_react36.useEffect)(() => {
+ const [adding, setAdding] = (0, import_react37.useState)(false);
+ const [confirming, setConfirming] = (0, import_react37.useState)(false);
+ (0, import_react37.useEffect)(() => {
if (!confirming) return void 0;
const timer = setTimeout(() => setConfirming(false), 4e3);
return () => clearTimeout(timer);
@@ -14439,41 +14456,41 @@ function GroupSettingsForm({ room: room2, roster, actions, run: run2, onDeleted
if (done) onDeleted?.();
});
};
- return (0, import_react36.createElement)(
+ return (0, import_react37.createElement)(
"div",
{ className: "bt-bs" },
- (0, import_react36.createElement)(
+ (0, import_react37.createElement)(
"div",
{ className: "bt-bs-hero" },
- (0, import_react36.createElement)(RoomAvatar, { room: room2, roster, size: 64 }),
- (0, import_react36.createElement)(
+ (0, import_react37.createElement)(RoomAvatar, { room: room2, roster, size: 64 }),
+ (0, import_react37.createElement)(
"div",
{ className: "bt-bs-who" },
- (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_react37.createElement)("span", { className: "bt-bs-name" }, room2.name),
+ (0, import_react37.createElement)("span", { className: "bt-bs-sub" }, roomSubtitle(room2, roster))
)
),
- (0, import_react36.createElement)(
+ (0, import_react37.createElement)(
Card2,
{ title: t("Profile") },
- (0, import_react36.createElement)(
+ (0, import_react37.createElement)(
Row,
{ label: t("Name"), hint: t("Leave it empty to name the group after its members.") },
- (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_react37.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)(
+ (0, import_react37.createElement)(
Row,
{ label: t("Notice"), hint: t("Every member reads it before speaking in this group."), stack: true },
- (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_react37.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)(
+ (0, import_react37.createElement)(
Card2,
{ title: t("Who answers") },
- (0, import_react36.createElement)(
+ (0, import_react37.createElement)(
"div",
{ className: "bt-set-row bt-bs-row bt-bs-stack" },
- (0, import_react36.createElement)(Segmented, { label: t("Who answers"), value: mode }, ROOM_MODES.map(([id, label]) => (0, import_react36.createElement)("button", {
+ (0, import_react37.createElement)(Segmented, { label: t("Who answers"), value: mode }, ROOM_MODES.map(([id, label]) => (0, import_react37.createElement)("button", {
key: id,
type: "button",
"aria-pressed": mode === id,
@@ -14483,88 +14500,88 @@ function GroupSettingsForm({ room: room2, roster, actions, run: run2, onDeleted
if (mode !== id) void update({ mode: id });
}
}, t(label)))),
- (0, import_react36.createElement)("span", { key: mode, className: "bt-set-hint bt-veil" }, `${t(modeHint)} ${t("@mentions always pick who answers.")}`)
+ (0, import_react37.createElement)("span", { key: mode, className: "bt-set-hint bt-veil" }, `${t(modeHint)} ${t("@mentions always pick who answers.")}`)
),
- (0, import_react36.createElement)(RelayLimitRow, { room: room2, update })
+ (0, import_react37.createElement)(RelayLimitRow, { room: room2, update })
),
- (0, import_react36.createElement)(
+ (0, import_react37.createElement)(
Card2,
{ title: t("Working folder") },
- (0, import_react36.createElement)(
+ (0, import_react37.createElement)(
"div",
{ className: "bt-set-row bt-bs-row" },
- (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_react37.createElement)("span", { className: "bt-set-copy" }, (0, import_react37.createElement)("span", { className: "bt-bs-label" }, t("Folder"))),
+ (0, import_react37.createElement)(FolderMenu, { value: room2.workDir, group: true, actions, run: run2, onPick: (workDir) => update({ workDir }) })
)
),
- (0, import_react36.createElement)(GroupPermission, { room: room2, catalog: roster.permissions, update }),
- (0, import_react36.createElement)(
+ (0, import_react37.createElement)(GroupPermission, { room: room2, catalog: roster.permissions, update }),
+ (0, import_react37.createElement)(
Card2,
{ title: t("Members · {count}", { count: members.length }) },
members.map((member) => {
const leads = room2.admin === member.id;
- return (0, import_react36.createElement)(
+ return (0, import_react37.createElement)(
"div",
{ key: member.id, className: "bt-set-row bt-bs-row bt-gs-member" },
- (0, import_react36.createElement)(
+ (0, import_react37.createElement)(
"button",
{ type: "button", className: "bt-gs-who", title: t("Open {name}'s chat", { name: member.name }), onClick: () => openBot(member.id) },
- (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
+ (0, import_react37.createElement)(BotAvatar, { bot: member, size: 26, main: isMainOf(roster, member.id), admin: leads, live: false }),
+ (0, import_react37.createElement)("span", { className: "bt-row-title" }, member.name),
+ leads ? (0, import_react37.createElement)("span", { className: "bt-tag" }, t("Admin")) : 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
+ leads ? (0, import_react37.createElement)("button", { type: "button", className: "bt-mini", title: t("Leave the group without an admin"), onClick: () => update({ admin: null }) }, t("Unset")) : (0, import_react37.createElement)("button", { type: "button", className: "bt-mini", onClick: () => update({ admin: member.id }) }, t("Make admin")),
+ members.length > 2 ? (0, import_react37.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_react36.createElement)(
+ ...outside.map((bot) => (0, import_react37.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_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_react37.createElement)(BotMark, { bot, size: 22 }),
+ (0, import_react37.createElement)("span", { className: "bt-set-copy" }, (0, import_react37.createElement)("span", { className: "bt-bs-label" }, bot.name)),
+ (0, import_react37.createElement)("span", { className: "bt-set-hint" }, t("Add"))
)),
- (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)(
+ (0, import_react37.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_react37.createElement)("button", { type: "button", className: "bt-set-row bt-bs-row bt-gs-add", onClick: () => setAdding(true) }, (0, import_react37.createElement)(PlusIcon), t("Add member")) : null,
+ (0, import_react37.createElement)("div", { className: "bt-set-row bt-gs-note" }, (0, import_react37.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_react36.createElement)(
+ (0, import_react37.createElement)(
Card2,
{ title: t("Sidebar") },
- (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_react37.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_react37.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)(
+ (0, import_react37.createElement)(
Card2,
{ title: t("Manage") },
- (0, import_react36.createElement)(
+ (0, import_react37.createElement)(
"button",
{ type: "button", className: "bt-set-row bt-bs-row bt-bs-danger", "data-confirm": confirming || void 0, onClick: remove },
- (0, import_react36.createElement)(
+ (0, import_react37.createElement)(
"span",
{ className: "bt-set-copy" },
- (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_react37.createElement)("span", { className: "bt-bs-label" }, confirming ? t("Delete {name}?", { name: room2.name }) : t("Delete group")),
+ (0, import_react37.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-chevron" }, (0, import_react36.createElement)(ChevronRightIcon))
+ (0, import_react37.createElement)("span", { className: "bt-chevron" }, (0, import_react37.createElement)(ChevronRightIcon))
)
)
);
}
function NewGroupForm({ roster, actions, run: run2, onCreated, onCancel }) {
- 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 [admin, setAdmin] = (0, import_react37.useState)(null);
+ const [members, setMembers] = (0, import_react37.useState)([]);
+ const [name, setName] = (0, import_react37.useState)("");
+ const [busy, setBusy] = (0, import_react37.useState)(false);
const toggle = (id) => setMembers((list) => list.includes(id) ? list.filter((item) => item !== id) : [...list, id]);
const pickAdmin = (id) => {
setAdmin(id);
@@ -14580,48 +14597,48 @@ function NewGroupForm({ roster, actions, run: run2, onCreated, onCancel }) {
if (done && room2) onCreated(room2);
else setBusy(false);
};
- const chip = (bot, on, onClick, role) => (0, import_react36.createElement)("button", {
+ const chip = (bot, on, onClick, role) => (0, import_react37.createElement)("button", {
key: bot.id,
type: "button",
role,
className: "bt-ng-chip",
"aria-checked": on,
onClick
- }, (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)(
+ }, (0, import_react37.createElement)(BotAvatar, { bot, size: 22, badge: false, live: false }), (0, import_react37.createElement)("span", { className: "bt-ng-name" }, bot.name), on && role === "radio" ? (0, import_react37.createElement)(AdminStar) : null);
+ return (0, import_react37.createElement)(
"div",
{ className: "bt-set-card bt-ng" },
- (0, import_react36.createElement)(
+ (0, import_react37.createElement)(
"div",
{ className: "bt-set-row bt-bs-row bt-bs-stack" },
- (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)(
+ (0, import_react37.createElement)("span", { className: "bt-set-copy" }, (0, import_react37.createElement)("span", { className: "bt-bs-label bt-ng-label" }, (0, import_react37.createElement)(AdminStar), t("Choose the group admin"))),
+ (0, import_react37.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_react36.createElement)(
+ admin === null ? null : (0, import_react37.createElement)(
"div",
{ className: "bt-set-row bt-bs-row bt-bs-stack bt-ng-step" },
- (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)(
+ (0, import_react37.createElement)("span", { className: "bt-set-copy" }, (0, import_react37.createElement)("span", { className: "bt-bs-label" }, t("Who to chat with…"))),
+ (0, import_react37.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_react36.createElement)(
+ admin === null || members.length === 0 ? null : (0, import_react37.createElement)(
"label",
{ className: "bt-set-row bt-bs-row bt-ng-step" },
- (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_react37.createElement)("span", { className: "bt-set-copy" }, (0, import_react37.createElement)("span", { className: "bt-bs-label" }, t("Name"))),
+ (0, import_react37.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)(
+ (0, import_react37.createElement)(
"div",
{ className: "bt-set-row bt-task-foot" },
- (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"))
+ (0, import_react37.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),
+ (0, import_react37.createElement)("button", { type: "button", className: "bt-send bt-soft-sm", disabled: busy || admin === null || members.length === 0, onClick: () => void create() }, t("Create group chat"))
)
);
}
@@ -14649,11 +14666,11 @@ var GROUP_SETTINGS_CSS = `
`;
// src/client/kept-private.js
-var import_react37 = require("react");
+var import_react38 = require("react");
function KeptPrivateSection({ roster, actions, run: run2, Section, Row: Row3 }) {
const kept = roster.privateArchives ?? [];
- const [confirming, setConfirming] = (0, import_react37.useState)(null);
- (0, import_react37.useEffect)(() => {
+ const [confirming, setConfirming] = (0, import_react38.useState)(null);
+ (0, import_react38.useEffect)(() => {
if (confirming === null) return void 0;
const timer = setTimeout(() => setConfirming(null), 4e3);
return () => clearTimeout(timer);
@@ -14667,14 +14684,14 @@ function KeptPrivateSection({ roster, actions, run: run2, Section, Row: Row3 })
setConfirming(null);
void run2(actions.releasePrivate(entry.id));
};
- return (0, import_react37.createElement)(
+ return (0, import_react38.createElement)(
Section,
{ title: t("Closed after deletion · {count}", { count: kept.length }) },
- kept.map((entry) => (0, import_react37.createElement)(Row3, {
+ kept.map((entry) => (0, import_react38.createElement)(Row3, {
key: entry.id,
label: entry.name,
hint: confirming === entry.id ? t("Click again to remove. Other Bots can then read its folder, memory and chats.") : entry.workDir
- }, (0, import_react37.createElement)("button", { type: "button", className: `bt-soft bt-soft-sm${confirming === entry.id ? " bt-danger" : ""}`, onClick: () => release(entry) }, t("Remove protection"))))
+ }, (0, import_react38.createElement)("button", { type: "button", className: `bt-soft bt-soft-sm${confirming === entry.id ? " bt-danger" : ""}`, onClick: () => release(entry) }, t("Remove protection"))))
);
}
@@ -14811,7 +14828,7 @@ function percent2(part, whole) {
}
// src/client/usage-page.js
-var import_react38 = require("react");
+var import_react39 = require("react");
var HEAT_WEEKS = 53;
var TOP_SERIES = 7;
var RING_R = 42;
@@ -14858,9 +14875,9 @@ function titleOf2(range, bucket) {
return dates({ year: "numeric", month: "long" }).format(bucket.start);
}
function useTween(value) {
- const [shown, setShown] = (0, import_react38.useState)(0);
- const from = (0, import_react38.useRef)(0);
- (0, import_react38.useEffect)(() => {
+ const [shown, setShown] = (0, import_react39.useState)(0);
+ const from = (0, import_react39.useRef)(0);
+ (0, import_react39.useEffect)(() => {
if (reducedMotion() || typeof requestAnimationFrame !== "function") {
from.current = value;
setShown(value);
@@ -14880,9 +14897,9 @@ function useTween(value) {
}, [value]);
return shown;
}
-var glyphBox = (size, icon2) => (0, import_react38.createElement)("span", { className: "bt-us-glyph", style: { width: size, height: size } }, (0, import_react38.createElement)(icon2));
+var glyphBox = (size, icon2) => (0, import_react39.createElement)("span", { className: "bt-us-glyph", style: { width: size, height: size } }, (0, import_react39.createElement)(icon2));
function ModelGlyph({ name, paint, size }) {
- return (0, import_react38.createElement)("span", {
+ return (0, import_react39.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))` }
@@ -14899,7 +14916,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_react38.createElement)(BotAvatar, { bot, size, badge: false, live: false })
+ glyph: (size) => (0, import_react39.createElement)(BotAvatar, { bot, size, badge: false, live: false })
};
}
if (owner.kind === "room") {
@@ -14909,7 +14926,7 @@ function ownerFace(owner, roster) {
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_react38.createElement)(RoomAvatar, { room: room2, roster, size }) : glyphBox(size, ChatsIcon)
+ glyph: (size) => room2 ? (0, import_react39.createElement)(RoomAvatar, { room: room2, roster, size }) : glyphBox(size, ChatsIcon)
};
}
if (owner.kind === "agent") {
@@ -14931,30 +14948,30 @@ function Tabs({ label, value, options, onChange, boxRef }) {
const names = options.map(([, text]) => text).join("\n");
const glide = useGlide(`${value}
${names}`, { box: boxRef });
- return (0, import_react38.createElement)(
+ return (0, import_react39.createElement)(
"div",
{ ref: glide.box, className: "bt-us-tabs", role: "group", "aria-label": label },
- (0, import_react38.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
- options.map(([id, text, icon2]) => (0, import_react38.createElement)("button", { key: id, type: "button", "aria-pressed": value === id, onClick: () => onChange(id) }, icon2 ? (0, import_react38.createElement)(icon2) : null, text))
+ (0, import_react39.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
+ options.map(([id, text, icon2]) => (0, import_react39.createElement)("button", { key: id, type: "button", "aria-pressed": value === id, onClick: () => onChange(id) }, icon2 ? (0, import_react39.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_react38.createElement)("div", { className: "bt-us-stat" }, (0, import_react38.createElement)("span", { className: "bt-us-stat-label" }, label), (0, import_react38.createElement)("span", { className: "bt-us-stat-value" }, value));
- return (0, import_react38.createElement)(
+ const cell = (label, value) => (0, import_react39.createElement)("div", { className: "bt-us-stat" }, (0, import_react39.createElement)("span", { className: "bt-us-stat-label" }, label), (0, import_react39.createElement)("span", { className: "bt-us-stat-value" }, value));
+ return (0, import_react39.createElement)(
"section",
{ className: "bt-us-stats", style: { "--i": 0 } },
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(
"div",
{ className: "bt-us-stat bt-us-stat-main" },
- (0, import_react38.createElement)("span", { className: "bt-us-stat-label" }, lastText(range)),
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)("span", { className: "bt-us-stat-label" }, lastText(range)),
+ (0, import_react39.createElement)(
"span",
{ className: "bt-us-stat-value" },
compact(shown),
- (0, import_react38.createElement)("small", null, t("tokens")),
- change === null ? null : (0, import_react38.createElement)(
+ (0, import_react39.createElement)("small", null, t("tokens")),
+ change === null ? null : (0, import_react39.createElement)(
"span",
{ className: "bt-us-delta", title: compareText(range) },
`${change >= 0 ? "↑" : "↓"} ${Math.abs(change)}%`
@@ -14972,83 +14989,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_react38.useState)(null);
+ const [hover, setHover] = (0, import_react39.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_react38.createElement)(
+ return (0, import_react39.createElement)(
"section",
{ className: "bt-us-card bt-us-chart", style: { "--i": 1 } },
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(
"div",
{ className: "bt-us-card-head" },
- (0, import_react38.createElement)("h3", null, t("Tokens over time"), (0, import_react38.createElement)("span", null, unitLabel(range.unit))),
- onBy ? (0, import_react38.createElement)(Tabs, { label: t("Group usage by"), value: by, onChange: onBy, options: [["bot", t("By Bot")], ["model", t("By model")]] }) : null
+ (0, import_react39.createElement)("h3", null, t("Tokens over time"), (0, import_react39.createElement)("span", null, unitLabel(range.unit))),
+ onBy ? (0, import_react39.createElement)(Tabs, { label: t("Group usage by"), value: by, onChange: onBy, options: [["bot", t("By Bot")], ["model", t("By model")]] }) : null
),
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(
"div",
{ className: "bt-us-chart-body" },
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(
"div",
{ className: "bt-us-plot", "data-hover": hover === null ? void 0 : "", onMouseLeave: () => setHover(null) },
- [1, 0.5].map((level) => (0, import_react38.createElement)("div", { key: level, className: "bt-us-grid", style: { bottom: `${level * 100}%` } }, (0, import_react38.createElement)("span", null, compact(top * level)))),
- (0, import_react38.createElement)("div", { className: "bt-us-grid bt-us-base", style: { bottom: 0 } }, (0, import_react38.createElement)("span", null, "0")),
- (0, import_react38.createElement)(
+ [1, 0.5].map((level) => (0, import_react39.createElement)("div", { key: level, className: "bt-us-grid", style: { bottom: `${level * 100}%` } }, (0, import_react39.createElement)("span", null, compact(top * level)))),
+ (0, import_react39.createElement)("div", { className: "bt-us-grid bt-us-base", style: { bottom: 0 } }, (0, import_react39.createElement)("span", null, "0")),
+ (0, import_react39.createElement)(
"div",
{ className: "bt-us-cols" },
- columns2.map((column, at) => (0, import_react38.createElement)("div", {
+ columns2.map((column, at) => (0, import_react39.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_react38.createElement)(
+ }, column.total > 0 ? (0, import_react39.createElement)(
"div",
{ className: "bt-us-stack", style: { height: `${column.total / top * 100}%`, "--i": at } },
- column.parts.map(([key, value]) => value > 0 ? (0, import_react38.createElement)("i", { key, style: { flexGrow: value, background: fillOf.get(key) } }) : null)
- ) : (0, import_react38.createElement)("div", { className: "bt-us-stub" })))
+ column.parts.map(([key, value]) => value > 0 ? (0, import_react39.createElement)("i", { key, style: { flexGrow: value, background: fillOf.get(key) } }) : null)
+ ) : (0, import_react39.createElement)("div", { className: "bt-us-stub" })))
),
- tip ? (0, import_react38.createElement)(
+ tip ? (0, import_react39.createElement)(
"div",
{ className: "bt-us-tip", style: tipSide },
- (0, import_react38.createElement)("div", { className: "bt-us-tip-title" }, tip.title),
- (0, import_react38.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_react38.createElement)(
+ (0, import_react39.createElement)("div", { className: "bt-us-tip-title" }, tip.title),
+ (0, import_react39.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_react39.createElement)(
"div",
{ key, className: "bt-us-tip-row" },
- (0, import_react38.createElement)("i", { className: "bt-us-dot", style: { background: tipOf.get(key)?.fill } }),
- (0, import_react38.createElement)("span", null, tipOf.get(key)?.name),
- (0, import_react38.createElement)("b", null, compact(value))
+ (0, import_react39.createElement)("i", { className: "bt-us-dot", style: { background: tipOf.get(key)?.fill } }),
+ (0, import_react39.createElement)("span", null, tipOf.get(key)?.name),
+ (0, import_react39.createElement)("b", null, compact(value))
))
) : null
),
- (0, import_react38.createElement)(
+ (0, import_react39.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_react38.createElement)(
+ columns2.map((column, at) => (0, import_react39.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_react38.createElement)(
+ series.length > 1 || series[0]?.pick ? (0, import_react39.createElement)(
"div",
{ className: "bt-us-legend" },
- series.map((entry) => (0, import_react38.createElement)(entry.pick ? "button" : "span", {
+ series.map((entry) => (0, import_react39.createElement)(entry.pick ? "button" : "span", {
key: entry.key,
className: "bt-us-key",
...entry.pick ? { type: "button", onClick: () => onPick(entry.pick) } : {}
- }, (0, import_react38.createElement)("i", { className: "bt-us-dot", style: { background: entry.fill } }), entry.name))
+ }, (0, import_react39.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_react38.createElement)(
+ return (0, import_react39.createElement)(
onClick ? "button" : "div",
{
className: "bt-us-row",
@@ -15057,69 +15074,69 @@ function Row2({ kind, glyph, name, sub, sum, whole, fill: fill2, index, onClick
title: t("{tokens} tokens · {calls} calls", { tokens: full(sum.total), calls: full(sum.calls) }),
...onClick ? { type: "button", onClick } : {}
},
- glyph ? (0, import_react38.createElement)("span", { className: "bt-us-row-glyph" }, glyph) : null,
- (0, import_react38.createElement)(
+ glyph ? (0, import_react39.createElement)("span", { className: "bt-us-row-glyph" }, glyph) : null,
+ (0, import_react39.createElement)(
"span",
{ className: "bt-us-row-body" },
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(
"span",
{ className: "bt-us-row-line" },
- (0, import_react38.createElement)("span", { className: "bt-us-row-name" }, name),
- sub ? (0, import_react38.createElement)("span", { className: "bt-us-row-sub" }, sub) : null
+ (0, import_react39.createElement)("span", { className: "bt-us-row-name" }, name),
+ sub ? (0, import_react39.createElement)("span", { className: "bt-us-row-sub" }, sub) : null
),
- (0, import_react38.createElement)("span", { className: "bt-us-track" }, (0, import_react38.createElement)("span", { style: { width: `${width}%`, background: fill2 } }))
+ (0, import_react39.createElement)("span", { className: "bt-us-track" }, (0, import_react39.createElement)("span", { style: { width: `${width}%`, background: fill2 } }))
),
- (0, import_react38.createElement)("span", { className: "bt-us-row-num" }, (0, import_react38.createElement)("b", null, compact(sum.total)), (0, import_react38.createElement)("small", null, `${percent2(sum.total, whole)}%`))
+ (0, import_react39.createElement)("span", { className: "bt-us-row-num" }, (0, import_react39.createElement)("b", null, compact(sum.total)), (0, import_react39.createElement)("small", null, `${percent2(sum.total, whole)}%`))
);
}
function ListCard({ title, count, index, children }) {
- return (0, import_react38.createElement)(
+ return (0, import_react39.createElement)(
"section",
{ className: "bt-us-card", style: { "--i": index } },
- (0, import_react38.createElement)("div", { className: "bt-us-card-head" }, (0, import_react38.createElement)("h3", null, title, count === void 0 ? null : (0, import_react38.createElement)("span", null, count))),
- (0, import_react38.createElement)("div", { className: "bt-us-rows" }, children)
+ (0, import_react39.createElement)("div", { className: "bt-us-card-head" }, (0, import_react39.createElement)("h3", null, title, count === void 0 ? null : (0, import_react39.createElement)("span", null, count))),
+ (0, import_react39.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_react38.createElement)(
+ return (0, import_react39.createElement)(
"section",
{ className: "bt-us-profile" },
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(
"span",
{ className: "bt-us-ring" },
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(
"svg",
{ viewBox: "0 0 96 96", "aria-hidden": true },
- face.stops ? (0, import_react38.createElement)("defs", null, (0, import_react38.createElement)(
+ face.stops ? (0, import_react39.createElement)("defs", null, (0, import_react39.createElement)(
"linearGradient",
{ id: "bt-us-ring-paint", x1: 0, y1: 1, x2: 1, y2: 0 },
- face.stops.map(([offset, color]) => (0, import_react38.createElement)("stop", { key: offset, offset, stopColor: color }))
+ face.stops.map(([offset, color]) => (0, import_react39.createElement)("stop", { key: offset, offset, stopColor: color }))
)) : null,
- (0, import_react38.createElement)("circle", { className: "bt-us-ring-track", cx: 48, cy: 48, r: RING_R }),
- arc > 0 ? (0, import_react38.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_react39.createElement)("circle", { className: "bt-us-ring-track", cx: 48, cy: 48, r: RING_R }),
+ arc > 0 ? (0, import_react39.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_react38.createElement)("span", { className: "bt-us-ring-face" }, face.glyph(64))
+ (0, import_react39.createElement)("span", { className: "bt-us-ring-face" }, face.glyph(64))
),
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(
"div",
{ className: "bt-us-profile-copy" },
- (0, import_react38.createElement)("h3", null, face.name),
- face.sub ? (0, import_react38.createElement)("span", { className: "bt-us-profile-sub" }, face.sub) : null,
- (0, import_react38.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_react39.createElement)("h3", null, face.name),
+ face.sub ? (0, import_react39.createElement)("span", { className: "bt-us-profile-sub" }, face.sub) : null,
+ (0, import_react39.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_react38.useRef)(null);
+ const box = (0, import_react39.useRef)(null);
const todayMs = hourMs(today);
const thisMonth = monthOf(todayMs);
- const [right, setRight] = (0, import_react38.useState)(() => Math.max(addMonths(oldest, 1), monthOf(hourMs(span?.to ?? today))));
- const [anchor, setAnchor] = (0, import_react38.useState)(null);
- const [hover, setHover] = (0, import_react38.useState)(null);
- (0, import_react38.useEffect)(() => {
+ const [right, setRight] = (0, import_react39.useState)(() => Math.max(addMonths(oldest, 1), monthOf(hourMs(span?.to ?? today))));
+ const [anchor, setAnchor] = (0, import_react39.useState)(null);
+ const [hover, setHover] = (0, import_react39.useState)(null);
+ (0, import_react39.useEffect)(() => {
const onDown = (event) => {
if (![box, near].some((ref) => ref.current?.contains(event.target))) onClose();
};
@@ -15145,17 +15162,17 @@ function SpanPicker({ span, today, oldest, active, near, onPick, onClose }) {
const [from, to] = [anchor, key].sort();
onPick(from, to);
};
- const weekdays = (0, import_react38.useMemo)(() => Array.from({ length: 7 }, (_, at) => dates({ weekday: "narrow" }).format(Date.UTC(2024, 0, 1 + at))), []);
+ const weekdays = (0, import_react39.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_react38.createElement)("span", { key: `b${at}` }));
+ const cells = Array.from({ length: lead }, (_, at) => (0, import_react39.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_react38.createElement)("button", {
+ cells.push((0, import_react39.createElement)("button", {
key,
type: "button",
className: "bt-us-day",
@@ -15171,15 +15188,15 @@ function SpanPicker({ span, today, oldest, active, near, onPick, onClose }) {
"data-has": flag(active.has(key)),
onMouseEnter: () => setHover(key),
onClick: () => press(key)
- }, (0, import_react38.createElement)("b", null, day)));
+ }, (0, import_react39.createElement)("b", null, day)));
}
- const nav = side === "left" ? (0, import_react38.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_react38.createElement)(ChevronLeftIcon)) : (0, import_react38.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_react38.createElement)(ChevronRightIcon));
- return (0, import_react38.createElement)(
+ const nav = side === "left" ? (0, import_react39.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_react39.createElement)(ChevronLeftIcon)) : (0, import_react39.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_react39.createElement)(ChevronRightIcon));
+ return (0, import_react39.createElement)(
"div",
{ key: start, className: "bt-us-month" },
- (0, import_react38.createElement)("div", { className: "bt-us-month-head" }, nav, (0, import_react38.createElement)("span", null, dates({ year: "numeric", month: "long" }).format(start))),
- (0, import_react38.createElement)("div", { className: "bt-us-weekdays", "aria-hidden": true }, weekdays.map((name, at) => (0, import_react38.createElement)("span", { key: at }, name))),
- (0, import_react38.createElement)("div", { className: "bt-us-days", onMouseLeave: () => setHover(null) }, cells)
+ (0, import_react39.createElement)("div", { className: "bt-us-month-head" }, nav, (0, import_react39.createElement)("span", null, dates({ year: "numeric", month: "long" }).format(start))),
+ (0, import_react39.createElement)("div", { className: "bt-us-weekdays", "aria-hidden": true }, weekdays.map((name, at) => (0, import_react39.createElement)("span", { key: at }, name))),
+ (0, import_react39.createElement)("div", { className: "bt-us-days", onMouseLeave: () => setHover(null) }, cells)
);
};
const shortcuts = [
@@ -15188,30 +15205,30 @@ function SpanPicker({ span, today, oldest, active, near, onPick, onClose }) {
["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_react38.createElement)(
+ return (0, import_react39.createElement)(
"div",
{ ref: box, className: "bt-us-pick", role: "dialog", "aria-label": t("Custom range") },
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(
"div",
{ className: "bt-us-pick-quick" },
- shortcuts.map(([id, label, from, to]) => (0, import_react38.createElement)("button", {
+ shortcuts.map(([id, label, from, to]) => (0, import_react39.createElement)("button", {
key: id,
type: "button",
"aria-pressed": span?.from === from && span?.to === to,
onClick: () => onPick(from, to)
}, label))
),
- (0, import_react38.createElement)("div", { className: "bt-us-pick-months" }, month(addMonths(right, -1), "left"), month(right, "right")),
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)("div", { className: "bt-us-pick-months" }, month(addMonths(right, -1), "left"), month(right, "right")),
+ (0, import_react39.createElement)(
"div",
{ className: "bt-us-pick-foot", role: "status" },
- (0, import_react38.createElement)("span", null, anchor ? t("Pick the last day") : t("Pick the first day")),
- low === null ? null : (0, import_react38.createElement)("span", null, (0, import_react38.createElement)("b", null, spanText(low, high)), ` · ${daysText(count)}`)
+ (0, import_react39.createElement)("span", null, anchor ? t("Pick the last day") : t("Pick the first day")),
+ low === null ? null : (0, import_react39.createElement)("span", null, (0, import_react39.createElement)("b", null, spanText(low, high)), ` · ${daysText(count)}`)
)
);
}
function Heat({ view, keep, paint, index }) {
- const [hover, setHover] = (0, import_react38.useState)(null);
+ const [hover, setHover] = (0, import_react39.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);
@@ -15227,13 +15244,13 @@ function Heat({ view, keep, paint, index }) {
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_react38.createElement)("span", { key: week, style: { gridColumn: week + 1 } }, dates({ month: "short" }).format(monday)));
+ months.push((0, import_react39.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_react38.createElement)("span", {
+ cells.push((0, import_react39.createElement)("span", {
key: ms,
className: "bt-us-cell",
style: { "--w": week },
@@ -15241,7 +15258,7 @@ function Heat({ view, keep, paint, index }) {
"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_react38.createElement)("i", { style: { background: soften(paint, levels[level - 1]) } }) : null));
+ }, level > 0 ? (0, import_react39.createElement)("i", { style: { background: soften(paint, levels[level - 1]) } }) : null));
}
}
const tipSide = hover ? {
@@ -15250,68 +15267,68 @@ function Heat({ view, keep, paint, index }) {
} : 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_react38.createElement)(
+ return (0, import_react39.createElement)(
"section",
{ className: "bt-us-card bt-us-heat", style: { "--i": index } },
- (0, import_react38.createElement)("div", { className: "bt-us-card-head" }, (0, import_react38.createElement)("h3", null, t("Activity")), (0, import_react38.createElement)("span", { className: "bt-us-head-note" }, summary)),
- (0, import_react38.createElement)("div", { className: "bt-us-heat-months", "aria-hidden": true }, months),
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)("div", { className: "bt-us-card-head" }, (0, import_react39.createElement)("h3", null, t("Activity")), (0, import_react39.createElement)("span", { className: "bt-us-head-note" }, summary)),
+ (0, import_react39.createElement)("div", { className: "bt-us-heat-months", "aria-hidden": true }, months),
+ (0, import_react39.createElement)(
"div",
{ className: "bt-us-heat-plot", onMouseLeave: () => setHover(null) },
- (0, import_react38.createElement)("div", { className: "bt-us-heat-grid", role: "img", "aria-label": summary }, cells),
- hover ? (0, import_react38.createElement)(
+ (0, import_react39.createElement)("div", { className: "bt-us-heat-grid", role: "img", "aria-label": summary }, cells),
+ hover ? (0, import_react39.createElement)(
"div",
{ className: "bt-us-tip bt-us-heat-tip", style: tipSide },
- (0, import_react38.createElement)("div", { className: "bt-us-tip-title" }, dates({ month: "long", day: "numeric", weekday: "short" }).format(hover.ms)),
- (0, import_react38.createElement)("div", { className: "bt-us-tip-total" }, t("{count} tokens", { count: full(daily.get(dayKey(hover.ms)) ?? 0) }))
+ (0, import_react39.createElement)("div", { className: "bt-us-tip-title" }, dates({ month: "long", day: "numeric", weekday: "short" }).format(hover.ms)),
+ (0, import_react39.createElement)("div", { className: "bt-us-tip-total" }, t("{count} tokens", { count: full(daily.get(dayKey(hover.ms)) ?? 0) }))
) : null
),
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(
"div",
{ className: "bt-us-heat-scale", "aria-hidden": true },
t("Light"),
- levels.map((level) => (0, import_react38.createElement)("span", { key: level, className: "bt-us-cell" }, (0, import_react38.createElement)("i", { style: { background: soften(paint, level) } }))),
+ levels.map((level) => (0, import_react39.createElement)("span", { key: level, className: "bt-us-cell" }, (0, import_react39.createElement)("i", { style: { background: soften(paint, level) } }))),
t("Heavy")
)
);
}
function Skeleton2() {
- return (0, import_react38.createElement)(
+ return (0, import_react39.createElement)(
"div",
{ className: "bt-us", "aria-busy": true },
- (0, import_react38.createElement)("div", { className: "bt-us-skel", style: { height: 32, width: 320, borderRadius: 999 } }),
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)("div", { className: "bt-us-skel", style: { height: 32, width: 320, borderRadius: 999 } }),
+ (0, import_react39.createElement)(
"div",
{ className: "bt-us-sheet bt-us-skel-sheet" },
- (0, import_react38.createElement)("div", { className: "bt-us-skel", style: { height: 94 } }),
- (0, import_react38.createElement)("div", { className: "bt-us-skel", style: { height: 318 } }),
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)("div", { className: "bt-us-skel", style: { height: 94 } }),
+ (0, import_react39.createElement)("div", { className: "bt-us-skel", style: { height: 318 } }),
+ (0, import_react39.createElement)(
"div",
{ className: "bt-us-pair" },
- (0, import_react38.createElement)("div", { className: "bt-us-skel", style: { height: 200 } }),
- (0, import_react38.createElement)("div", { className: "bt-us-skel", style: { height: 200 } })
+ (0, import_react39.createElement)("div", { className: "bt-us-skel", style: { height: 200 } }),
+ (0, import_react39.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_react38.useState)(null);
- const [error, setError] = (0, import_react38.useState)("");
- const [rangeId, setRangeId] = (0, import_react38.useState)("7d");
- const [span, setSpan] = (0, import_react38.useState)(null);
- const [picking, setPicking] = (0, import_react38.useState)(false);
- const [by, setBy] = (0, import_react38.useState)("bot");
- const tabs = (0, import_react38.useRef)(null);
+ const [view, setView] = (0, import_react39.useState)(null);
+ const [error, setError] = (0, import_react39.useState)("");
+ const [rangeId, setRangeId] = (0, import_react39.useState)("7d");
+ const [span, setSpan] = (0, import_react39.useState)(null);
+ const [picking, setPicking] = (0, import_react39.useState)(false);
+ const [by, setBy] = (0, import_react39.useState)("bot");
+ const tabs = (0, import_react39.useRef)(null);
const focus = focusOf(focusId);
- (0, import_react38.useEffect)(() => {
+ (0, import_react39.useEffect)(() => {
let stopped = false;
let timer;
const load = async () => {
try {
const value = await actions.usage();
if (stopped) return;
- (0, import_react38.startTransition)(() => setView(value));
+ (0, import_react39.startTransition)(() => setView(value));
setError("");
timer = setTimeout(load, value.scanning ? 3e3 : 2e4);
} catch (failure) {
@@ -15328,7 +15345,7 @@ function UsagePage({ roster, actions, focusId }) {
}, []);
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_react38.useMemo)(() => {
+ const shaped = (0, import_react39.useMemo)(() => {
if (!view) return null;
const faces2 = view.owners.map((owner) => ownerFace(owner, roster));
const lifetime = /* @__PURE__ */ new Map();
@@ -15337,7 +15354,7 @@ function UsagePage({ roster, actions, focusId }) {
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_react38.createElement)(ModelGlyph, { name, paint, size }) };
+ return { kind: "model", name, sub: model.providerName ?? model.provider, paint, glyph: (size) => (0, import_react39.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;
@@ -15385,23 +15402,23 @@ function UsagePage({ roster, actions, focusId }) {
});
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_react38.useRef)(null);
- (0, import_react38.useEffect)(() => {
+ const root = (0, import_react39.useRef)(null);
+ (0, import_react39.useEffect)(() => {
root.current?.closest(".bt-settings-scroll")?.scrollTo?.({ top: 0 });
}, [focusId]);
if (!view) {
- return error ? (0, import_react38.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : (0, import_react38.createElement)(Skeleton2);
+ return error ? (0, import_react39.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : (0, import_react39.createElement)(Skeleton2);
}
if (view.rows.length === 0) {
- return (0, import_react38.createElement)(
+ return (0, import_react39.createElement)(
"div",
{ className: "bt-us" },
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(
"div",
{ className: "bt-us-empty" },
- (0, import_react38.createElement)(BotMark, { look: MAIN_LOOK, size: 56, live: true }),
- (0, import_react38.createElement)("b", null, view.scanning ? t("Reading your chats…") : t("No usage yet.")),
- (0, import_react38.createElement)("span", null, t("Token usage shows up here after a model is called."))
+ (0, import_react39.createElement)(BotMark, { look: MAIN_LOOK, size: 56, live: true }),
+ (0, import_react39.createElement)("b", null, view.scanning ? t("Reading your chats…") : t("No usage yet.")),
+ (0, import_react39.createElement)("span", null, t("Token usage shows up here after a model is called."))
)
);
}
@@ -15426,7 +15443,7 @@ function UsagePage({ roster, actions, focusId }) {
["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_react38.createElement)(Row2, {
+ const ownerRow = ([at, sum], index, total = whole) => (0, import_react39.createElement)(Row2, {
key: `o${at}`,
kind: faces[at].kind,
glyph: faces[at].glyph(32),
@@ -15438,7 +15455,7 @@ function UsagePage({ roster, actions, focusId }) {
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_react38.createElement)(Row2, {
+ const modelRow = ([at, sum], index) => (0, import_react39.createElement)(Row2, {
key: `m${at}`,
kind: "model",
glyph: models[at].glyph(32),
@@ -15450,30 +15467,30 @@ function UsagePage({ roster, actions, focusId }) {
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_react38.createElement)("div", { className: "bt-us-none" }, t("Nothing in this range."));
+ const nothing = (0, import_react39.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_react38.createElement)(Profile, { key: "profile", face, range, share: all.total.total > 0 ? whole / all.total.total : 0 }),
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(Profile, { key: "profile", face, range, share: all.total.total > 0 ? whole / all.total.total : 0 }),
+ (0, import_react39.createElement)(
"div",
{ key: "sheet", className: "bt-us-sheet" },
- (0, import_react38.createElement)(Stats, { key: "stats", range, total: part.total, previous: part.previous }),
- (0, import_react38.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, onPick: pick2 }),
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(Stats, { key: "stats", range, total: part.total, previous: part.previous }),
+ (0, import_react39.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, onPick: pick2 }),
+ (0, import_react39.createElement)(
"div",
{ key: "pair", className: "bt-us-pair" },
- ownerAt >= 0 ? (0, import_react38.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 2 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing) : (0, import_react38.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_react38.createElement)(
+ ownerAt >= 0 ? (0, import_react39.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 2 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing) : (0, import_react39.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_react39.createElement)(
ListCard,
{ title: t("What for"), index: 3 },
- kinds.length > 0 ? kinds.map(([at, sum], index) => (0, import_react38.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_react39.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_react38.createElement)(Heat, { key: "heat", view, keep, paint: face.paint, index: 4 })
+ (0, import_react39.createElement)(Heat, { key: "heat", view, keep, paint: face.paint, index: 4 })
)
];
} else {
@@ -15482,39 +15499,39 @@ function UsagePage({ roster, actions, focusId }) {
const rest = owners.filter(([at]) => !isBot(at));
const usedModels = ranked(all.models);
body = [
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(
"div",
{ key: "sheet", className: "bt-us-sheet" },
- (0, import_react38.createElement)(Stats, { key: "stats", range, total: all.total, previous: all.previous }),
- (0, import_react38.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, by, onBy: setBy, onPick: pick2 }),
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(Stats, { key: "stats", range, total: all.total, previous: all.previous }),
+ (0, import_react39.createElement)(Chart, { key: "chart", range, columns: columns2, series, tipSeries, by, onBy: setBy, onPick: pick2 }),
+ (0, import_react39.createElement)(
"div",
{ key: "pair", className: "bt-us-pair" },
- (0, import_react38.createElement)(
+ (0, import_react39.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_react38.createElement)("div", { className: "bt-us-split", role: "separator" }) : null,
+ bots.length > 0 && rest.length > 0 ? (0, import_react39.createElement)("div", { className: "bt-us-split", role: "separator" }) : null,
rest.map((entry, index) => ownerRow(entry, bots.length + index))
),
- (0, import_react38.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 3 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing)
+ (0, import_react39.createElement)(ListCard, { title: t("Models"), count: usedModels.length, index: 3 }, usedModels.length > 0 ? usedModels.map(modelRow) : nothing)
),
- (0, import_react38.createElement)(Heat, { key: "heat", view, keep, paint: "var(--bt-accent)", index: 4 })
+ (0, import_react39.createElement)(Heat, { key: "heat", view, keep, paint: "var(--bt-accent)", index: 4 })
)
];
}
- return (0, import_react38.createElement)(
+ return (0, import_react39.createElement)(
"div",
{ ref: root, className: "bt-us", key: focusId ?? "all" },
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(
"div",
{ className: "bt-us-top" },
- (0, import_react38.createElement)(Tabs, { label: t("Time range"), value: rangeId, onChange: chooseRange, options: rangeOptions, boxRef: tabs }),
- view.scanning ? (0, import_react38.createElement)("span", { className: "bt-us-note", role: "status" }, t("Still reading older chats; totals may grow.")) : null,
- picking ? (0, import_react38.createElement)(SpanPicker, { span, today, oldest, active: activeDays, near: tabs, onPick: pickSpan, onClose: () => setPicking(false) }) : null
+ (0, import_react39.createElement)(Tabs, { label: t("Time range"), value: rangeId, onChange: chooseRange, options: rangeOptions, boxRef: tabs }),
+ view.scanning ? (0, import_react39.createElement)("span", { className: "bt-us-note", role: "status" }, t("Still reading older chats; totals may grow.")) : null,
+ picking ? (0, import_react39.createElement)(SpanPicker, { span, today, oldest, active: activeDays, near: tabs, onPick: pickSpan, onClose: () => setPicking(false) }) : null
),
- error ? (0, import_react38.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,
+ error ? (0, import_react39.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null,
body
);
}
@@ -15685,12 +15702,12 @@ button.bt-us-row:hover{background:var(--bt-hover)}
`;
// src/client/connectors.js
-var import_react39 = require("react");
+var import_react40 = require("react");
var TOKEN_URL = "https://github.com/settings/personal-access-tokens/new";
-var GitHubMark = () => (0, import_react39.createElement)(
+var GitHubMark = () => (0, import_react40.createElement)(
"svg",
{ width: 20, height: 20, viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": true },
- (0, import_react39.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_react40.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") };
@@ -15701,10 +15718,10 @@ function statusText2(connector) {
return ABOUT[connector.id]?.() ?? "";
}
function ConnectorRow({ connector, actions }) {
- const [form, setForm] = (0, import_react39.useState)(false);
- const [token, setToken] = (0, import_react39.useState)("");
- const [busy, setBusy] = (0, import_react39.useState)(false);
- const [error, setError] = (0, import_react39.useState)(null);
+ const [form, setForm] = (0, import_react40.useState)(false);
+ const [token, setToken] = (0, import_react40.useState)("");
+ const [busy, setBusy] = (0, import_react40.useState)(false);
+ const [error, setError] = (0, import_react40.useState)(null);
const run2 = (task, after) => {
setBusy(true);
setError(null);
@@ -15721,58 +15738,58 @@ function ConnectorRow({ connector, actions }) {
};
const on = connector.state !== "off";
const Mark = MARKS[connector.id];
- const row = (0, import_react39.useRef)(null);
+ const row = (0, import_react40.useRef)(null);
useMorph(row, `${form}:${error !== null}:${connector.state}`);
- return (0, import_react39.createElement)(
+ return (0, import_react40.createElement)(
"div",
{ ref: row, className: "bt-connector", "data-state": connector.state },
- (0, import_react39.createElement)(
+ (0, import_react40.createElement)(
"div",
{ className: "bt-connector-head" },
- (0, import_react39.createElement)("span", { className: "bt-connector-mark" }, Mark ? (0, import_react39.createElement)(Mark) : null),
- (0, import_react39.createElement)(
+ (0, import_react40.createElement)("span", { className: "bt-connector-mark" }, Mark ? (0, import_react40.createElement)(Mark) : null),
+ (0, import_react40.createElement)(
"span",
{ className: "bt-connector-text" },
- (0, import_react39.createElement)("span", { className: "bt-connector-name" }, connector.name),
- (0, import_react39.createElement)("span", { className: "bt-connector-status" }, statusText2(connector))
+ (0, import_react40.createElement)("span", { className: "bt-connector-name" }, connector.name),
+ (0, import_react40.createElement)("span", { className: "bt-connector-status" }, statusText2(connector))
),
- (0, import_react39.createElement)(
+ (0, import_react40.createElement)(
"span",
{ className: "bt-connector-actions" },
- connector.state === "error" ? (0, import_react39.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_react39.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_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setForm(true) }, t("Connect"))
+ connector.state === "error" ? (0, import_react40.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_react40.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_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setForm(true) }, t("Connect"))
)
),
- !on && form ? (0, import_react39.createElement)(
+ !on && form ? (0, import_react40.createElement)(
"div",
{ className: "bt-connector-form" },
- (0, import_react39.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react39.createElement)(MaskedInput, { value: token, onChange: setToken, onEnter: connect, label: t("GitHub token"), autoFocus: true })),
- (0, import_react39.createElement)(
+ (0, import_react40.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react40.createElement)(MaskedInput, { value: token, onChange: setToken, onEnter: connect, label: t("GitHub token"), autoFocus: true })),
+ (0, import_react40.createElement)(
"div",
{ className: "bt-connector-form-row" },
- (0, import_react39.createElement)("a", { className: "bt-connector-link", href: TOKEN_URL, target: "_blank", rel: "noopener noreferrer" }, t("Create a token on GitHub")),
- (0, import_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => {
+ (0, import_react40.createElement)("a", { className: "bt-connector-link", href: TOKEN_URL, target: "_blank", rel: "noopener noreferrer" }, t("Create a token on GitHub")),
+ (0, import_react40.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy, onClick: () => {
setForm(false);
setToken("");
setError(null);
} }, t("Cancel")),
- (0, import_react39.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: busy || token.trim() === "", onClick: connect }, busy ? t("Connecting…") : t("Connect"))
+ (0, import_react40.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_react39.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null
+ error ? (0, import_react40.createElement)("div", { className: "bt-connector-error", role: "alert" }, error) : null
);
}
function ConnectorsPage({ roster, actions }) {
const list = roster?.connectors ?? [];
- return (0, import_react39.createElement)(
+ return (0, import_react40.createElement)(
"section",
{ className: "bt-set-section" },
- (0, import_react39.createElement)("div", { className: "bt-set-card bt-connectors-card" }, list.length === 0 ? (0, import_react39.createElement)("div", { className: "bt-set-row" }, (0, import_react39.createElement)("span", { className: "bt-set-hint" }, t("No connectors"))) : list.map((connector) => (0, import_react39.createElement)(ConnectorRow, { key: connector.id, connector, actions })))
+ (0, import_react40.createElement)("div", { className: "bt-set-card bt-connectors-card" }, list.length === 0 ? (0, import_react40.createElement)("div", { className: "bt-set-row" }, (0, import_react40.createElement)("span", { className: "bt-set-hint" }, t("No connectors"))) : list.map((connector) => (0, import_react40.createElement)(ConnectorRow, { key: connector.id, connector, actions })))
);
}
// src/client/browser-settings.js
-var import_react40 = require("react");
+var import_react41 = 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();
@@ -15791,13 +15808,13 @@ function grantKinds(grant) {
}
function BrowserPage({ roster, actions, run: run2, Section, Row: Row3 }) {
const bots = roster.bots ?? [];
- const [botId, setBotId] = (0, import_react40.useState)(bots[0]?.id ?? "");
- const [site, setSite] = (0, import_react40.useState)("");
- const [kinds, setKinds] = (0, import_react40.useState)(["post"]);
- const [duration, setDuration] = (0, import_react40.useState)("hour");
- const [busy, setBusy] = (0, import_react40.useState)(false);
+ const [botId, setBotId] = (0, import_react41.useState)(bots[0]?.id ?? "");
+ const [site, setSite] = (0, import_react41.useState)("");
+ const [kinds, setKinds] = (0, import_react41.useState)(["post"]);
+ const [duration, setDuration] = (0, import_react41.useState)("hour");
+ const [busy, setBusy] = (0, import_react41.useState)(false);
const selectedBot = bots.find((bot) => bot.id === botId);
- (0, import_react40.useEffect)(() => {
+ (0, import_react41.useEffect)(() => {
if (!bots.some((bot) => bot.id === botId)) setBotId(bots[0]?.id ?? "");
}, [bots, botId]);
const grants = bots.flatMap((bot) => (bot.browserGrants ?? []).map((grant, index) => ({
@@ -15830,37 +15847,37 @@ function BrowserPage({ roster, actions, run: run2, Section, Row: Row3 }) {
const toggleKind = (kind, checked) => {
setKinds((current) => checked ? current.includes(kind) ? current : [...current, kind] : current.filter((value) => value !== kind));
};
- return (0, import_react40.createElement)(
+ return (0, import_react41.createElement)(
"div",
{ className: "bt-browser-settings" },
- (0, import_react40.createElement)(
+ (0, import_react41.createElement)(
Section,
{ title: t("Browser access") },
- (0, import_react40.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_react41.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_react40.createElement)(
+ (0, import_react41.createElement)(
Section,
{ title: t("Allowed actions") },
- grants.length === 0 ? (0, import_react40.createElement)(Row3, { label: t("Nothing allowed yet.") }) : grants.map(({ bot, grant, index, expired: expired2 }) => (0, import_react40.createElement)(
+ grants.length === 0 ? (0, import_react41.createElement)(Row3, { label: t("Nothing allowed yet.") }) : grants.map(({ bot, grant, index, expired: expired2 }) => (0, import_react41.createElement)(
"div",
{
key: `${bot.id}:${index}`,
className: `bt-browser-grant${expired2 ? " bt-browser-grant-expired" : ""}`
},
- (0, import_react40.createElement)(
+ (0, import_react41.createElement)(
"div",
{ className: "bt-browser-grant-who" },
- (0, import_react40.createElement)(BotAvatar, { bot, size: 28 }),
- (0, import_react40.createElement)("span", null, bot.name)
+ (0, import_react41.createElement)(BotAvatar, { bot, size: 28 }),
+ (0, import_react41.createElement)("span", null, bot.name)
),
- (0, import_react40.createElement)(
+ (0, import_react41.createElement)(
"div",
{ className: "bt-browser-grant-meta" },
- (0, import_react40.createElement)("span", { className: "bt-browser-grant-site" }, grant.site === "*" ? t("All sites") : grant.site),
- (0, import_react40.createElement)("div", { className: "bt-browser-grant-kinds" }, grantKinds(grant).map((label) => (0, import_react40.createElement)("span", { key: label, className: "bt-chip" }, label))),
- (0, import_react40.createElement)("span", { className: "bt-set-hint" }, grantTime(grant))
+ (0, import_react41.createElement)("span", { className: "bt-browser-grant-site" }, grant.site === "*" ? t("All sites") : grant.site),
+ (0, import_react41.createElement)("div", { className: "bt-browser-grant-kinds" }, grantKinds(grant).map((label) => (0, import_react41.createElement)("span", { key: label, className: "bt-chip" }, label))),
+ (0, import_react41.createElement)("span", { className: "bt-set-hint" }, grantTime(grant))
),
- (0, import_react40.createElement)("button", {
+ (0, import_react41.createElement)("button", {
type: "button",
className: "bt-soft bt-soft-sm",
onClick: () => remove(bot, index),
@@ -15868,25 +15885,25 @@ function BrowserPage({ roster, actions, run: run2, Section, Row: Row3 }) {
}, t("Remove grant"))
))
),
- (0, import_react40.createElement)(
+ (0, import_react41.createElement)(
Section,
{ title: t("Allow an action") },
- (0, import_react40.createElement)(
+ (0, import_react41.createElement)(
"form",
{ className: "bt-browser-form", onSubmit: add },
- (0, import_react40.createElement)(
+ (0, import_react41.createElement)(
Row3,
{ label: t("Bot") },
- (0, import_react40.createElement)(
+ (0, import_react41.createElement)(
"select",
{ className: "bt-select", value: botId, onChange: (event) => setBotId(event.target.value), disabled: bots.length === 0 },
- bots.map((bot) => (0, import_react40.createElement)("option", { key: bot.id, value: bot.id }, bot.name))
+ bots.map((bot) => (0, import_react41.createElement)("option", { key: bot.id, value: bot.id }, bot.name))
)
),
- (0, import_react40.createElement)(
+ (0, import_react41.createElement)(
Row3,
{ label: t("Site") },
- (0, import_react40.createElement)("input", {
+ (0, import_react41.createElement)("input", {
className: "bt-select bt-browser-site",
type: "text",
value: site,
@@ -15894,16 +15911,16 @@ function BrowserPage({ roster, actions, run: run2, Section, Row: Row3 }) {
onChange: (event) => setSite(event.target.value)
})
),
- (0, import_react40.createElement)(
+ (0, import_react41.createElement)(
Row3,
{ label: t("Actions") },
- (0, import_react40.createElement)(
+ (0, import_react41.createElement)(
"div",
{ className: "bt-browser-action-list" },
- ACTIONS.map(([kind, label]) => (0, import_react40.createElement)(
+ ACTIONS.map(([kind, label]) => (0, import_react41.createElement)(
"label",
{ key: kind, className: "bt-browser-action-choice" },
- (0, import_react40.createElement)("input", {
+ (0, import_react41.createElement)("input", {
type: "checkbox",
checked: kinds.includes(kind),
onChange: (event) => toggleKind(kind, event.target.checked)
@@ -15912,13 +15929,13 @@ function BrowserPage({ roster, actions, run: run2, Section, Row: Row3 }) {
))
)
),
- (0, import_react40.createElement)(
+ (0, import_react41.createElement)(
Row3,
{ label: t("Duration") },
- (0, import_react40.createElement)(
+ (0, import_react41.createElement)(
"div",
{ className: "bt-browser-duration", role: "group", "aria-label": t("Duration") },
- DURATIONS.map(([key, label]) => (0, import_react40.createElement)("button", {
+ DURATIONS.map(([key, label]) => (0, import_react41.createElement)("button", {
key,
type: "button",
className: "bt-browser-duration-choice",
@@ -15927,10 +15944,10 @@ function BrowserPage({ roster, actions, run: run2, Section, Row: Row3 }) {
}, t(label)))
)
),
- (0, import_react40.createElement)(
+ (0, import_react41.createElement)(
"div",
{ className: "bt-browser-form-foot" },
- (0, import_react40.createElement)("button", {
+ (0, import_react41.createElement)("button", {
type: "submit",
className: "bt-soft",
disabled: busy || !selectedBot || kinds.length === 0
@@ -15942,12 +15959,12 @@ function BrowserPage({ roster, actions, run: run2, Section, Row: Row3 }) {
}
// src/client/feedback.js
-var import_react41 = require("react");
-var FeedbackIcon = () => (0, import_react41.createElement)(
+var import_react42 = require("react");
+var FeedbackIcon = () => (0, import_react42.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_react41.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_react41.createElement)("path", { d: "M10 7v2.6M10 11.4h.01" })
+ (0, import_react42.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_react42.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" }));
@@ -15985,16 +16002,16 @@ function issueWindow() {
};
}
function FeedbackPage({ actions, run: run2, Section, Row: Row3 }) {
- const [what, setWhat] = (0, import_react41.useState)("");
- const [report, setReport] = (0, import_react41.useState)(null);
- const [preview, setPreview] = (0, import_react41.useState)(false);
- const [note, setNote] = (0, import_react41.useState)("");
+ const [what, setWhat] = (0, import_react42.useState)("");
+ const [report, setReport] = (0, import_react42.useState)(null);
+ const [preview, setPreview] = (0, import_react42.useState)(false);
+ const [note, setNote] = (0, import_react42.useState)("");
const fetchReport = () => actions.diagnostics({ client: clientFacts(), clientErrors: clientErrors() }).then((next) => {
setReport(next);
return next;
});
const load = () => fetchReport().then(() => void 0);
- (0, import_react41.useEffect)(() => {
+ (0, import_react42.useEffect)(() => {
void run2(load());
}, []);
const copyReport = () => run2(fetchReport().then(async (next) => {
@@ -16002,7 +16019,7 @@ function FeedbackPage({ actions, run: run2, Section, Row: Row3 }) {
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_react41.useState)(null);
+ const [issueLink, setIssueLink] = (0, import_react42.useState)(null);
const openIssue = () => {
const target = issueWindow();
run2(fetchReport().then(async (next) => {
@@ -16028,59 +16045,59 @@ function FeedbackPage({ actions, run: run2, Section, Row: Row3 }) {
const total = (report?.total ?? 0) + browserErrors.length;
const shown = entries2.slice(0, 8);
return [
- (0, import_react41.createElement)(
+ (0, import_react42.createElement)(
Section,
{ key: "report", title: t("Report a problem") },
- (0, import_react41.createElement)(
+ (0, import_react42.createElement)(
"div",
{ className: "bt-set-row bt-set-paste bt-fb-what" },
- (0, import_react41.createElement)(
+ (0, import_react42.createElement)(
"label",
{ className: "bt-set-copy", htmlFor: "bt-fb-what" },
- (0, import_react41.createElement)("span", null, t("What happened?")),
- (0, import_react41.createElement)("span", { className: "bt-set-hint" }, t("What you did, what you expected, and what happened instead. It goes into the issue."))
+ (0, import_react42.createElement)("span", null, t("What happened?")),
+ (0, import_react42.createElement)("span", { className: "bt-set-hint" }, t("What you did, what you expected, and what happened instead. It goes into the issue."))
),
- (0, import_react41.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_react42.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_react41.createElement)(
+ (0, import_react42.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_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setPreview(!preview), "aria-expanded": preview }, preview ? t("Hide") : t("Show")),
- (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: copyReport }, t("Copy"))
+ (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setPreview(!preview), "aria-expanded": preview }, preview ? t("Hide") : t("Show")),
+ (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: copyReport }, t("Copy"))
),
- preview ? (0, import_react41.createElement)("div", { className: "bt-set-row bt-fb-preview" }, (0, import_react41.createElement)("pre", { tabIndex: 0, "aria-label": t("Diagnostics") }, report?.markdown || t("Loading…"))) : null,
- (0, import_react41.createElement)(
+ preview ? (0, import_react42.createElement)("div", { className: "bt-set-row bt-fb-preview" }, (0, import_react42.createElement)("pre", { tabIndex: 0, "aria-label": t("Diagnostics") }, report?.markdown || t("Loading…"))) : null,
+ (0, import_react42.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_react41.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: openIssue }, t("Report on GitHub"))
+ (0, import_react42.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: openIssue }, t("Report on GitHub"))
)
),
- note ? (0, import_react41.createElement)(
+ note ? (0, import_react42.createElement)(
"div",
{ key: "note", className: "bt-note bt-fb-note", role: "status" },
note,
- issueLink ? [" ", (0, import_react41.createElement)("a", { key: "link", href: issueLink, target: "_blank", rel: "noopener noreferrer" }, t("Open the issue"))] : null
+ issueLink ? [" ", (0, import_react42.createElement)("a", { key: "link", href: issueLink, target: "_blank", rel: "noopener noreferrer" }, t("Open the issue"))] : null
) : null,
- (0, import_react41.createElement)(
+ (0, import_react42.createElement)(
Section,
{ key: "errors", title: report ? t("Recent errors · {count}", { count: total }) : t("Recent errors") },
- shown.length === 0 ? (0, import_react41.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_react41.createElement)(
+ shown.length === 0 ? (0, import_react42.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_react42.createElement)(
"div",
{ key: `${entry.time}-${index}`, className: "bt-set-row bt-fb-entry", title: entry.text },
- (0, import_react41.createElement)("span", { className: "bt-fb-dot", "data-level": entry.level, "aria-hidden": true }),
- (0, import_react41.createElement)(
+ (0, import_react42.createElement)("span", { className: "bt-fb-dot", "data-level": entry.level, "aria-hidden": true }),
+ (0, import_react42.createElement)(
"div",
{ className: "bt-set-copy" },
- (0, import_react41.createElement)("span", { className: "bt-fb-text" }, entrySummary(entry)),
- (0, import_react41.createElement)("span", { className: "bt-set-hint" }, [whenText(entry.time), entry.bot, entry.where, t(SOURCES[entry.source] ?? "DS Bot")].filter(Boolean).join(" · "))
+ (0, import_react42.createElement)("span", { className: "bt-fb-text" }, entrySummary(entry)),
+ (0, import_react42.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_react41.createElement)("span", { className: "bt-tag bt-fb-code" }, entry.status ? `${entry.code} ${entry.status}` : entry.code) : null
+ entry.code ? (0, import_react42.createElement)("span", { className: "bt-tag bt-fb-code" }, entry.status ? `${entry.code} ${entry.status}` : entry.code) : null
)),
- (0, import_react41.createElement)(
+ (0, import_react42.createElement)(
Row3,
{ label: t("Error log"), hint: t("Kept on this computer across restarts, up to about 1 MB.") },
- (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: downloadLog }, t("Download")),
- (0, import_react41.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: clearLog, disabled: !report || total === 0 }, t("Clear"))
+ (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: downloadLog }, t("Download")),
+ (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: clearLog, disabled: !report || total === 0 }, t("Clear"))
)
)
];
@@ -16088,8 +16105,8 @@ function FeedbackPage({ actions, run: run2, Section, Row: Row3 }) {
var TOAST_MS = 6e3;
function ErrorToast({ useUi, actions }) {
const toast = useUi((state) => state.toast);
- const [leaving, setLeaving] = (0, import_react41.useState)(false);
- (0, import_react41.useEffect)(() => {
+ const [leaving, setLeaving] = (0, import_react42.useState)(false);
+ (0, import_react42.useEffect)(() => {
if (!toast) return void 0;
setLeaving(false);
const fade = setTimeout(() => setLeaving(true), TOAST_MS);
@@ -16100,15 +16117,15 @@ function ErrorToast({ useUi, actions }) {
};
}, [toast?.token]);
if (!toast) return null;
- return (0, import_react41.createElement)(
+ return (0, import_react42.createElement)(
"div",
{ className: "bt-toast", role: "alert", "data-leaving": leaving || void 0 },
- (0, import_react41.createElement)("span", { className: "bt-toast-text" }, toast.text),
- (0, import_react41.createElement)("button", { type: "button", className: "bt-toast-link", onClick: () => {
+ (0, import_react42.createElement)("span", { className: "bt-toast-text" }, toast.text),
+ (0, import_react42.createElement)("button", { type: "button", className: "bt-toast-link", onClick: () => {
actions.dismissToast(toast.token);
actions.openSettings("feedback");
} }, t("Details")),
- (0, import_react41.createElement)("button", { type: "button", className: "bt-icon-btn bt-toast-close", "aria-label": t("Dismiss"), onClick: () => actions.dismissToast(toast.token) }, (0, import_react41.createElement)(CloseIcon))
+ (0, import_react42.createElement)("button", { type: "button", className: "bt-icon-btn bt-toast-close", "aria-label": t("Dismiss"), onClick: () => actions.dismissToast(toast.token) }, (0, import_react42.createElement)(CloseIcon))
);
}
var FEEDBACK_CSS = `
@@ -16140,7 +16157,7 @@ var FEEDBACK_CSS = `
`;
// src/client/about.js
-var import_react42 = require("react");
+var import_react43 = require("react");
var CHEER_MS = 1800;
var starCount = (count) => new Intl.NumberFormat(dateLocale(), { notation: "compact", maximumFractionDigits: 1 }).format(count);
function botHint(update) {
@@ -16188,9 +16205,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_react42.useState)(false);
- const [stars, setStars] = (0, import_react42.useState)(null);
- (0, import_react42.useEffect)(() => {
+ const [checking, setChecking] = (0, import_react43.useState)(false);
+ const [stars, setStars] = (0, import_react43.useState)(null);
+ (0, import_react43.useEffect)(() => {
let live = true;
actions.repoStars().then((count) => {
if (live && Number.isInteger(count)) setStars(count);
@@ -16200,8 +16217,8 @@ function AboutPage({ useUpdate, actions, run: run2, Section, Row: Row3 }) {
live = false;
};
}, []);
- const [cheer, setCheer] = (0, import_react42.useState)(true);
- (0, import_react42.useEffect)(() => {
+ const [cheer, setCheer] = (0, import_react43.useState)(true);
+ (0, import_react43.useEffect)(() => {
if (!cheer) return void 0;
const timer = setTimeout(() => setCheer(false), CHEER_MS);
return () => clearTimeout(timer);
@@ -16216,37 +16233,37 @@ function AboutPage({ useUpdate, actions, run: run2, Section, Row: Row3 }) {
const phase = update.phase ?? "idle";
const dsh = update.dsh;
const dshPhase = dsh?.phase ?? "idle";
- (0, import_react42.useEffect)(() => {
+ (0, import_react43.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_react42.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: () => run2(actions.installOwnApp()) }, t("Restart to update")) : ownRow?.button === "check" ? (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.checkOwnApp()) }, t("Check for updates")) : ownRow?.button === "open" ? (0, import_react42.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_react42.createElement)(
+ const ownControl = ownRow?.button === "restart" ? (0, import_react43.createElement)("button", { type: "button", className: "bt-fb-primary", onClick: () => run2(actions.installOwnApp()) }, t("Restart to update")) : ownRow?.button === "check" ? (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.checkOwnApp()) }, t("Check for updates")) : ownRow?.button === "open" ? (0, import_react43.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_react43.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_react42.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_react42.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_react42.createElement)(
+ ) : (0, import_react43.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_react43.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_react43.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_react42.createElement)(
+ (0, import_react43.createElement)(
"div",
{ key: "hero", className: "bt-about-hero" },
- (0, import_react42.createElement)("span", { className: "bt-about-mark" }, (0, import_react42.createElement)(BotMark, { look: MAIN_LOOK, bot: { id: "about" }, size: 52, state: markState, live: true, gaze: true, pokeable: true })),
- (0, import_react42.createElement)(
+ (0, import_react43.createElement)("span", { className: "bt-about-mark" }, (0, import_react43.createElement)(BotMark, { look: MAIN_LOOK, bot: { id: "about" }, size: 52, state: markState, live: true, gaze: true, pokeable: true })),
+ (0, import_react43.createElement)(
"div",
{ className: "bt-about-copy" },
- (0, import_react42.createElement)("span", { className: "bt-about-name" }, "DS Bot"),
- update.current ? (0, import_react42.createElement)("span", { className: "bt-about-version" }, t("Version {version}", { version: update.current })) : null
+ (0, import_react43.createElement)("span", { className: "bt-about-name" }, "DS Bot"),
+ update.current ? (0, import_react43.createElement)("span", { className: "bt-about-version" }, t("Version {version}", { version: update.current })) : null
),
- repo ? (0, import_react42.createElement)(
+ repo ? (0, import_react43.createElement)(
"a",
{
className: "bt-star",
@@ -16256,23 +16273,23 @@ function AboutPage({ useUpdate, actions, run: run2, Section, Row: Row3 }) {
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_react42.createElement)("span", { className: "bt-star-main" }, (0, import_react42.createElement)("span", { className: "bt-star-icon" }, (0, import_react42.createElement)(StarLineIcon)), "Star"),
- stars === null ? null : (0, import_react42.createElement)("span", { className: "bt-star-count" }, starCount(stars))
+ (0, import_react43.createElement)("span", { className: "bt-star-main" }, (0, import_react43.createElement)("span", { className: "bt-star-icon" }, (0, import_react43.createElement)(StarLineIcon)), "Star"),
+ stars === null ? null : (0, import_react43.createElement)("span", { className: "bt-star-count" }, starCount(stars))
) : null
),
- repo ? (0, import_react42.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_react42.createElement)(
+ repo ? (0, import_react43.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_react43.createElement)(
Section,
{ key: "updates", title: t("Updates") },
- (0, import_react42.createElement)(Row3, { label: "DS Bot", hint: ownRow?.hint ?? botHint(update) }, botControl, update.available && update.notesUrl ? (0, import_react42.createElement)("a", linkProps(update.notesUrl), t("What's new")) : null),
- dsh?.current ? (0, import_react42.createElement)(Row3, { label: "DeepSeek Harness", hint: dshHint(dsh, dshShown) }, dshControl) : null
+ (0, import_react43.createElement)(Row3, { label: "DS Bot", hint: ownRow?.hint ?? botHint(update) }, botControl, update.available && update.notesUrl ? (0, import_react43.createElement)("a", linkProps(update.notesUrl), t("What's new")) : null),
+ dsh?.current ? (0, import_react43.createElement)(Row3, { label: "DeepSeek Harness", hint: dshHint(dsh, dshShown) }, dshControl) : null
),
- (0, import_react42.createElement)(
+ (0, import_react43.createElement)(
Section,
{ key: "links", title: t("Links") },
- repo ? (0, import_react42.createElement)(Row3, { label: t("Source code"), hint: repo.replace(/^https:\/\//, "") }, (0, import_react42.createElement)("a", linkProps(repo), (0, import_react42.createElement)(GitHubMark), t("Open"))) : null,
- update.notesUrl ? (0, import_react42.createElement)(Row3, { label: t("Release notes") }, (0, import_react42.createElement)("a", linkProps(update.notesUrl), t("Open"))) : null,
- (0, import_react42.createElement)(Row3, { label: t("Report a problem") }, (0, import_react42.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("feedback") }, t("Open")))
+ repo ? (0, import_react43.createElement)(Row3, { label: t("Source code"), hint: repo.replace(/^https:\/\//, "") }, (0, import_react43.createElement)("a", linkProps(repo), (0, import_react43.createElement)(GitHubMark), t("Open"))) : null,
+ update.notesUrl ? (0, import_react43.createElement)(Row3, { label: t("Release notes") }, (0, import_react43.createElement)("a", linkProps(update.notesUrl), t("Open"))) : null,
+ (0, import_react43.createElement)(Row3, { label: t("Report a problem") }, (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.openSettings("feedback") }, t("Open")))
)
];
}
@@ -16305,7 +16322,7 @@ body:not([data-bt-motion=quiet]) .bt-about-mark:hover .bt-mark[data-live][data-s
`;
// src/client/providers-page.js
-var import_react43 = require("react");
+var import_react44 = 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;
@@ -16313,22 +16330,22 @@ var translated = (promise) => Promise.resolve(promise).catch((failure) => {
throw new Error(hostText(failure?.message ?? String(failure)));
});
function ProvidersPage({ actions, run: run2, Section }) {
- const [view, setView] = (0, import_react43.useState)(null);
- const [open, setOpen] = (0, import_react43.useState)(null);
- const [adding, setAdding] = (0, import_react43.useState)(false);
+ const [view, setView] = (0, import_react44.useState)(null);
+ const [open, setOpen] = (0, import_react44.useState)(null);
+ const [adding, setAdding] = (0, import_react44.useState)(false);
const apply2 = (promise) => run2(translated(promise).then((next) => {
if (next?.providers) setView(next);
}));
- (0, import_react43.useEffect)(() => {
+ (0, import_react44.useEffect)(() => {
void apply2(actions.providers());
}, []);
if (view === null) return null;
- if (!view.available) return (0, import_react43.createElement)("p", { className: "bt-set-hint" }, t("This DSH cannot set up model providers."));
+ if (!view.available) return (0, import_react44.createElement)("p", { className: "bt-set-hint" }, t("This DSH cannot set up model providers."));
return [
- (0, import_react43.createElement)(
+ (0, import_react44.createElement)(
Section,
{ key: "list", title: t("Model providers · {count}", { count: view.providers.length }) },
- view.providers.map((provider) => (0, import_react43.createElement)(ProviderRow, {
+ view.providers.map((provider) => (0, import_react44.createElement)(ProviderRow, {
key: provider.id,
provider,
apply: apply2,
@@ -16336,9 +16353,9 @@ function ProvidersPage({ actions, run: run2, Section }) {
open: open === provider.id,
onToggle: () => setOpen(open === provider.id ? null : provider.id)
})),
- adding ? (0, import_react43.createElement)(AddProvider, { key: "add", view, apply: apply2, actions, onDone: () => setAdding(false) }) : null
+ adding ? (0, import_react44.createElement)(AddProvider, { key: "add", view, apply: apply2, actions, onDone: () => setAdding(false) }) : null
),
- adding ? null : (0, import_react43.createElement)("div", { key: "add", className: "bt-actions" }, (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setAdding(true) }, t("Add a provider")))
+ adding ? null : (0, import_react44.createElement)("div", { key: "add", className: "bt-actions" }, (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => setAdding(true) }, t("Add a provider")))
];
}
function keyState(key) {
@@ -16347,58 +16364,58 @@ function keyState(key) {
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_react43.useState)(false);
- (0, import_react43.useEffect)(() => {
+ const [confirm, setConfirm] = (0, import_react44.useState)(false);
+ (0, import_react44.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_react43.createElement)(
+ return (0, import_react44.createElement)(
"div",
{ className: "bt-secret-item bt-provider", "data-open": open ? "" : void 0 },
- (0, import_react43.createElement)(
+ (0, import_react44.createElement)(
"button",
{ type: "button", className: "bt-set-row bt-secret-summary", "aria-expanded": open, onClick: onToggle },
- (0, import_react43.createElement)(
+ (0, import_react44.createElement)(
"span",
{ className: "bt-set-copy" },
- (0, import_react43.createElement)("span", { className: "bt-secret-title" }, provider.name, provider.name !== provider.id ? (0, import_react43.createElement)("span", { className: "bt-provider-id" }, provider.id) : null),
- (0, import_react43.createElement)("span", { className: "bt-set-hint", "data-error": provider.error ? "" : void 0 }, hint)
+ (0, import_react44.createElement)("span", { className: "bt-secret-title" }, provider.name, provider.name !== provider.id ? (0, import_react44.createElement)("span", { className: "bt-provider-id" }, provider.id) : null),
+ (0, import_react44.createElement)("span", { className: "bt-set-hint", "data-error": provider.error ? "" : void 0 }, hint)
),
- state ? (0, import_react43.createElement)("span", { className: "bt-set-control" }, (0, import_react43.createElement)("span", { className: "bt-provider-state", "data-state": state[0] }, state[1])) : null
+ state ? (0, import_react44.createElement)("span", { className: "bt-set-control" }, (0, import_react44.createElement)("span", { className: "bt-provider-state", "data-state": state[0] }, state[1])) : null
),
- open ? (0, import_react43.createElement)(
+ open ? (0, import_react44.createElement)(
"div",
{ className: "bt-secret-edit" },
- provider.key?.writable ? (0, import_react43.createElement)(KeyEditor, { provider, apply: apply2, actions }) : null,
- provider.key && !provider.key.writable ? (0, import_react43.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_react43.createElement)(
+ provider.key?.writable ? (0, import_react44.createElement)(KeyEditor, { provider, apply: apply2, actions }) : null,
+ provider.key && !provider.key.writable ? (0, import_react44.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_react44.createElement)(
"div",
{ className: "bt-secret-edit-block" },
- (0, import_react43.createElement)("div", { className: "bt-secret-edit-label" }, t("Models")),
- (0, import_react43.createElement)(
+ (0, import_react44.createElement)("div", { className: "bt-secret-edit-label" }, t("Models")),
+ (0, import_react44.createElement)(
"div",
{ className: "bt-provider-models" },
- shown.map((model) => (0, import_react43.createElement)("span", { key: model.ref, className: "bt-tag", title: model.ref }, model.name)),
- provider.models.length > shown.length ? (0, import_react43.createElement)("span", { className: "bt-set-hint" }, t("and {count} more", { count: provider.models.length - shown.length })) : null
+ shown.map((model) => (0, import_react44.createElement)("span", { key: model.ref, className: "bt-tag", title: model.ref }, model.name)),
+ provider.models.length > shown.length ? (0, import_react44.createElement)("span", { className: "bt-set-hint" }, t("and {count} more", { count: provider.models.length - shown.length })) : null
)
) : null,
- provider.removable ? (0, import_react43.createElement)(
+ provider.removable ? (0, import_react44.createElement)(
"div",
{ className: "bt-secret-row-actions" },
confirm ? [
- (0, import_react43.createElement)("span", { key: "q", className: "bt-set-hint" }, t("Remove {name}? Bots on its models need another model.", { name: provider.name })),
- (0, import_react43.createElement)("button", { key: "no", type: "button", className: "bt-soft bt-soft-sm", onClick: () => setConfirm(false) }, t("Keep")),
- (0, import_react43.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_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => setConfirm(true) }, (0, import_react43.createElement)(TrashIcon), t("Remove provider"))
+ (0, import_react44.createElement)("span", { key: "q", className: "bt-set-hint" }, t("Remove {name}? Bots on its models need another model.", { name: provider.name })),
+ (0, import_react44.createElement)("button", { key: "no", type: "button", className: "bt-soft bt-soft-sm", onClick: () => setConfirm(false) }, t("Keep")),
+ (0, import_react44.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_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-secret-danger", onClick: () => setConfirm(true) }, (0, import_react44.createElement)(TrashIcon), t("Remove provider"))
) : null
) : null
);
}
function KeyEditor({ provider, apply: apply2, actions }) {
- const [value, setValue] = (0, import_react43.useState)("");
- const [saved, setSaved] = (0, import_react43.useState)(false);
+ const [value, setValue] = (0, import_react44.useState)("");
+ const [saved, setSaved] = (0, import_react44.useState)(false);
const ready = value.trim() !== "";
const save = () => {
if (!ready) return;
@@ -16414,29 +16431,29 @@ function KeyEditor({ provider, apply: apply2, actions }) {
setSaved(false);
};
const label = t("{provider} API key", { provider: provider.name });
- return (0, import_react43.createElement)(
+ return (0, import_react44.createElement)(
"div",
{ className: "bt-secret-edit-block" },
- (0, import_react43.createElement)("div", { className: "bt-secret-edit-label" }, provider.key.configured ? t("Replace the API key") : t("API key")),
- (0, import_react43.createElement)(
+ (0, import_react44.createElement)("div", { className: "bt-secret-edit-label" }, provider.key.configured ? t("Replace the API key") : t("API key")),
+ (0, import_react44.createElement)(
"div",
{ className: "bt-secret-inline" },
- (0, import_react43.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react43.createElement)(KeyIcon), (0, import_react43.createElement)(MaskedInput, { value, onChange: edit, onEnter: save, label })),
- (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: save }, t("Save")),
- provider.key.configured ? (0, import_react43.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_react44.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react44.createElement)(KeyIcon), (0, import_react44.createElement)(MaskedInput, { value, onChange: edit, onEnter: save, label })),
+ (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: save }, t("Save")),
+ provider.key.configured ? (0, import_react44.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_react43.createElement)("div", { className: "bt-set-hint bt-secret-ok", role: "status" }, (0, import_react43.createElement)(CheckIcon), t("Saved.")) : null
+ saved ? (0, import_react44.createElement)("div", { className: "bt-set-hint bt-secret-ok", role: "status" }, (0, import_react44.createElement)(CheckIcon), t("Saved.")) : null
);
}
function AddProvider({ view, apply: apply2, actions, onDone }) {
- const [mode, setMode] = (0, import_react43.useState)(view.addable.length > 0 ? "known" : "custom");
- return (0, import_react43.createElement)(
+ const [mode, setMode] = (0, import_react44.useState)(view.addable.length > 0 ? "known" : "custom");
+ return (0, import_react44.createElement)(
"div",
{ className: "bt-set-row bt-set-paste bt-provider-add" },
- (0, import_react43.createElement)(
+ (0, import_react44.createElement)(
Segmented,
{ label: t("Kind of provider"), value: mode },
- [["known", t("Known provider")], ["custom", t("Custom API")]].map(([id, label]) => (0, import_react43.createElement)("button", {
+ [["known", t("Known provider")], ["custom", t("Custom API")]].map(([id, label]) => (0, import_react44.createElement)("button", {
key: id,
type: "button",
"aria-pressed": mode === id,
@@ -16445,13 +16462,13 @@ function AddProvider({ view, apply: apply2, actions, onDone }) {
}, label))
),
// Both forms stay mounted, so switching keeps what is typed in the other.
- (0, import_react43.createElement)("div", { hidden: mode !== "known" }, (0, import_react43.createElement)(KnownForm, { view, apply: apply2, actions, onDone })),
- (0, import_react43.createElement)("div", { hidden: mode !== "custom" }, (0, import_react43.createElement)(CustomForm, { view, apply: apply2, actions, onDone }))
+ (0, import_react44.createElement)("div", { hidden: mode !== "known" }, (0, import_react44.createElement)(KnownForm, { view, apply: apply2, actions, onDone })),
+ (0, import_react44.createElement)("div", { hidden: mode !== "custom" }, (0, import_react44.createElement)(CustomForm, { view, apply: apply2, actions, onDone }))
);
}
function KnownForm({ view, apply: apply2, actions, onDone }) {
- const [provider, setProvider] = (0, import_react43.useState)("");
- const [key, setKey] = (0, import_react43.useState)("");
+ const [provider, setProvider] = (0, import_react44.useState)("");
+ const [key, setKey] = (0, import_react44.useState)("");
const options = [...view.addable].sort((a, b) => a.name.localeCompare(b.name));
const add = () => {
if (provider === "") return;
@@ -16459,24 +16476,24 @@ function KnownForm({ view, apply: apply2, actions, onDone }) {
if (ok) onDone();
});
};
- return (0, import_react43.createElement)(
+ return (0, import_react44.createElement)(
"div",
{ className: "bt-provider-form" },
- (0, import_react43.createElement)(
+ (0, import_react44.createElement)(
"select",
{ className: "bt-select", "aria-label": t("Provider"), value: provider, onChange: (event) => setProvider(event.target.value) },
- (0, import_react43.createElement)("option", { value: "", disabled: true }, t("Choose a provider")),
- options.map((option) => (0, import_react43.createElement)("option", { key: option.id, value: option.id }, option.name))
+ (0, import_react44.createElement)("option", { value: "", disabled: true }, t("Choose a provider")),
+ options.map((option) => (0, import_react44.createElement)("option", { key: option.id, value: option.id }, option.name))
),
- (0, import_react43.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react43.createElement)(KeyIcon), (0, import_react43.createElement)(MaskedInput, { value: key, onChange: setKey, onEnter: add, label: t("API key") })),
- (0, import_react43.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready: provider !== "" })
+ (0, import_react44.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react44.createElement)(KeyIcon), (0, import_react44.createElement)(MaskedInput, { value: key, onChange: setKey, onEnter: add, label: t("API key") })),
+ (0, import_react44.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready: provider !== "" })
);
}
function CustomForm({ view, apply: apply2, actions, onDone }) {
- const [draft, setDraft] = (0, import_react43.useState)({ provider: "", name: "", baseURL: "", api: view.protocols[0], key: "", typed: "" });
- const [found, setFound] = (0, import_react43.useState)(null);
- const [picked, setPicked] = (0, import_react43.useState)([]);
- const [asking, setAsking] = (0, import_react43.useState)(false);
+ const [draft, setDraft] = (0, import_react44.useState)({ provider: "", name: "", baseURL: "", api: view.protocols[0], key: "", typed: "" });
+ const [found, setFound] = (0, import_react44.useState)(null);
+ const [picked, setPicked] = (0, import_react44.useState)([]);
+ const [asking, setAsking] = (0, import_react44.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 }))];
@@ -16495,7 +16512,7 @@ function CustomForm({ view, apply: apply2, actions, onDone }) {
if (ok) onDone();
});
};
- const input = (field, label, placeholder) => (0, import_react43.createElement)("input", {
+ const input = (field, label, placeholder) => (0, import_react44.createElement)("input", {
className: "bt-input",
"aria-label": label,
placeholder,
@@ -16504,55 +16521,55 @@ function CustomForm({ view, apply: apply2, actions, onDone }) {
autoComplete: "off",
onChange: (event) => set(field, event.target.value)
});
- return (0, import_react43.createElement)(
+ return (0, import_react44.createElement)(
"div",
{ className: "bt-provider-form" },
- (0, import_react43.createElement)(
+ (0, import_react44.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_react43.createElement)(
+ (0, import_react44.createElement)(
"div",
{ className: "bt-provider-pair" },
input("baseURL", t("Endpoint"), ENDPOINT_HINTS[draft.api] ?? "https://gateway.example/v1"),
- (0, import_react43.createElement)(
+ (0, import_react44.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_react43.createElement)("option", { key: api, value: api }, PROTOCOL_NAMES[api] ?? api))
+ view.protocols.map((api) => (0, import_react44.createElement)("option", { key: api, value: api }, PROTOCOL_NAMES[api] ?? api))
)
),
- (0, import_react43.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react43.createElement)(KeyIcon), (0, import_react43.createElement)(MaskedInput, { value: draft.key, onChange: (value) => set("key", value), label: t("API key") })),
- (0, import_react43.createElement)(
+ (0, import_react44.createElement)("label", { className: "bt-q-field bt-secret-field" }, (0, import_react44.createElement)(KeyIcon), (0, import_react44.createElement)(MaskedInput, { value: draft.key, onChange: (value) => set("key", value), label: t("API key") })),
+ (0, import_react44.createElement)(
"div",
{ className: "bt-secret-edit-block" },
- (0, import_react43.createElement)(
+ (0, import_react44.createElement)(
"div",
{ className: "bt-provider-models-head" },
- (0, import_react43.createElement)("span", { className: "bt-secret-edit-label" }, t("Models")),
- (0, import_react43.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_react44.createElement)("span", { className: "bt-secret-edit-label" }, t("Models")),
+ (0, import_react44.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_react43.createElement)("div", { className: "bt-set-hint" }, t("The endpoint lists no models. Enter their ids below.")) : null,
- found !== null && found.length > 0 ? (0, import_react43.createElement)("div", { className: "bt-secret-bots bt-provider-found" }, found.map((model) => (0, import_react43.createElement)("button", {
+ found !== null && found.length === 0 ? (0, import_react44.createElement)("div", { className: "bt-set-hint" }, t("The endpoint lists no models. Enter their ids below.")) : null,
+ found !== null && found.length > 0 ? (0, import_react44.createElement)("div", { className: "bt-secret-bots bt-provider-found" }, found.map((model) => (0, import_react44.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_react43.createElement)("code", null, model.id), picked.includes(model.id) ? (0, import_react43.createElement)(CheckIcon) : null))) : null,
+ }, (0, import_react44.createElement)("code", null, model.id), picked.includes(model.id) ? (0, import_react44.createElement)(CheckIcon) : null))) : null,
input("typed", t("Model ids"), t("Model ids, separated by commas"))
),
- (0, import_react43.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready })
+ (0, import_react44.createElement)(FormActions, { onCancel: onDone, onAdd: add, ready })
);
}
function FormActions({ onCancel, onAdd, ready }) {
- return (0, import_react43.createElement)(
+ return (0, import_react44.createElement)(
"div",
{ className: "bt-secret-row-actions" },
- (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),
- (0, import_react43.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: onAdd }, t("Add"))
+ (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: onCancel }, t("Cancel")),
+ (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: !ready, onClick: onAdd }, t("Add"))
);
}
var PROVIDERS_CSS = `
@@ -16582,24 +16599,24 @@ var PROVIDERS_CSS = `
`;
// src/client/settings.js
-var import_react44 = require("react");
+var import_react45 = 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_react44.createElement)("section", { className: `bt-set-section ${className}`.trim() }, (0, import_react44.createElement)("h3", null, title), (0, import_react44.createElement)("div", { className: "bt-set-card" }, children));
+ return (0, import_react45.createElement)("section", { className: `bt-set-section ${className}`.trim() }, (0, import_react45.createElement)("h3", null, title), (0, import_react45.createElement)("div", { className: "bt-set-card" }, children));
}
function SetRow({ label, hint, children, className = "" }) {
- return (0, import_react44.createElement)(
+ return (0, import_react45.createElement)(
"div",
{ className: `bt-set-row ${className}`.trim() },
- (0, import_react44.createElement)("div", { className: "bt-set-copy" }, (0, import_react44.createElement)("span", null, label), hint ? (0, import_react44.createElement)("span", { className: "bt-set-hint" }, hint) : null),
- children ? (0, import_react44.createElement)("div", { className: "bt-set-control" }, children) : null
+ (0, import_react45.createElement)("div", { className: "bt-set-copy" }, (0, import_react45.createElement)("span", null, label), hint ? (0, import_react45.createElement)("span", { className: "bt-set-hint" }, hint) : null),
+ children ? (0, import_react45.createElement)("div", { className: "bt-set-control" }, children) : null
);
}
var LAYOUTS = [["bubble", "Bubble"], ["flat", "Flat"]];
function Choice({ label, value, options, pick: pick2 }) {
- return (0, import_react44.createElement)(Segmented, { label, value, className: "bt-look-seg" }, options.map(([id, text]) => (0, import_react44.createElement)("button", {
+ return (0, import_react45.createElement)(Segmented, { label, value, className: "bt-look-seg" }, options.map(([id, text]) => (0, import_react45.createElement)("button", {
key: id,
type: "button",
"aria-pressed": value === id,
@@ -16609,12 +16626,12 @@ function Choice({ label, value, options, pick: pick2 }) {
}, t(text))));
}
function WidthSlider({ label, value, save }) {
- const [width, setWidth] = (0, import_react44.useState)(value);
- const pending = (0, import_react44.useRef)(null);
- const timer = (0, import_react44.useRef)(0);
- const saveRef = (0, import_react44.useRef)(save);
+ const [width, setWidth] = (0, import_react45.useState)(value);
+ const pending = (0, import_react45.useRef)(null);
+ const timer = (0, import_react45.useRef)(0);
+ const saveRef = (0, import_react45.useRef)(save);
saveRef.current = save;
- (0, import_react44.useEffect)(() => {
+ (0, import_react45.useEffect)(() => {
if (pending.current === null) setWidth(value);
}, [value]);
const flush = () => {
@@ -16622,7 +16639,7 @@ function WidthSlider({ label, value, save }) {
pending.current = null;
if (next !== null) saveRef.current(next);
};
- (0, import_react44.useEffect)(() => () => {
+ (0, import_react45.useEffect)(() => () => {
clearTimeout(timer.current);
flush();
}, []);
@@ -16633,46 +16650,46 @@ function WidthSlider({ label, value, save }) {
timer.current = setTimeout(flush, 350);
};
const { min, max, step } = MESSAGE_WIDTH;
- return (0, import_react44.createElement)(
+ return (0, import_react45.createElement)(
"div",
{ className: "bt-range", style: { "--bt-fill": `${(width - min) / (max - min) * 100}%` } },
- (0, import_react44.createElement)("input", { type: "range", min, max, step, value: width, "aria-label": label, "aria-valuetext": `${width}%`, onChange: (event) => pick2(Number(event.target.value)) }),
- (0, import_react44.createElement)("output", null, `${width}%`)
+ (0, import_react45.createElement)("input", { type: "range", min, max, step, value: width, "aria-label": label, "aria-valuetext": `${width}%`, onChange: (event) => pick2(Number(event.target.value)) }),
+ (0, import_react45.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_react44.useState)(prefs.accent ?? "#4d6bfe");
- const timer = (0, import_react44.useRef)(0);
- (0, import_react44.useEffect)(() => () => clearTimeout(timer.current), []);
+ const [custom, setCustom] = (0, import_react45.useState)(prefs.accent ?? "#4d6bfe");
+ const timer = (0, import_react45.useRef)(0);
+ (0, import_react45.useEffect)(() => () => clearTimeout(timer.current), []);
const pickCustom = (value) => {
setCustom(value);
clearTimeout(timer.current);
timer.current = setTimeout(() => run2(actions.setPrefs({ accent: value })), 350);
};
return [
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)(
SetSection,
{ key: "look", title: t("Appearance") },
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)(
SetRow,
{ label: t("Theme"), hint: t("Colors for the whole team, on every device.") },
- (0, import_react44.createElement)(
+ (0, import_react45.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_react44.createElement)("option", { key: id, value: id }, t(theme.label)))
+ Object.entries(themes).map(([id, theme]) => (0, import_react45.createElement)("option", { key: id, value: id }, t(theme.label)))
)
),
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)(
SetRow,
{ label: t("Accent"), hint: t("Unread marks, badges, and the brand mark.") },
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)(
"div",
{ className: "bt-swatches" },
- (0, import_react44.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_react44.createElement)("button", {
+ (0, import_react45.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_react45.createElement)("button", {
key: ink,
type: "button",
className: "bt-swatch",
@@ -16682,38 +16699,38 @@ function GeneralPage({ roster, actions, run: run2 }) {
style: { background: INKS[ink][0] },
onClick: () => run2(actions.setPrefs({ accent: INKS[ink][0] }))
})),
- (0, import_react44.createElement)(
+ (0, import_react45.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_react44.createElement)("input", { type: "color", value: custom, "aria-label": t("Custom accent"), onChange: (event) => pickCustom(event.target.value) })
+ (0, import_react45.createElement)("input", { type: "color", value: custom, "aria-label": t("Custom accent"), onChange: (event) => pickCustom(event.target.value) })
)
)
),
- (0, import_react44.createElement)(SetRow, { label: t("Message layout") }, (0, import_react44.createElement)(Choice, { label: t("Message layout"), value: layoutOf(prefs), options: LAYOUTS, pick: (id) => run2(actions.setPrefs({ layout: id })) })),
+ (0, import_react45.createElement)(SetRow, { label: t("Message layout") }, (0, import_react45.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_react44.createElement)(SetRow, { label: t("Text width") }, (0, import_react44.createElement)(WidthSlider, { label: t("Text width"), value: flatWidthOf(prefs), save: (flatWidth) => run2(actions.setPrefs({ flatWidth })) })) : null,
- (0, import_react44.createElement)(SetRow, { label: t("Bubble width") }, (0, import_react44.createElement)(WidthSlider, { label: t("Bubble width"), value: widthOf(prefs), save: (width) => run2(actions.setPrefs({ width })) })),
- (0, import_react44.createElement)(SetRow, { label: t("Show thinking") }, (0, import_react44.createElement)(Switch, { label: t("Show thinking"), on: thinkingShown(prefs), onChange: (thinking) => run2(actions.setPrefs({ thinking })) }))
+ layoutOf(prefs) === "flat" ? (0, import_react45.createElement)(SetRow, { label: t("Text width") }, (0, import_react45.createElement)(WidthSlider, { label: t("Text width"), value: flatWidthOf(prefs), save: (flatWidth) => run2(actions.setPrefs({ flatWidth })) })) : null,
+ (0, import_react45.createElement)(SetRow, { label: t("Bubble width") }, (0, import_react45.createElement)(WidthSlider, { label: t("Bubble width"), value: widthOf(prefs), save: (width) => run2(actions.setPrefs({ width })) })),
+ (0, import_react45.createElement)(SetRow, { label: t("Show thinking") }, (0, import_react45.createElement)(Switch, { label: t("Show thinking"), on: thinkingShown(prefs), onChange: (thinking) => run2(actions.setPrefs({ thinking })) }))
),
- actions.setSurface ? (0, import_react44.createElement)(
+ actions.setSurface ? (0, import_react45.createElement)(
SetSection,
{ key: "mode", title: t("Mode") },
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)(
SetRow,
{ label: t("Classic Agent mode") },
- (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.setSurface("agent") }, t("Switch"))
+ (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => actions.setSurface("agent") }, t("Switch"))
)
) : null,
- (0, import_react44.createElement)(LocationsSection, { key: "places", actions, run: run2 })
+ (0, import_react45.createElement)(LocationsSection, { key: "places", actions, run: run2 })
];
}
function LocationsSection({ actions, run: run2 }) {
const app = globalThis.dsBotApp;
- const [team, setTeam] = (0, import_react44.useState)(null);
- const [data, setData] = (0, import_react44.useState)(null);
- const [moving, setMoving] = (0, import_react44.useState)(false);
- const busy = (0, import_react44.useRef)(false);
- (0, import_react44.useEffect)(() => {
+ const [team, setTeam] = (0, import_react45.useState)(null);
+ const [data, setData] = (0, import_react45.useState)(null);
+ const [moving, setMoving] = (0, import_react45.useState)(false);
+ const busy = (0, import_react45.useRef)(false);
+ (0, import_react45.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(() => {
@@ -16731,18 +16748,18 @@ function LocationsSection({ actions, run: run2 }) {
setMoving(false);
}));
};
- return (0, import_react44.createElement)(
+ return (0, import_react45.createElement)(
SetSection,
{ title: t("Locations"), className: "bt-set-places" },
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)(
SetRow,
{ label: t("Team workspace"), hint: t("Where Bots without a folder of their own work.") },
- team === null ? null : (0, import_react44.createElement)(FolderMenu, { value: team, team: true, actions, run: run2, onPick: pickTeam, disabled: moving })
+ team === null ? null : (0, import_react45.createElement)(FolderMenu, { value: team, team: true, actions, run: run2, onPick: pickTeam, disabled: moving })
),
- data === null ? null : (0, import_react44.createElement)(
+ data === null ? null : (0, import_react45.createElement)(
SetRow,
{ label: t("Data location"), hint: data.path },
- data.fixed ? null : (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: moving, onClick: () => {
+ data.fixed ? null : (0, import_react45.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…"))
)
@@ -16752,52 +16769,52 @@ function MainBotsSection({ roster, actions, run: run2 }) {
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_react44.createElement)(
+ return (0, import_react45.createElement)(
SetSection,
{ title: t("Main Bot") },
- (0, import_react44.createElement)(
+ (0, import_react45.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_react44.createElement)("select", {
+ (0, import_react45.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_react44.createElement)("option", { value: "" }, t("Choose a Bot…")), roster.bots.map((bot) => (0, import_react44.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))
+ }, first ? null : (0, import_react45.createElement)("option", { value: "" }, t("Choose a Bot…")), roster.bots.map((bot) => (0, import_react45.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))
),
- others.map((bot) => (0, import_react44.createElement)(
+ others.map((bot) => (0, import_react45.createElement)(
SetRow,
{ key: bot.id, label: bot.name, hint: t("Also a Main Bot.") },
- (0, import_react44.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_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => run2(actions.setMain(bot.id, false)) }, t("Remove Main Bot role"))
+ (0, import_react45.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_react45.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_react44.createElement)(
+ candidates.length > 0 ? (0, import_react45.createElement)(
SetRow,
{ label: t("Add a Main Bot"), hint: t("Main Bots can create and change Bots, and run every group chat.") },
- (0, import_react44.createElement)("select", {
+ (0, import_react45.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_react44.createElement)("option", { value: "" }, t("Choose a Bot…")), candidates.map((bot) => (0, import_react44.createElement)("option", { key: bot.id, value: bot.id }, bot.name)))
+ }, (0, import_react45.createElement)("option", { value: "" }, t("Choose a Bot…")), candidates.map((bot) => (0, import_react45.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_react44.createElement)(
+ return (0, import_react45.createElement)(
SetSection,
{ title: t("Animation") },
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)(
SetRow,
{ label: t("Bot animation") },
- (0, import_react44.createElement)(Segmented, { label: t("Bot animation"), value: motion, className: "bt-motion-seg" }, MOTIONS.map(([id, label]) => (0, import_react44.createElement)("button", {
+ (0, import_react45.createElement)(Segmented, { label: t("Bot animation"), value: motion, className: "bt-motion-seg" }, MOTIONS.map(([id, label]) => (0, import_react45.createElement)("button", {
key: id,
type: "button",
"aria-pressed": motion === id,
@@ -16809,70 +16826,70 @@ function MotionSection({ roster, actions, run: run2 }) {
);
}
function BotsPage({ roster, actions, run: run2 }) {
- const [creating, setCreating] = (0, import_react44.useState)(false);
+ const [creating, setCreating] = (0, import_react45.useState)(false);
return [
- (0, import_react44.createElement)(MainBotsSection, { key: "main", roster, actions, run: run2 }),
- (0, import_react44.createElement)(MotionSection, { key: "motion", roster, actions, run: run2 }),
- creating ? (0, import_react44.createElement)(CreateBot, { key: "create", roster, actions, inline: true, onBack: () => setCreating(false), onCreated: (bot) => actions.openSettings("bots", bot.id) }) : (0, import_react44.createElement)(
+ (0, import_react45.createElement)(MainBotsSection, { key: "main", roster, actions, run: run2 }),
+ (0, import_react45.createElement)(MotionSection, { key: "motion", roster, actions, run: run2 }),
+ creating ? (0, import_react45.createElement)(CreateBot, { key: "create", roster, actions, inline: true, onBack: () => setCreating(false), onCreated: (bot) => actions.openSettings("bots", bot.id) }) : (0, import_react45.createElement)(
"div",
{ key: "new", className: "bt-actions" },
- (0, import_react44.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", onClick: () => setCreating(true) }, (0, import_react44.createElement)(PlusIcon), t("New Bot"))
+ (0, import_react45.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm bt-with-icon", onClick: () => setCreating(true) }, (0, import_react45.createElement)(PlusIcon), t("New Bot"))
),
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)(
SetSection,
{ key: "bots", title: t("Bots · {count}", { count: roster.bots.length }) },
- roster.bots.map((bot) => (0, import_react44.createElement)(
+ roster.bots.map((bot) => (0, import_react45.createElement)(
"button",
{ key: bot.id, type: "button", className: "bt-set-row", onClick: () => actions.openSettings("bots", bot.id) },
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)(
"span",
{ className: "bt-set-bot" },
- (0, import_react44.createElement)(BotAvatar, { bot, size: 28, badge: false, live: false }),
- (0, import_react44.createElement)("span", { className: "bt-row-title" }, bot.name),
- bot.role ? (0, import_react44.createElement)("span", { className: "bt-tag" }, bot.role) : null,
- isMainOf(roster, bot.id) ? (0, import_react44.createElement)("span", { className: "bt-tag" }, t("Main Bot")) : null,
- bot.hidden && !isMainOf(roster, bot.id) ? (0, import_react44.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null
+ (0, import_react45.createElement)(BotAvatar, { bot, size: 28, badge: false, live: false }),
+ (0, import_react45.createElement)("span", { className: "bt-row-title" }, bot.name),
+ bot.role ? (0, import_react45.createElement)("span", { className: "bt-tag" }, bot.role) : null,
+ isMainOf(roster, bot.id) ? (0, import_react45.createElement)("span", { className: "bt-tag" }, t("Main Bot")) : null,
+ bot.hidden && !isMainOf(roster, bot.id) ? (0, import_react45.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null
),
- (0, import_react44.createElement)("span", { className: "bt-chevron" }, (0, import_react44.createElement)(ChevronRightIcon))
+ (0, import_react45.createElement)("span", { className: "bt-chevron" }, (0, import_react45.createElement)(ChevronRightIcon))
))
),
- (0, import_react44.createElement)(KeptPrivateSection, { key: "kept", roster, actions, run: run2, Section: SetSection, Row: SetRow })
+ (0, import_react45.createElement)(KeptPrivateSection, { key: "kept", roster, actions, run: run2, Section: SetSection, Row: SetRow })
];
}
function GroupsPage({ roster, actions, run: run2 }) {
- const [creating, setCreating] = (0, import_react44.useState)(false);
+ const [creating, setCreating] = (0, import_react45.useState)(false);
return [
- creating ? (0, import_react44.createElement)(NewGroupForm, { key: "create", roster, actions, run: run2, onCancel: () => setCreating(false), onCreated: (room2) => actions.openSettings("groups", room2.id) }) : (0, import_react44.createElement)(
+ creating ? (0, import_react45.createElement)(NewGroupForm, { key: "create", roster, actions, run: run2, onCancel: () => setCreating(false), onCreated: (room2) => actions.openSettings("groups", room2.id) }) : (0, import_react45.createElement)(
"div",
{ key: "new", className: "bt-actions" },
- (0, import_react44.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_react44.createElement)(PlusIcon), t("Create group chat"))
+ (0, import_react45.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_react45.createElement)(PlusIcon), t("Create group chat"))
),
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)(
SetSection,
{ key: "groups", title: t("Group chats · {count}", { count: roster.rooms.length }) },
- roster.rooms.length === 0 ? (0, import_react44.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_react45.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_react44.createElement)(
+ return (0, import_react45.createElement)(
"button",
{ key: room2.id, type: "button", className: "bt-set-row", onClick: () => actions.openSettings("groups", room2.id) },
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)(
"span",
{ className: "bt-set-bot" },
- (0, import_react44.createElement)(RoomAvatar, { room: room2, roster, size: 28 }),
- (0, import_react44.createElement)("span", { className: "bt-row-title" }, room2.name),
- (0, import_react44.createElement)("span", { className: "bt-tag" }, t("{count} members", { count: room2.members.length })),
- admin ? (0, import_react44.createElement)("span", { className: "bt-tag bt-tag-admin" }, (0, import_react44.createElement)(AdminStar), admin.name) : null,
- room2.hidden ? (0, import_react44.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null
+ (0, import_react45.createElement)(RoomAvatar, { room: room2, roster, size: 28 }),
+ (0, import_react45.createElement)("span", { className: "bt-row-title" }, room2.name),
+ (0, import_react45.createElement)("span", { className: "bt-tag" }, t("{count} members", { count: room2.members.length })),
+ admin ? (0, import_react45.createElement)("span", { className: "bt-tag bt-tag-admin" }, (0, import_react45.createElement)(AdminStar), admin.name) : null,
+ room2.hidden ? (0, import_react45.createElement)("span", { className: "bt-tag" }, t("Hidden")) : null
),
- (0, import_react44.createElement)("span", { className: "bt-chevron" }, (0, import_react44.createElement)(ChevronRightIcon))
+ (0, import_react45.createElement)("span", { className: "bt-chevron" }, (0, import_react45.createElement)(ChevronRightIcon))
);
})
)
];
}
function SettingsDialog({ page, id, roster, actions, useUpdate, leaving = false }) {
- const [error, setError] = (0, import_react44.useState)("");
- const close = (0, import_react44.useCallback)(() => actions.closeSettings(), []);
+ const [error, setError] = (0, import_react45.useState)("");
+ const close = (0, import_react45.useCallback)(() => actions.closeSettings(), []);
useEscape(close);
const run2 = (promise) => Promise.resolve(promise).then(() => {
setError("");
@@ -16891,32 +16908,32 @@ function SettingsDialog({ page, id, roster, actions, useUpdate, leaving = false
const nav = useGlide(shown, { axis: "y" });
const pageKey = `${shown}:${bot?.id ?? room2?.id ?? ""}`;
const depth = bot || room2 ? 1 : 0;
- const last = (0, import_react44.useRef)({ key: pageKey, depth, move: "up" });
+ const last = (0, import_react45.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_react44.useState)(shown === "usage");
+ const [usageOpened, setUsageOpened] = (0, import_react45.useState)(shown === "usage");
if (shown === "usage" && !usageOpened) setUsageOpened(true);
- const errorLine = error ? (0, import_react44.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;
- return (0, import_react44.createElement)(
+ const errorLine = error ? (0, import_react45.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;
+ return (0, import_react45.createElement)(
"div",
{ className: "bt-settings-layer", "data-leaving": leaving || void 0 },
- (0, import_react44.createElement)("div", { className: "bt-scrim", onMouseDown: close }),
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)("div", { className: "bt-scrim", onMouseDown: close }),
+ (0, import_react45.createElement)(
"div",
{ className: "bt-settings", role: "dialog", "aria-modal": true, "aria-label": t("DS Bot settings") },
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)(
"nav",
{ ref: nav.box, className: "bt-settings-nav", "aria-label": t("Settings pages") },
- (0, import_react44.createElement)("span", { ref: nav.thumb, className: "bt-thumb", "aria-hidden": true }),
- pages.map(([key, text]) => (0, import_react44.createElement)("button", {
+ (0, import_react45.createElement)("span", { ref: nav.thumb, className: "bt-thumb", "aria-hidden": true }),
+ pages.map(([key, text]) => (0, import_react45.createElement)("button", {
key,
type: "button",
className: "bt-settings-item",
"aria-current": shown === key ? "page" : void 0,
onClick: () => actions.openSettings(key)
- }, (0, import_react44.createElement)(PAGE_ICONS[key]), t(text))),
- actions.openHarnessSettings ? (0, import_react44.createElement)("button", {
+ }, (0, import_react45.createElement)(PAGE_ICONS[key]), t(text))),
+ actions.openHarnessSettings ? (0, import_react45.createElement)("button", {
type: "button",
className: "bt-settings-item bt-settings-shell",
title: t("Models, providers, and the rest of DeepSeek Harness"),
@@ -16924,67 +16941,67 @@ function SettingsDialog({ page, id, roster, actions, useUpdate, leaving = false
close();
actions.openHarnessSettings();
}
- }, (0, import_react44.createElement)(SlidersIcon), t("Harness settings")) : null
+ }, (0, import_react45.createElement)(SlidersIcon), t("Harness settings")) : null
),
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)(
"div",
{ className: "bt-settings-main" },
- (0, import_react44.createElement)(
+ (0, import_react45.createElement)(
"div",
{ className: "bt-settings-head" },
- back ? (0, import_react44.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": back, title: back, onClick: () => actions.openSettings(shown) }, (0, import_react44.createElement)(ChevronLeftIcon)) : null,
- (0, import_react44.createElement)("h2", { key: bot?.id ?? room2?.id ?? shown }, bot?.name ?? room2?.name ?? label)
+ back ? (0, import_react45.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": back, title: back, onClick: () => actions.openSettings(shown) }, (0, import_react45.createElement)(ChevronLeftIcon)) : null,
+ (0, import_react45.createElement)("h2", { key: bot?.id ?? room2?.id ?? shown }, bot?.name ?? room2?.name ?? label)
),
- shown === "usage" ? null : (0, import_react44.createElement)(
+ shown === "usage" ? null : (0, import_react45.createElement)(
"div",
{ key: pageKey, className: "bt-settings-scroll bt-settings-page", "data-move": last.current.move },
errorLine,
- shown === "general" ? (0, import_react44.createElement)(GeneralPage, { roster, actions, run: run2 }) : null,
- shown === "models" ? (0, import_react44.createElement)(ProvidersPage, { actions, run: run2, Section: SetSection }) : null,
- bot ? (0, import_react44.createElement)("div", { className: "bt-settings-form" }, (0, import_react44.createElement)(BotSettingsForm, { key: bot.id, bot, roster, actions, run: run2 })) : null,
- shown === "bots" && !bot ? (0, import_react44.createElement)(BotsPage, { roster, actions, run: run2 }) : null,
- room2 ? (0, import_react44.createElement)("div", { className: "bt-settings-form" }, (0, import_react44.createElement)(GroupSettingsForm, { key: room2.id, room: room2, roster, actions, run: run2 })) : null,
- shown === "groups" && !room2 ? (0, import_react44.createElement)(GroupsPage, { roster, actions, run: run2 }) : null,
- shown === "connectors" ? (0, import_react44.createElement)(ConnectorsPage, { roster, actions }) : null,
- shown === "capabilities" ? (0, import_react44.createElement)(CapabilitiesPage, { roster, actions, run: run2 }) : null,
- shown === "browser" ? (0, import_react44.createElement)(BrowserPage, { roster, actions, run: run2, Section: SetSection, Row: SetRow }) : null,
- shown === "schedules" ? (0, import_react44.createElement)(SchedulesPage, { roster, actions, start: id ?? void 0 }) : null,
- shown === "secrets" ? (0, import_react44.createElement)(SecretsPage, { roster, actions, run: run2, Section: SetSection }) : null,
- shown === "feedback" ? (0, import_react44.createElement)(FeedbackPage, { actions, run: run2, Section: SetSection, Row: SetRow }) : null,
- shown === "about" ? (0, import_react44.createElement)(AboutPage, { useUpdate, actions, run: run2, Section: SetSection, Row: SetRow }) : null
+ shown === "general" ? (0, import_react45.createElement)(GeneralPage, { roster, actions, run: run2 }) : null,
+ shown === "models" ? (0, import_react45.createElement)(ProvidersPage, { actions, run: run2, Section: SetSection }) : null,
+ bot ? (0, import_react45.createElement)("div", { className: "bt-settings-form" }, (0, import_react45.createElement)(BotSettingsForm, { key: bot.id, bot, roster, actions, run: run2 })) : null,
+ shown === "bots" && !bot ? (0, import_react45.createElement)(BotsPage, { roster, actions, run: run2 }) : null,
+ room2 ? (0, import_react45.createElement)("div", { className: "bt-settings-form" }, (0, import_react45.createElement)(GroupSettingsForm, { key: room2.id, room: room2, roster, actions, run: run2 })) : null,
+ shown === "groups" && !room2 ? (0, import_react45.createElement)(GroupsPage, { roster, actions, run: run2 }) : null,
+ shown === "connectors" ? (0, import_react45.createElement)(ConnectorsPage, { roster, actions }) : null,
+ shown === "capabilities" ? (0, import_react45.createElement)(CapabilitiesPage, { roster, actions, run: run2 }) : null,
+ shown === "browser" ? (0, import_react45.createElement)(BrowserPage, { roster, actions, run: run2, Section: SetSection, Row: SetRow }) : null,
+ shown === "schedules" ? (0, import_react45.createElement)(SchedulesPage, { roster, actions, start: id ?? void 0 }) : null,
+ shown === "secrets" ? (0, import_react45.createElement)(SecretsPage, { roster, actions, run: run2, Section: SetSection }) : null,
+ shown === "feedback" ? (0, import_react45.createElement)(FeedbackPage, { actions, run: run2, Section: SetSection, Row: SetRow }) : null,
+ shown === "about" ? (0, import_react45.createElement)(AboutPage, { useUpdate, actions, run: run2, Section: SetSection, Row: SetRow }) : null
),
- usageOpened ? (0, import_react44.createElement)(
+ usageOpened ? (0, import_react45.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_react44.createElement)(UsagePage, { roster, actions, focusId: usageFocus })
+ (0, import_react45.createElement)(UsagePage, { roster, actions, focusId: usageFocus })
) : null
),
- (0, import_react44.createElement)("button", { type: "button", className: "bt-settings-close", "aria-label": t("Close settings"), onClick: close }, (0, import_react44.createElement)(CloseIcon))
+ (0, import_react45.createElement)("button", { type: "button", className: "bt-settings-close", "aria-label": t("Close settings"), onClick: close }, (0, import_react45.createElement)(CloseIcon))
)
);
}
// src/client/context-menu.js
-var import_react45 = require("react");
+var import_react46 = require("react");
function ContextMenu({ menu, roster, actions, leaving = false }) {
useEscape(() => actions.closeMenu());
- (0, import_react45.useEffect)(() => {
+ (0, import_react46.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_react45.useRef)(null);
- const [place, setPlace] = (0, import_react45.useState)({ left: menu.x, top: menu.y });
+ const ref = (0, import_react46.useRef)(null);
+ const [place, setPlace] = (0, import_react46.useState)({ left: menu.x, top: menu.y });
const tick = useViewport();
- (0, import_react45.useLayoutEffect)(() => {
+ (0, import_react46.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_react45.createElement)(AgentMenu, { menu, roster, actions, leaving });
+ if (menu.kind === "agent" || menu.kind === "agent-session") return (0, import_react46.createElement)(AgentMenu, { menu, roster, actions, leaving });
const bot = roster.byId[menu.id];
const room2 = roster.roomsById[menu.id];
const entry = bot ?? room2;
@@ -17015,14 +17032,14 @@ function ContextMenu({ menu, roster, actions, leaving = false }) {
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_react45.createElement)(
+ return (0, import_react46.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_react45.createElement)(
- import_react45.Fragment,
+ groups.map((group, index) => (0, import_react46.createElement)(
+ import_react46.Fragment,
{ key: index },
- index > 0 ? (0, import_react45.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,
- group.map(([label, Icon, run2, danger]) => (0, import_react45.createElement)("button", {
+ index > 0 ? (0, import_react46.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,
+ group.map(([label, Icon, run2, danger]) => (0, import_react46.createElement)("button", {
key: label,
type: "button",
role: "menuitem",
@@ -17031,15 +17048,15 @@ function ContextMenu({ menu, roster, actions, leaving = false }) {
actions.closeMenu();
void Promise.resolve(run2()).catch((error) => actions.reportError(error, "menu"));
}
- }, (0, import_react45.createElement)(Icon), label))
+ }, (0, import_react46.createElement)(Icon), label))
))
);
}
function AgentMenu({ menu, roster, actions, leaving }) {
- const ref = (0, import_react45.useRef)(null);
- const [place, setPlace] = (0, import_react45.useState)({ left: menu.x, top: menu.y });
+ const ref = (0, import_react46.useRef)(null);
+ const [place, setPlace] = (0, import_react46.useState)({ left: menu.x, top: menu.y });
const tick = useViewport();
- (0, import_react45.useLayoutEffect)(() => {
+ (0, import_react46.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)) });
@@ -17061,14 +17078,14 @@ function AgentMenu({ menu, roster, actions, leaving }) {
[t("Archive"), TrashIcon, () => actions.archiveAgentSession(agent.id, menu.id), true]
]
];
- return (0, import_react45.createElement)(
+ return (0, import_react46.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_react45.createElement)(
- import_react45.Fragment,
+ groups.map((group, index) => (0, import_react46.createElement)(
+ import_react46.Fragment,
{ key: index },
- index > 0 ? (0, import_react45.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,
- group.map(([label, Icon, run2, danger]) => (0, import_react45.createElement)("button", {
+ index > 0 ? (0, import_react46.createElement)("div", { className: "bt-menu-sep", role: "separator" }) : null,
+ group.map(([label, Icon, run2, danger]) => (0, import_react46.createElement)("button", {
key: label,
type: "button",
role: "menuitem",
@@ -17077,13 +17094,13 @@ function AgentMenu({ menu, roster, actions, leaving }) {
actions.closeMenu();
void Promise.resolve(run2()).catch((error) => console.warn("[ds-bot]", error));
}
- }, (0, import_react45.createElement)(Icon), label))
+ }, (0, import_react46.createElement)(Icon), label))
))
);
}
// src/client/member-status.js
-var import_react46 = require("react");
+var import_react47 = require("react");
var NO_WORK = { bots: {}, rooms: {}, approvals: [] };
var FACES_MAX = 3;
var DOCK_EXIT_MS = 160;
@@ -17144,15 +17161,15 @@ function dockModel(sessionId, roster, work) {
};
}
function Face({ bot, ask, state }) {
- return (0, import_react46.createElement)(
+ return (0, import_react47.createElement)(
"span",
{ className: "bt-mw-face", "data-ask": ask || void 0 },
- (0, import_react46.createElement)(BotMark, { bot, size: 20, state: ask ? "alert" : state })
+ (0, import_react47.createElement)(BotMark, { bot, size: 20, state: ask ? "alert" : state })
);
}
function useFitWidth(inner, key) {
- const [width, setWidth] = (0, import_react46.useState)(null);
- (0, import_react46.useLayoutEffect)(() => {
+ const [width, setWidth] = (0, import_react47.useState)(null);
+ (0, import_react47.useLayoutEffect)(() => {
setWidth(key && inner.current ? inner.current.offsetWidth : null);
}, [key]);
return width;
@@ -17163,61 +17180,61 @@ function MemberDock({ sessionId, useRoster, useWork, actions }) {
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_react46.useRef)(null);
+ const inner = (0, import_react47.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_react46.createElement)(
+ return (0, import_react47.createElement)(
"div",
{ className: "bt-mw-dock", "data-leaving": leaving || void 0 },
- (0, import_react46.createElement)(
+ (0, import_react47.createElement)(
"button",
{ type: "button", className: "bt-mw-pill", "aria-label": label, onClick: open, disabled: leaving, style: width ? { width } : void 0 },
- (0, import_react46.createElement)(
+ (0, import_react47.createElement)(
"span",
{ ref: inner, className: "bt-mw-pill-in" },
- (0, import_react46.createElement)("span", { className: "bt-mw-faces", "aria-hidden": true }, faces.map((face) => (0, import_react46.createElement)(Face, { key: face.id, ...face }))),
- (0, import_react46.createElement)(
+ (0, import_react47.createElement)("span", { className: "bt-mw-faces", "aria-hidden": true }, faces.map((face) => (0, import_react47.createElement)(Face, { key: face.id, ...face }))),
+ (0, import_react47.createElement)(
"span",
{ key: label, className: "bt-mw-label", "aria-hidden": true },
- model.waiting ? (0, import_react46.createElement)("span", { className: "bt-mw-ask" }, model.waiting) : null,
- model.waiting && model.doing ? (0, import_react46.createElement)("span", { className: "bt-mw-dot" }, "·") : null,
- model.doing ? (0, import_react46.createElement)("span", { className: "bt-mw-doing" }, (0, import_react46.createElement)(Shimmer, null, model.doing)) : null
+ model.waiting ? (0, import_react47.createElement)("span", { className: "bt-mw-ask" }, model.waiting) : null,
+ model.waiting && model.doing ? (0, import_react47.createElement)("span", { className: "bt-mw-dot" }, "·") : null,
+ model.doing ? (0, import_react47.createElement)("span", { className: "bt-mw-doing" }, (0, import_react47.createElement)(Shimmer, null, model.doing)) : null
)
)
)
);
}
-var stateLine = (className, at, ...what) => (0, import_react46.createElement)(
+var stateLine = (className, at, ...what) => (0, import_react47.createElement)(
"span",
{ className },
- (0, import_react46.createElement)("span", { className: "bt-member-what" }, ...what),
- typeof at === "number" ? (0, import_react46.createElement)(Elapsed, { at, className: "bt-member-time" }) : null
+ (0, import_react47.createElement)("span", { className: "bt-member-what" }, ...what),
+ typeof at === "number" ? (0, import_react47.createElement)(Elapsed, { at, className: "bt-member-time" }) : null
);
function ApprovalCard({ approval, bot, actions }) {
- const [busy, setBusy] = (0, import_react46.useState)(false);
+ const [busy, setBusy] = (0, import_react47.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_react46.createElement)(
+ return (0, import_react47.createElement)(
"div",
{ className: "bt-mw-card", role: "group", "aria-label": t("{name} is waiting for your approval", { name: bot.name }) },
- (0, import_react46.createElement)("div", { className: "bt-mw-tool" }, approval.tool),
- approval.detail?.text ? (0, import_react46.createElement)("div", { className: "bt-mw-text" }, approval.detail.text) : null,
- approval.reason ? (0, import_react46.createElement)("div", { className: "bt-mw-reason" }, approval.reason) : null,
- approval.detail?.code ? (0, import_react46.createElement)("code", { className: "bt-mw-code", title: approval.detail.code }, approval.detail.code) : null,
- approval.answerable ? (0, import_react46.createElement)(
+ (0, import_react47.createElement)("div", { className: "bt-mw-tool" }, approval.tool),
+ approval.detail?.text ? (0, import_react47.createElement)("div", { className: "bt-mw-text" }, approval.detail.text) : null,
+ approval.reason ? (0, import_react47.createElement)("div", { className: "bt-mw-reason" }, approval.reason) : null,
+ approval.detail?.code ? (0, import_react47.createElement)("code", { className: "bt-mw-code", title: approval.detail.code }, approval.detail.code) : null,
+ approval.answerable ? (0, import_react47.createElement)(
"div",
{ className: "bt-mw-actions" },
- (0, import_react46.createElement)("button", { type: "button", className: "bt-q-btn", disabled: busy, onClick: () => answer("reject") }, t("Reject")),
- (0, import_react46.createElement)("button", { type: "button", className: "bt-q-submit", disabled: busy, onClick: () => answer("allow") }, t("Allow once"))
- ) : (0, import_react46.createElement)(
+ (0, import_react47.createElement)("button", { type: "button", className: "bt-q-btn", disabled: busy, onClick: () => answer("reject") }, t("Reject")),
+ (0, import_react47.createElement)("button", { type: "button", className: "bt-q-submit", disabled: busy, onClick: () => answer("allow") }, t("Allow once"))
+ ) : (0, import_react47.createElement)(
"div",
{ className: "bt-mw-actions" },
- (0, import_react46.createElement)("button", { type: "button", className: "bt-q-btn", onClick: () => actions.openSession(bot.id) }, t("Open {name}'s chat", { name: bot.name }))
+ (0, import_react47.createElement)("button", { type: "button", className: "bt-q-btn", onClick: () => actions.openSession(bot.id) }, t("Open {name}'s chat", { name: bot.name }))
)
);
}
@@ -17225,30 +17242,30 @@ function MemberState({ entry, bot, room: room2, roster }) {
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_react46.createElement)(Shimmer, null, `${workPhrase(entry.doing)}…`), where ? ` ${where}` : "");
+ return stateLine("bt-member-state", entry.doing.since, (0, import_react47.createElement)(Shimmer, null, `${workPhrase(entry.doing)}…`), where ? ` ${where}` : "");
}
function StopMemberWork({ entry, bot, room: room2, actions }) {
- const [stopping, setStopping] = (0, import_react46.useState)(false);
+ const [stopping, setStopping] = (0, import_react47.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_react46.createElement)("button", { type: "button", className: "bt-member-stop", disabled: stopping, "aria-label": `${t("Stop")} · ${bot.name}`, onClick: stop }, t("Stop"));
+ return (0, import_react47.createElement)("button", { type: "button", className: "bt-member-stop", disabled: stopping, "aria-label": `${t("Stop")} · ${bot.name}`, onClick: stop }, t("Stop"));
}
function StopRoomWork({ room: room2, entries: entries2, actions }) {
- const [stopping, setStopping] = (0, import_react46.useState)(false);
+ const [stopping, setStopping] = (0, import_react47.useState)(false);
if (!entries2.some((entry) => entry.here)) return null;
const stop = () => {
setStopping(true);
void Promise.resolve(actions.stopRoomWork(room2.id)).catch((error) => actions.reportError(error, "stop")).finally(() => setStopping(false));
};
const label = t("Stop all work in this group");
- return (0, import_react46.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: stopping, "aria-label": label, title: label, onClick: stop }, t("Stop all"));
+ return (0, import_react47.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", disabled: stopping, "aria-label": label, title: label, onClick: stop }, t("Stop all"));
}
function MemberApprovals({ entry, bot, actions }) {
if (entry?.state !== "ask") return null;
- return (0, import_react46.createElement)("div", { className: "bt-member-cards" }, entry.approvals.map((approval) => (0, import_react46.createElement)(ApprovalCard, { key: approval.id, approval, bot, actions })));
+ return (0, import_react47.createElement)("div", { className: "bt-member-cards" }, entry.approvals.map((approval) => (0, import_react47.createElement)(ApprovalCard, { key: approval.id, approval, bot, actions })));
}
function useMemberWork(room2, useWork) {
const work = useWork?.((value) => value) ?? NO_WORK;
@@ -17312,7 +17329,7 @@ body[data-ds-dark-theme] .bt-member-state.bt-mw-ask{color:#f0b84a}
`;
// src/client/details-drawer.js
-var import_react47 = require("react");
+var import_react48 = 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 "";
@@ -17337,17 +17354,17 @@ var EMPTY_TABS = { ids: [], active: null };
function PermissionRow({ bot, roster, actions, run: run2 }) {
const catalog = roster.permissions;
if (!catalog?.options?.length) return null;
- return (0, import_react47.createElement)(
+ return (0, import_react48.createElement)(
"div",
{ className: "bt-drawer-permission" },
- (0, import_react47.createElement)("div", { className: "bt-section-title" }, t("Permissions")),
+ (0, import_react48.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_react47.createElement)(PermissionPicker, { catalog, saved: bot.permission ?? catalog.defaultPreset, repick: bot.permission === void 0, onPick: (permission) => run2(actions.updateBot(bot.id, { permission })) })
+ (0, import_react48.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_react47.useState)(null);
- (0, import_react47.useEffect)(() => {
+ const [values, setValues] = (0, import_react48.useState)(null);
+ (0, import_react48.useEffect)(() => {
if (!actions.runStats) return void 0;
let current = true;
actions.runStats(bot.id).then(
@@ -17364,56 +17381,56 @@ function RunStats({ bot, part, running, actions }) {
}, [bot.id, part, running]);
const shown = runStatsOf(values);
if (shown.length === 0) return null;
- return (0, import_react47.createElement)(
+ return (0, import_react48.createElement)(
"div",
{ className: "bt-run-stats" },
- shown.map((entry, index) => (0, import_react47.createElement)(
- import_react47.Fragment,
+ shown.map((entry, index) => (0, import_react48.createElement)(
+ import_react48.Fragment,
{ key: entry.key },
- index > 0 ? (0, import_react47.createElement)("span", { className: "bt-run-sep", "aria-hidden": true }, "·") : null,
- (0, import_react47.createElement)("span", { title: entry.title }, entry.text)
+ index > 0 ? (0, import_react48.createElement)("span", { className: "bt-run-sep", "aria-hidden": true }, "·") : null,
+ (0, import_react48.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_react47.useEffect)(() => {
+ (0, import_react48.useEffect)(() => {
actions.browserEnsure?.(bot.id);
}, [bot.id]);
if (roster.browser !== true || !actions.browserShow) {
- return (0, import_react47.createElement)("div", { className: "bt-muted" }, t("The browser is in DSH Desktop and the DeepSeek Bot app."));
+ return (0, import_react48.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_react47.createElement)(
+ return (0, import_react48.createElement)(
"div",
{ className: "bt-browser-empty-mark" },
- (0, import_react47.createElement)(BotMark, { bot, size: 40, 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-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_react47.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => actions.openBrowser(sessionId) }, t("Open browser"))
+ (0, import_react48.createElement)(BotMark, { bot, size: 40, state: "idle", live: true }),
+ (0, import_react48.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),
+ (0, import_react48.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_react48.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => actions.openBrowser(sessionId) }, t("Open browser"))
);
}
- return (0, import_react47.createElement)(
+ return (0, import_react48.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_react47.createElement)(
+ return (0, import_react48.createElement)(
"div",
{ key: tabId, className: "bt-bcard", "data-active": state.active === tabId || void 0, style: { animationDelay: `${index * 30}ms` } },
- (0, import_react47.createElement)(
+ (0, import_react48.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_react47.createElement)(
+ page.excerpt ? (0, import_react48.createElement)(
"span",
{ className: "bt-bcard-preview" },
- (0, import_react47.createElement)("span", { className: "bt-bcard-ptitle" }, label),
- (0, import_react47.createElement)("span", { className: "bt-bcard-excerpt" }, page.excerpt)
- ) : (0, import_react47.createElement)("span", { className: "bt-bcard-blank" }, (0, import_react47.createElement)(GlobeIcon2), (0, import_react47.createElement)("span", null, label))
+ (0, import_react48.createElement)("span", { className: "bt-bcard-ptitle" }, label),
+ (0, import_react48.createElement)("span", { className: "bt-bcard-excerpt" }, page.excerpt)
+ ) : (0, import_react48.createElement)("span", { className: "bt-bcard-blank" }, (0, import_react48.createElement)(GlobeIcon2), (0, import_react48.createElement)("span", null, label))
),
- (0, import_react47.createElement)("button", {
+ (0, import_react48.createElement)("button", {
type: "button",
className: "bt-bcard-x",
"aria-label": t("Close tab"),
@@ -17422,29 +17439,29 @@ function BrowserCards({ bot, sessionId, roster, actions, useBrowserTabs, useBrow
void actions.browserCloseTab(bot.id, tabId);
}
}, "×"),
- (0, import_react47.createElement)(
+ (0, import_react48.createElement)(
"div",
{ className: "bt-bcard-row" },
- (0, import_react47.createElement)(Favicon, { src: page.favicon, className: "bt-bcard-fav" }),
- (0, import_react47.createElement)("span", { className: "bt-bcard-title" }, label),
- page.url ? (0, import_react47.createElement)("span", { className: "bt-bcard-host" }, hostOf2(page.url)) : null
+ (0, import_react48.createElement)(Favicon, { src: page.favicon, className: "bt-bcard-fav" }),
+ (0, import_react48.createElement)("span", { className: "bt-bcard-title" }, label),
+ page.url ? (0, import_react48.createElement)("span", { className: "bt-bcard-host" }, hostOf2(page.url)) : null
)
);
}),
- (0, import_react47.createElement)("button", { type: "button", className: "bt-bcard-new", style: { animationDelay: `${state.ids.length * 30}ms` }, onClick: () => actions.browserNewTab(sessionId) }, (0, import_react47.createElement)(PlusIcon), t("New tab"))
+ (0, import_react48.createElement)("button", { type: "button", className: "bt-bcard-new", style: { animationDelay: `${state.ids.length * 30}ms` }, onClick: () => actions.browserNewTab(sessionId) }, (0, import_react48.createElement)(PlusIcon), t("New tab"))
);
}
function About({ text, title = "About" }) {
- const [open, setOpen] = (0, import_react47.useState)(false);
+ const [open, setOpen] = (0, import_react48.useState)(false);
const long = text.split("\n").length > 5 || text.length > 240;
- const body = (0, import_react47.useRef)(null);
+ const body = (0, import_react48.useRef)(null);
useMorph(body, open);
- return (0, import_react47.createElement)(
+ return (0, import_react48.createElement)(
"div",
null,
- (0, import_react47.createElement)("div", { className: "bt-section-title" }, t(title)),
- (0, import_react47.createElement)("div", { ref: body, className: "bt-about", "data-open": open || void 0 }, text),
- long ? (0, import_react47.createElement)("button", { type: "button", className: "bt-more", onClick: () => setOpen((value) => !value) }, open ? t("Show less") : t("Show more")) : null
+ (0, import_react48.createElement)("div", { className: "bt-section-title" }, t(title)),
+ (0, import_react48.createElement)("div", { ref: body, className: "bt-about", "data-open": open || void 0 }, text),
+ long ? (0, import_react48.createElement)("button", { type: "button", className: "bt-more", onClick: () => setOpen((value) => !value) }, open ? t("Show less") : t("Show more")) : null
);
}
var PILE_MAX = 4;
@@ -17452,57 +17469,57 @@ function MemberPile({ room: room2, roster }) {
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_react47.createElement)(
+ return (0, import_react48.createElement)(
"span",
{ className: "bt-pile", "aria-hidden": true },
- shown.map((bot, index) => (0, import_react47.createElement)("span", { key: bot.id, className: "bt-pile-face", style: { animationDelay: `${index * 40}ms` } }, (0, import_react47.createElement)(BotMark, { bot, size: 44, live: true }))),
- more > 0 ? (0, import_react47.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_react48.createElement)("span", { key: bot.id, className: "bt-pile-face", style: { animationDelay: `${index * 40}ms` } }, (0, import_react48.createElement)(BotMark, { bot, size: 44, live: true }))),
+ more > 0 ? (0, import_react48.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_react47.createElement)(
+ return (0, import_react48.createElement)(
"div",
{ role: "listitem", className: "bt-member" },
- (0, import_react47.createElement)(
+ (0, import_react48.createElement)(
"div",
{ className: "bt-member-row" },
- (0, import_react47.createElement)(
+ (0, import_react48.createElement)(
"button",
{ type: "button", className: "bt-member-open", title: t("Open {name}'s chat", { name: member.name }), onClick: () => actions.openSession(member.id) },
- (0, import_react47.createElement)(BotMark, { bot: member, size: 32, state: markOf(entry) }),
- (0, import_react47.createElement)(
+ (0, import_react48.createElement)(BotMark, { bot: member, size: 32, state: markOf(entry) }),
+ (0, import_react48.createElement)(
"span",
{ className: "bt-member-text" },
- (0, import_react47.createElement)(
+ (0, import_react48.createElement)(
"span",
{ className: "bt-member-line" },
- (0, import_react47.createElement)("span", { className: "bt-member-name" }, member.name),
- room2.admin === member.id ? (0, import_react47.createElement)("span", { className: "bt-tag" }, t("Admin")) : null
+ (0, import_react48.createElement)("span", { className: "bt-member-name" }, member.name),
+ room2.admin === member.id ? (0, import_react48.createElement)("span", { className: "bt-tag" }, t("Admin")) : null
),
- (0, import_react47.createElement)(MemberState, { entry, bot: member, room: room2, roster })
+ (0, import_react48.createElement)(MemberState, { entry, bot: member, room: room2, roster })
)
),
- (0, import_react47.createElement)(StopMemberWork, { entry, bot: member, room: room2, actions })
+ (0, import_react48.createElement)(StopMemberWork, { entry, bot: member, room: room2, actions })
),
- (0, import_react47.createElement)(MemberApprovals, { entry, bot: member, actions })
+ (0, import_react48.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_react47.createElement)(About, { key: "notice", title: "Notice", text: room2.notice }) : (0, import_react47.createElement)("button", { key: "notice", type: "button", className: "bt-more", onClick: openSettings }, t("Add a notice in group settings")),
- (0, import_react47.createElement)(
+ room2.notice ? (0, import_react48.createElement)(About, { key: "notice", title: "Notice", text: room2.notice }) : (0, import_react48.createElement)("button", { key: "notice", type: "button", className: "bt-more", onClick: openSettings }, t("Add a notice in group settings")),
+ (0, import_react48.createElement)(
"div",
{ key: "members" },
- (0, import_react47.createElement)(
+ (0, import_react48.createElement)(
"div",
{ className: "bt-members-head" },
- (0, import_react47.createElement)("div", { className: "bt-section-title" }, t("Members · {count}", { count: members.length })),
- (0, import_react47.createElement)(StopRoomWork, { room: room2, entries: entries2, actions })
+ (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Members · {count}", { count: members.length })),
+ (0, import_react48.createElement)(StopRoomWork, { room: room2, entries: entries2, actions })
),
- (0, import_react47.createElement)("div", { className: "bt-members", role: "list" }, members.map((member) => (0, import_react47.createElement)(MemberRow, {
+ (0, import_react48.createElement)("div", { className: "bt-members", role: "list" }, members.map((member) => (0, import_react48.createElement)(MemberRow, {
key: member.id,
member,
entry: entries2.find((item) => item.id === member.id),
@@ -17511,24 +17528,24 @@ function GroupOverview({ room: room2, roster, actions, usage, useWork, openSetti
actions
})))
),
- (0, import_react47.createElement)(
+ (0, import_react48.createElement)(
"div",
{ key: "mode" },
- (0, import_react47.createElement)("div", { className: "bt-section-title" }, t("Who answers")),
- (0, import_react47.createElement)("div", { className: "bt-kv" }, (0, import_react47.createElement)("span", null, t(ROOM_MODES.find(([id]) => id === shownMode(room2, roster))?.[1] ?? "Everyone")))
+ (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Who answers")),
+ (0, import_react48.createElement)("div", { className: "bt-kv" }, (0, import_react48.createElement)("span", null, t(ROOM_MODES.find(([id]) => id === shownMode(room2, roster))?.[1] ?? "Everyone")))
),
- room2.permission ? (0, import_react47.createElement)(
+ room2.permission ? (0, import_react48.createElement)(
"div",
{ key: "permission" },
- (0, import_react47.createElement)("div", { className: "bt-section-title" }, t("Permissions")),
- (0, import_react47.createElement)("div", { className: "bt-kv" }, (0, import_react47.createElement)("span", { className: presetDanger(room2.permission) ? "bt-perm-danger" : void 0 }, presetName(room2.permission, roster.permissions)))
+ (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Permissions")),
+ (0, import_react48.createElement)("div", { className: "bt-kv" }, (0, import_react48.createElement)("span", { className: presetDanger(room2.permission) ? "bt-perm-danger" : void 0 }, presetName(room2.permission, roster.permissions)))
) : null,
- roster.memory === false ? null : (0, import_react47.createElement)(MemoryRow, { key: "memory", owner: { id: room2.id, name: room2.name, group: true }, actions }),
- usage ? (0, import_react47.createElement)(
+ roster.memory === false ? null : (0, import_react48.createElement)(MemoryRow, { key: "memory", owner: { id: room2.id, name: room2.name, group: true }, actions }),
+ usage ? (0, import_react48.createElement)(
"div",
{ key: "usage" },
- (0, import_react47.createElement)("div", { className: "bt-section-title" }, t("Usage")),
- (0, import_react47.createElement)("div", { className: "bt-kv" }, (0, import_react47.createElement)("span", null, room2.name), (0, import_react47.createElement)("span", null, usage))
+ (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Usage")),
+ (0, import_react48.createElement)("div", { className: "bt-kv" }, (0, import_react48.createElement)("span", null, room2.name), (0, import_react48.createElement)("span", null, usage))
) : null
];
}
@@ -17536,15 +17553,15 @@ function DetailsDrawer({ sessionId, startRenaming, startTab, hasStrip, roster, a
const owner = roster.byId[sessionId];
const part = owner ? currentPart(owner) : sessionId;
const isMainBot = isMainOf(roster, owner?.id);
- const [tab, setTab] = (0, import_react47.useState)("details");
+ const [tab, setTab] = (0, import_react48.useState)("details");
const room2 = roster.roomsById[sessionId];
- const [view, setView] = (0, import_react47.useState)(startTab === "settings" && (owner || room2) ? "settings" : "overview");
- const [editing, setEditing] = (0, import_react47.useState)(Boolean(startRenaming && (roster.byId[sessionId] || roster.roomsById[sessionId])));
- const [draftName, setDraftName] = (0, import_react47.useState)(roster.byId[sessionId]?.name ?? (roster.roomsById[sessionId]?.named ? roster.roomsById[sessionId].name : ""));
- const [copied, setCopied] = (0, import_react47.useState)(false);
- const [error, setError] = (0, import_react47.useState)("");
+ const [view, setView] = (0, import_react48.useState)(startTab === "settings" && (owner || room2) ? "settings" : "overview");
+ const [editing, setEditing] = (0, import_react48.useState)(Boolean(startRenaming && (roster.byId[sessionId] || roster.roomsById[sessionId])));
+ const [draftName, setDraftName] = (0, import_react48.useState)(roster.byId[sessionId]?.name ?? (roster.roomsById[sessionId]?.named ? roster.roomsById[sessionId].name : ""));
+ const [copied, setCopied] = (0, import_react48.useState)(false);
+ const [error, setError] = (0, import_react48.useState)("");
const glide = useGlide(tab);
- const last = (0, import_react47.useRef)({ view, tab, move: void 0 });
+ const last = (0, import_react48.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;
@@ -17569,21 +17586,21 @@ function DetailsDrawer({ sessionId, startRenaming, startTab, hasStrip, roster, a
setTimeout(() => setCopied(false), 1600);
});
};
- const errorLine = error ? (0, import_react47.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;
+ const errorLine = error ? (0, import_react48.createElement)("div", { className: "bt-error", role: "alert", style: { padding: 0 } }, error) : null;
if ((bot || room2) && view === "settings") {
return [
- (0, import_react47.createElement)(
+ (0, import_react48.createElement)(
"div",
{ key: "head", className: "bt-subhead", "data-move": move },
- (0, import_react47.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to details"), onClick: () => setView("overview") }, (0, import_react47.createElement)(ChevronLeftIcon)),
- (0, import_react47.createElement)("span", { className: "bt-subhead-title" }, bot ? t("Settings") : t("Group settings")),
- hasStrip ? null : (0, import_react47.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close details"), onClick: close }, (0, import_react47.createElement)(CloseIcon))
+ (0, import_react48.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Back to details"), onClick: () => setView("overview") }, (0, import_react48.createElement)(ChevronLeftIcon)),
+ (0, import_react48.createElement)("span", { className: "bt-subhead-title" }, bot ? t("Settings") : t("Group settings")),
+ hasStrip ? null : (0, import_react48.createElement)("button", { type: "button", className: "bt-icon-btn", "aria-label": t("Close details"), onClick: close }, (0, import_react48.createElement)(CloseIcon))
),
- (0, import_react47.createElement)(
+ (0, import_react48.createElement)(
"div",
{ key: "set-body", className: "bt-drawer-body bt-set-body", "data-move": move },
errorLine,
- bot ? (0, import_react47.createElement)(BotSettingsForm, { bot, roster, actions, run: run2 }) : (0, import_react47.createElement)(GroupSettingsForm, { room: room2, roster, actions, run: run2, onDeleted: close })
+ bot ? (0, import_react48.createElement)(BotSettingsForm, { bot, roster, actions, run: run2 }) : (0, import_react48.createElement)(GroupSettingsForm, { room: room2, roster, actions, run: run2, onDeleted: close })
)
];
}
@@ -17594,18 +17611,18 @@ function DetailsDrawer({ sessionId, startRenaming, startTab, hasStrip, roster, a
canTerminal: actions.canOpenTerminal?.() === true,
canFiles: actions.canOpenFiles?.() === true
}).map((key) => menuItemFor(key, actions, sessionId));
- const top = (0, import_react47.createElement)(
+ const top = (0, import_react48.createElement)(
"div",
{ className: "bt-drawer-top", "data-move": side },
- bot || room2 ? (0, import_react47.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_react47.createElement)(GearIcon)) : null,
- more.length > 0 ? (0, import_react47.createElement)("span", { "data-info-row": "more" }, (0, import_react47.createElement)(PanelMenu, { items: more, className: "bt-round", "aria-label": t("More") })) : null,
- bot || room2 ? (0, import_react47.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_react47.createElement)("span", { key: "copied", className: "bt-pop-in" }, "✓") : (0, import_react47.createElement)(ShareIcon)) : null,
- hasStrip ? null : (0, import_react47.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Close details"), onClick: close }, (0, import_react47.createElement)(CloseIcon))
+ bot || room2 ? (0, import_react48.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_react48.createElement)(GearIcon)) : null,
+ more.length > 0 ? (0, import_react48.createElement)("span", { "data-info-row": "more" }, (0, import_react48.createElement)(PanelMenu, { items: more, className: "bt-round", "aria-label": t("More") })) : null,
+ bot || room2 ? (0, import_react48.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_react48.createElement)("span", { key: "copied", className: "bt-pop-in" }, "✓") : (0, import_react48.createElement)(ShareIcon)) : null,
+ hasStrip ? null : (0, import_react48.createElement)("button", { type: "button", className: "bt-round", "aria-label": t("Close details"), onClick: close }, (0, import_react48.createElement)(CloseIcon))
);
if (!bot && !room2) {
return [
- (0, import_react47.createElement)(import_react47.Fragment, { key: "top" }, top),
- (0, import_react47.createElement)("div", { key: "body", className: "bt-drawer-body" }, (0, import_react47.createElement)("div", { className: "bt-muted" }, t("This conversation is not part of your Bot team.")))
+ (0, import_react48.createElement)(import_react48.Fragment, { key: "top" }, top),
+ (0, import_react48.createElement)("div", { key: "body", className: "bt-drawer-body" }, (0, import_react48.createElement)("div", { className: "bt-muted" }, t("This conversation is not part of your Bot team.")))
];
}
const current = bot?.name ?? room2.name;
@@ -17619,12 +17636,12 @@ function DetailsDrawer({ sessionId, startRenaming, startTab, hasStrip, roster, a
const subtitle = bot ? bot.role : roomSubtitle(room2, roster);
const tabs = bot ? ["details", "browser"] : ["details"];
return [
- (0, import_react47.createElement)(import_react47.Fragment, { key: "top" }, top),
- (0, import_react47.createElement)(
+ (0, import_react48.createElement)(import_react48.Fragment, { key: "top" }, top),
+ (0, import_react48.createElement)(
"div",
{ key: "id", className: "bt-drawer-id", "data-move": side },
- bot ? (0, import_react47.createElement)(BotAvatar, { bot, size: 64, state: botState(running, doing, roster.questions?.[part] !== void 0), main: isMainBot, badge: false, gaze: true, pokeable: true }) : (0, import_react47.createElement)(MemberPile, { room: room2, roster }),
- editing ? (0, import_react47.createElement)("input", {
+ bot ? (0, import_react48.createElement)(BotAvatar, { bot, size: 64, state: botState(running, doing, roster.questions?.[part] !== void 0), main: isMainBot, badge: false, gaze: true, pokeable: true }) : (0, import_react48.createElement)(MemberPile, { room: room2, roster }),
+ editing ? (0, import_react48.createElement)("input", {
className: "bt-drawer-name-input",
autoFocus: true,
value: draftName,
@@ -17639,50 +17656,50 @@ function DetailsDrawer({ sessionId, startRenaming, startTab, hasStrip, roster, a
setEditing(false);
}
}
- }) : (0, import_react47.createElement)("button", { type: "button", className: "bt-drawer-name", "aria-label": t("Rename {name}", { name: current }), title: t("Rename"), onClick: () => {
+ }) : (0, import_react48.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_react47.createElement)("span", { className: "bt-drawer-role" }, subtitle) : null
+ subtitle ? (0, import_react48.createElement)("span", { className: "bt-drawer-role" }, subtitle) : null
),
- tabs.length > 1 ? (0, import_react47.createElement)(
+ tabs.length > 1 ? (0, import_react48.createElement)(
"div",
{ key: "tabs", ref: glide.box, className: "bt-tabs", role: "tablist", "data-move": side },
- (0, import_react47.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
- tabs.map((key) => (0, import_react47.createElement)("button", { key, type: "button", role: "tab", className: "bt-tab", "aria-selected": tab === key, onClick: () => setTab(key) }, t(TAB_LABELS[key])))
+ (0, import_react48.createElement)("span", { ref: glide.thumb, className: "bt-thumb", "aria-hidden": true }),
+ tabs.map((key) => (0, import_react48.createElement)("button", { key, type: "button", role: "tab", className: "bt-tab", "aria-selected": tab === key, onClick: () => setTab(key) }, t(TAB_LABELS[key])))
) : null,
- (0, import_react47.createElement)(
+ (0, import_react48.createElement)(
"div",
{ key: `body:${tab}`, className: "bt-drawer-body", "data-move": move },
errorLine,
- room2 && tab === "details" ? (0, import_react47.createElement)(GroupOverview, { room: room2, roster, actions, usage, useWork, openSettings: () => setView("settings") }) : null,
+ room2 && tab === "details" ? (0, import_react48.createElement)(GroupOverview, { room: room2, roster, actions, usage, useWork, openSettings: () => setView("settings") }) : null,
bot && tab === "details" ? [
- (0, import_react47.createElement)(RunStats, { key: "stats", bot, part, running, actions }),
- (0, import_react47.createElement)(
+ (0, import_react48.createElement)(RunStats, { key: "stats", bot, part, running, actions }),
+ (0, import_react48.createElement)(
"div",
{ key: "model", className: "bt-drawer-model" },
- (0, import_react47.createElement)("div", { className: "bt-section-title" }, t("Model")),
- (0, import_react47.createElement)(ModelMenu, { bot, roster, actions, run: run2, wide: true }),
- modelOf(bot, roster) ? null : (0, import_react47.createElement)("div", { className: "bt-note" }, t("Pick a model and {name} can start.", { name: bot.name }))
+ (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Model")),
+ (0, import_react48.createElement)(ModelMenu, { bot, roster, actions, run: run2, wide: true }),
+ modelOf(bot, roster) ? null : (0, import_react48.createElement)("div", { className: "bt-note" }, t("Pick a model and {name} can start.", { name: bot.name }))
),
- (0, import_react47.createElement)(PermissionRow, { key: "permission", bot, roster, actions, run: run2 }),
- (0, import_react47.createElement)(
+ (0, import_react48.createElement)(PermissionRow, { key: "permission", bot, roster, actions, run: run2 }),
+ (0, import_react48.createElement)(
"div",
{ key: "folder", className: "bt-drawer-model" },
- (0, import_react47.createElement)("div", { className: "bt-section-title" }, t("Working folder")),
- (0, import_react47.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, wide: true, onPick: (workDir) => run2(actions.updateBot(bot.id, { workDir })) })
+ (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Working folder")),
+ (0, import_react48.createElement)(FolderMenu, { value: bot.workDir, actions, run: run2, wide: true, onPick: (workDir) => run2(actions.updateBot(bot.id, { workDir })) })
),
- bot.instructions ? (0, import_react47.createElement)(About, { key: "about", text: bot.instructions }) : (0, import_react47.createElement)("button", { key: "about", type: "button", className: "bt-more", onClick: () => setView("settings") }, t("Add instructions in Bot settings")),
- roster.memory === false ? null : (0, import_react47.createElement)(MemoryRow, { key: "memory", owner: { id: bot.id, name: bot.name }, actions }),
- usage ? (0, import_react47.createElement)(
+ bot.instructions ? (0, import_react48.createElement)(About, { key: "about", text: bot.instructions }) : (0, import_react48.createElement)("button", { key: "about", type: "button", className: "bt-more", onClick: () => setView("settings") }, t("Add instructions in Bot settings")),
+ roster.memory === false ? null : (0, import_react48.createElement)(MemoryRow, { key: "memory", owner: { id: bot.id, name: bot.name }, actions }),
+ usage ? (0, import_react48.createElement)(
"div",
{ key: "usage" },
- (0, import_react47.createElement)("div", { className: "bt-section-title" }, t("Usage")),
- (0, import_react47.createElement)("div", { className: "bt-kv" }, (0, import_react47.createElement)("span", null, bot.name), (0, import_react47.createElement)("span", null, usage))
+ (0, import_react48.createElement)("div", { className: "bt-section-title" }, t("Usage")),
+ (0, import_react48.createElement)("div", { className: "bt-kv" }, (0, import_react48.createElement)("span", null, bot.name), (0, import_react48.createElement)("span", null, usage))
) : null,
- (0, import_react47.createElement)(ScheduleSummary, { key: "routines", bot, actions })
+ (0, import_react48.createElement)(ScheduleSummary, { key: "routines", bot, actions })
] : null,
- bot && tab === "browser" ? (0, import_react47.createElement)(BrowserCards, { bot, sessionId, roster, actions, useBrowserTabs, useBrowserPages }) : null
+ bot && tab === "browser" ? (0, import_react48.createElement)(BrowserCards, { bot, sessionId, roster, actions, useBrowserTabs, useBrowserPages }) : null
)
];
}
@@ -17693,7 +17710,7 @@ function rectsOverlap(a, b) {
}
// src/client/browser-pane.js
-var import_react48 = require("react");
+var import_react49 = require("react");
var import_react_dom8 = require("react-dom");
var PANEL_LINGER_MS = 300;
var WIDTH_KEY = STORAGE.browserWidth;
@@ -17707,10 +17724,10 @@ var EMPTY_TABS2 = { ids: [], active: null };
var SPRING_LEAD2 = springEasing(576, 39.4);
var SPRING_TRAIL2 = springEasing(144, 19.7);
var icon = (paths) => function BrowserIcon() {
- return (0, import_react48.createElement)(
+ return (0, import_react49.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_react48.createElement)("path", { key: index, d }))
+ paths.map((d, index) => (0, import_react49.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"]);
@@ -17725,9 +17742,9 @@ var ImportIcon = icon(["M10 3.5v8.5", "M6 8.5l4 4 4-4", "M4.5 14v1.5a1.5 1.5 0 0
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_react48.useState)(null);
- if (!src || failed === src) return (0, import_react48.createElement)("span", { className: `${className} bt-ptab-globe` }, (0, import_react48.createElement)(GlobeIcon2));
- return (0, import_react48.createElement)("img", { className, src, alt: "", "aria-hidden": true, onError: () => setFailed(src) });
+ const [failed, setFailed] = (0, import_react49.useState)(null);
+ if (!src || failed === src) return (0, import_react49.createElement)("span", { className: `${className} bt-ptab-globe` }, (0, import_react49.createElement)(GlobeIcon2));
+ return (0, import_react49.createElement)("img", { className, src, alt: "", "aria-hidden": true, onError: () => setFailed(src) });
}
var savedWidth = () => {
try {
@@ -17743,9 +17760,9 @@ var shortAddress = (url) => String(url ?? "").replace(/^https?:\/\//i, "").repla
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_react48.useState)(false);
- const wrap = (0, import_react48.useRef)(null);
- (0, import_react48.useEffect)(() => {
+ const [open, setOpen] = (0, import_react49.useState)(false);
+ const wrap = (0, import_react49.useRef)(null);
+ (0, import_react49.useEffect)(() => {
if (!open) return void 0;
const onDown = (event) => {
if (wrap.current && !wrap.current.contains(event.target)) setOpen(false);
@@ -17763,10 +17780,10 @@ function PanelMenu({ items, className, "aria-label": label }) {
};
}, [open]);
if (items.length === 0) return null;
- return (0, import_react48.createElement)(
+ return (0, import_react49.createElement)(
"span",
{ className: "bt-pmenu", ref: wrap },
- (0, import_react48.createElement)("button", {
+ (0, import_react49.createElement)("button", {
type: "button",
className,
"aria-label": label,
@@ -17774,11 +17791,11 @@ function PanelMenu({ items, className, "aria-label": label }) {
"aria-haspopup": "menu",
"aria-expanded": open,
onClick: () => setOpen((value) => !value)
- }, (0, import_react48.createElement)(DotsIcon)),
- open ? (0, import_react48.createElement)(
+ }, (0, import_react49.createElement)(DotsIcon)),
+ open ? (0, import_react49.createElement)(
"div",
{ className: "bt-pmenu-pop", role: "menu" },
- items.map((item, index) => item.sep ? (0, import_react48.createElement)("span", { key: `sep-${index}`, className: "bt-pmenu-sep", role: "separator" }) : (0, import_react48.createElement)("button", {
+ items.map((item, index) => item.sep ? (0, import_react49.createElement)("span", { key: `sep-${index}`, className: "bt-pmenu-sep", role: "separator" }) : (0, import_react49.createElement)("button", {
key: item.key,
type: "button",
role: "menuitem",
@@ -17787,7 +17804,7 @@ function PanelMenu({ items, className, "aria-label": label }) {
setOpen(false);
item.onPick();
}
- }, (0, import_react48.createElement)(item.icon), (0, import_react48.createElement)("span", null, item.label)))
+ }, (0, import_react49.createElement)(item.icon), (0, import_react49.createElement)("span", null, item.label)))
) : null
);
}
@@ -17813,12 +17830,12 @@ function menuItemFor(key, actions, subject) {
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_react48.useRef)(null);
- const ind = (0, import_react48.useRef)(null);
- const spot = (0, import_react48.useRef)(null);
- const under = (0, import_react48.useRef)(null);
- const watcher = (0, import_react48.useRef)(null);
- (0, import_react48.useLayoutEffect)(() => {
+ const wrap = (0, import_react49.useRef)(null);
+ const ind = (0, import_react49.useRef)(null);
+ const spot = (0, import_react49.useRef)(null);
+ const under = (0, import_react49.useRef)(null);
+ const watcher = (0, import_react49.useRef)(null);
+ (0, import_react49.useLayoutEffect)(() => {
const box = wrap.current;
const capsule = ind.current;
if (!box || !capsule) return void 0;
@@ -17851,7 +17868,7 @@ function PanelStrip({ bot, subject, view, ids, active, sides, side, canBrowse, r
trail.cancel();
};
});
- (0, import_react48.useEffect)(() => {
+ (0, import_react49.useEffect)(() => {
const box = wrap.current;
if (!box) return void 0;
const observer = new ResizeObserver(() => {
@@ -17875,13 +17892,13 @@ function PanelStrip({ bot, subject, view, ids, active, sides, side, canBrowse, r
canTerminal: actions.canOpenTerminal?.() === true,
canFiles: actions.canOpenFiles?.() === true
}).map((key) => menuItemFor(key, actions, subject));
- return (0, import_react48.createElement)(
+ return (0, import_react49.createElement)(
"div",
{ className: "bt-ptabs", role: "tablist", "aria-label": t("Panel tabs") },
- (0, import_react48.createElement)(
+ (0, import_react49.createElement)(
"div",
{ className: "bt-ptabs-in", ref: wrap },
- (0, import_react48.createElement)(
+ (0, import_react49.createElement)(
"button",
{
type: "button",
@@ -17891,13 +17908,13 @@ function PanelStrip({ bot, subject, view, ids, active, sides, side, canBrowse, r
title: bot.name,
onClick: () => onView("details")
},
- (0, import_react48.createElement)(BotMark, { bot, size: 20, state: reading ? "searching" : "idle" }),
- view === "details" ? (0, import_react48.createElement)("span", { className: "bt-ptab-name" }, bot.name) : null
+ (0, import_react49.createElement)(BotMark, { bot, size: 20, state: reading ? "searching" : "idle" }),
+ view === "details" ? (0, import_react49.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_react48.createElement)(
+ return (0, import_react49.createElement)(
"button",
{
key: tabId,
@@ -17918,9 +17935,9 @@ function PanelStrip({ bot, subject, view, ids, active, sides, side, canBrowse, r
}
}
},
- (0, import_react48.createElement)(Favicon, { src: page.favicon, className: "bt-ptab-fav" }),
- (0, import_react48.createElement)("span", { className: "bt-ptab-title" }, tabLabel(page)),
- (0, import_react48.createElement)("span", {
+ (0, import_react49.createElement)(Favicon, { src: page.favicon, className: "bt-ptab-fav" }),
+ (0, import_react49.createElement)("span", { className: "bt-ptab-title" }, tabLabel(page)),
+ (0, import_react49.createElement)("span", {
className: "bt-ptab-x",
role: "button",
"aria-label": t("Close tab"),
@@ -17934,7 +17951,7 @@ function PanelStrip({ bot, subject, view, ids, active, sides, side, canBrowse, r
}),
sides.map((chat) => {
const on = view === "side" && chat.id === side;
- return (0, import_react48.createElement)(
+ return (0, import_react49.createElement)(
"button",
{
key: chat.id,
@@ -17952,9 +17969,9 @@ function PanelStrip({ bot, subject, view, ids, active, sides, side, canBrowse, r
}
}
},
- (0, import_react48.createElement)("span", { className: "bt-ptab-globe", "aria-hidden": true }, (0, import_react48.createElement)(SideIcon)),
- (0, import_react48.createElement)("span", { className: "bt-ptab-title" }, sideTitle(chat)),
- (0, import_react48.createElement)("span", {
+ (0, import_react49.createElement)("span", { className: "bt-ptab-globe", "aria-hidden": true }, (0, import_react49.createElement)(SideIcon)),
+ (0, import_react49.createElement)("span", { className: "bt-ptab-title" }, sideTitle(chat)),
+ (0, import_react49.createElement)("span", {
className: "bt-ptab-x",
role: "button",
"aria-label": t("Close side chat"),
@@ -17966,30 +17983,30 @@ function PanelStrip({ bot, subject, view, ids, active, sides, side, canBrowse, r
}, "×")
);
}),
- (0, import_react48.createElement)("span", { ref: ind, className: "bt-ptab-ind", "aria-hidden": true })
+ (0, import_react49.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_react48.createElement)(PanelMenu, { items, className: "bt-ptab-new", "aria-label": t("More") }),
- (0, import_react48.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_react48.createElement)(CloseIcon3))
+ (0, import_react49.createElement)(PanelMenu, { items, className: "bt-ptab-new", "aria-label": t("More") }),
+ (0, import_react49.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_react49.createElement)(CloseIcon3))
);
}
function BrowserView({ bot, tabId, leaving, landed, actions, useBrowserPages, hold }) {
const page = useBrowserPages((pages) => pages[tabId ?? ""]) ?? EMPTY_PAGE;
- const frame = (0, import_react48.useRef)(null);
- const input = (0, import_react48.useRef)(null);
- const [draft, setDraft] = (0, import_react48.useState)(null);
- const [covered, setCovered] = (0, import_react48.useState)(false);
+ const frame = (0, import_react49.useRef)(null);
+ const input = (0, import_react49.useRef)(null);
+ const [draft, setDraft] = (0, import_react49.useState)(null);
+ const [covered, setCovered] = (0, import_react49.useState)(false);
const imports = actions.browserImport;
- const [flow, setFlow] = (0, import_react48.useState)(null);
- const flowRef = (0, import_react48.useRef)(null);
- const [sources, setSources] = (0, import_react48.useState)(null);
- const [busy, setBusy] = (0, import_react48.useState)(false);
+ const [flow, setFlow] = (0, import_react49.useState)(null);
+ const flowRef = (0, import_react49.useRef)(null);
+ const [sources, setSources] = (0, import_react49.useState)(null);
+ const [busy, setBusy] = (0, import_react49.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_react48.useEffect)(() => {
+ (0, import_react49.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()));
@@ -18004,7 +18021,7 @@ function BrowserView({ bot, tabId, leaving, landed, actions, useBrowserPages, ho
window.removeEventListener("resize", update);
};
}, []);
- (0, import_react48.useEffect)(() => {
+ (0, import_react49.useEffect)(() => {
setFlowTracked(null);
return () => {
const id = typeof flowRef.current === "object" && flowRef.current !== null ? flowRef.current.id : null;
@@ -18048,7 +18065,7 @@ function BrowserView({ bot, tabId, leaving, landed, actions, useBrowserPages, ho
if (id) void imports?.cancel(id).catch(() => {
});
};
- (0, import_react48.useLayoutEffect)(() => {
+ (0, import_react49.useLayoutEffect)(() => {
const element = frame.current;
if (!element || leaving || !tabId) {
void actions.browserShow(null);
@@ -18074,7 +18091,7 @@ function BrowserView({ bot, tabId, leaving, landed, actions, useBrowserPages, ho
window.removeEventListener("resize", schedule);
};
}, [tabId, showGuest, leaving]);
- (0, import_react48.useEffect)(() => {
+ (0, import_react49.useEffect)(() => {
setDraft(null);
if (landed && !page.url) input.current?.focus();
}, [tabId, landed]);
@@ -18090,38 +18107,38 @@ function BrowserView({ bot, tabId, leaving, landed, actions, useBrowserPages, ho
};
const editing = draft !== null;
const secure = /^https:/i.test(page.url);
- return (0, import_react48.createElement)(
+ return (0, import_react49.createElement)(
"div",
{ className: "bt-panel-view bt-panel-browser", "aria-label": t("{name}'s browser", { name: bot.name }) },
- actions.browserTakeover ? (0, import_react48.createElement)(
+ actions.browserTakeover ? (0, import_react49.createElement)(
"div",
{ className: "bt-browser-takeover", "data-held": hold?.by === "user" || void 0 },
- (0, import_react48.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_react48.createElement)("button", { type: "button", onClick: () => void actions.browserGiveBack(bot.id) }, t("Give back")) : (0, import_react48.createElement)(
+ (0, import_react49.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_react49.createElement)("button", { type: "button", onClick: () => void actions.browserGiveBack(bot.id) }, t("Give back")) : (0, import_react49.createElement)(
"span",
{ className: "bt-browser-takeover-actions" },
- (0, import_react48.createElement)("button", { type: "button", onClick: () => void actions.browserTakeover(bot.id) }, t("Take over")),
- (0, import_react48.createElement)("button", { type: "button", onClick: () => void actions.browserStop(bot.id) }, t("Stop"))
+ (0, import_react49.createElement)("button", { type: "button", onClick: () => void actions.browserTakeover(bot.id) }, t("Take over")),
+ (0, import_react49.createElement)("button", { type: "button", onClick: () => void actions.browserStop(bot.id) }, t("Stop"))
)
) : null,
- (0, import_react48.createElement)(
+ (0, import_react49.createElement)(
"div",
{ className: "bt-browser-bar" },
- (0, import_react48.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_react48.createElement)(BackIcon)),
- (0, import_react48.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_react48.createElement)(ForwardIcon)),
- (0, import_react48.createElement)("button", {
+ (0, import_react49.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_react49.createElement)(BackIcon)),
+ (0, import_react49.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_react49.createElement)(ForwardIcon)),
+ (0, import_react49.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_react48.createElement)(page.loading ? StopIcon : ReloadIcon)),
- (0, import_react48.createElement)(
+ }, (0, import_react49.createElement)(page.loading ? StopIcon : ReloadIcon)),
+ (0, import_react49.createElement)(
"form",
{ className: "bt-browser-address", onSubmit: go, "data-editing": editing || void 0 },
- (0, import_react48.createElement)("span", { className: "bt-browser-scheme", "aria-hidden": true }, (0, import_react48.createElement)(secure && !editing ? LockIcon2 : GlobeIcon2)),
- (0, import_react48.createElement)("input", {
+ (0, import_react49.createElement)("span", { className: "bt-browser-scheme", "aria-hidden": true }, (0, import_react49.createElement)(secure && !editing ? LockIcon2 : GlobeIcon2)),
+ (0, import_react49.createElement)("input", {
ref: input,
type: "text",
spellCheck: false,
@@ -18145,14 +18162,14 @@ function BrowserView({ bot, tabId, leaving, landed, actions, useBrowserPages, ho
}
})
),
- (0, import_react48.createElement)("button", {
+ (0, import_react49.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_react48.createElement)(PlusTabIcon)),
- imports ? (0, import_react48.createElement)("button", {
+ }, (0, import_react49.createElement)(PlusTabIcon)),
+ imports ? (0, import_react49.createElement)("button", {
type: "button",
className: "bt-icon-btn bt-import-btn",
"aria-label": t("Import cookies"),
@@ -18163,29 +18180,29 @@ function BrowserView({ bot, tabId, leaving, landed, actions, useBrowserPages, ho
if (flow === "menu") setFlowTracked(null);
else openImport();
}
- }, (0, import_react48.createElement)(ImportIcon)) : null,
- page.loading ? (0, import_react48.createElement)("span", { className: "bt-browser-progress", "aria-hidden": true }) : null
+ }, (0, import_react49.createElement)(ImportIcon)) : null,
+ page.loading ? (0, import_react49.createElement)("span", { className: "bt-browser-progress", "aria-hidden": true }) : null
),
- (0, import_react48.createElement)(
+ (0, import_react49.createElement)(
"div",
{ ref: frame, className: "bt-browser-frame", "data-guest": showGuest || void 0 },
- flow === "menu" ? (0, import_react48.createElement)(ImportMenu, { sources, busy, onFile: pickFile, onSource: pickSource, onClose: () => setFlowTracked(null) }) : null,
- typeof flow === "object" && flow !== null ? (0, import_react48.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_react48.createElement)(
+ flow === "menu" ? (0, import_react49.createElement)(ImportMenu, { sources, busy, onFile: pickFile, onSource: pickSource, onClose: () => setFlowTracked(null) }) : null,
+ typeof flow === "object" && flow !== null ? (0, import_react49.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_react49.createElement)(
"div",
{ className: "bt-browser-empty" },
- (0, import_react48.createElement)("div", { className: "bt-browser-empty-title" }, t("This page didn’t load")),
- (0, import_react48.createElement)("div", { className: "bt-browser-empty-text" }, t(page.error)),
- page.url ? (0, import_react48.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: () => {
+ (0, import_react49.createElement)("div", { className: "bt-browser-empty-title" }, t("This page didn’t load")),
+ (0, import_react49.createElement)("div", { className: "bt-browser-empty-text" }, t(page.error)),
+ page.url ? (0, import_react49.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_react48.createElement)(
+ ) : flow === null && !page.url ? (0, import_react49.createElement)(
"div",
{ className: "bt-browser-empty" },
- (0, import_react48.createElement)(BotMark, { bot, size: 48, state: "idle", live: true }),
- (0, import_react48.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),
- (0, import_react48.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_react48.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: openImport }, t("Import cookies")) : null
+ (0, import_react49.createElement)(BotMark, { bot, size: 48, state: "idle", live: true }),
+ (0, import_react49.createElement)("div", { className: "bt-browser-empty-title" }, t("{name}'s browser", { name: bot.name })),
+ (0, import_react49.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_react49.createElement)("button", { type: "button", className: "bt-browser-retry", onClick: openImport }, t("Import cookies")) : null
) : null
)
);
@@ -18197,25 +18214,25 @@ function importError(error) {
return String(error);
}
function ImportMenu({ sources, busy, onFile, onSource, onClose }) {
- (0, import_react48.useEffect)(() => {
+ (0, import_react49.useEffect)(() => {
const close = (event) => {
if (event.key === "Escape") onClose();
};
window.addEventListener("keydown", close);
return () => window.removeEventListener("keydown", close);
}, [onClose]);
- return (0, import_react48.createElement)(
+ return (0, import_react49.createElement)(
"div",
{ className: "bt-import-menu", role: "menu", "aria-label": t("Import cookies") },
- (0, import_react48.createElement)("div", { className: "bt-import-menu-title" }, t("Import cookies")),
- (0, import_react48.createElement)(
+ (0, import_react49.createElement)("div", { className: "bt-import-menu-title" }, t("Import cookies")),
+ (0, import_react49.createElement)(
"button",
{ type: "button", className: "bt-import-item", role: "menuitem", disabled: busy, onClick: onFile },
- (0, import_react48.createElement)(FileIcon, { className: "bt-import-item-icon" }),
- (0, import_react48.createElement)("span", { className: "bt-import-item-name" }, t("From a file…")),
- (0, import_react48.createElement)("span", { className: "bt-import-item-sub" }, t("cookies.txt, JSON, storageState"))
+ (0, import_react49.createElement)(FileIcon, { className: "bt-import-item-icon" }),
+ (0, import_react49.createElement)("span", { className: "bt-import-item-name" }, t("From a file…")),
+ (0, import_react49.createElement)("span", { className: "bt-import-item-sub" }, t("cookies.txt, JSON, storageState"))
),
- sources === null ? (0, import_react48.createElement)("div", { className: "bt-import-menu-note" }, t("Loading…")) : sources.length === 0 ? (0, import_react48.createElement)("div", { className: "bt-import-menu-note" }, t("No browsers found")) : sources.map((source) => (0, import_react48.createElement)(
+ sources === null ? (0, import_react49.createElement)("div", { className: "bt-import-menu-note" }, t("Loading…")) : sources.length === 0 ? (0, import_react49.createElement)("div", { className: "bt-import-menu-note" }, t("No browsers found")) : sources.map((source) => (0, import_react49.createElement)(
"button",
{
key: source.id,
@@ -18225,83 +18242,83 @@ function ImportMenu({ sources, busy, onFile, onSource, onClose }) {
disabled: busy,
onClick: () => onSource(source)
},
- (0, import_react48.createElement)(WindowIcon, { className: "bt-import-item-icon" }),
- (0, import_react48.createElement)("span", { className: "bt-import-item-name" }, source.label),
- (0, import_react48.createElement)("span", { className: "bt-import-item-sub" }, t("Copy of its cookies"))
+ (0, import_react49.createElement)(WindowIcon, { className: "bt-import-item-icon" }),
+ (0, import_react49.createElement)("span", { className: "bt-import-item-name" }, source.label),
+ (0, import_react49.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_react48.createElement)("div", { className: "bt-import-card" }, (0, import_react48.createElement)(
+ return (0, import_react49.createElement)("div", { className: "bt-import-card" }, (0, import_react49.createElement)(
"div",
{ className: "bt-import-box" },
- (0, import_react48.createElement)("div", { className: "bt-import-title" }, t("{name} is running", { name: flow.source.name })),
- (0, import_react48.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_react48.createElement)(
+ (0, import_react49.createElement)("div", { className: "bt-import-title" }, t("{name} is running", { name: flow.source.name })),
+ (0, import_react49.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_react49.createElement)(
"div",
{ className: "bt-import-actions" },
- (0, import_react48.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_react48.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel"))
+ (0, import_react49.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_react49.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel"))
)
));
}
if (stage === "error") {
- return (0, import_react48.createElement)("div", { className: "bt-import-card" }, (0, import_react48.createElement)(
+ return (0, import_react49.createElement)("div", { className: "bt-import-card" }, (0, import_react49.createElement)(
"div",
{ className: "bt-import-box" },
- (0, import_react48.createElement)("div", { className: "bt-import-title" }, t("Import failed")),
- (0, import_react48.createElement)("div", { className: "bt-import-text" }, flow.message),
- (0, import_react48.createElement)("div", { className: "bt-import-actions" }, (0, import_react48.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onCancel }, t("Close")))
+ (0, import_react49.createElement)("div", { className: "bt-import-title" }, t("Import failed")),
+ (0, import_react49.createElement)("div", { className: "bt-import-text" }, flow.message),
+ (0, import_react49.createElement)("div", { className: "bt-import-actions" }, (0, import_react49.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_react48.createElement)("div", { className: "bt-import-card" }, (0, import_react48.createElement)(
+ return (0, import_react49.createElement)("div", { className: "bt-import-card" }, (0, import_react49.createElement)(
"div",
{ className: "bt-import-box" },
- (0, import_react48.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_react48.createElement)("div", { className: "bt-import-sub" }, flow.label) : null,
- problems.length ? (0, import_react48.createElement)(
+ (0, import_react49.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_react49.createElement)("div", { className: "bt-import-sub" }, flow.label) : null,
+ problems.length ? (0, import_react49.createElement)(
"div",
{ className: "bt-import-list" },
- problems.slice(0, 8).map((item, index) => (0, import_react48.createElement)(
+ problems.slice(0, 8).map((item, index) => (0, import_react49.createElement)(
"div",
{ key: index, className: "bt-import-line" },
- (0, import_react48.createElement)("span", { className: "bt-import-line-name" }, item.name ?? "—"),
- (0, import_react48.createElement)("span", { className: "bt-import-line-reason" }, item.reason)
+ (0, import_react49.createElement)("span", { className: "bt-import-line-name" }, item.name ?? "—"),
+ (0, import_react49.createElement)("span", { className: "bt-import-line-reason" }, item.reason)
)),
- problems.length > 8 ? (0, import_react48.createElement)("div", { className: "bt-import-line" }, (0, import_react48.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: problems.length - 8 }))) : null
+ problems.length > 8 ? (0, import_react49.createElement)("div", { className: "bt-import-line" }, (0, import_react49.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: problems.length - 8 }))) : null
) : null,
- (0, import_react48.createElement)(
+ (0, import_react49.createElement)(
"div",
{ className: "bt-import-actions" },
- page.url ? (0, import_react48.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onReload }, t("Reload the page")) : null,
- (0, import_react48.createElement)("button", { type: "button", className: "bt-import-primary", onClick: onDone }, t("Done"))
+ page.url ? (0, import_react49.createElement)("button", { type: "button", className: "bt-import-plain", onClick: onReload }, t("Reload the page")) : null,
+ (0, import_react49.createElement)("button", { type: "button", className: "bt-import-primary", onClick: onDone }, t("Done"))
)
));
}
const { preview } = flow;
- return (0, import_react48.createElement)("div", { className: "bt-import-card" }, (0, import_react48.createElement)(
+ return (0, import_react49.createElement)("div", { className: "bt-import-card" }, (0, import_react49.createElement)(
"div",
{ className: "bt-import-box" },
- (0, import_react48.createElement)("div", { className: "bt-import-title" }, t("Import {count} cookies", { count: preview.cookies })),
- (0, import_react48.createElement)(
+ (0, import_react49.createElement)("div", { className: "bt-import-title" }, t("Import {count} cookies", { count: preview.cookies })),
+ (0, import_react49.createElement)(
"div",
{ className: "bt-import-sub" },
preview.source?.label ?? "",
flow.restarted ? ` · ${t("the browser was restarted")}` : ""
),
- preview.sites.length ? (0, import_react48.createElement)(
+ preview.sites.length ? (0, import_react49.createElement)(
"div",
{ className: "bt-import-list" },
- preview.sites.map((site) => (0, import_react48.createElement)(
+ preview.sites.map((site) => (0, import_react49.createElement)(
"div",
{ key: site.site, className: "bt-import-line" },
- (0, import_react48.createElement)("span", { className: "bt-import-line-name" }, site.site),
- (0, import_react48.createElement)(
+ (0, import_react49.createElement)("span", { className: "bt-import-line-name" }, site.site),
+ (0, import_react49.createElement)(
"span",
{ className: "bt-import-line-count" },
t("{count}", { count: site.cookies }),
@@ -18309,35 +18326,35 @@ function ImportCard({ flow, page, busy, onApply, onCancel, onCloseAndImport, onD
)
))
) : null,
- preview.skipped.length ? (0, import_react48.createElement)(
+ preview.skipped.length ? (0, import_react49.createElement)(
"div",
{ className: "bt-import-list" },
- (0, import_react48.createElement)("div", { className: "bt-import-note" }, t("{count} skipped", { count: preview.skipped.length })),
- preview.skipped.slice(0, 5).map((item, index) => (0, import_react48.createElement)(
+ (0, import_react49.createElement)("div", { className: "bt-import-note" }, t("{count} skipped", { count: preview.skipped.length })),
+ preview.skipped.slice(0, 5).map((item, index) => (0, import_react49.createElement)(
"div",
{ key: index, className: "bt-import-line" },
- (0, import_react48.createElement)("span", { className: "bt-import-line-name" }, item.name ?? item.where),
- (0, import_react48.createElement)("span", { className: "bt-import-line-reason" }, item.reason)
+ (0, import_react49.createElement)("span", { className: "bt-import-line-name" }, item.name ?? item.where),
+ (0, import_react49.createElement)("span", { className: "bt-import-line-reason" }, item.reason)
)),
- preview.skipped.length > 5 ? (0, import_react48.createElement)("div", { className: "bt-import-line" }, (0, import_react48.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: preview.skipped.length - 5 }))) : null
+ preview.skipped.length > 5 ? (0, import_react49.createElement)("div", { className: "bt-import-line" }, (0, import_react49.createElement)("span", { className: "bt-import-line-reason" }, t("and {count} more", { count: preview.skipped.length - 5 }))) : null
) : null,
- preview.warnings.length ? (0, import_react48.createElement)(
+ preview.warnings.length ? (0, import_react49.createElement)(
"details",
{ className: "bt-import-warns" },
- (0, import_react48.createElement)("summary", null, t("{count} adjusted", { count: preview.warnings.reduce((n, w) => n + w.count, 0) })),
- preview.warnings.map((w, index) => (0, import_react48.createElement)(
+ (0, import_react49.createElement)("summary", null, t("{count} adjusted", { count: preview.warnings.reduce((n, w) => n + w.count, 0) })),
+ preview.warnings.map((w, index) => (0, import_react49.createElement)(
"div",
{ key: index, className: "bt-import-line" },
- (0, import_react48.createElement)("span", { className: "bt-import-line-reason" }, `${w.count} × ${w.message}`)
+ (0, import_react49.createElement)("span", { className: "bt-import-line-reason" }, `${w.count} × ${w.message}`)
))
) : null,
- preview.notes.includes("session-cookies") ? (0, import_react48.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_react48.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_react48.createElement)(
+ preview.notes.includes("session-cookies") ? (0, import_react49.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_react49.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_react49.createElement)(
"div",
{ className: "bt-import-actions" },
- (0, import_react48.createElement)("button", { type: "button", className: "bt-import-primary", disabled: busy, onClick: onApply }, busy ? t("Importing…") : t("Import")),
- (0, import_react48.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel"))
+ (0, import_react49.createElement)("button", { type: "button", className: "bt-import-primary", disabled: busy, onClick: onApply }, busy ? t("Importing…") : t("Import")),
+ (0, import_react49.createElement)("button", { type: "button", className: "bt-import-plain", disabled: busy, onClick: onCancel }, t("Cancel"))
)
));
}
@@ -18351,41 +18368,41 @@ function BotPanel({ pane, leaving, room: room2, overlay, roster, actions, useSes
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_react48.useRef)(null);
- const fly = (0, import_react48.useRef)(null);
- const [landed, setLanded] = (0, import_react48.useState)(false);
- const [settling, setSettling] = (0, import_react48.useState)(false);
- const [width, setWidth] = (0, import_react48.useState)(savedWidth);
- const [dragging, setDragging] = (0, import_react48.useState)(false);
- const [resizing, setResizing] = (0, import_react48.useState)(false);
+ const root = (0, import_react49.useRef)(null);
+ const fly = (0, import_react49.useRef)(null);
+ const [landed, setLanded] = (0, import_react49.useState)(false);
+ const [settling, setSettling] = (0, import_react49.useState)(false);
+ const [width, setWidth] = (0, import_react49.useState)(savedWidth);
+ const [dragging, setDragging] = (0, import_react49.useState)(false);
+ const [resizing, setResizing] = (0, import_react49.useState)(false);
const instant = dragging || resizing;
- const [reading, setReading] = (0, import_react48.useState)(false);
+ const [reading, setReading] = (0, import_react49.useState)(false);
const panelWidth = fitWidth(width ?? (view === "browser" ? DEFAULT_WIDTH : DETAILS_WIDTH), widthRange(view, room2));
- (0, import_react48.useLayoutEffect)(() => {
+ (0, import_react49.useLayoutEffect)(() => {
if (view === "browser" && width === null) setWidth(DEFAULT_WIDTH);
}, [view, width]);
- (0, import_react48.useLayoutEffect)(() => {
+ (0, import_react49.useLayoutEffect)(() => {
chatRoom.hold(instant);
}, [instant]);
- const [last, setLast] = (0, import_react48.useState)({ view, width: panelWidth });
+ const [last, setLast] = (0, import_react49.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_react48.useRef)(view);
- (0, import_react48.useLayoutEffect)(() => {
+ const shownView = (0, import_react49.useRef)(view);
+ (0, import_react49.useLayoutEffect)(() => {
const switched = settling && shownView.current !== view;
shownView.current = view;
if (switched) chatRoom.hold(true);
chatRoom.setRight(leaving || overlay ? null : panelWidth);
if (switched) chatRoom.hold(false);
}, [view, panelWidth, leaving, overlay]);
- (0, import_react48.useEffect)(() => () => {
+ (0, import_react49.useEffect)(() => () => {
chatRoom.setRight(null);
chatRoom.hold(false);
}, []);
- const mounted = (0, import_react48.useRef)(false);
- (0, import_react48.useEffect)(() => {
+ const mounted = (0, import_react49.useRef)(false);
+ (0, import_react49.useEffect)(() => {
if (!mounted.current) {
mounted.current = true;
return void 0;
@@ -18394,31 +18411,31 @@ function BotPanel({ pane, leaving, room: room2, overlay, roster, actions, useSes
const timer = setTimeout(() => setResizing(false), 160);
return () => clearTimeout(timer);
}, [room2]);
- (0, import_react48.useEffect)(() => {
+ (0, import_react49.useEffect)(() => {
if (!settling) return void 0;
const timer = setTimeout(() => setSettling(false), SPRING_SHAPE.duration + 40);
return () => clearTimeout(timer);
}, [settling, view]);
- (0, import_react48.useEffect)(() => {
+ (0, import_react49.useEffect)(() => {
const timer = setTimeout(() => setLanded(true), 360);
return () => clearTimeout(timer);
}, []);
- (0, import_react48.useEffect)(() => {
+ (0, import_react49.useEffect)(() => {
if (canBrowse) actions.browserEnsure(bot.id);
}, [bot?.id, canBrowse]);
- (0, import_react48.useEffect)(() => {
+ (0, import_react49.useEffect)(() => {
if (view === "browser" && (active === null || !tabState.ids.includes(active))) actions.setPanelView("details");
}, [view, active, tabState.ids.length]);
- (0, import_react48.useEffect)(() => {
+ (0, import_react49.useEffect)(() => {
if (pane.view === "side" && sideChat === void 0) actions.setPanelView("details");
}, [pane.view, sideChat]);
- (0, import_react48.useEffect)(() => {
+ (0, import_react49.useEffect)(() => {
if (view !== "browser" || leaving) void actions.browserShow?.(null);
}, [view, leaving]);
- (0, import_react48.useEffect)(() => () => {
+ (0, import_react49.useEffect)(() => () => {
void actions.browserShow?.(null);
}, []);
- (0, import_react48.useEffect)(() => {
+ (0, import_react49.useEffect)(() => {
if (!page.readAt || Date.now() - page.readAt > READ_FLASH_MS) return void 0;
setReading(true);
const timer = setTimeout(() => setReading(false), READ_FLASH_MS);
@@ -18461,7 +18478,7 @@ function BotPanel({ pane, leaving, room: room2, overlay, roster, actions, useSes
return actions[name](...args);
};
}
- (0, import_react48.useLayoutEffect)(() => {
+ (0, import_react49.useLayoutEffect)(() => {
const move = fly.current;
if (!move) return;
fly.current = null;
@@ -18544,7 +18561,7 @@ function BotPanel({ pane, leaving, room: room2, overlay, roster, actions, useSes
for (const name of ends) grip.addEventListener(name, onEnd);
};
const hasStrip = panelHasStrip(canBrowse, tabState.ids.length, sideChats.length);
- return (0, import_react48.createElement)(
+ return (0, import_react49.createElement)(
"aside",
{
ref: root,
@@ -18562,15 +18579,15 @@ function BotPanel({ pane, leaving, room: room2, overlay, roster, actions, useSes
if (event.target === event.currentTarget) setLanded(true);
}
},
- leaving || overlay ? null : (0, import_react48.createElement)("div", { className: "bt-panel-grip", role: "separator", "aria-orientation": "vertical", "aria-label": t("Resize panel"), onPointerDown: startResize }),
+ leaving || overlay ? null : (0, import_react49.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_react48.createElement)("div", { className: "bt-drag-shield", "aria-hidden": true }), document.body) : null,
- hasStrip ? (0, import_react48.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_react48.createElement)(BrowserView, { key: `browser:${active}`, bot, tabId: active, leaving, landed: landed && !settling, actions, useBrowserPages, hold }) : view === "side" && sideChat ? (0, import_react48.createElement)("div", { key: `side:${sideChat.id}`, className: "bt-panel-view" }, (0, import_react48.createElement)(SideChatView, { subject: pane.id, chat: sideChat, actions: panelActions })) : (0, import_react48.createElement)(
+ dragging ? (0, import_react_dom8.createPortal)((0, import_react49.createElement)("div", { className: "bt-drag-shield", "aria-hidden": true }), document.body) : null,
+ hasStrip ? (0, import_react49.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_react49.createElement)(BrowserView, { key: `browser:${active}`, bot, tabId: active, leaving, landed: landed && !settling, actions, useBrowserPages, hold }) : view === "side" && sideChat ? (0, import_react49.createElement)("div", { key: `side:${sideChat.id}`, className: "bt-panel-view" }, (0, import_react49.createElement)(SideChatView, { subject: pane.id, chat: sideChat, actions: panelActions })) : (0, import_react49.createElement)(
"div",
{ key: `details:${pane.id}:${pane.renaming ? "rename" : ""}:${pane.tab ?? ""}`, className: "bt-panel-view" },
- (0, import_react48.createElement)(DetailsDrawer, {
+ (0, import_react49.createElement)(DetailsDrawer, {
sessionId: pane.id,
startRenaming: pane.renaming,
startTab: pane.tab,
@@ -18711,7 +18728,7 @@ var BROWSER_CSS = `
`;
// src/client/overlays.js
-var import_react49 = require("react");
+var import_react50 = require("react");
var import_react_dom9 = require("react-dom");
var DIALOG_EXIT_MS = 160;
var MENU_EXIT_MS3 = 120;
@@ -18722,8 +18739,8 @@ function Overlays({ useRoster, useUi, useSessions, useSessionStatus, useActivity
const frameSnap = useFrame ? useFrame((value) => value) : { viewport: window.innerWidth, sidebarWidth: FALLBACK_SIDEBAR_WIDTH, collapsedWidth: 0 };
const pref = useSidebarPref ? useSidebarPref((value) => value) : "open";
const current = useSessions((list) => Object.values(list.byId).find((session) => (session?.retainedBy?.mainView ?? 0) > 0)?.id ?? null);
- const previous = (0, import_react49.useRef)(current);
- (0, import_react49.useEffect)(() => {
+ const previous = (0, import_react50.useRef)(current);
+ (0, import_react50.useEffect)(() => {
if (previous.current === current) return;
previous.current = current;
if (current) actions.followPanel?.(current);
@@ -18737,8 +18754,8 @@ function Overlays({ useRoster, useUi, useSessions, useSessionStatus, useActivity
panel: open ? { view: open.view, yielded: ui2.panelYield === true } : null
});
const shown = open !== null && layout.panel !== "folded" ? open : null;
- const [kept, setKept] = (0, import_react49.useState)(shown);
- (0, import_react49.useEffect)(() => {
+ const [kept, setKept] = (0, import_react50.useState)(shown);
+ (0, import_react50.useEffect)(() => {
if (shown) {
setKept(shown);
return void 0;
@@ -18757,17 +18774,17 @@ function Overlays({ useRoster, useUi, useSessions, useSessionStatus, useActivity
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_react49.createElement)(
- import_react49.Fragment,
+ return (0, import_react50.createElement)(
+ import_react50.Fragment,
null,
- pane ? (0, import_react_dom9.createPortal)((0, import_react49.createElement)(BotPanel, { pane, leaving: shown === null, room: layout.room, overlay: layout.panel === "overlay", roster, actions, useSessions, useSessionStatus, useActivity, useWork, useBrowserTabs, useBrowserPages, useBrowserHolds }), document.body) : null,
- ui2.newChat ? (0, import_react_dom9.createPortal)((0, import_react49.createElement)(NewChat, { key: ui2.newChat, mode: ui2.newChat, roster, actions }), document.body) : null,
- ui2.palette ? (0, import_react_dom9.createPortal)((0, import_react49.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_react49.createElement)(ExchangeDialog, { pair: ui2.exchange, roster, actions }), document.body) : null,
- ui2.voice ? (0, import_react_dom9.createPortal)((0, import_react49.createElement)(VoiceMode, { key: ui2.voice, sessionId: ui2.voice, roster, actions, useSessions, useSessionStatus }), document.body) : null,
- menu ? (0, import_react_dom9.createPortal)((0, import_react49.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_react49.createElement)(SettingsDialog, { page: settings.page, id: settings.id, roster, actions, useUpdate, leaving: settingsLeaving }), document.body) : null,
- owner ? (0, import_react_dom9.createPortal)((0, import_react49.createElement)(MemoryDialog, { key: owner.id, owner, actions, leaving: memoryLeaving }), document.body) : null
+ pane ? (0, import_react_dom9.createPortal)((0, import_react50.createElement)(BotPanel, { pane, leaving: shown === null, room: layout.room, overlay: layout.panel === "overlay", roster, actions, useSessions, useSessionStatus, useActivity, useWork, useBrowserTabs, useBrowserPages, useBrowserHolds }), document.body) : null,
+ ui2.newChat ? (0, import_react_dom9.createPortal)((0, import_react50.createElement)(NewChat, { key: ui2.newChat, mode: ui2.newChat, roster, actions }), document.body) : null,
+ ui2.palette ? (0, import_react_dom9.createPortal)((0, import_react50.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_react50.createElement)(ExchangeDialog, { pair: ui2.exchange, roster, actions }), document.body) : null,
+ ui2.voice ? (0, import_react_dom9.createPortal)((0, import_react50.createElement)(VoiceMode, { key: ui2.voice, sessionId: ui2.voice, roster, actions, useSessions, useSessionStatus }), document.body) : null,
+ menu ? (0, import_react_dom9.createPortal)((0, import_react50.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_react50.createElement)(SettingsDialog, { page: settings.page, id: settings.id, roster, actions, useUpdate, leaving: settingsLeaving }), document.body) : null,
+ owner ? (0, import_react_dom9.createPortal)((0, import_react50.createElement)(MemoryDialog, { key: owner.id, owner, actions, leaving: memoryLeaving }), document.body) : null
);
}
@@ -19825,13 +19842,13 @@ function lineDiff(before, after) {
}
// src/client/learning-card.js
-var import_react50 = require("react");
+var import_react51 = require("react");
var failedAnswers = /* @__PURE__ */ new Map();
function ProposalCard({ proposal, initialError = "", onFailure, onResolved, actions }) {
- const [busy, setBusy] = (0, import_react50.useState)(false);
- const [error, setError] = (0, import_react50.useState)(initialError);
- const busyRef = (0, import_react50.useRef)(false);
- const titleId = (0, import_react50.useId)();
+ const [busy, setBusy] = (0, import_react51.useState)(false);
+ const [error, setError] = (0, import_react51.useState)(initialError);
+ const busyRef = (0, import_react51.useRef)(false);
+ const titleId = (0, import_react51.useId)();
const answer = (approve) => {
if (busyRef.current) return;
busyRef.current = true;
@@ -19847,58 +19864,58 @@ function ProposalCard({ proposal, initialError = "", onFailure, onResolved, acti
});
};
const update = proposal.action === "update";
- const rows2 = (0, import_react50.useMemo)(() => lineDiff(update ? proposal.previous?.content : "", proposal.content), [update, proposal.previous?.content, proposal.content]);
+ const rows2 = (0, import_react51.useMemo)(() => lineDiff(update ? proposal.previous?.content : "", proposal.content), [update, proposal.previous?.content, proposal.content]);
if (proposal.kind === "agents") {
const blocks = proposal.edits.map((edit) => [
...(edit.op === "add" ? [] : editLines(edit.old)).map((line) => ({ kind: "removed", line })),
...(edit.op === "remove" ? [] : editLines(edit.text)).map((line) => ({ kind: "added", line }))
]);
- return (0, import_react50.createElement)(
+ return (0, import_react51.createElement)(
"section",
{ className: "bt-q bt-learning-card", role: "group", "aria-labelledby": titleId, "aria-busy": busy },
- (0, import_react50.createElement)(ProposalHead, { titleId, icon: PencilIcon, title: t("AGENTS.md update") }),
- (0, import_react50.createElement)(FileBox, { name: "AGENTS.md", path: proposal.folder, state: proposal.exists === false ? "Added" : "Modified", blocks }),
- proposal.edits.map((edit, index) => edit.why ? (0, import_react50.createElement)("p", { className: "bt-learning-why", key: index }, edit.why) : null),
- error ? (0, import_react50.createElement)("div", { className: "bt-learning-error", role: "alert" }, error) : null,
- (0, import_react50.createElement)(ProposalFoot, { busy, answer })
+ (0, import_react51.createElement)(ProposalHead, { titleId, icon: PencilIcon, title: t("AGENTS.md update") }),
+ (0, import_react51.createElement)(FileBox, { name: "AGENTS.md", path: proposal.folder, state: proposal.exists === false ? "Added" : "Modified", blocks }),
+ proposal.edits.map((edit, index) => edit.why ? (0, import_react51.createElement)("p", { className: "bt-learning-why", key: index }, edit.why) : null),
+ error ? (0, import_react51.createElement)("div", { className: "bt-learning-error", role: "alert" }, error) : null,
+ (0, import_react51.createElement)(ProposalFoot, { busy, answer })
);
}
const oldDetail = update && typeof proposal.previous?.description === "string" && proposal.previous.description !== proposal.description ? proposal.previous.description : void 0;
- return (0, import_react50.createElement)(
+ return (0, import_react51.createElement)(
"section",
{ className: "bt-q bt-learning-card", role: "group", "aria-labelledby": titleId, "aria-busy": busy },
- (0, import_react50.createElement)(ProposalHead, { titleId, title: proposal.name, kind: t(update ? "Skill update" : "New skill"), detail: proposal.description, oldDetail }),
- (0, import_react50.createElement)(FileBox, { name: "SKILL.md", path: `skills/${proposal.name}`, state: update ? "Updated" : "Added", blocks: [rows2] }),
- proposal.why ? (0, import_react50.createElement)("p", { className: "bt-learning-why" }, proposal.why) : null,
- error ? (0, import_react50.createElement)("div", { className: "bt-learning-error", role: "alert" }, error) : null,
- (0, import_react50.createElement)(ProposalFoot, { busy, answer })
+ (0, import_react51.createElement)(ProposalHead, { titleId, title: proposal.name, kind: t(update ? "Skill update" : "New skill"), detail: proposal.description, oldDetail }),
+ (0, import_react51.createElement)(FileBox, { name: "SKILL.md", path: `skills/${proposal.name}`, state: update ? "Updated" : "Added", blocks: [rows2] }),
+ proposal.why ? (0, import_react51.createElement)("p", { className: "bt-learning-why" }, proposal.why) : null,
+ error ? (0, import_react51.createElement)("div", { className: "bt-learning-error", role: "alert" }, error) : null,
+ (0, import_react51.createElement)(ProposalFoot, { busy, answer })
);
}
function ProposalHead({ titleId, icon: icon2 = MemoryIcon, title, kind, detail, oldDetail }) {
- return (0, import_react50.createElement)(
+ return (0, import_react51.createElement)(
"div",
{ className: "bt-q-head" },
- (0, import_react50.createElement)("span", { className: "bt-learning-icon", "aria-hidden": true }, (0, import_react50.createElement)(icon2)),
- (0, import_react50.createElement)(
+ (0, import_react51.createElement)("span", { className: "bt-learning-icon", "aria-hidden": true }, (0, import_react51.createElement)(icon2)),
+ (0, import_react51.createElement)(
"div",
{ className: "bt-q-text" },
- (0, import_react50.createElement)("p", { className: "bt-q-title", id: titleId }, title),
- kind ? (0, import_react50.createElement)("div", { className: "bt-q-detail" }, kind) : null,
- oldDetail ? (0, import_react50.createElement)("p", { className: "bt-learning-description bt-learning-old" }, (0, import_react50.createElement)("del", null, oldDetail)) : null,
- detail ? (0, import_react50.createElement)("p", { className: "bt-learning-description" }, detail) : null
+ (0, import_react51.createElement)("p", { className: "bt-q-title", id: titleId }, title),
+ kind ? (0, import_react51.createElement)("div", { className: "bt-q-detail" }, kind) : null,
+ oldDetail ? (0, import_react51.createElement)("p", { className: "bt-learning-description bt-learning-old" }, (0, import_react51.createElement)("del", null, oldDetail)) : null,
+ detail ? (0, import_react51.createElement)("p", { className: "bt-learning-description" }, detail) : null
),
- (0, import_react50.createElement)("span", { className: "bt-q-badge bt-learning-status" }, (0, import_react50.createElement)("span", { className: "bt-learning-dot", "aria-hidden": true }), t("Awaiting approval"))
+ (0, import_react51.createElement)("span", { className: "bt-q-badge bt-learning-status" }, (0, import_react51.createElement)("span", { className: "bt-learning-dot", "aria-hidden": true }), t("Awaiting approval"))
);
}
function ProposalFoot({ busy, answer }) {
- return (0, import_react50.createElement)(
+ return (0, import_react51.createElement)(
"div",
{ className: "bt-q-foot bt-learning-foot" },
- (0, import_react50.createElement)("button", { type: "button", className: "bt-learning-btn bt-learning-decline", disabled: busy, onClick: () => answer(false) }, t("Decline")),
- (0, import_react50.createElement)(
+ (0, import_react51.createElement)("button", { type: "button", className: "bt-learning-btn bt-learning-decline", disabled: busy, onClick: () => answer(false) }, t("Decline")),
+ (0, import_react51.createElement)(
"button",
{ type: "button", className: "bt-learning-btn bt-learning-approve", disabled: busy, onClick: () => answer(true) },
- (0, import_react50.createElement)(CheckIcon),
+ (0, import_react51.createElement)(CheckIcon),
t("Approve")
)
);
@@ -19906,43 +19923,43 @@ function ProposalFoot({ busy, answer }) {
var COLLAPSE_ROWS = 8;
var SIGNS = { added: "+", removed: "−", same: "" };
function FileBox({ name, path, state, blocks }) {
- const [open, setOpen] = (0, import_react50.useState)(false);
+ const [open, setOpen] = (0, import_react51.useState)(false);
const all = blocks.flat();
const added = all.filter((row) => row.kind === "added").length;
const removed = all.filter((row) => row.kind === "removed").length;
const folds = all.length > COLLAPSE_ROWS;
const shut = folds && !open;
- return (0, import_react50.createElement)(
+ return (0, import_react51.createElement)(
"div",
{ className: "bt-learning-file" },
- (0, import_react50.createElement)(
+ (0, import_react51.createElement)(
"div",
{ className: "bt-learning-filehead" },
- (0, import_react50.createElement)("span", { className: "bt-learning-name" }, name),
- path ? (0, import_react50.createElement)("span", { className: "bt-learning-path" }, path) : null,
- (0, import_react50.createElement)("span", { className: "bt-learning-spacer" }),
- added > 0 ? (0, import_react50.createElement)("span", { className: "bt-learning-plus" }, `+${added}`) : null,
- removed > 0 ? (0, import_react50.createElement)("span", { className: "bt-learning-minus" }, `−${removed}`) : null,
- (0, import_react50.createElement)("span", { className: `bt-learning-state bt-learning-state-${state.toLowerCase()}` }, t(state))
+ (0, import_react51.createElement)("span", { className: "bt-learning-name" }, name),
+ path ? (0, import_react51.createElement)("span", { className: "bt-learning-path" }, path) : null,
+ (0, import_react51.createElement)("span", { className: "bt-learning-spacer" }),
+ added > 0 ? (0, import_react51.createElement)("span", { className: "bt-learning-plus" }, `+${added}`) : null,
+ removed > 0 ? (0, import_react51.createElement)("span", { className: "bt-learning-minus" }, `−${removed}`) : null,
+ (0, import_react51.createElement)("span", { className: `bt-learning-state bt-learning-state-${state.toLowerCase()}` }, t(state))
),
- (0, import_react50.createElement)(
+ (0, import_react51.createElement)(
"div",
{ className: shut ? "bt-learning-code bt-learning-shut" : "bt-learning-code" },
blocks.map((rows2, blockIndex) => [
- blockIndex > 0 ? (0, import_react50.createElement)("div", { className: "bt-learning-gap", key: `gap-${blockIndex}` }) : null,
- ...rows2.map((row, rowIndex) => (0, import_react50.createElement)(
+ blockIndex > 0 ? (0, import_react51.createElement)("div", { className: "bt-learning-gap", key: `gap-${blockIndex}` }) : null,
+ ...rows2.map((row, rowIndex) => (0, import_react51.createElement)(
"div",
{ className: `bt-learning-row bt-learning-${row.kind}`, key: `${blockIndex}-${rowIndex}` },
- (0, import_react50.createElement)("span", { className: "bt-learning-num", "aria-hidden": true }, row.number ?? ""),
- (0, import_react50.createElement)("span", { className: "bt-learning-sign", "aria-hidden": true }, SIGNS[row.kind]),
- (0, import_react50.createElement)("span", { className: "bt-learning-text" }, row.line || " ")
+ (0, import_react51.createElement)("span", { className: "bt-learning-num", "aria-hidden": true }, row.number ?? ""),
+ (0, import_react51.createElement)("span", { className: "bt-learning-sign", "aria-hidden": true }, SIGNS[row.kind]),
+ (0, import_react51.createElement)("span", { className: "bt-learning-text" }, row.line || " ")
))
])
),
- folds ? (0, import_react50.createElement)(
+ folds ? (0, import_react51.createElement)(
"div",
{ className: shut ? "bt-learning-morebar bt-learning-morebar-shut" : "bt-learning-morebar" },
- (0, import_react50.createElement)(
+ (0, import_react51.createElement)(
"button",
{ type: "button", className: "bt-learning-more", "aria-expanded": open, onClick: () => setOpen(!open) },
t(open ? "Show less" : "Show all {count} lines", { count: all.length })
@@ -19953,7 +19970,7 @@ function FileBox({ name, path, state, blocks }) {
function LearningProposals({ turn, dock, sessionId, useRoster, actions }) {
const roster = useRoster((value) => value);
const facts = useTurnFacts(sessionId, actions);
- const [failed, setFailed] = (0, import_react50.useState)({});
+ const [failed, setFailed] = (0, import_react51.useState)({});
const bot = roster.byId?.[sessionId];
if (!bot || currentPart(bot) !== sessionId) return null;
const proposals = roster.learning?.[bot.id] ?? [];
@@ -19980,10 +19997,10 @@ function LearningProposals({ turn, dock, sessionId, useRoster, actions }) {
delete next[id];
return next;
});
- return (0, import_react50.createElement)("div", { className: dock ? "bt-learning-stack bt-learning-dock" : "bt-learning-stack" }, cards.map((proposal) => (0, import_react50.createElement)(
+ return (0, import_react51.createElement)("div", { className: dock ? "bt-learning-stack bt-learning-dock" : "bt-learning-stack" }, cards.map((proposal) => (0, import_react51.createElement)(
"div",
{ className: "bt-q-inline", key: proposal.id },
- (0, import_react50.createElement)(ProposalCard, {
+ (0, import_react51.createElement)(ProposalCard, {
proposal,
initialError: failed[proposal.id]?.error ?? failedAnswers.get(proposal.id)?.error,
onFailure,
@@ -19993,10 +20010,10 @@ function LearningProposals({ turn, dock, sessionId, useRoster, actions }) {
)));
}
function LearningTurnTail(props) {
- return (0, import_react50.createElement)(LearningProposals, { ...props, dock: false });
+ return (0, import_react51.createElement)(LearningProposals, { ...props, dock: false });
}
function LearningDock(props) {
- return (0, import_react50.createElement)(LearningProposals, { ...props, dock: true });
+ return (0, import_react51.createElement)(LearningProposals, { ...props, dock: true });
}
var LEARNING_CSS = `
.bt-learning-stack{display:flex;flex-direction:column;gap:4px}
@@ -20079,7 +20096,7 @@ function createSwitchWindow(settle) {
}
// src/client/user-message.js
-var import_react51 = require("react");
+var import_react52 = require("react");
var ui = __toESM(require("@deepseek-ai/dsh-client-ui-primitives"), 1);
var canDrawUserMessages = () => typeof ui.projectUserText === "function";
function contentParts(content) {
@@ -20111,38 +20128,38 @@ function userTextParts(text, bots, referenceLabels = []) {
return parts;
}
function UserText({ text, bots, referenceLabels, skillNames, references, actions }) {
- return userTextParts(text, bots, referenceLabels).map((part, index) => part.bot ? (0, import_react51.createElement)(
+ return userTextParts(text, bots, referenceLabels).map((part, index) => part.bot ? (0, import_react52.createElement)(
"button",
{ key: index, type: "button", className: "bt-umention", title: `@${part.bot.name}`, onClick: () => actions.openSession(part.bot.id) },
- (0, import_react51.createElement)(BotMark, { bot: part.bot, size: 16 }),
+ (0, import_react52.createElement)(BotMark, { bot: part.bot, size: 16 }),
part.label
- ) : (0, import_react51.createElement)(import_react51.Fragment, { key: index }, ui.projectUserText(part.text, referenceLabels, skillNames, "skill", references)));
+ ) : (0, import_react52.createElement)(import_react52.Fragment, { key: index }, ui.projectUserText(part.text, referenceLabels, skillNames, "skill", references)));
}
function Attachments({ attachments, renderMessageImages }) {
const compact2 = attachments.length > 1;
- return (0, import_react51.createElement)("div", { className: "bt-uattach" }, attachments.map((block, index) => {
+ return (0, import_react52.createElement)("div", { className: "bt-uattach" }, attachments.map((block, index) => {
if (block.type === "image") {
- return renderMessageImages ? (0, import_react51.createElement)(import_react51.Fragment, { key: index }, renderMessageImages({ images: [{ attachment: block.attachment }], align: "end", compact: compact2 })) : null;
+ return renderMessageImages ? (0, import_react52.createElement)(import_react52.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_react51.createElement)(
+ return (0, import_react52.createElement)(
"span",
{ key: index, className: "bt-ufile", title: file.name },
- ui.FileTypeIcon ? (0, import_react51.createElement)(ui.FileTypeIcon, { path: file.name, className: "bt-ufile-icon" }) : null,
- (0, import_react51.createElement)("span", { className: "bt-ufile-text" }, (0, import_react51.createElement)("span", { className: "bt-ufile-name" }, file.name), meta ? (0, import_react51.createElement)("span", { className: "bt-ufile-meta" }, meta) : null)
+ ui.FileTypeIcon ? (0, import_react52.createElement)(ui.FileTypeIcon, { path: file.name, className: "bt-ufile-icon" }) : null,
+ (0, import_react52.createElement)("span", { className: "bt-ufile-text" }, (0, import_react52.createElement)("span", { className: "bt-ufile-name" }, file.name), meta ? (0, import_react52.createElement)("span", { className: "bt-ufile-meta" }, meta) : null)
);
}));
}
function CopyButton({ text }) {
- const [copied, setCopied] = (0, import_react51.useState)(false);
+ const [copied, setCopied] = (0, import_react52.useState)(false);
const copy2 = () => {
void navigator.clipboard?.writeText(text).then(() => {
setCopied(true);
setTimeout(() => setCopied(false), 1e3);
});
};
- return (0, import_react51.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_react51.createElement)(CheckIcon) : (0, import_react51.createElement)(CopyIcon));
+ return (0, import_react52.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_react52.createElement)(CheckIcon) : (0, import_react52.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 }) {
@@ -20154,10 +20171,10 @@ function UserMessageCell({ node, sessionId, useRoster, actions, renderMessageIma
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_react51.createElement)(UserText, { text: shown, bots: mentionableBots(roster, sessionId), referenceLabels, skillNames: data.skillNames ?? [], references, actions });
- const row = (0, import_react51.useRef)(null);
- const [toolsOpen, setToolsOpen] = (0, import_react51.useState)(false);
- (0, import_react51.useEffect)(() => {
+ const body = (0, import_react52.createElement)(UserText, { text: shown, bots: mentionableBots(roster, sessionId), referenceLabels, skillNames: data.skillNames ?? [], references, actions });
+ const row = (0, import_react52.useRef)(null);
+ const [toolsOpen, setToolsOpen] = (0, import_react52.useState)(false);
+ (0, import_react52.useEffect)(() => {
if (!toolsOpen) return void 0;
const onDown = (event) => {
if (!row.current?.contains(event.target)) setToolsOpen(false);
@@ -20173,24 +20190,24 @@ function UserMessageCell({ node, sessionId, useRoster, actions, renderMessageIma
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_react51.createElement)(
+ return (0, import_react52.createElement)(
"div",
{ ref: row, className: "bt-umsg", "data-steering": steering || void 0 },
- (0, import_react51.createElement)(
+ (0, import_react52.createElement)(
"div",
{ className: "bt-ustack" },
- attachments.length > 0 ? (0, import_react51.createElement)(Attachments, { attachments, renderMessageImages }) : null,
- text !== "" || rest.length > 0 ? (0, import_react51.createElement)(
+ attachments.length > 0 ? (0, import_react52.createElement)(Attachments, { attachments, renderMessageImages }) : null,
+ text !== "" || rest.length > 0 ? (0, import_react52.createElement)(
"div",
{ className: "bt-ubody", title: clock3(data.time), "data-folded": folded || void 0, onClick: tapTools },
- control ? (0, import_react51.createElement)("div", { className: "bt-fold-body" }, body) : body,
+ control ? (0, import_react52.createElement)("div", { className: "bt-fold-body" }, body) : body,
control,
- rest.map((block, index) => ui.JsonBlock ? (0, import_react51.createElement)(ui.JsonBlock, { key: index, label: t("Content"), payload: block }) : null)
+ rest.map((block, index) => ui.JsonBlock ? (0, import_react52.createElement)(ui.JsonBlock, { key: index, label: t("Content"), payload: block }) : null)
) : null,
- referenceLabels.length > 0 ? (0, import_react51.createElement)("div", { className: "bt-urefs" }, t("Referenced {labels}", { labels: referenceLabels.join(t(", ")) })) : null,
- groupTime ? (0, import_react51.createElement)("div", { className: "bt-utime", title: clockLabel(data.time) }, groupTime) : null
+ referenceLabels.length > 0 ? (0, import_react52.createElement)("div", { className: "bt-urefs" }, t("Referenced {labels}", { labels: referenceLabels.join(t(", ")) })) : null,
+ groupTime ? (0, import_react52.createElement)("div", { className: "bt-utime", title: clockLabel(data.time) }, groupTime) : null
),
- text === "" ? null : (0, import_react51.createElement)("div", { className: "bt-utools", "data-open": toolsOpen || void 0 }, (0, import_react51.createElement)(CopyButton, { text }))
+ text === "" ? null : (0, import_react52.createElement)("div", { className: "bt-utools", "data-open": toolsOpen || void 0 }, (0, import_react52.createElement)(CopyButton, { text }))
);
}
var USER_MESSAGE_CSS = `
@@ -21115,10 +21132,10 @@ function apply(ctx) {
// A Bot condenses its conversation without telling anyone; the chat keeps showing
// every message.
() => shadow("conversation.chat.node", { key: "question-reply", priority: BOT_PRIORITY, locale: "chat" }, AnsweredReply),
- () => shadow("conversation.chat.node", { key: "compaction", priority: BOT_PRIORITY, locale: "chat" }, Nothing),
+ () => shadow("conversation.chat.node", { key: "compaction", priority: BOT_PRIORITY, locale: "chat" }, CellEmpty),
// A Bot chat leaves DSH's context lines (tool updates, injected context) out; a Bot
// message spliced in mid-turn gets an event line from the step that reads it instead.
- () => shadow("conversation.chat.node", { key: "context", priority: BOT_PRIORITY, locale: "chat" }, Nothing),
+ () => shadow("conversation.chat.node", { key: "context", priority: BOT_PRIORITY, locale: "chat" }, CellEmpty),
...canDrawUserMessages() ? ["user", "steering"].map((key) => () => shadow("conversation.chat.node", { key, priority: BOT_PRIORITY, locale: "chat", inject: face }, UserMessageCell)) : [],
() => shadow("conversation.input.permission", { priority: BOT_PRIORITY }, Nothing),
() => shadow("conversation.input.plan", { priority: BOT_PRIORITY }, Nothing),
diff --git a/ds-bot/src/client/cell-empty.js b/ds-bot/src/client/cell-empty.js
new file mode 100644
index 00000000..681b96d9
--- /dev/null
+++ b/ds-bot/src/client/cell-empty.js
@@ -0,0 +1,17 @@
+import { createElement as h, useLayoutEffect, useRef } from 'react'
+
+// A cell that draws nothing marks itself, so the row or seat wrapping it can tell a
+// cell DS Bot emptied from one another renderer filled — a cell holding only text has
+// no element child for a descendant check to see. The mark also reaches the slot that
+// carries it: :has() cannot nest, so no selector can ask whether every node in a seat
+// holds just the mark; the slot's own attribute can say it.
+export function CellEmpty({ className }) {
+ const ref = useRef(null)
+ useLayoutEffect(() => {
+ const slot = ref.current?.closest('[data-slot]')
+ if (!slot) return undefined
+ slot.dataset.btEmptied = ''
+ return () => { if (slot.querySelectorAll('[data-bt-empty]').length <= 1) delete slot.dataset.btEmptied }
+ }, [])
+ return h('span', { ref, className, hidden: true, 'data-bt-empty': true })
+}
diff --git a/ds-bot/src/client/cells.js b/ds-bot/src/client/cells.js
index 3555f0cf..53a4f7f5 100644
--- a/ds-bot/src/client/cells.js
+++ b/ds-bot/src/client/cells.js
@@ -5,6 +5,7 @@ import { inkText } from './inks.js'
import { linkMentions, mentionTarget, dayLabel, contentText, stripHeader, isHiddenTurn, isRelayContext, relaysBefore, relayPart, commRunOf, toolName, toolArgs, reminderPrompts, elapsedLabel, clockLabel, messageClock } from './text.js'
import { SmileIcon, ReplyIcon, DotsIcon, CheckIcon, DownloadIcon, CopyIcon, MemoryIcon } from './icons.js'
import { colorOf, toolState, BotMark, RoomAvatar } from './mark.js'
+import { CellEmpty } from './cell-empty.js'
import { SettledQuestion, PendingQuestion } from './questions.js'
import { AnsweredReply, WidgetCell } from './widget-cell.js'
import { SecretToolCell } from './secret-card.js'
@@ -235,12 +236,12 @@ export function AssistantCell({ node, groupPart, sessionId, openFile, fileMentio
const ms = useThinkingMs({ sessionId, turn: data.turn, settledSteps: members.filter(step => step.status !== 'running').length, skip: hidden || reasoning === '' })
// A streaming reply stands in for the activity row.
useLiveNote(actions, sessionId, `text:${node.key ?? data.seq}`, !hidden && running && texts.length > 0 ? { text: true } : null)
- if (hidden) return null
+ if (hidden) return h(CellEmpty)
// A relay spliced mid-turn is a 'context' node, hidden from the chat flow on
// DSH 0.2; the step that answers it shows the event line where it was read,
// once, in the step's first cell.
const relays = relayPart(data, groupPart) ? relaysBefore(contexts, steps, data) : []
- if (texts.length === 0 && !reasoning && relays.length === 0) return null
+ if (texts.length === 0 && !reasoning && relays.length === 0) return h(CellEmpty)
const selfId = roster.byId[sessionId]?.id ?? sessionId
// The flat layout heads a reply with who speaks, once per Turn: in the step that opens
// it, in that step's reasoning part when the reasoning shows there.
@@ -379,7 +380,7 @@ function MemoryEvent({ sessionId, scope, tool, result, failed, code, roster, act
panel === undefined ? h('span', null, h(MemoryIcon), t('Already saved')) : h('button', { type: 'button', onClick: () => actions.openMemory(panel) }, h(MemoryIcon), t('Already saved')))
}
if (!failed && MEMORY_SAVED.test(result)) {
- if (!target) return null
+ if (!target) return h(CellEmpty)
const label = team ? t('Team memory updated') : target === self ? t('Memory updated') : t("Updated {name}'s memory", { name: target.name })
return h('div', { className: 'bt-event' },
h('button', { type: 'button', title: result, onClick: () => actions.openMemory(target.id) }, h(MemoryIcon), label))
@@ -581,7 +582,7 @@ export function TriggerCell({ node, sessionId, useRoster, useSessions, useTurnCl
const body = triggerBody()
return unreadOpening
? h(Fragment, null, h('div', { className: 'bt-open-new' }, h(NewDivider), h('div', { className: 'bt-time-sep', role: 'separator' }, unreadOpening)), body)
- : body
+ : (body ?? h(CellEmpty))
function triggerBody() {
if (source.kind === 'bot') {
@@ -671,11 +672,13 @@ export function TurnProcessCell({ node, sessionId, turnProcess, useRoster, useUi
return !hidden && typeof visit?.seen === 'number' && own?.first !== undefined && own.first <= visit.seen
&& own.end !== undefined && own.end > visit.seen && own.end <= visit.entered
})
- return fresh ? h(NewDivider) : null
+ return fresh ? h(NewDivider) : h(CellEmpty)
}
export function Nothing() { return null }
+export { CellEmpty }
+
// A pause longer than this splits the transcript with a time separator.
const SEPARATOR_GAP_MS = 30 * 60 * 1000
function nextTurnStart(turns, turn) {
@@ -901,7 +904,7 @@ function GroupReplies({ sessionId, callId, done, content, roster, actions, useUi
if (replies.length === 0 && pending.length === 0) {
// A pruned tool result left nothing to draw; keep a marker row instead of an
// empty turn, which reads as a blank gap on a narrow first paint.
- return broken ? h('div', { className: 'bt-group-replies' }, h('div', { className: 'bt-event' }, t('The group replies could not be shown'))) : null
+ return broken ? h('div', { className: 'bt-group-replies' }, h('div', { className: 'bt-event' }, t('The group replies could not be shown'))) : h(CellEmpty)
}
const room = roster.roomsById[sessionId]
return h('div', { className: 'bt-group-replies' },
@@ -1011,12 +1014,12 @@ function renderCall(call, { sessionId, roster, actions, useUi, useWork, findBot,
}
case 'create_bot': {
const created = findBot(arg('name'))
- if (!done || created === undefined) return null
+ if (!done || created === undefined) return h(CellEmpty)
return h(EventLine, { prefix: t('Created'), bots: [created], onOpen: bot => actions.openSession(bot.id) })
}
case 'update_bot': {
const target = findBot(arg('name')) ?? findBot(arg('bot')) ?? (arg('bot') ? undefined : self)
- return done && target ? h(EventLine, { prefix: t('Updated'), bots: [target], onOpen: bot => actions.openSession(bot.id) }) : null
+ return done && target ? h(EventLine, { prefix: t('Updated'), bots: [target], onOpen: bot => actions.openSession(bot.id) }) : h(CellEmpty)
}
case 'group_relay':
return h(GroupReplies, { sessionId, callId: call.callId, done, content: call.content, roster, actions, useUi, useWork })
@@ -1030,7 +1033,7 @@ function renderCall(call, { sessionId, roster, actions, useUi, useWork, findBot,
delete_group: ['Deleted group', "Couldn't delete the group"],
post_to_group: ['Posted in', "Couldn't post in the group"],
}[tool]
- if (!done) return null
+ if (!done) return h(CellEmpty)
// Tool results quote the group's name; anything else is a refusal.
const result = contentText(call.content)
const named = /^(Created group|Updated|Nothing changed in|Deleted|Posted in) "([^"]+)"/.exec(result)
@@ -1042,8 +1045,8 @@ function renderCall(call, { sessionId, roster, actions, useUi, useWork, findBot,
case 'ask_user': {
const question = roster.questions?.[sessionId]
// Answered or closed: the card leaves no gap where it was.
- if (!question || question.callId !== call.callId) return h('span', { className: 'bt-q-gone', hidden: true })
- if (heldCards?.[heldCardKey('question', question.id)] > 0) return null
+ if (!question || question.callId !== call.callId) return h(CellEmpty, { className: 'bt-q-gone' })
+ if (heldCards?.[heldCardKey('question', question.id)] > 0) return h(CellEmpty)
return h(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: true })
}
case 'show_view':
@@ -1053,24 +1056,24 @@ function renderCall(call, { sessionId, roster, actions, useUi, useWork, findBot,
case 'browser_handoff':
return h(HandoffCall, { sessionId, callId: call.callId, roster, actions, heldCards, hooks })
case 'ask_user_question': {
- if (!done) return null
+ if (!done) return h(CellEmpty)
let parsed = null
try { parsed = JSON.parse(contentText(call.content)) } catch { parsed = null }
const answer = parsed?.answers?.[0]
const question = argValue('questions')?.[0]
- if (!answer) return null
+ if (!answer) return h(CellEmpty)
return h('div', { className: 'bt-q-inline' }, h(SettledQuestion, { question, answer }))
}
case 'read_group_chat': {
- if (!done) return null
+ if (!done) return h(CellEmpty)
const room = roster.rooms.find(entry => entry.name === arg('group'))
- return room ? h(GroupEvent, { prefix: t('Read'), room, roster, actions }) : null
+ return room ? h(GroupEvent, { prefix: t('Read'), room, roster, actions }) : h(CellEmpty)
}
case 'remember':
case 'forget':
- return done ? h(MemoryEvent, { sessionId, scope: arg('scope'), tool, result: contentText(call.content), failed: call.isError === true, code: call.error?.code, roster, actions, findBot }) : null
+ return done ? h(MemoryEvent, { sessionId, scope: arg('scope'), tool, result: contentText(call.content), failed: call.isError === true, code: call.error?.code, roster, actions, findBot }) : h(CellEmpty)
default:
- return null
+ return h(CellEmpty)
}
}
@@ -1089,7 +1092,7 @@ export function ToolCell({ node, sessionId, useRoster, useUi, useWork, useHeldCa
// A running tool shows only as the activity row's phrase.
useLiveNote(actions, sessionId, `tool:${root.callId ?? node.key}`, note)
useShownCards(actions, sessionId, drawn.filter(call => CARDS.has(toolName(call)) && call.callId).map(call => call.callId))
- if (drawn.length === 0) return null
+ if (drawn.length === 0) return h(CellEmpty)
const env = { sessionId, roster, actions, useUi, useWork, findBot, heldCards, hooks: { useBrowserHolds, useBrowserTabs, useBrowserPages } }
return h(Fragment, null, drawn.map((call, index) => h(Fragment, { key: call.callId ?? index }, renderCall(call, env))))
}
diff --git a/ds-bot/src/client/handoff-card.js b/ds-bot/src/client/handoff-card.js
index 5d5a22de..e8df32c8 100644
--- a/ds-bot/src/client/handoff-card.js
+++ b/ds-bot/src/client/handoff-card.js
@@ -3,6 +3,7 @@ import { CheckIcon, GlobeIcon } from './icons.js'
import { t } from './i18n.js'
import { useDockHold } from './card-hold.js'
import { heldCardKey } from './sources.js'
+import { CellEmpty } from './cell-empty.js'
// -------------------------------------------------------------------------
// Browser handoff: a Bot's browser reached a step only the user can do (a sign-in,
@@ -86,8 +87,8 @@ export function HandoffCall({ sessionId, callId, roster, actions, heldCards, hoo
const bot = roster.byId[sessionId]
const hold = hooks.useBrowserHolds?.(map => (bot ? map[bot.id] : undefined))
// Answered, taken back, or never raised on this machine: no card, and no gap where it was.
- if (!bot || hold?.callId !== callId || !actions.browserGiveBack) return h('span', { className: 'bt-q-gone', hidden: true })
- if (heldCards?.[heldCardKey('handoff', callId)] > 0) return null
+ if (!bot || hold?.callId !== callId || !actions.browserGiveBack) return h(CellEmpty, { className: 'bt-q-gone' })
+ if (heldCards?.[heldCardKey('handoff', callId)] > 0) return h(CellEmpty)
return h(PendingHandoff, { key: callId, sessionId, bot, hold, hooks, actions, inline: true })
}
diff --git a/ds-bot/src/client/index.js b/ds-bot/src/client/index.js
index 31f66057..ad9bef8c 100644
--- a/ds-bot/src/client/index.js
+++ b/ds-bot/src/client/index.js
@@ -21,7 +21,7 @@ import { QuestionCard, QuestionDock } from './questions.js'
import { AnsweredReply, WidgetDock, WIDGET_CSS } from './widget-cell.js'
import { HandoffDock, HANDOFF_CSS } from './handoff-card.js'
import { installHeaderNavigation } from './header-navigation.js'
-import { AssistantCell, TriggerCell, TurnProcessCell, Nothing, TurnTailCell, ToolCell } from './cells.js'
+import { AssistantCell, TriggerCell, TurnProcessCell, Nothing, CellEmpty, TurnTailCell, ToolCell } from './cells.js'
import { Overlays } from './overlays.js'
import { createBotBrowsers, serveBrowserReads } from './bot-browsers.js'
import { BROWSER_CSS } from './browser-pane.js'
@@ -904,10 +904,10 @@ export function apply(ctx) {
// A Bot condenses its conversation without telling anyone; the chat keeps showing
// every message.
() => shadow('conversation.chat.node', { key: 'question-reply', priority: BOT_PRIORITY, locale: 'chat' }, AnsweredReply),
- () => shadow('conversation.chat.node', { key: 'compaction', priority: BOT_PRIORITY, locale: 'chat' }, Nothing),
+ () => shadow('conversation.chat.node', { key: 'compaction', priority: BOT_PRIORITY, locale: 'chat' }, CellEmpty),
// A Bot chat leaves DSH's context lines (tool updates, injected context) out; a Bot
// message spliced in mid-turn gets an event line from the step that reads it instead.
- () => shadow('conversation.chat.node', { key: 'context', priority: BOT_PRIORITY, locale: 'chat' }, Nothing),
+ () => shadow('conversation.chat.node', { key: 'context', priority: BOT_PRIORITY, locale: 'chat' }, CellEmpty),
...(canDrawUserMessages() ? ['user', 'steering'].map(key => () => shadow('conversation.chat.node', { key, priority: BOT_PRIORITY, locale: 'chat', inject: face }, UserMessageCell)) : []),
() => shadow('conversation.input.permission', { priority: BOT_PRIORITY }, Nothing),
() => shadow('conversation.input.plan', { priority: BOT_PRIORITY }, Nothing),
diff --git a/ds-bot/src/client/questions.js b/ds-bot/src/client/questions.js
index 3bcfb983..9428a41b 100644
--- a/ds-bot/src/client/questions.js
+++ b/ds-bot/src/client/questions.js
@@ -1,5 +1,6 @@
import { createElement as h, useEffect, useId, useRef, useState, useSyncExternalStore } from 'react'
import { CloseIcon, CheckIcon } from './icons.js'
+import { CellEmpty } from './cell-empty.js'
import { t } from './i18n.js'
import { useDockHold } from './card-hold.js'
import { createSource, heldCardKey } from './sources.js'
@@ -183,7 +184,7 @@ export function PendingQuestion({ sessionId, question, actions, inline }) {
const [busy, setBusy] = useState(false)
const busyRef = useRef(false)
const hold = useDockHold(sessionId, 'question', question.id, actions, inline)
- if (answered === question.id) return null
+ if (answered === question.id) return h(CellEmpty)
const run = (make) => {
if (busyRef.current) return
hold()
@@ -219,7 +220,7 @@ export function AnsweredCell({ node }) {
const data = node.data ?? {}
const questions = Array.isArray(data.questions) ? data.questions : []
if (questions.length === 0) {
- return data.text ? h('div', { className: 'bt-urow' }, h('div', { className: 'bt-ububble' }, data.text)) : null
+ return data.text ? h('div', { className: 'bt-urow' }, h('div', { className: 'bt-ububble' }, data.text)) : h(CellEmpty)
}
const answers = Array.isArray(data.answers) ? data.answers : []
return h('div', { className: 'bt-q-inline' }, questions.map(question => h(SettledQuestion, {
diff --git a/ds-bot/src/client/secret-card.js b/ds-bot/src/client/secret-card.js
index 4180621d..51b9d477 100644
--- a/ds-bot/src/client/secret-card.js
+++ b/ds-bot/src/client/secret-card.js
@@ -10,6 +10,7 @@ import { dateLocale, t } from './i18n.js'
import { SPRING_POP, SPRING_SHAPE, spring } from './motion.js'
import { useDockHold } from './card-hold.js'
import { heldCardKey } from './sources.js'
+import { CellEmpty } from './cell-empty.js'
const MIN_VALUE = 4
const NONE = {}
@@ -153,10 +154,10 @@ function RequestView({ sessionId, bot, request, roster, actions }) {
// The card at its request_secret call; a key that was already there gets one line.
export function SecretToolCell({ sessionId, callId, name, done, content, roster, actions, heldCards = NONE }) {
const bot = roster.byId[sessionId]
- if (!bot) return null
+ if (!bot) return h(CellEmpty)
// Call ids repeat across a Bot's chat parts.
const request = (roster.secretRequests?.[bot.id] ?? []).find(entry => entry.callId === callId && (entry.sessionId ?? sessionId) === sessionId)
- if (request?.status === 'pending' && heldCards[heldCardKey('secret', request.id)] > 0) return null
+ if (request?.status === 'pending' && heldCards[heldCardKey('secret', request.id)] > 0) return h(CellEmpty)
if (request) return h('div', { className: 'bt-q-inline' }, h(RequestView, { sessionId, bot, request, roster, actions }))
if (done && /already saved/.test(contentText(content))) {
return h('div', { className: 'bt-event' }, h('span', { className: 'bt-secret-event' }, h(KeyIcon), t('{bot} is using {name}', { bot: bot.name, name: name ?? t('a saved key') })))
@@ -166,7 +167,7 @@ export function SecretToolCell({ sessionId, callId, name, done, content, roster,
if (done && contentText(content).startsWith('No card can be shown now')) {
return h('div', { className: 'bt-event' }, h('span', { className: 'bt-secret-event' }, h(KeyIcon), t('{bot} could not ask for a key: this window can only view the team', { bot: bot.name })))
}
- return null
+ return h(CellEmpty)
}
// A card whose call the transcript does not draw (an earlier part of the chat, a
diff --git a/ds-bot/src/client/styles.js b/ds-bot/src/client/styles.js
index 568e25c7..e824eea7 100644
--- a/ds-bot/src/client/styles.js
+++ b/ds-bot/src/client/styles.js
@@ -957,11 +957,13 @@ body[data-bt-layout=flat] .bt-think{max-width:calc(var(--bt-flat-w) * 100%)}
[data-step-process]>div:first-child{display:none!important}
[data-step-process]>[data-step-process-body]{display:block!important;content-visibility:visible!important;max-height:none!important;overflow:visible!important;mask-image:none!important;scrollbar-gutter:auto!important}
:is([data-step-process],[data-turn-process-hidden])[hidden]{content-visibility:visible!important}
-[class*="_flowItem"]:has(> [data-slot="conversation.chat.node"]:empty){display:none!important}
-/* A turn's process seat is a flow child of its own, not a flowItem: an empty one
- (a hidden exchange turn, a turn whose calls draw nothing) still kept its
- margin, stacking a blank band per hidden call. */
-[data-step-process]:not(:has([data-slot="conversation.chat.node"] :not([hidden]))){display:none!important}
+[class*="_flowItem"]:has(> [data-slot="conversation.chat.node"]:empty, > [data-slot="conversation.chat.node"][data-bt-emptied]){display:none!important}
+/* A turn's process seat is a flow child of its own, not a flowItem: a seat whose
+ member cells all emptied themselves (a hidden exchange turn, a turn whose
+ calls draw nothing) still kept its margin, stacking a blank band per hidden
+ call. Only the slot a DS Bot cell marked counts, so a seat another renderer
+ fills — even with plain text and no element child — is never taken for empty. */
+[data-step-process]:has(> [data-step-process-body] [data-slot="conversation.chat.node"][data-bt-emptied]):not(:has(> [data-step-process-body] [data-slot="conversation.chat.node"]:not([data-bt-emptied]))){display:none!important}
[class*="_header"]:has(.bt-head){border-bottom-color:transparent!important;box-shadow:none!important}
/* The transcript runs under a floating header pill. */
header[class*="_header"]:has(.bt-head){position:absolute!important;top:0;left:0;right:0;z-index:8;display:flex!important;padding:10px 0 0!important;background:transparent!important;pointer-events:none;justify-content:center}
diff --git a/ds-bot/src/client/widget-cell.js b/ds-bot/src/client/widget-cell.js
index 00e913f6..bfb4e04f 100644
--- a/ds-bot/src/client/widget-cell.js
+++ b/ds-bot/src/client/widget-cell.js
@@ -1,5 +1,6 @@
import { createElement as h, useRef, useState } from 'react'
import { MarkdownText } from './dsh-primitives.js'
+import { CellEmpty } from './cell-empty.js'
import { t } from './i18n.js'
import { AnsweredCell } from './questions.js'
import { useDockHold } from './card-hold.js'
@@ -47,11 +48,11 @@ export function PendingView({ sessionId, view, actions, inline }) {
export function WidgetCell({ sessionId, callId, args, done, isError, roster, actions, heldCards }) {
const record = roster.views?.[sessionId]
if (record !== undefined && record.callId === callId) {
- if (heldCards?.[heldCardKey('view', record.id)] > 0) return null
+ if (heldCards?.[heldCardKey('view', record.id)] > 0) return h(CellEmpty)
return h(PendingView, { sessionId, view: record, actions, inline: true })
}
// A refused call (bad blueprint) drew no card; don't render an empty one.
- if (done && isError) return h('span', { className: 'bt-q-gone', hidden: true })
+ if (done && isError) return h(CellEmpty, { className: 'bt-q-gone' })
// Display-only cards draw from the recorded call arguments, which keep the
// provider's encoding: checkShownView measures and unwraps them as the host did.
// The args accessor reads strings through `text`; `value` drops them.
@@ -61,7 +62,7 @@ export function WidgetCell({ sessionId, callId, args, done, isError, roster, act
// a settled interactive call: answered, dismissed or replaced, it leaves no gap
// where it was (same as ask_user).
if (shown.error !== undefined || shown.interactive || args?.value?.('await_reply') === true) {
- return h('span', { className: 'bt-q-gone', hidden: true })
+ return h(CellEmpty, { className: 'bt-q-gone' })
}
return h('div', { className: 'bt-q-inline' }, h(Card, { title: shown.title, view: shown.view }))
}
@@ -86,7 +87,7 @@ export function AnsweredView({ node }) {
if (payload?.kind !== 'answer_to_pending_view') payload = null
}
const view = payload?.views?.[0]
- if (view === null || typeof view !== 'object' || view.view === undefined) return null
+ if (view === null || typeof view !== 'object' || view.view === undefined) return h(CellEmpty)
const answers = Array.isArray(payload.answers) ? payload.answers : []
const answer = answers.find(entry => entry?.id === view.id) ?? answers[0] ?? null
return h('div', { className: 'bt-q-inline' }, h(Card, { title: view.title ?? '', view: view.view, settled: true, answer }))
diff --git a/ds-bot/test/card-hold.test.js b/ds-bot/test/card-hold.test.js
index 07e3994f..dd48cf9a 100644
--- a/ds-bot/test/card-hold.test.js
+++ b/ds-bot/test/card-hold.test.js
@@ -17,6 +17,7 @@ const { outputFiles } = await build({
"export { PendingView, AnsweredReply } from './src/client/widget-cell.js'",
"export { AnsweredCell } from './src/client/questions.js'",
"export { HandoffCall, HandoffDock, PendingHandoff, SettledHandoff } from './src/client/handoff-card.js'",
+ "export { CellEmpty } from './src/client/cell-empty.js'",
].join('\n'),
resolveDir: fileURLToPath(new URL('..', import.meta.url)),
},
@@ -66,7 +67,7 @@ runInNewContext(outputFiles[0].text, {
HTMLInputElement: class {}, HTMLTextAreaElement: class {}, HTMLSelectElement: class {}, HTMLElement: class {},
URL,
})
-const { useDockHold, PendingQuestion, SecretCard, PendingView, AnsweredReply, AnsweredCell, HandoffCall, HandoffDock, PendingHandoff, SettledHandoff } = module.exports
+const { useDockHold, PendingQuestion, SecretCard, PendingView, AnsweredReply, AnsweredCell, HandoffCall, HandoffDock, PendingHandoff, SettledHandoff, CellEmpty } = module.exports
const mount = (Component, props) => {
const instance = {
slots: [], effects: [], props,
@@ -186,7 +187,7 @@ test('a question keeps its custom answer and selection while submitting, after f
form.props.onSubmit({ preventDefault() {} })
await tick()
assert.equal(sent.length, 2)
- assert.equal(pending.render(), null)
+ assert.equal(pending.render().type, CellEmpty)
view.unmount()
pending.unmount()
assert.equal(count('chief', 'question', question.id), 0)
@@ -451,11 +452,11 @@ test('a handoff call draws its card only while the browser is held for that call
assert.equal(draw({ hold: handoff() }).props.inline, true)
// Answered, another call's hold, no hold, a chat without the Bot, or no answer path: nothing, and no gap.
for (const gone of [draw({ hold: undefined }), draw({ hold: handoff({ callId: 'call-2' }) }), draw({ hold: handoff(), roster: { byId: {} } }), draw({ hold: handoff(), actions: {} })]) {
- assert.equal(gone.type, 'span')
- assert.equal(gone.props.hidden, true)
+ assert.equal(gone.type, CellEmpty)
+ assert.equal(gone.props.className, 'bt-q-gone')
}
// The dock draws it while the user is working in it.
- assert.equal(draw({ hold: handoff(), heldCards: { [JSON.stringify(['handoff', 'call-1'])]: 1 } }), null)
+ assert.equal(draw({ hold: handoff(), heldCards: { [JSON.stringify(['handoff', 'call-1'])]: 1 } }).type, CellEmpty)
})
test('the dock draws a handoff the transcript does not, and keeps one the user started on', () => {
diff --git a/ds-bot/test/tool-cells.test.js b/ds-bot/test/tool-cells.test.js
index 18780147..910ce7d6 100644
--- a/ds-bot/test/tool-cells.test.js
+++ b/ds-bot/test/tool-cells.test.js
@@ -75,6 +75,8 @@ const find = (node, match) => {
return match(node) ? node : find(node.props.children, match)
}
const count = (haystack, needle) => haystack.split(needle).length - 1
+// A cell that draws nothing leaves its empty mark (cells.js CellEmpty).
+const emptied = node => find(expand(node), each => each.props?.['data-bt-empty'] === true) !== undefined
const writer = { id: 'writer', name: 'Writer', color: 'blue' }
const chief = { id: 'chief', name: 'Chief', color: 'green' }
@@ -291,12 +293,45 @@ test('each sub-call shows its own state, not its program\'s', () => {
})
test('a program with no known sub-call draws nothing, as before', () => {
- assert.equal(ToolCell(props(program([]))), null)
- assert.equal(ToolCell(props(program([call('bash', 'program:ptc:1'), call('read_file', 'program:ptc:2')]))), null)
- assert.equal(ToolCell(props(call('bash', 'direct'))), null)
+ assert.ok(emptied(ToolCell(props(program([])))))
+ assert.ok(emptied(ToolCell(props(program([call('bash', 'program:ptc:1'), call('read_file', 'program:ptc:2')])))))
+ assert.ok(emptied(ToolCell(props(call('bash', 'direct')))))
effects = []
})
+test('every call that draws nothing leaves only the empty mark, so its seat can hide', () => {
+ const roster = team({
+ questions: { chief: question('q-call') },
+ secretRequests: { chief: [request('s-call')] },
+ views: { chief: { id: 'view-1', callId: 'v-call', title: 'Card', view: { type: 'metric', label: 'Done', value: '3' } } },
+ })
+ const held = {
+ chief: {
+ [JSON.stringify(['question', 'question'])]: 1,
+ [JSON.stringify(['secret', 'request'])]: 1,
+ [JSON.stringify(['view', 'view-1'])]: 1,
+ },
+ }
+ const onlyMarks = (node) => {
+ const elements = findAll(expand(node), each => typeof each.type === 'string' && each.type !== 'fragment')
+ return elements.length > 0 && elements.every(each => each.props?.['data-bt-empty'] === true && each.props.hidden === true)
+ }
+ // A card the user is holding in the dock, an unfinished call, a name that
+ // resolves to nobody, an answerless reply: each marks itself, at any depth.
+ for (const root of [
+ call('ask_user', 'q-call'),
+ call('show_view', 'v-call'),
+ call('request_secret', 's-call', { args: { name: 'DEMO_TOKEN' } }),
+ call('browser_handoff', 'h-call'),
+ call('create_bot', 'c-call', { args: { name: 'Nobody' } }),
+ call('ask_user_question', 'aq-call', { args: { questions: [{ question: 'Ship it?' }] }, running: true }),
+ call('remember', 'm-call', { running: true }),
+ ]) {
+ assert.ok(onlyMarks(ToolCell(props(root, { roster, held }))), `${root.name} leaves only marks`)
+ effects = []
+ }
+})
+
test('a hidden Bot-to-Bot turn draws none of its sub-calls', () => {
const roster = team({ exchangeTurns: { chief: [1] }, secretRequests: { chief: [request('program:ptc:1')] } })
const root = program([call('request_secret', 'program:ptc:1', { args: { name: 'DEMO_TOKEN' } }), call('message_bot', 'program:ptc:2', { args: { to: 'Writer' } })])
@@ -693,7 +728,7 @@ test('a goal round draws nothing, while another unknown trigger keeps its event
useUi: select => select({ visits: {} }),
actions: {},
}))
- assert.equal(trigger({ kind: 'goal', goalId: 'goal-1', revision: 1, round: 1 }), null)
+ assert.ok(emptied(trigger({ kind: 'goal', goalId: 'goal-1', revision: 1, round: 1 })))
assert.match(text(trigger({ kind: 'webhook' })), /<goal_round>Keep going/)
})
diff --git a/ds-bot/test/turn-tail.test.js b/ds-bot/test/turn-tail.test.js
index 323880a7..eb967933 100644
--- a/ds-bot/test/turn-tail.test.js
+++ b/ds-bot/test/turn-tail.test.js
@@ -28,7 +28,7 @@ runInNewContext(bundle.outputFiles[0].text, {
return platform[name]
},
})
-const { AssistantCell, TurnTailCell, ThinkingRow } = module.exports
+const { AssistantCell, TurnTailCell, ThinkingRow, CellEmpty } = module.exports
// Renders the named components of an element tree, leaving the rest as elements.
const expand = (node, names) => {
@@ -132,9 +132,9 @@ test('the thinking row shows only with its switch on, and the activity row is ne
}
const reason = [{ kind: 'reasoning', text: 'Weighing it' }]
const thinking = { turn: 3, step: 1, status: 'running', blocks: reason }
- // Off: a thinking step draws nothing and notes nothing.
+ // Off: a thinking step draws nothing — the empty mark — and notes nothing.
const off = cell({}, reason, [thinking])
- assert.equal(off.out, null)
+ assert.equal(off.out?.type, CellEmpty)
assert.deepEqual(off.noted, [])
// On: the live row shows — and still notes nothing, so the activity row stays.
const on = cell({ thinking: true }, reason, [thinking])