Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

feat(chat): show the bots' exchanges over the message box

luishron123d71902571596
diff --git a/src/components/BotExchangeLine.dom.test.ts b/src/components/BotExchangeLine.dom.test.ts
new file mode 100644
index 0000000000..6cc198766f
--- /dev/null
+++ b/src/components/BotExchangeLine.dom.test.ts
@@ -0,0 +1,200 @@
+// @vitest-environment happy-dom
+import { createElement } from "react";
+import { flushSync } from "react-dom";
+import { createRoot, type Root } from "react-dom/client";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { setLocale } from "@/lib/i18n";
+import type { JobNodeRead } from "@/lib/bot-exchanges";
+import type { LiveFrameListener } from "@/lib/live-events";
+import type { Bot, Message } from "@/state/store";
+
+const fixture = vi.hoisted(() => ({
+ api: vi.fn(),
+ load: vi.fn(),
+ listeners: new Set<LiveFrameListener>(),
+}));
+const bot = (id: string, name: string, threadId: string, extra: Partial<Bot> = {}): Bot => ({
+ id, threadId, name, title: "", description: "", notifications: true, color: "blue", unread: false, messages: [],
+ modelSelection: { instanceId: "fake", model: "test" }, ...extra,
+} as Bot);
+const asked: Message = { id: "p1", role: "user", kind: "text", text: "Get the numbers", at: 5_000 };
+const pepper = bot("pepper", "Pepper", "chat-1", { messages: [asked] });
+const helper = bot("engineer", "Engineer", "engineer-main");
+vi.mock("@/state/api", async (importOriginal) => ({ ...await importOriginal<typeof import("@/state/api")>(), api: fixture.api }));
+vi.mock("@/state/store-select", async (importOriginal) => ({
+ ...await importOriginal<typeof import("@/state/store-select")>(),
+ useStoreSelector: (select: (state: unknown) => unknown) => select({ bots: [pepper, helper] }),
+}));
+vi.mock("@/state/message-history", async (importOriginal) => ({
+ ...await importOriginal<typeof import("@/state/message-history")>(), loadFullThread: fixture.load,
+}));
+vi.mock("@/lib/live-events", async (importOriginal) => ({
+ ...await importOriginal<typeof import("@/lib/live-events")>(),
+ listenLiveFrames: (listener: LiveFrameListener) => { fixture.listeners.add(listener); return () => fixture.listeners.delete(listener); },
+}));
+vi.mock("./Avatar", () => ({
+ BotAvatar: ({ bot: shown }: { bot: Bot }) => createElement("span", { "data-avatar": shown.id }),
+ InitialsAvatar: ({ initials }: { initials: string }) => createElement("span", { "data-avatar": initials }),
+}));
+import { ApiError } from "@/state/api";
+import { BotExchangeLine } from "./BotExchangeLine";
+import { HandoffExchangeHost } from "./HandoffExchange";
+
+const root = (): JobNodeRead => ({ id: "root", botId: "pepper", botName: "Pepper", threadId: "chat-1", status: "running", reply: "required", createdAt: 5_100 });
+const handoff = (extra: Partial<JobNodeRead> = {}): JobNodeRead => ({
+ id: "h1", parentId: "root", botId: "engineer", botName: "Engineer", threadId: "work-1", status: "running", reply: "required",
+ createdAt: 10_000, ...extra,
+});
+const job = (nodes: JobNodeRead[], version = "v1") => ({ since: 5_000, version, nodes, needsInput: [] });
+
+/** The job the server answers, by request: `GET .../job…` reads it, `POST .../stop` answers with `stop`. */
+let current = job([root(), handoff()]);
+let stop: () => unknown = () => ({ ok: true, outcome: "stopped" });
+const reads = () => fixture.api.mock.calls.filter(([path]) => String(path).includes("/job") && !String(path).endsWith("/stop"));
+const stops = () => fixture.api.mock.calls.filter(([path]) => String(path).endsWith("/stop"));
+
+let host: HTMLDivElement;
+let view: Root;
+
+beforeEach(() => {
+ setLocale("en");
+ fixture.listeners.clear();
+ fixture.load.mockReset();
+ fixture.api.mockReset();
+ current = job([root(), handoff()]);
+ stop = () => ({ ok: true, outcome: "stopped" });
+ fixture.api.mockImplementation(async (path: string, init?: { method?: string; signal?: AbortSignal }) => {
+ if (path.endsWith("/stop")) return stop();
+ // A held read is answered when the job changes; a test changes it and answers by rendering again.
+ if (path.includes("wait=")) return new Promise((_, reject) => init?.signal?.addEventListener("abort", () => reject(new Error("aborted"))));
+ return current;
+ });
+ if (typeof globalThis.ResizeObserver === "undefined") {
+ vi.stubGlobal("ResizeObserver", class { observe() {} disconnect() {} unobserve() {} });
+ }
+ host = document.createElement("div");
+ document.body.append(host);
+ view = createRoot(host);
+});
+
+afterEach(() => {
+ flushSync(() => view.unmount());
+ document.body.replaceChildren();
+});
+
+const settle = async () => {
+ for (let i = 0; i < 4; i++) await new Promise((resolve) => setTimeout(resolve, 0));
+ flushSync(() => {});
+};
+const render = (shown: Bot = { ...pepper, busy: true }) => flushSync(() => view.render(createElement(HandoffExchangeHost, {
+ bot: shown, children: createElement("main", { "data-chat": "" }, createElement(BotExchangeLine), createElement("textarea")),
+})));
+const line = () => host.querySelector<HTMLButtonElement>("[data-bot-exchange]");
+const status = () => host.querySelector("[data-bot-exchange-status]");
+const stopButton = () => host.querySelector<HTMLButtonElement>("[data-bot-exchange-stop]");
+
+async function openExchange() {
+ render();
+ await settle();
+ flushSync(() => line()!.click());
+ await settle();
+}
+
+describe("the bot exchange line", () => {
+ it("reads the job from the person's latest message and holds the next read while the bots work", async () => {
+ render();
+ await settle();
+ expect(reads()[0]![0]).toBe("/api/threads/chat-1/job?since=5000");
+ expect(reads()[1]![0]).toBe("/api/threads/chat-1/job?since=5000&wait=25000&version=v1");
+ expect(line()!.textContent).toBe("PepperEngineer·working…");
+ expect(line()!.getAttribute("aria-label")).toBe("Open the exchange between Pepper and Engineer · working…");
+ expect(host.querySelector("[data-bot-exchange-line]")!.getAttribute("role")).toBe("status");
+ });
+
+ it.each([
+ [{ status: "queued" }, "asking…"],
+ [{ status: "needs_input" }, "needs you"],
+ [{ status: "completed", finishedAt: 52_000 }, "42s"],
+ [{ status: "cancelled", outcome: "stopped", finishedAt: 22_000 }, "stopped · 12s"],
+ [{ status: "failed", outcome: "expired", finishedAt: 70_000 }, "ran out of time · 1m"],
+ [{ status: "failed", outcome: "error", finishedAt: 13_000 }, "didn't finish · 3s"],
+ ] as const)("shows %o as %s", async (record, text) => {
+ current = job([root(), handoff(record)]);
+ render();
+ await settle();
+ expect(line()!.textContent).toBe(`PepperEngineer·${text}`);
+ });
+
+ it("goes quiet once the bots are done: one read, nothing held, and a compact row for the finished exchange", async () => {
+ current = job([{ ...root(), status: "completed" }, handoff({ status: "completed", finishedAt: 52_000 })]);
+ render({ ...pepper, busy: false });
+ await settle();
+ expect(reads()).toHaveLength(1);
+ expect(line()!.getAttribute("data-state")).toBe("answered");
+ });
+
+ it("shows nothing when no bot handed anything on", async () => {
+ current = job([root()]);
+ render();
+ await settle();
+ expect(host.querySelector("[data-bot-exchange-line]")).toBeNull();
+ });
+});
+
+describe("an opened exchange", () => {
+ const line1: Message = { id: "old", role: "bot", kind: "text", text: "An earlier request's answer", at: 8_000, parentId: null };
+ const ask: Message = { id: "ask", role: "user", kind: "text", text: "Count the rows", at: 9_500, parentId: "old", peerAsk: { botId: "pepper", name: "Pepper" } };
+ const reply: Message = { id: "reply", role: "bot", kind: "text", text: "There are 12 rows", at: 20_000, parentId: "ask" };
+ const later: Message = { id: "next", role: "user", kind: "text", text: "Now the totals", at: 31_000, parentId: "reply", peerAsk: { botId: "pepper", name: "Pepper" } };
+ const shown = () => Array.from(host.querySelectorAll("[data-side]")).map((row) => row.textContent);
+
+ it("shows only that exchange's lines of the helper's thread", async () => {
+ current = job([root(), handoff({ status: "completed", finishedAt: 30_000 })]);
+ fixture.load.mockResolvedValue({ messages: [line1, ask, reply, later], activeLeafId: "next" });
+ await openExchange();
+ expect(fixture.load).toHaveBeenCalledWith("work-1");
+ expect(shown()).toEqual(["PepperCount the rows", "EngineerThere are 12 rows"]);
+ expect(status()!.textContent).toBe("Engineer answered in 20s");
+ expect(stopButton()).toBeNull();
+ });
+
+ it("has Stop while the helper works, and shows the stop once the server has it", async () => {
+ fixture.load.mockResolvedValue({ messages: [line1, ask], activeLeafId: "ask" });
+ await openExchange();
+ expect(shown()).toEqual(["PepperCount the rows"]);
+ expect(status()!.textContent).toContain("Engineer is working on it…");
+ current = job([root(), handoff({ status: "cancelled", outcome: "stopped", finishedAt: 22_000 })], "v2");
+ flushSync(() => stopButton()!.click());
+ await settle();
+ expect(stops().map(([path, init]) => [path, init.method])).toEqual([["/api/threads/chat-1/job/h1/stop", "POST"]]);
+ expect(status()!.getAttribute("data-bot-exchange-status")).toBe("stopped");
+ expect(status()!.textContent).toBe("Stopped after 12s");
+ expect(stopButton()).toBeNull();
+ expect(host.querySelector("[role=alert]")).toBeNull();
+ });
+
+ it("takes an exchange that already ended as done, with no error", async () => {
+ fixture.load.mockResolvedValue({ messages: [ask], activeLeafId: "ask" });
+ await openExchange();
+ stop = () => ({ ok: true, outcome: "already-ended" });
+ current = job([root(), handoff({ status: "completed", finishedAt: 52_000 })], "v2");
+ flushSync(() => stopButton()!.click());
+ await settle();
+ expect(status()!.textContent).toBe("Engineer answered in 42s");
+ expect(host.querySelector("[role=alert]")).toBeNull();
+ });
+
+ it.each([
+ [403, "Only the person who asked can stop this."],
+ [404, "This exchange can't be stopped from here."],
+ [500, "Couldn't stop it. Check that you're online and try again."],
+ ])("says why a stop answered %i was refused, and keeps Stop to try again", async (code, text) => {
+ fixture.load.mockResolvedValue({ messages: [ask], activeLeafId: "ask" });
+ await openExchange();
+ stop = () => { throw new ApiError("refused", code, code === 403 ? { code: "stop_not_yours" } : {}); };
+ flushSync(() => stopButton()!.click());
+ await settle();
+ expect(host.querySelector("[role=alert]")!.textContent).toBe(text);
+ expect(stopButton()!.disabled).toBe(false);
+ });
+});
diff --git a/src/components/BotExchangeLine.tsx b/src/components/BotExchangeLine.tsx
new file mode 100644
index 0000000000..1f6af438b2
--- /dev/null
+++ b/src/components/BotExchangeLine.tsx
@@ -0,0 +1,126 @@
+// The bots' exchanges for the person's request: a line over the message box while they work, a compact row once done.
+import { use, useState } from "react";
+import { ArrowLeftRight, Square } from "lucide-react";
+import { BotAvatar, InitialsAvatar } from "./Avatar";
+import { ELEVATED_FLOAT, ELEVATED_TINT } from "./elevated";
+import { OpenExchangeContext } from "./HandoffExchange";
+import { exchangeEnded, exchangeWindow, type BotExchangeEntry } from "@/lib/bot-exchanges";
+import { cn } from "@/lib/cn";
+import { t } from "@/lib/i18n";
+import { BotExchangesContext } from "@/lib/use-bot-exchanges";
+import { formatDuration } from "@/lib/usage-trace";
+import { ApiError } from "@/state/api";
+import type { Bot } from "@/state/store";
+import { useStoreSelector } from "@/state/store-select";
+
+const took = (entry: BotExchangeEntry, now = Date.now()) =>
+ formatDuration(Math.max(1, Math.round(((entry.finishedAt ?? now) - entry.createdAt) / 1_000)) * 1_000);
+
+function lineState(entry: BotExchangeEntry): string {
+ switch (entry.state) {
+ case "asking": return t("chat.botExchange.asking");
+ case "working": return t("chat.botExchange.working");
+ case "needs-you": return t("chat.botExchange.needsYou");
+ case "answered": return took(entry);
+ case "stopped": return `${t("chat.botExchange.stopped")} · ${took(entry)}`;
+ case "expired": return `${t("chat.botExchange.expired")} · ${took(entry)}`;
+ case "failed": return `${t("chat.botExchange.failed")} · ${took(entry)}`;
+ }
+}
+
+export function BotExchangeLine() {
+ const { exchanges } = use(BotExchangesContext);
+ const open = use(OpenExchangeContext);
+ const bots = useStoreSelector((state) => state.bots);
+ if (!open || !exchanges.length) return null;
+ const botOf = (id: string | undefined) => id ? bots.find((candidate) => candidate.id === id) : undefined;
+ return (
+ <div role="status" data-bot-exchange-line className="pointer-events-none mx-5 mb-2 flex flex-wrap justify-center gap-2">
+ {exchanges.map((entry) => {
+ const asker = botOf(entry.asker.botId), helper = botOf(entry.helper.botId);
+ const label = t("chat.botExchange.open", { asker: entry.asker.name, helper: entry.helper.name });
+ const state = lineState(entry);
+ return (
+ <button
+ key={entry.id}
+ type="button"
+ data-bot-exchange={entry.id}
+ data-state={entry.state}
+ aria-label={`${label} · ${state}`}
+ title={`${entry.asker.name} ⇄ ${entry.helper.name} · ${state}`}
+ onClick={() => open({
+ id: entry.id, threadId: entry.threadId, window: exchangeWindow(entry),
+ asker: { botId: entry.asker.botId ?? "", name: entry.asker.name, color: asker?.color },
+ helper: { botId: entry.helper.botId, name: entry.helper.name, color: helper?.color },
+ })}
+ className={cn("pointer-events-auto flex h-8 min-w-0 max-w-full items-center gap-1.5 rounded-full ps-1.5 pe-3 text-[13px] leading-[18px]",
+ ELEVATED_FLOAT, ELEVATED_TINT, exchangeEnded(entry.state) ? "text-ink-secondary" : "text-ink")}
+ >
+ <Face bot={asker} name={entry.asker.name} />
+ <span dir="auto" className="min-w-0 max-w-[160px] truncate font-medium">{entry.asker.name}</span>
+ <ArrowLeftRight size={14} aria-hidden="true" className="shrink-0 text-ink-tertiary" />
+ <Face bot={helper} name={entry.helper.name} />
+ <span dir="auto" className="min-w-0 max-w-[160px] truncate font-medium">{entry.helper.name}</span>
+ <span aria-hidden="true" className="shrink-0 text-ink-tertiary">·</span>
+ <span className={cn("shrink-0 tabular-nums", entry.state === "needs-you" ? "font-medium text-ink" : "text-ink-secondary")}>{state}</span>
+ </button>
+ );
+ })}
+ </div>
+ );
+}
+
+function Face({ bot, name }: { bot: Bot | undefined; name: string }) {
+ if (bot) return <BotAvatar bot={bot} state="happy" size={20} animated={false} />;
+ return <InitialsAvatar initials={name.slice(0, 1).toUpperCase()} size={20} />;
+}
+
+function statusText(entry: BotExchangeEntry): string {
+ const names = { asker: entry.asker.name, helper: entry.helper.name };
+ switch (entry.state) {
+ case "asking": return t("chat.botExchange.status.asking", names);
+ case "working": return t("chat.botExchange.status.working", names);
+ case "needs-you": return t("chat.botExchange.status.needsYou", names);
+ case "answered": return t("chat.botExchange.status.answered", { ...names, duration: took(entry) });
+ case "stopped": return t("chat.botExchange.status.stopped", { duration: took(entry) });
+ case "expired": return t("chat.botExchange.status.expired", { duration: took(entry) });
+ case "failed": return t("chat.botExchange.status.failed", names);
+ }
+}
+
+/** Under an opened exchange: how it stands, and Stop while the helper still works on it. */
+export function BotExchangeStatus({ id }: { id: string }) {
+ const { exchanges, stop } = use(BotExchangesContext);
+ const [stopping, setStopping] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const entry = exchanges.find((candidate) => candidate.id === id);
+ if (!entry) return null;
+ const stoppable = !exchangeEnded(entry.state);
+ const stopNow = async () => {
+ setStopping(true);
+ setError(null);
+ try {
+ await stop(entry.id);
+ } catch (failure) {
+ const status = failure instanceof ApiError ? failure.status : 0;
+ setError(status === 403 ? t("chat.botExchange.notYours") : status === 404 ? t("chat.botExchange.gone") : t("chat.botExchange.stopFailed"));
+ } finally {
+ setStopping(false);
+ }
+ };
+ return (
+ <div data-bot-exchange-status={entry.state} className="chat-column mx-auto flex w-full items-center gap-3 px-4 pb-4 pt-2">
+ <div className="min-w-0 flex-1">
+ <p role="status" dir="auto" className="truncate text-[13px] leading-[18px] text-ink-secondary" title={statusText(entry)}>{statusText(entry)}</p>
+ {error && <p role="alert" className="text-[12px] leading-4 text-danger">{error}</p>}
+ </div>
+ {stoppable && (
+ <button type="button" data-bot-exchange-stop onClick={stopNow} disabled={stopping}
+ className="ui-button ui-button-pill shrink-0">
+ <Square size={12} aria-hidden="true" className="fill-current" />
+ {stopping ? t("chat.botExchange.stopping") : t("chat.stop")}
+ </button>
+ )}
+ </div>
+ );
+}
diff --git a/src/components/ChatView.tsx b/src/components/ChatView.tsx
index a35aed55c0..97c098bba7 100644
--- a/src/components/ChatView.tsx
+++ b/src/components/ChatView.tsx
@@ -95,6 +95,7 @@ import { CitationSelectionToolbar, SentCitations } from "./CitationUI";
import { SpeakButton, speakReady } from "./SpeakButton";
import { CallOverlay } from "./CallView";
import { LiveCallBar } from "./LiveCallBar";
+import { BotExchangeLine } from "./BotExchangeLine";
import { LiveCallChip } from "./LiveCallPill";
import { effectivePlace, type EffectivePlace } from "@/lib/place";
import { cn } from "@/lib/cn";
@@ -1171,6 +1172,7 @@ export const ChatView = memo(function ChatView({ bot: profile, inForkPanel = fal
<JumpToLatestButton onClick={jumpToLatest} className="pointer-events-auto bottom-2" />
</div>
)}
+ <BotExchangeLine />
<LiveCallBar bot={bot} />
{canWrite === false ? (
<NewConversationInstead bot={bot} onNew={() => dispatch({ type: "newTask", botId: bot.id })} />
diff --git a/src/components/HandoffExchange.dom.test.ts b/src/components/HandoffExchange.dom.test.ts
index ce90b615ce..864709a7d9 100644
--- a/src/components/HandoffExchange.dom.test.ts
+++ b/src/components/HandoffExchange.dom.test.ts
@@ -30,6 +30,9 @@ vi.mock("@/state/store-select", async (importOriginal) => ({
...await importOriginal<typeof import("@/state/store-select")>(),
useStoreSelector: (select: (state: unknown) => unknown) => select({ bots: [maestro, helper] }),
}));
+vi.mock("@/state/api", async (importOriginal) => ({
+ ...await importOriginal<typeof import("@/state/api")>(), api: async () => ({ since: 0, version: "v1", nodes: [], needsInput: [] }),
+}));
vi.mock("@/state/message-history", async (importOriginal) => ({
...await importOriginal<typeof import("@/state/message-history")>(), loadFullThread: fixture.load,
}));
diff --git a/src/components/HandoffExchange.tsx b/src/components/HandoffExchange.tsx
index 918a8b6932..75dd61b258 100644
--- a/src/components/HandoffExchange.tsx
+++ b/src/components/HandoffExchange.tsx
@@ -1,7 +1,8 @@
// A teammate's hand-off, read in place of the asker's chat: the two bots' exchange, live, with no message box.
-import { createContext, Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, type ReactNode } from "react";
+import { createContext, Fragment, use, useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, type ReactNode } from "react";
import { ArrowLeftRight, ChevronLeft } from "lucide-react";
import { BotAvatar, InitialsAvatar } from "./Avatar";
+import { BotExchangeStatus } from "./BotExchangeLine";
import { ChatMarkdown } from "./ChatMarkdown";
import { DaySeparator } from "./DaySeparator";
import { ClusterLabel } from "./RoomClusterLabel";
@@ -9,11 +10,13 @@ import { ChatBackdrop, GlassBar, GlassScrollFrame } from "./GlassScrollFrame";
import { ELEVATED_FLOAT, ELEVATED_HOVER, ELEVATED_TINT } from "./elevated";
import { joinedCorners, SIMPLE_BOT_BUBBLE, SIMPLE_BUBBLE_MAX, SIMPLE_STACKED, SIMPLE_USER_BUBBLE } from "./chat-bubble";
import { useCaptionChrome } from "@/components/DesktopCapabilities";
+import { exchangeWindow, inWindow, type ExchangeWindow } from "@/lib/bot-exchanges";
import { cn } from "@/lib/cn";
import { conversationRows, handoffTranscript, LOADING_TRANSCRIPT, type ConversationRow, type ConversationSpeaker } from "@/lib/handoff-conversation";
import { intlLocale, t } from "@/lib/i18n";
import { listenLiveFrames } from "@/lib/live-events";
import { localDay } from "@/lib/transcript-derivations";
+import { BotExchangesContext, latestPersonTurn, useBotExchanges } from "@/lib/use-bot-exchanges";
import { loadFullThread } from "@/state/message-history";
import type { Bot, Message } from "@/state/store";
import { useStoreSelector } from "@/state/store-select";
@@ -25,6 +28,9 @@ export interface HandoffExchange {
helper: Named;
/** The helper's work thread the hand-off went to. */
threadId: string;
+ /** The hand-off, when the view is for one exchange: its lines are those in `window`, and it can be stopped. */
+ id?: string;
+ window?: ExchangeWindow;
}
/** Opens a hand-off's exchange in place of the chat it is in. Null where no chat column hosts one (a room, the side
@@ -39,11 +45,17 @@ export function HandoffExchangeHost({ bot, children }: { bot: Bot; children: Rea
if (open && open.chat !== chat) setOpen(null);
const openExchange = useCallback((exchange: HandoffExchange) => setOpen({ chat, exchange }), [chat]);
const exchange = open?.chat === chat ? open.exchange : null;
- if (exchange) return <HandoffExchangeView key={exchange.threadId} exchange={exchange} onBack={() => setOpen(null)} />;
- return <OpenExchangeContext value={openExchange}>{children}</OpenExchangeContext>;
+ const since = useMemo(() => latestPersonTurn(bot.messages), [bot.messages]);
+ const exchanges = useBotExchanges(bot.threadId, since, Boolean(bot.busy || bot.waitingForTeammates));
+ return (
+ <BotExchangesContext value={exchanges}>
+ {exchange ? <HandoffExchangeView key={exchange.id ?? exchange.threadId} exchange={exchange} onBack={() => setOpen(null)} />
+ : <OpenExchangeContext value={openExchange}>{children}</OpenExchangeContext>}
+ </BotExchangesContext>
+ );
}
-export function HandoffExchangeView({ exchange: { asker, helper, threadId }, onBack }: { exchange: HandoffExchange; onBack: () => void }) {
+export function HandoffExchangeView({ exchange: { asker, helper, threadId, id, window: opened }, onBack }: { exchange: HandoffExchange; onBack: () => void }) {
const [transcript, dispatch] = useReducer(handoffTranscript, LOADING_TRANSCRIPT);
const [load, setLoad] = useState(0);
const reload = () => {
@@ -73,9 +85,11 @@ export function HandoffExchangeView({ exchange: { asker, helper, threadId }, onB
onMissedFrames: reload,
}), [threadId]);
+ const entry = use(BotExchangesContext).exchanges.find((candidate) => candidate.id === id);
+ const slice = entry ? exchangeWindow(entry) : opened;
const you = t("chat.you");
- const rows = useMemo(() => conversationRows(transcript, asker, helper, you),
- [transcript, asker.botId, asker.name, asker.color, helper.botId, helper.name, helper.color, you]);
+ const rows = useMemo(() => conversationRows(transcript, asker, helper, you).filter((row) => !slice || inWindow(row.at, slice)),
+ [transcript, asker.botId, asker.name, asker.color, helper.botId, helper.name, helper.color, you, slice?.from, slice?.to]);
// The newest line stays in sight as lines come in, unless the person scrolled up to read.
const listRef = useRef<HTMLDivElement>(null);
const atEnd = useRef(true);
@@ -186,6 +200,7 @@ export function HandoffExchangeView({ exchange: { asker, helper, threadId }, onB
)}
</div>
</div>
+ {id && <GlassBar edge="bottom" fade={!remoteClient} className="z-[25]"><BotExchangeStatus id={id} /></GlassBar>}
</GlassScrollFrame>
</main>
);
diff --git a/src/lib/bot-exchanges.test.ts b/src/lib/bot-exchanges.test.ts
new file mode 100644
index 0000000000..98e5eb88b2
--- /dev/null
+++ b/src/lib/bot-exchanges.test.ts
@@ -0,0 +1,68 @@
+import { describe, expect, it } from "vitest";
+import { exchangesOf, exchangeState, exchangeWindow, inWindow, type JobNodeRead, type JobRead } from "./bot-exchanges";
+
+const node = (id: string, extra: Partial<JobNodeRead> = {}): JobNodeRead => ({
+ id, botId: "maestro", botName: "Maestro", threadId: "chat", status: "running", reply: "required", createdAt: 1_000, ...extra,
+});
+const job = (nodes: JobNodeRead[], needsInput: string[] = []): JobRead =>
+ ({ since: 0, version: "v1", nodes, needsInput: needsInput.map((id) => ({ id })) });
+
+describe("an exchange's state", () => {
+ it.each([
+ [{ status: "queued" }, false, "asking"],
+ [{ status: "running" }, false, "working"],
+ [{ status: "waiting" }, false, "working"],
+ [{ status: "resume" }, false, "working"],
+ [{ status: "needs_input" }, false, "needs-you"],
+ [{ status: "running" }, true, "needs-you"],
+ [{ status: "completed", outcome: "done" }, false, "answered"],
+ [{ status: "cancelled", outcome: "stopped" }, false, "stopped"],
+ [{ status: "failed", outcome: "expired" }, false, "expired"],
+ [{ status: "cancelled", outcome: "expired" }, false, "expired"],
+ [{ status: "failed", outcome: "error" }, false, "failed"],
+ [{ status: "cancelled" }, false, "failed"],
+ ] as const)("%o (asking the person: %s) is %s", (record, needsYou, state) => {
+ expect(exchangeState(record, needsYou)).toBe(state);
+ });
+});
+
+describe("the exchanges in a job", () => {
+ const root = node("root");
+ it("are hand-offs from one bot to another, with the asker taken from the parent, open ones first", () => {
+ const done = node("a", { parentId: "root", botId: "pessoal", botName: "Pessoal", threadId: "work", status: "completed", createdAt: 1_100, finishedAt: 1_900 });
+ const deeper = node("b", { parentId: "a", botId: "research", botName: "Research", threadId: "work-2", createdAt: 1_200 });
+ expect(exchangesOf(job([root, done, deeper], ["b"]), "A teammate")).toEqual([
+ { id: "b", asker: { botId: "pessoal", name: "Pessoal" }, helper: { botId: "research", name: "Research" }, threadId: "work-2",
+ state: "needs-you", live: true, createdAt: 1_200 },
+ { id: "a", asker: { botId: "maestro", name: "Maestro" }, helper: { botId: "pessoal", name: "Pessoal" }, threadId: "work",
+ state: "answered", live: false, createdAt: 1_100, finishedAt: 1_900 },
+ ]);
+ });
+
+ it("leave out a bot's thread on itself, room work and the conversation's own turn", () => {
+ const own = node("self", { parentId: "root", threadId: "side" });
+ const room = node("room", { parentId: "root", botId: "pessoal", groupId: "g1" });
+ expect(exchangesOf(job([root, own, room]), "A teammate")).toEqual([]);
+ });
+
+ it("name the asker a teammate when its row is hidden from the reader", () => {
+ const [entry] = exchangesOf(job([node("a", { parentId: "unseen", botId: "pessoal", botName: "Pessoal" })]), "A teammate");
+ expect(entry!.asker).toEqual({ name: "A teammate" });
+ });
+
+ it("do not keep the line alive for a notice that waits for no answer", () => {
+ const [entry] = exchangesOf(job([root, node("n", { parentId: "root", botId: "pessoal", reply: "none" })]), "A teammate");
+ expect(entry).toMatchObject({ state: "working", live: false });
+ });
+});
+
+describe("an exchange's lines in the helper's thread", () => {
+ it("start just before the hand-off and end when it ended", () => {
+ const window = exchangeWindow({ createdAt: 10_000, finishedAt: 20_000 });
+ expect([8_999, 9_000, 15_000, 20_000, 20_001].map((at) => inWindow(at, window))).toEqual([false, true, true, true, false]);
+ });
+
+ it("run on while it is open", () => {
+ expect(inWindow(90_000, exchangeWindow({ createdAt: 10_000 }))).toBe(true);
+ });
+});
diff --git a/src/lib/bot-exchanges.ts b/src/lib/bot-exchanges.ts
new file mode 100644
index 0000000000..85a30fbe04
--- /dev/null
+++ b/src/lib/bot-exchanges.ts
@@ -0,0 +1,92 @@
+// The bots' exchanges under the person's latest request, read from the conversation's job.
+type Status = "queued" | "running" | "needs_input" | "waiting" | "resume" | "completed" | "failed" | "cancelled";
+
+/** The fields of `GET /api/threads/:id/job` the line reads. */
+export interface JobNodeRead {
+ id: string;
+ parentId?: string;
+ botId: string;
+ botName: string;
+ threadId: string;
+ groupId?: string;
+ status: Status;
+ outcome?: string;
+ reply: "required" | "optional" | "none";
+ createdAt: number;
+ finishedAt?: number;
+}
+
+export interface JobRead {
+ since: number;
+ version: string;
+ nodes: JobNodeRead[];
+ needsInput: Array<{ id: string }>;
+}
+
+export type ExchangeState = "asking" | "working" | "needs-you" | "answered" | "stopped" | "expired" | "failed";
+
+export interface BotExchangeEntry {
+ /** The hand-off's assignment: what Stop names. */
+ id: string;
+ /** No bot id: the asker works in a conversation the reader may not open. */
+ asker: { botId?: string; name: string };
+ helper: { botId: string; name: string };
+ threadId: string;
+ state: ExchangeState;
+ /** Still working on an answer someone waits for. */
+ live: boolean;
+ createdAt: number;
+ finishedAt?: number;
+}
+
+export const exchangeEnded = (state: ExchangeState): boolean =>
+ state === "answered" || state === "stopped" || state === "expired" || state === "failed";
+
+export function exchangeState(node: Pick<JobNodeRead, "status" | "outcome">, needsYou: boolean): ExchangeState {
+ switch (node.status) {
+ case "queued": return "asking";
+ case "needs_input": return "needs-you";
+ case "running": return needsYou ? "needs-you" : "working";
+ case "waiting":
+ case "resume": return "working";
+ case "completed": return "answered";
+ case "failed":
+ case "cancelled": return node.outcome === "expired" ? "expired" : node.outcome === "stopped" ? "stopped" : "failed";
+ }
+}
+
+/** One per hand-off from one bot to another; a bot's own threads and room work are not exchanges. Open ones first. */
+export function exchangesOf(job: JobRead, teammate: string): BotExchangeEntry[] {
+ const byId = new Map(job.nodes.map((node) => [node.id, node]));
+ const needsYou = new Set(job.needsInput.map((row) => row.id));
+ const entries: BotExchangeEntry[] = [];
+ for (const node of job.nodes) {
+ if (!node.parentId || node.groupId) continue;
+ const parent = byId.get(node.parentId);
+ if (parent?.botId === node.botId) continue;
+ const state = exchangeState(node, needsYou.has(node.id));
+ entries.push({
+ id: node.id,
+ asker: parent ? { botId: parent.botId, name: parent.botName } : { name: teammate },
+ helper: { botId: node.botId, name: node.botName },
+ threadId: node.threadId,
+ state,
+ live: !exchangeEnded(state) && node.reply !== "none",
+ createdAt: node.createdAt,
+ ...(node.finishedAt !== undefined ? { finishedAt: node.finishedAt } : {}),
+ });
+ }
+ return entries.sort((a, b) => Number(b.live) - Number(a.live) || a.createdAt - b.createdAt);
+}
+
+/** The asker's request can be stamped a moment before the hand-off's record in the helper's thread. */
+const REQUEST_LEAD_MS = 1_000;
+
+/** Where one exchange sits in the helper's thread, which can hold several. */
+export interface ExchangeWindow { from: number; to?: number }
+
+export const exchangeWindow = (entry: Pick<BotExchangeEntry, "createdAt" | "finishedAt">): ExchangeWindow =>
+ ({ from: entry.createdAt - REQUEST_LEAD_MS, ...(entry.finishedAt !== undefined ? { to: entry.finishedAt } : {}) });
+
+export const inWindow = (at: number, window: ExchangeWindow): boolean =>
+ at >= window.from && (window.to === undefined || at <= window.to);
diff --git a/src/lib/use-bot-exchanges.ts b/src/lib/use-bot-exchanges.ts
new file mode 100644
index 0000000000..f271690152
--- /dev/null
+++ b/src/lib/use-bot-exchanges.ts
@@ -0,0 +1,78 @@
+// Keeps the open conversation's bot exchanges current: one read, then held reads while work goes on.
+import { createContext, useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { personWrote } from "../../shared/person-wait";
+import { api } from "@/state/api";
+import type { Message } from "@/state/store";
+import { exchangesOf, type BotExchangeEntry, type JobRead } from "./bot-exchanges";
+import { t } from "./i18n";
+
+/** The server holds a read at most this long (`JOB_WAIT_MAX_MS`). */
+const HOLD_MS = 25_000;
+const RETRY_MS = [2_000, 5_000, 15_000];
+
+export interface BotExchanges {
+ exchanges: BotExchangeEntry[];
+ /** Stops one hand-off (`POST /api/threads/:threadId/job/:assignmentId/stop`); an `ApiError` carries a refusal. */
+ stop(id: string): Promise<void>;
+}
+
+export const BotExchangesContext = createContext<BotExchanges>({ exchanges: [], stop: async () => {} });
+
+/** When the person last wrote in this conversation: the job read starts there. */
+export function latestPersonTurn(messages: readonly Message[]): number | undefined {
+ return messages.findLast((message) => personWrote(message) && !message.id.startsWith("optimistic-"))?.at;
+}
+
+export function useBotExchanges(threadId: string | undefined, since: number | undefined, working: boolean): BotExchanges {
+ const key = threadId ? `${threadId}:${since ?? ""}` : "";
+ const [read, setRead] = useState<{ key: string; job: JobRead } | null>(null);
+ const latest = useRef(read);
+ latest.current = read;
+ const [asked, setAsked] = useState(0);
+ const stop = useCallback(async (id: string) => {
+ if (!threadId) return;
+ try {
+ await api(`/api/threads/${encodeURIComponent(threadId)}/job/${encodeURIComponent(id)}/stop`, { method: "POST" });
+ } finally {
+ setAsked((count) => count + 1);
+ }
+ }, [threadId]);
+
+ useEffect(() => {
+ if (!threadId) return;
+ const abort = new AbortController();
+ const base = `/api/threads/${encodeURIComponent(threadId)}/job${since === undefined ? "" : `?since=${since}`}`;
+ const join = since === undefined ? "?" : "&";
+ void (async () => {
+ let failures = 0;
+ for (let first = true; !abort.signal.aborted; first = false) {
+ const known = latest.current?.key === key ? latest.current.job : null;
+ const open = Boolean(known && exchangesOf(known, "").some((entry) => entry.live));
+ const hold = !first && known !== null && (working || open);
+ if (!first && !hold && failures === 0) return;
+ const path = hold ? `${base}${join}wait=${HOLD_MS}&version=${encodeURIComponent(known!.version)}` : base;
+ try {
+ const job = await api<JobRead>(path, { signal: abort.signal, background: true, timeoutMs: HOLD_MS + 10_000 });
+ if (abort.signal.aborted) return;
+ failures = 0;
+ if (Array.isArray(job?.nodes)) setRead({ key, job });
+ latest.current = Array.isArray(job?.nodes) ? { key, job } : latest.current;
+ } catch {
+ if (abort.signal.aborted || failures >= RETRY_MS.length) return;
+ await pause(RETRY_MS[failures++]!, abort.signal);
+ }
+ }
+ })();
+ return () => abort.abort();
+ }, [key, working, asked]);
+
+ const teammate = t("chat.botExchange.teammate");
+ const job = read?.key === key ? read.job : null;
+ const exchanges = useMemo(() => job ? exchangesOf(job, teammate) : [], [job, teammate]);
+ return useMemo(() => ({ exchanges, stop }), [exchanges, stop]);
+}
+
+const pause = (ms: number, signal: AbortSignal) => new Promise<void>((resolve) => {
+ const timer = setTimeout(resolve, ms);
+ signal.addEventListener("abort", () => { clearTimeout(timer); resolve(); }, { once: true });
+});
diff --git a/src/locales/de.json b/src/locales/de.json
index 90b620631a..1081113531 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -4218,6 +4218,25 @@
"chat.handoffExchange.loading": "Unterhaltung wird geladen…",
"chat.handoffExchange.failed": "Die Unterhaltung konnte nicht geladen werden.",
"chat.handoffExchange.empty": "Noch keine Nachrichten.",
+ "chat.botExchange.open": "Austausch zwischen {asker} und {helper} öffnen",
+ "chat.botExchange.teammate": "Ein Teammitglied",
+ "chat.botExchange.asking": "fragt…",
+ "chat.botExchange.working": "arbeitet…",
+ "chat.botExchange.needsYou": "braucht dich",
+ "chat.botExchange.stopped": "gestoppt",
+ "chat.botExchange.expired": "Zeit abgelaufen",
+ "chat.botExchange.failed": "nicht fertig geworden",
+ "chat.botExchange.status.asking": "{asker} fragt {helper}…",
+ "chat.botExchange.status.working": "{helper} arbeitet daran…",
+ "chat.botExchange.status.needsYou": "{helper} wartet in seinem Gespräch auf deine Antwort",
+ "chat.botExchange.status.answered": "{helper} hat in {duration} geantwortet",
+ "chat.botExchange.status.stopped": "Nach {duration} gestoppt",
+ "chat.botExchange.status.expired": "Zeit nach {duration} abgelaufen",
+ "chat.botExchange.status.failed": "{helper} konnte nicht fertig werden",
+ "chat.botExchange.stopping": "Wird gestoppt…",
+ "chat.botExchange.notYours": "Nur die Person, die gefragt hat, kann das stoppen.",
+ "chat.botExchange.gone": "Dieser Austausch kann hier nicht gestoppt werden.",
+ "chat.botExchange.stopFailed": "Stoppen nicht möglich. Prüfe deine Verbindung und versuche es erneut.",
"keys.vps.servers.title": "Benannte Server",
"keys.vps.servers.hint": "Füge weitere Server mit Namen hinzu. Jeder Bot kann dann in seinen eigenen Computer-Einstellungen einen davon wählen; der Alias oben bleibt der Standard.",
"keys.vps.servers.name": "Servername",
diff --git a/src/locales/en.json b/src/locales/en.json
index 6ec1213444..2b95b7193a 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -11675,6 +11675,25 @@
"chat.handoffExchange.loading": "Loading the conversation…",
"chat.handoffExchange.failed": "Couldn't load the conversation.",
"chat.handoffExchange.empty": "No messages yet.",
+ "chat.botExchange.open": "Open the exchange between {asker} and {helper}",
+ "chat.botExchange.teammate": "A teammate",
+ "chat.botExchange.asking": "asking…",
+ "chat.botExchange.working": "working…",
+ "chat.botExchange.needsYou": "needs you",
+ "chat.botExchange.stopped": "stopped",
+ "chat.botExchange.expired": "ran out of time",
+ "chat.botExchange.failed": "didn't finish",
+ "chat.botExchange.status.asking": "{asker} is asking {helper}…",
+ "chat.botExchange.status.working": "{helper} is working on it…",
+ "chat.botExchange.status.needsYou": "{helper} is waiting for your answer in its conversation",
+ "chat.botExchange.status.answered": "{helper} answered in {duration}",
+ "chat.botExchange.status.stopped": "Stopped after {duration}",
+ "chat.botExchange.status.expired": "Ran out of time after {duration}",
+ "chat.botExchange.status.failed": "{helper} couldn't finish",
+ "chat.botExchange.stopping": "Stopping…",
+ "chat.botExchange.notYours": "Only the person who asked can stop this.",
+ "chat.botExchange.gone": "This exchange can't be stopped from here.",
+ "chat.botExchange.stopFailed": "Couldn't stop it. Check that you're online and try again.",
"sidebar.threads.hidden": "Thread hidden",
"sidebar.threads.hide": "Hide {title}",
"sidebar.threads.hideShort": "Hide",
diff --git a/src/locales/es.json b/src/locales/es.json
index e79cb3e695..89a2b77966 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -6567,5 +6567,24 @@
"skillBurger.run.pathUndone": "Camino quitado",
"skillBurger.run.addPathFailed": "No se pudo hacer. Inténtalo de nuevo.",
"activity.tool.team.runWorkflow": "Ejecutar Skill Burger",
- "activity.tool.team.workflowEdit": "Cambiar Skill Burger"
+ "activity.tool.team.workflowEdit": "Cambiar Skill Burger",
+ "chat.botExchange.open": "Abrir el intercambio entre {asker} y {helper}",
+ "chat.botExchange.teammate": "Un compañero",
+ "chat.botExchange.asking": "preguntando…",
+ "chat.botExchange.working": "trabajando…",
+ "chat.botExchange.needsYou": "te necesita",
+ "chat.botExchange.stopped": "detenido",
+ "chat.botExchange.expired": "se acabó el tiempo",
+ "chat.botExchange.failed": "no terminó",
+ "chat.botExchange.status.asking": "{asker} le está pidiendo a {helper}…",
+ "chat.botExchange.status.working": "{helper} está trabajando en ello…",
+ "chat.botExchange.status.needsYou": "{helper} espera tu respuesta en su conversación",
+ "chat.botExchange.status.answered": "{helper} respondió en {duration}",
+ "chat.botExchange.status.stopped": "Detenido tras {duration}",
+ "chat.botExchange.status.expired": "Se acabó el tiempo tras {duration}",
+ "chat.botExchange.status.failed": "{helper} no pudo terminar",
+ "chat.botExchange.stopping": "Deteniendo…",
+ "chat.botExchange.notYours": "Solo quien lo pidió puede detenerlo.",
+ "chat.botExchange.gone": "Este intercambio no se puede detener desde aquí.",
+ "chat.botExchange.stopFailed": "No se pudo detener. Comprueba tu conexión e inténtalo de nuevo."
}
diff --git a/src/locales/fr.json b/src/locales/fr.json
index ff7d1a6628..348e654e46 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -3972,5 +3972,24 @@
"skillBurger.run.pathUndone": "Chemin retiré",
"skillBurger.run.addPathFailed": "Impossible de le faire. Réessayez.",
"activity.tool.team.runWorkflow": "Exécuter le Skill Burger",
- "activity.tool.team.workflowEdit": "Modifier le Skill Burger"
+ "activity.tool.team.workflowEdit": "Modifier le Skill Burger",
+ "chat.botExchange.open": "Ouvrir l’échange entre {asker} et {helper}",
+ "chat.botExchange.teammate": "Un coéquipier",
+ "chat.botExchange.asking": "demande…",
+ "chat.botExchange.working": "travaille…",
+ "chat.botExchange.needsYou": "a besoin de vous",
+ "chat.botExchange.stopped": "arrêté",
+ "chat.botExchange.expired": "temps écoulé",
+ "chat.botExchange.failed": "n’a pas terminé",
+ "chat.botExchange.status.asking": "{asker} demande à {helper}…",
+ "chat.botExchange.status.working": "{helper} y travaille…",
+ "chat.botExchange.status.needsYou": "{helper} attend votre réponse dans sa conversation",
+ "chat.botExchange.status.answered": "{helper} a répondu en {duration}",
+ "chat.botExchange.status.stopped": "Arrêté après {duration}",
+ "chat.botExchange.status.expired": "Temps écoulé après {duration}",
+ "chat.botExchange.status.failed": "{helper} n’a pas pu terminer",
+ "chat.botExchange.stopping": "Arrêt…",
+ "chat.botExchange.notYours": "Seule la personne qui a demandé peut l’arrêter.",
+ "chat.botExchange.gone": "Cet échange ne peut pas être arrêté d’ici.",
+ "chat.botExchange.stopFailed": "Impossible d’arrêter. Vérifiez votre connexion et réessayez."
}
diff --git a/src/locales/hi.json b/src/locales/hi.json
index c6c640445d..654f8ed1e9 100644
--- a/src/locales/hi.json
+++ b/src/locales/hi.json
@@ -3824,5 +3824,24 @@
"skillBurger.run.pathUndone": "रास्ता हटाया गया",
"skillBurger.run.addPathFailed": "यह नहीं हो सका। फिर कोशिश करें।",
"activity.tool.team.runWorkflow": "Skill Burger चलाएँ",
- "activity.tool.team.workflowEdit": "Skill Burger बदलें"
+ "activity.tool.team.workflowEdit": "Skill Burger बदलें",
+ "chat.botExchange.open": "{asker} और {helper} की बातचीत खोलें",
+ "chat.botExchange.teammate": "एक साथी",
+ "chat.botExchange.asking": "पूछ रहा है…",
+ "chat.botExchange.working": "काम कर रहा है…",
+ "chat.botExchange.needsYou": "आपकी ज़रूरत है",
+ "chat.botExchange.stopped": "रोका गया",
+ "chat.botExchange.expired": "समय खत्म",
+ "chat.botExchange.failed": "पूरा नहीं हुआ",
+ "chat.botExchange.status.asking": "{asker}, {helper} से पूछ रहा है…",
+ "chat.botExchange.status.working": "{helper} इस पर काम कर रहा है…",
+ "chat.botExchange.status.needsYou": "{helper} अपनी बातचीत में आपके जवाब का इंतज़ार कर रहा है",
+ "chat.botExchange.status.answered": "{helper} ने {duration} में जवाब दिया",
+ "chat.botExchange.status.stopped": "{duration} बाद रोका गया",
+ "chat.botExchange.status.expired": "{duration} बाद समय खत्म",
+ "chat.botExchange.status.failed": "{helper} पूरा नहीं कर सका",
+ "chat.botExchange.stopping": "रोका जा रहा है…",
+ "chat.botExchange.notYours": "इसे सिर्फ़ पूछने वाला व्यक्ति रोक सकता है।",
+ "chat.botExchange.gone": "इस बातचीत को यहाँ से रोका नहीं जा सकता।",
+ "chat.botExchange.stopFailed": "रोका नहीं जा सका। अपना कनेक्शन जाँचें और फिर से कोशिश करें।"
}
diff --git a/src/locales/it.json b/src/locales/it.json
index 750494dbd0..81cf6e9b3e 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -11456,5 +11456,24 @@
"skillBurger.run.pathUndone": "Percorso rimosso",
"skillBurger.run.addPathFailed": "Non è stato possibile. Riprova.",
"activity.tool.team.runWorkflow": "Esegui Skill Burger",
- "activity.tool.team.workflowEdit": "Modifica Skill Burger"
+ "activity.tool.team.workflowEdit": "Modifica Skill Burger",
+ "chat.botExchange.open": "Apri lo scambio tra {asker} e {helper}",
+ "chat.botExchange.teammate": "Un collega",
+ "chat.botExchange.asking": "sta chiedendo…",
+ "chat.botExchange.working": "al lavoro…",
+ "chat.botExchange.needsYou": "ha bisogno di te",
+ "chat.botExchange.stopped": "fermato",
+ "chat.botExchange.expired": "tempo scaduto",
+ "chat.botExchange.failed": "non ha finito",
+ "chat.botExchange.status.asking": "{asker} sta chiedendo a {helper}…",
+ "chat.botExchange.status.working": "{helper} ci sta lavorando…",
+ "chat.botExchange.status.needsYou": "{helper} aspetta la tua risposta nella sua conversazione",
+ "chat.botExchange.status.answered": "{helper} ha risposto in {duration}",
+ "chat.botExchange.status.stopped": "Fermato dopo {duration}",
+ "chat.botExchange.status.expired": "Tempo scaduto dopo {duration}",
+ "chat.botExchange.status.failed": "{helper} non è riuscito a finire",
+ "chat.botExchange.stopping": "Arresto…",
+ "chat.botExchange.notYours": "Solo chi l’ha chiesto può fermarlo.",
+ "chat.botExchange.gone": "Questo scambio non si può fermare da qui.",
+ "chat.botExchange.stopFailed": "Impossibile fermarlo. Controlla la connessione e riprova."
}
diff --git a/src/locales/ja.json b/src/locales/ja.json
index a83edfbbef..5b96071d4d 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -8102,5 +8102,24 @@
"skillBurger.run.pathUndone": "手順を削除しました",
"skillBurger.run.addPathFailed": "できませんでした。もう一度お試しください。",
"activity.tool.team.runWorkflow": "Skill Burger を実行",
- "activity.tool.team.workflowEdit": "Skill Burger を変更"
+ "activity.tool.team.workflowEdit": "Skill Burger を変更",
+ "chat.botExchange.open": "{asker} と {helper} のやり取りを開く",
+ "chat.botExchange.teammate": "チームメイト",
+ "chat.botExchange.asking": "依頼中…",
+ "chat.botExchange.working": "作業中…",
+ "chat.botExchange.needsYou": "対応が必要",
+ "chat.botExchange.stopped": "停止しました",
+ "chat.botExchange.expired": "時間切れ",
+ "chat.botExchange.failed": "完了できませんでした",
+ "chat.botExchange.status.asking": "{asker} が {helper} に依頼しています…",
+ "chat.botExchange.status.working": "{helper} が作業しています…",
+ "chat.botExchange.status.needsYou": "{helper} が会話であなたの返答を待っています",
+ "chat.botExchange.status.answered": "{helper} が {duration} で回答しました",
+ "chat.botExchange.status.stopped": "{duration} 後に停止しました",
+ "chat.botExchange.status.expired": "{duration} 後に時間切れになりました",
+ "chat.botExchange.status.failed": "{helper} は完了できませんでした",
+ "chat.botExchange.stopping": "停止しています…",
+ "chat.botExchange.notYours": "停止できるのは依頼した人だけです。",
+ "chat.botExchange.gone": "このやり取りはここからは停止できません。",
+ "chat.botExchange.stopFailed": "停止できませんでした。接続を確認してもう一度お試しください。"
}
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 2c3aaf7e8f..2f8b3f1bb2 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -7792,5 +7792,24 @@
"skillBurger.run.pathUndone": "경로를 제거했습니다",
"skillBurger.run.addPathFailed": "하지 못했습니다. 다시 시도하세요.",
"activity.tool.team.runWorkflow": "Skill Burger 실행",
- "activity.tool.team.workflowEdit": "Skill Burger 변경"
+ "activity.tool.team.workflowEdit": "Skill Burger 변경",
+ "chat.botExchange.open": "{asker}와 {helper}의 대화 열기",
+ "chat.botExchange.teammate": "팀원",
+ "chat.botExchange.asking": "요청 중…",
+ "chat.botExchange.working": "작업 중…",
+ "chat.botExchange.needsYou": "확인 필요",
+ "chat.botExchange.stopped": "중지됨",
+ "chat.botExchange.expired": "시간 초과",
+ "chat.botExchange.failed": "완료하지 못함",
+ "chat.botExchange.status.asking": "{asker}가 {helper}에게 요청하는 중…",
+ "chat.botExchange.status.working": "{helper}가 작업하는 중…",
+ "chat.botExchange.status.needsYou": "{helper}가 대화에서 답변을 기다리고 있어요",
+ "chat.botExchange.status.answered": "{helper}가 {duration} 만에 답했어요",
+ "chat.botExchange.status.stopped": "{duration} 후 중지됨",
+ "chat.botExchange.status.expired": "{duration} 후 시간 초과",
+ "chat.botExchange.status.failed": "{helper}가 완료하지 못했어요",
+ "chat.botExchange.stopping": "중지하는 중…",
+ "chat.botExchange.notYours": "요청한 사람만 중지할 수 있어요.",
+ "chat.botExchange.gone": "이 대화는 여기서 중지할 수 없어요.",
+ "chat.botExchange.stopFailed": "중지하지 못했어요. 연결을 확인하고 다시 시도하세요."
}
diff --git a/src/locales/pl.json b/src/locales/pl.json
index bf2d8f227f..d2db188196 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -7263,5 +7263,24 @@
"skillBurger.run.pathUndone": "Usunięto ścieżkę",
"skillBurger.run.addPathFailed": "Nie udało się. Spróbuj ponownie.",
"activity.tool.team.runWorkflow": "Uruchom Skill Burger",
- "activity.tool.team.workflowEdit": "Zmień Skill Burger"
+ "activity.tool.team.workflowEdit": "Zmień Skill Burger",
+ "chat.botExchange.open": "Otwórz wymianę między {asker} a {helper}",
+ "chat.botExchange.teammate": "Członek zespołu",
+ "chat.botExchange.asking": "pyta…",
+ "chat.botExchange.working": "pracuje…",
+ "chat.botExchange.needsYou": "potrzebuje ciebie",
+ "chat.botExchange.stopped": "zatrzymano",
+ "chat.botExchange.expired": "czas minął",
+ "chat.botExchange.failed": "nie skończył",
+ "chat.botExchange.status.asking": "{asker} prosi {helper}…",
+ "chat.botExchange.status.working": "{helper} nad tym pracuje…",
+ "chat.botExchange.status.needsYou": "{helper} czeka na twoją odpowiedź w swojej rozmowie",
+ "chat.botExchange.status.answered": "{helper} odpowiedział w {duration}",
+ "chat.botExchange.status.stopped": "Zatrzymano po {duration}",
+ "chat.botExchange.status.expired": "Czas minął po {duration}",
+ "chat.botExchange.status.failed": "{helper} nie zdołał skończyć",
+ "chat.botExchange.stopping": "Zatrzymywanie…",
+ "chat.botExchange.notYours": "Zatrzymać może tylko osoba, która prosiła.",
+ "chat.botExchange.gone": "Tej wymiany nie można zatrzymać stąd.",
+ "chat.botExchange.stopFailed": "Nie udało się zatrzymać. Sprawdź połączenie i spróbuj ponownie."
}
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 978cd3fe83..a1f6faeee8 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -11675,6 +11675,25 @@
"chat.handoffExchange.loading": "Carregando a conversa…",
"chat.handoffExchange.failed": "Não foi possível carregar a conversa.",
"chat.handoffExchange.empty": "Nenhuma mensagem ainda.",
+ "chat.botExchange.open": "Abrir a conversa entre {asker} e {helper}",
+ "chat.botExchange.teammate": "Um colega",
+ "chat.botExchange.asking": "pedindo…",
+ "chat.botExchange.working": "trabalhando…",
+ "chat.botExchange.needsYou": "precisa de você",
+ "chat.botExchange.stopped": "parado",
+ "chat.botExchange.expired": "tempo esgotado",
+ "chat.botExchange.failed": "não terminou",
+ "chat.botExchange.status.asking": "{asker} está pedindo a {helper}…",
+ "chat.botExchange.status.working": "{helper} está trabalhando nisso…",
+ "chat.botExchange.status.needsYou": "{helper} está esperando sua resposta na conversa dele",
+ "chat.botExchange.status.answered": "{helper} respondeu em {duration}",
+ "chat.botExchange.status.stopped": "Parado após {duration}",
+ "chat.botExchange.status.expired": "Tempo esgotado após {duration}",
+ "chat.botExchange.status.failed": "{helper} não conseguiu terminar",
+ "chat.botExchange.stopping": "Parando…",
+ "chat.botExchange.notYours": "Só quem pediu pode parar isto.",
+ "chat.botExchange.gone": "Esta conversa não pode ser parada daqui.",
+ "chat.botExchange.stopFailed": "Não foi possível parar. Confira se você está on-line e tente novamente.",
"sidebar.threads.hidden": "Conversa oculta",
"sidebar.threads.hide": "Ocultar {title}",
"sidebar.threads.hideShort": "Ocultar",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index 6d10c73305..0f29f2c6ff 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -7317,5 +7317,24 @@
"skillBurger.run.pathUndone": "Путь удалён",
"skillBurger.run.addPathFailed": "Не получилось. Попробуйте ещё раз.",
"activity.tool.team.runWorkflow": "Запустить Skill Burger",
- "activity.tool.team.workflowEdit": "Изменить Skill Burger"
+ "activity.tool.team.workflowEdit": "Изменить Skill Burger",
+ "chat.botExchange.open": "Открыть обмен между {asker} и {helper}",
+ "chat.botExchange.teammate": "Коллега",
+ "chat.botExchange.asking": "спрашивает…",
+ "chat.botExchange.working": "работает…",
+ "chat.botExchange.needsYou": "нужны вы",
+ "chat.botExchange.stopped": "остановлено",
+ "chat.botExchange.expired": "время вышло",
+ "chat.botExchange.failed": "не закончил",
+ "chat.botExchange.status.asking": "{asker} просит {helper}…",
+ "chat.botExchange.status.working": "{helper} работает над этим…",
+ "chat.botExchange.status.needsYou": "{helper} ждёт вашего ответа в своём разговоре",
+ "chat.botExchange.status.answered": "{helper} ответил за {duration}",
+ "chat.botExchange.status.stopped": "Остановлено через {duration}",
+ "chat.botExchange.status.expired": "Время вышло через {duration}",
+ "chat.botExchange.status.failed": "{helper} не смог закончить",
+ "chat.botExchange.stopping": "Остановка…",
+ "chat.botExchange.notYours": "Остановить может только тот, кто просил.",
+ "chat.botExchange.gone": "Этот обмен нельзя остановить отсюда.",
+ "chat.botExchange.stopFailed": "Не удалось остановить. Проверьте подключение и попробуйте снова."
}
diff --git a/src/locales/tr.json b/src/locales/tr.json
index aa7c872e91..577ad6ecbb 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -6062,5 +6062,24 @@
"skillBurger.run.pathUndone": "Yol kaldırıldı",
"skillBurger.run.addPathFailed": "Yapılamadı. Tekrar deneyin.",
"activity.tool.team.runWorkflow": "Skill Burger çalıştır",
- "activity.tool.team.workflowEdit": "Skill Burger değiştir"
+ "activity.tool.team.workflowEdit": "Skill Burger değiştir",
+ "chat.botExchange.open": "{asker} ile {helper} arasındaki konuşmayı aç",
+ "chat.botExchange.teammate": "Bir ekip arkadaşı",
+ "chat.botExchange.asking": "soruyor…",
+ "chat.botExchange.working": "çalışıyor…",
+ "chat.botExchange.needsYou": "sana ihtiyacı var",
+ "chat.botExchange.stopped": "durduruldu",
+ "chat.botExchange.expired": "süre doldu",
+ "chat.botExchange.failed": "bitiremedi",
+ "chat.botExchange.status.asking": "{asker}, {helper} ile konuşuyor…",
+ "chat.botExchange.status.working": "{helper} bunun üzerinde çalışıyor…",
+ "chat.botExchange.status.needsYou": "{helper} kendi konuşmasında yanıtını bekliyor",
+ "chat.botExchange.status.answered": "{helper} {duration} içinde yanıtladı",
+ "chat.botExchange.status.stopped": "{duration} sonra durduruldu",
+ "chat.botExchange.status.expired": "{duration} sonra süre doldu",
+ "chat.botExchange.status.failed": "{helper} bitiremedi",
+ "chat.botExchange.stopping": "Durduruluyor…",
+ "chat.botExchange.notYours": "Bunu yalnızca isteyen kişi durdurabilir.",
+ "chat.botExchange.gone": "Bu konuşma buradan durdurulamaz.",
+ "chat.botExchange.stopFailed": "Durdurulamadı. Bağlantını kontrol edip tekrar dene."
}
diff --git a/src/locales/uk.json b/src/locales/uk.json
index 12a537a8f7..0c05cc3d03 100644
--- a/src/locales/uk.json
+++ b/src/locales/uk.json
@@ -4244,5 +4244,24 @@
"skillBurger.run.pathUndone": "Шлях вилучено",
"skillBurger.run.addPathFailed": "Не вдалося. Спробуйте ще раз.",
"activity.tool.team.runWorkflow": "Запустити Skill Burger",
- "activity.tool.team.workflowEdit": "Змінити Skill Burger"
+ "activity.tool.team.workflowEdit": "Змінити Skill Burger",
+ "chat.botExchange.open": "Відкрити обмін між {asker} і {helper}",
+ "chat.botExchange.teammate": "Колега",
+ "chat.botExchange.asking": "запитує…",
+ "chat.botExchange.working": "працює…",
+ "chat.botExchange.needsYou": "потрібні ви",
+ "chat.botExchange.stopped": "зупинено",
+ "chat.botExchange.expired": "час вийшов",
+ "chat.botExchange.failed": "не завершив",
+ "chat.botExchange.status.asking": "{asker} просить {helper}…",
+ "chat.botExchange.status.working": "{helper} працює над цим…",
+ "chat.botExchange.status.needsYou": "{helper} чекає на вашу відповідь у своїй розмові",
+ "chat.botExchange.status.answered": "{helper} відповів за {duration}",
+ "chat.botExchange.status.stopped": "Зупинено через {duration}",
+ "chat.botExchange.status.expired": "Час вийшов через {duration}",
+ "chat.botExchange.status.failed": "{helper} не зміг завершити",
+ "chat.botExchange.stopping": "Зупинення…",
+ "chat.botExchange.notYours": "Зупинити може лише той, хто просив.",
+ "chat.botExchange.gone": "Цей обмін не можна зупинити звідси.",
+ "chat.botExchange.stopFailed": "Не вдалося зупинити. Перевірте з’єднання і спробуйте ще раз."
}
diff --git a/src/locales/vi.json b/src/locales/vi.json
index 5c78decbc9..a9cb8544c0 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -6062,5 +6062,24 @@
"skillBurger.run.pathUndone": "Đã xóa nhánh",
"skillBurger.run.addPathFailed": "Không làm được. Hãy thử lại.",
"activity.tool.team.runWorkflow": "Chạy Skill Burger",
- "activity.tool.team.workflowEdit": "Đổi Skill Burger"
+ "activity.tool.team.workflowEdit": "Đổi Skill Burger",
+ "chat.botExchange.open": "Mở cuộc trao đổi giữa {asker} và {helper}",
+ "chat.botExchange.teammate": "Một đồng đội",
+ "chat.botExchange.asking": "đang hỏi…",
+ "chat.botExchange.working": "đang làm…",
+ "chat.botExchange.needsYou": "cần bạn",
+ "chat.botExchange.stopped": "đã dừng",
+ "chat.botExchange.expired": "hết thời gian",
+ "chat.botExchange.failed": "chưa xong",
+ "chat.botExchange.status.asking": "{asker} đang nhờ {helper}…",
+ "chat.botExchange.status.working": "{helper} đang làm việc này…",
+ "chat.botExchange.status.needsYou": "{helper} đang chờ bạn trả lời trong cuộc trò chuyện của nó",
+ "chat.botExchange.status.answered": "{helper} đã trả lời sau {duration}",
+ "chat.botExchange.status.stopped": "Đã dừng sau {duration}",
+ "chat.botExchange.status.expired": "Hết thời gian sau {duration}",
+ "chat.botExchange.status.failed": "{helper} không thể hoàn thành",
+ "chat.botExchange.stopping": "Đang dừng…",
+ "chat.botExchange.notYours": "Chỉ người đã yêu cầu mới có thể dừng việc này.",
+ "chat.botExchange.gone": "Không thể dừng cuộc trao đổi này từ đây.",
+ "chat.botExchange.stopFailed": "Không thể dừng. Hãy kiểm tra kết nối rồi thử lại."
}
diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.json
index 1680fd8088..4b00a16e5c 100644
--- a/src/locales/zh-tw.json
+++ b/src/locales/zh-tw.json
@@ -10378,5 +10378,24 @@
"skillBurger.run.pathUndone": "已移除路徑",
"skillBurger.run.addPathFailed": "無法完成,請再試一次。",
"activity.tool.team.runWorkflow": "執行 Skill Burger",
- "activity.tool.team.workflowEdit": "變更 Skill Burger"
+ "activity.tool.team.workflowEdit": "變更 Skill Burger",
+ "chat.botExchange.open": "開啟 {asker} 與 {helper} 的交流",
+ "chat.botExchange.teammate": "一位隊友",
+ "chat.botExchange.asking": "正在詢問…",
+ "chat.botExchange.working": "正在處理…",
+ "chat.botExchange.needsYou": "需要你",
+ "chat.botExchange.stopped": "已停止",
+ "chat.botExchange.expired": "已逾時",
+ "chat.botExchange.failed": "未完成",
+ "chat.botExchange.status.asking": "{asker} 正在請 {helper} 幫忙…",
+ "chat.botExchange.status.working": "{helper} 正在處理…",
+ "chat.botExchange.status.needsYou": "{helper} 正在它的對話中等你回覆",
+ "chat.botExchange.status.answered": "{helper} 花了 {duration} 回覆",
+ "chat.botExchange.status.stopped": "{duration} 後已停止",
+ "chat.botExchange.status.expired": "{duration} 後已逾時",
+ "chat.botExchange.status.failed": "{helper} 未能完成",
+ "chat.botExchange.stopping": "正在停止…",
+ "chat.botExchange.notYours": "只有提出請求的人可以停止。",
+ "chat.botExchange.gone": "無法在這裡停止此交流。",
+ "chat.botExchange.stopFailed": "無法停止。請檢查網路連線後再試一次。"
}
diff --git a/src/locales/zh.json b/src/locales/zh.json
index c011481601..69ba017d8f 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -10291,5 +10291,24 @@
"skillBurger.run.pathUndone": "已移除路径",
"skillBurger.run.addPathFailed": "无法完成,请重试。",
"activity.tool.team.runWorkflow": "运行 Skill Burger",
- "activity.tool.team.workflowEdit": "更改 Skill Burger"
+ "activity.tool.team.workflowEdit": "更改 Skill Burger",
+ "chat.botExchange.open": "打开 {asker} 与 {helper} 的交流",
+ "chat.botExchange.teammate": "一位队友",
+ "chat.botExchange.asking": "正在询问…",
+ "chat.botExchange.working": "正在处理…",
+ "chat.botExchange.needsYou": "需要你",
+ "chat.botExchange.stopped": "已停止",
+ "chat.botExchange.expired": "已超时",
+ "chat.botExchange.failed": "未完成",
+ "chat.botExchange.status.asking": "{asker} 正在请 {helper} 帮忙…",
+ "chat.botExchange.status.working": "{helper} 正在处理…",
+ "chat.botExchange.status.needsYou": "{helper} 正在它的对话中等你回复",
+ "chat.botExchange.status.answered": "{helper} 用了 {duration} 回复",
+ "chat.botExchange.status.stopped": "{duration} 后已停止",
+ "chat.botExchange.status.expired": "{duration} 后已超时",
+ "chat.botExchange.status.failed": "{helper} 未能完成",
+ "chat.botExchange.stopping": "正在停止…",
+ "chat.botExchange.notYours": "只有提出请求的人可以停止。",
+ "chat.botExchange.gone": "无法在这里停止此交流。",
+ "chat.botExchange.stopFailed": "无法停止。请检查网络连接后重试。"
}