mirror of
https://github.com/Untrivial-ai/agent-orchestrator.git
synced 2026-11-23 16:21:31 +08:00
fix(chat): restore an archived chat by sending to it (#8818)
* fix(chat): restore an archived chat by sending to it Opening an archived chat now shows its history with the ordinary composer and no archived/restore banner. Viewing or typing restores nothing. Pressing Send shows the message at once as a normal send does, runs the existing restore for that session (local, remote host, or cloud), and only after the restore succeeds sends the message once with its client message id. The sidebar picks the session up from the restore's own workspace refresh, so a failed restore leaves it archived and out of the sidebar. - A failed restore is a definitive refusal: the composer gets the draft back with the reason, and Send retries the restore. - SESSION_NOT_RESTORABLE (restored meanwhile from another window) counts as restored, so the message still goes. - A lost send answer parks in the unsent strip as before; its retry keeps the same id, which the daemon answers as a duplicate. - A cloud session shared from another organization, or read-only, is not restored from here. * fix(chat): take files in an archived chat only once it is restored Staging writes into the session's worktree, which an archived session may no longer have until the restore its first message runs. * fix(chat): send a cloud message held by a restore to its own session The cloud chat surface outlives the session it shows, and the send read its target from the render that ran it. A message waiting on an archived session's restore could go to a session opened meanwhile. The send now carries its org and session, and leaves out the shown session's picks, mode and composer lease when they are not its own. * fix(chat): show an archived chat's saved settings in its composer The settings bar needed a live, resuming or waking agent, so an archived chat's composer showed no agent or model controls until a message restored it. It now shows the saved settings, as a sleeping chat does. * fix(chat): say an archived chat restores on send, and show the restore The archived composer reads "Send a message to restore this session". While the send's restore runs, the composer shimmers and reads "Restoring session" until the agent is back. The saved settings stay visible but inert, and the add menu drops its mode items, so no picker opens before the restore. * fix(chat): no agent banner while an archived chat restores The session turns live before its agent is back, which briefly brought the controller banner above the chat. The composer already shows the restore. * fix(chat): show the restore in an archived cloud chat's composer The shimmer and "Restoring session" followed the local resume mutation only. An archived cloud chat's restore now sets the same state for its session. * test(chat): end the archived restore test with the agent back * fix(chat): keep an archived chat's restore state to its own session The Cloud surface shows several sessions in one chat workspace, so a restore remembered as a flag could mark the next session's ordinary resume as a restore. It is kept by session id. * fix(chat): lock the composer of an archived session shared from another org Only the sharer's organization can restore it, and the control plane queues a message to an archived session without running it, so a guest's message would wait unanswered. The composer reads "Only the owner can restore this archived session" instead. * fix(chat): name the owner as restorer even while a shared session's access loads
This commit is contained in:
1 parent
7d65580194
commit
5cac6e95a9
20 files changed
+500
-144
No files matched your search
@@ -148,6 +148,8 @@ const DEFINITIVE_SEND_REJECTIONS = new Set([
|
||||
AGENT_SWITCH_FAILED,
|
||||
// The new chat page could not create the session this brief would start.
|
||||
"TASK_CREATE_FAILED",
|
||||
// An archived chat could not be restored, so its message was never sent.
|
||||
"SESSION_RESTORE_FAILED",
|
||||
"CHAT_FILE_REFERENCE_INVALID", "CHAT_ANNOTATION_LIMIT", "CHAT_FILE_REFERENCES_SIDE_UNSUPPORTED",
|
||||
// Cloud validation failures reject the request before durable acceptance.
|
||||
"validation_error",
|
||||
|
||||
@@ -3428,46 +3428,117 @@ describe("ChatWorkspace timeline", () => {
|
||||
expect(screen.getByLabelText("Message the agent")).toHaveAttribute("aria-placeholder", "The controller is not connected");
|
||||
});
|
||||
|
||||
it("offers Restore, not Resume, on a terminated session", async () => {
|
||||
const user = userEvent.setup();
|
||||
it("opens an archived chat as an ordinary one, without restoring it", async () => {
|
||||
const restore = vi.fn();
|
||||
const send = vi.fn();
|
||||
render(
|
||||
<ChatWorkspace
|
||||
snapshot={{ ...chatFixtureSettled, controller: { state: "stopped" } }}
|
||||
session={{ ...chatSession, isTerminated: true }}
|
||||
snapshot={{ ...chatFixtureSettled, sessionId: "archived-open", controller: { state: "stopped" } }}
|
||||
session={{ ...chatSession, id: "archived-open", isTerminated: true }}
|
||||
onResumeAgent={restore}
|
||||
onSend={send}
|
||||
onOpenShell={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
// Archiving is a normal end, not a failure.
|
||||
// No archived banner, no Restore or Resume, no shell in a worktree that may be gone.
|
||||
expect(screen.queryByRole("alert")).not.toBeInTheDocument();
|
||||
expect(screen.getByText("Session terminated")).toBeInTheDocument();
|
||||
expect(screen.getByText("History is kept. Restore the session to continue.")).toBeInTheDocument();
|
||||
expect(screen.getByText("Restore the session to continue")).toBeInTheDocument();
|
||||
expect(screen.queryByText("Session terminated")).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "Restore session" })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "Resume agent" })).not.toBeInTheDocument();
|
||||
// A shell here would open in the project root once the worktree is gone.
|
||||
expect(screen.queryByRole("button", { name: "Open shell" })).not.toBeInTheDocument();
|
||||
const composer = screen.getByRole("combobox", { name: "Message the agent" });
|
||||
expect(composer).toHaveAttribute("contenteditable", "true");
|
||||
expect(composer).toHaveAttribute("aria-placeholder", "Send a message to restore this session");
|
||||
|
||||
await user.click(screen.getByRole("button", { name: "Restore session" }));
|
||||
expect(restore).toHaveBeenCalledOnce();
|
||||
// Typing is not sending: nothing restores yet.
|
||||
await typeInLexicalEditor(composer, "pick this back up");
|
||||
expect(restore).not.toHaveBeenCalled();
|
||||
expect(send).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("keeps the composer locked while a terminated session restores", () => {
|
||||
it("sends from an archived chat once, and shows the restore in the composer while it runs", async () => {
|
||||
const user = userEvent.setup();
|
||||
const restore = vi.fn();
|
||||
const send = vi.fn().mockResolvedValue(undefined);
|
||||
const view = (resumingAgent: boolean, isTerminated = true, controller: "stopped" | "ready" = "stopped") => (
|
||||
<ChatWorkspace
|
||||
snapshot={{ ...chatFixtureSettled, sessionId: "archived-send", controller: { state: controller } }}
|
||||
session={{ ...chatSession, id: "archived-send", isTerminated }}
|
||||
onResumeAgent={restore}
|
||||
onSend={send}
|
||||
resumingAgent={resumingAgent}
|
||||
/>
|
||||
);
|
||||
const { rerender } = render(view(false));
|
||||
const composer = screen.getByRole("combobox", { name: "Message the agent" });
|
||||
await typeInLexicalEditor(composer, "continue from here");
|
||||
await user.click(screen.getByRole("button", { name: "Send message" }));
|
||||
await waitFor(() => expect(send).toHaveBeenCalledOnce());
|
||||
expect(send.mock.calls[0]?.[0]).toBe("continue from here");
|
||||
// The surface's send restores; the chat itself never asks for one.
|
||||
expect(restore).not.toHaveBeenCalled();
|
||||
|
||||
// While the send's restore runs the composer says so and shimmers, and typing goes on.
|
||||
rerender(view(true));
|
||||
expect(composer).toHaveAttribute("aria-placeholder", "Restoring session");
|
||||
expect(document.querySelector(".cursor-chat-composer")).toHaveAttribute("data-starting");
|
||||
expect(composer).toHaveAttribute("contenteditable", "true");
|
||||
// The session turns live before its agent is back: still one restore.
|
||||
rerender(view(true, false));
|
||||
expect(composer).toHaveAttribute("aria-placeholder", "Restoring session");
|
||||
// No agent banner flashes above the chat meanwhile.
|
||||
expect(screen.queryByText("Waking agent…")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("Resuming…")).not.toBeInTheDocument();
|
||||
expect(screen.queryByText("The agent controller stopped")).not.toBeInTheDocument();
|
||||
// The restore ends once the agent is back.
|
||||
rerender(view(false, false, "ready"));
|
||||
expect(composer).toHaveAttribute("aria-placeholder", "Message the agent");
|
||||
expect(document.querySelector(".cursor-chat-composer")).not.toHaveAttribute("data-starting");
|
||||
expect(send).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("does not carry an archived chat's restore over to the next session shown in the same workspace", () => {
|
||||
const view = (id: string, isTerminated: boolean, resumingAgent: boolean) => (
|
||||
<ChatWorkspace
|
||||
snapshot={{ ...chatFixtureSettled, sessionId: id, controller: { state: "stopped" } }}
|
||||
session={{ ...chatSession, id, isTerminated }}
|
||||
onResumeAgent={vi.fn()}
|
||||
onSend={vi.fn()}
|
||||
resumingAgent={resumingAgent}
|
||||
/>
|
||||
);
|
||||
const { rerender } = render(view("archived-first", true, false));
|
||||
// Another, live session whose agent is resuming: an ordinary resume, not a restore.
|
||||
rerender(view("live-next", false, true));
|
||||
expect(screen.getByRole("combobox", { name: "Message the agent" })).not.toHaveAttribute("aria-placeholder", "Restoring session");
|
||||
});
|
||||
|
||||
it("gives the draft back with the reason when the archived chat cannot be restored", async () => {
|
||||
const user = userEvent.setup();
|
||||
const send = vi.fn()
|
||||
.mockRejectedValueOnce(Object.assign(new Error("Workspace restore failed"), { code: "SESSION_RESTORE_FAILED" }))
|
||||
.mockResolvedValue(undefined);
|
||||
render(
|
||||
<ChatWorkspace
|
||||
snapshot={{ ...chatFixtureSettled, controller: { state: "stopped" } }}
|
||||
session={{ ...chatSession, isTerminated: true }}
|
||||
snapshot={{ ...chatFixtureSettled, sessionId: "archived-refused", controller: { state: "stopped" } }}
|
||||
session={{ ...chatSession, id: "archived-refused", isTerminated: true }}
|
||||
onResumeAgent={vi.fn()}
|
||||
resumingAgent
|
||||
onSend={send}
|
||||
/>,
|
||||
);
|
||||
const composer = screen.getByRole("combobox", { name: "Message the agent" });
|
||||
await typeInLexicalEditor(composer, "try again later");
|
||||
await user.click(screen.getByRole("button", { name: "Send message" }));
|
||||
|
||||
// The banner title and the composer placeholder both say so.
|
||||
expect(screen.getAllByText("Restoring session")).toHaveLength(2);
|
||||
expect(screen.queryByRole("button", { name: "Restore session" })).not.toBeInTheDocument();
|
||||
// A message sent now would reach a session the daemon still calls terminated.
|
||||
expect(screen.getByRole("combobox", { name: "Message the agent" })).toHaveAttribute("contenteditable", "false");
|
||||
await screen.findByText("Workspace restore failed");
|
||||
await waitFor(() => expect(composer).toHaveTextContent("try again later"));
|
||||
expect(composer).toHaveAttribute("contenteditable", "true");
|
||||
|
||||
// Sending again retries the restore with the same text.
|
||||
await user.click(screen.getByRole("button", { name: "Send message" }));
|
||||
await waitFor(() => expect(send).toHaveBeenCalledTimes(2));
|
||||
expect(send.mock.calls[1]?.[0]).toBe("try again later");
|
||||
});
|
||||
|
||||
it("does not wait for a reconnect on a terminated session", () => {
|
||||
@@ -3480,7 +3551,7 @@ describe("ChatWorkspace timeline", () => {
|
||||
);
|
||||
|
||||
expect(screen.queryByText("Reconnecting to the agent…")).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Restore session" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("combobox", { name: "Message the agent" })).toHaveAttribute("contenteditable", "true");
|
||||
});
|
||||
|
||||
it("shows a reconnect in progress while the daemon is still checking the session", () => {
|
||||
|
||||
@@ -54,7 +54,7 @@ import {
|
||||
type WheelEvent as ReactWheelEvent,
|
||||
} from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { Archive, ArrowDown, Columns2, FlaskConical, ListTodo, Loader2, NotebookPen, Presentation, Route, ScanSearch, TriangleAlert, Undo2, WandSparkles } from "@/components/app-icons";
|
||||
import { ArrowDown, Columns2, FlaskConical, ListTodo, Loader2, NotebookPen, Presentation, Route, ScanSearch, TriangleAlert, Undo2, WandSparkles } from "@/components/app-icons";
|
||||
import { AnimatePresence, motion, Reorder, usePresence, useReducedMotion } from "motion/react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { ChatSelectionActions } from "./ChatSelectionActions";
|
||||
@@ -1061,6 +1061,13 @@ function ChatWorkspaceContent({
|
||||
const suppressStopped = wakingFromHibernate.current && snapshot.controller.state === "stopped";
|
||||
// A terminated session has no agent to resume: only a restore brings it back.
|
||||
const terminated = Boolean(session && !sessionIsActive(session));
|
||||
// A message sent to an archived chat restores it first. The restore reads as one
|
||||
// step until the agent is back, though the session turns live partway through it.
|
||||
// Kept by session id: the Cloud surface shows several sessions in one workspace.
|
||||
const restoringArchived = useRef<string | undefined>(undefined);
|
||||
if (terminated) restoringArchived.current = session?.id;
|
||||
else if (!resumingAgent) restoringArchived.current = undefined;
|
||||
const restoring = Boolean(resumingAgent) && restoringArchived.current !== undefined && restoringArchived.current === session?.id;
|
||||
// After a restart the daemon is still verifying this session and reconnects
|
||||
// its surviving agent itself. Until it settles, "stopped" is not a state to act on.
|
||||
const startupReconnecting = snapshot.controller.state === "stopped" && !resumingAgent && !terminated &&
|
||||
@@ -2308,7 +2315,9 @@ function ChatWorkspaceContent({
|
||||
{t("chat.draft.storageUnavailable")}
|
||||
</div>
|
||||
) : null}
|
||||
{savedCopy && activeRemoteHostId ? <HostAwayBanner hostId={activeRemoteHostId} /> : savedCopy || importBlock ? null : (
|
||||
{/* An archived chat reads as an ordinary one: sending to it restores it, and the
|
||||
composer, not a banner, says so until the agent is back. */}
|
||||
{savedCopy && activeRemoteHostId ? <HostAwayBanner hostId={activeRemoteHostId} /> : savedCopy || importBlock || terminated || restoring ? null : (
|
||||
<ControllerBanner
|
||||
controller={snapshot.controller}
|
||||
quietConnect={Boolean(openingStartedAt) && !firstTurnSettled(snapshot)}
|
||||
@@ -2317,7 +2326,6 @@ function ChatWorkspaceContent({
|
||||
transitioning={controllerTransitioning || agentResuming}
|
||||
automaticWakePending={suppressStopped}
|
||||
reconnecting={startupReconnecting}
|
||||
terminated={terminated}
|
||||
onResume={newWorkDisabled ? undefined : onResumeAgent}
|
||||
resuming={resumingAgent}
|
||||
resumeError={resumeError}
|
||||
@@ -2515,9 +2523,10 @@ function ChatWorkspaceContent({
|
||||
{/* Normally right of the model control; with no settings bar, beside the ring. */}
|
||||
{composerSettings ? null : quotaSign}
|
||||
<QuotaStatus quota={runningQuota} />
|
||||
{composerSettings}
|
||||
{/* Shown so the chat reads as itself, but nothing runs its picks until it is restored. */}
|
||||
{terminated && composerSettings ? <div inert className="contents">{composerSettings}</div> : composerSettings}
|
||||
</>}
|
||||
addMenuItems={agentSwitch ? (
|
||||
addMenuItems={agentSwitch && !terminated ? (
|
||||
<ComposerModeItems
|
||||
configOptions={configOptions ?? []}
|
||||
settings={stableSettings}
|
||||
@@ -2535,8 +2544,8 @@ function ChatWorkspaceContent({
|
||||
? t("chat.startup.queuePlaceholder", { agent: agentLabel(snapshot.harness) })
|
||||
: undefined
|
||||
}
|
||||
starting={orchestratorStarting || arrivingInChat || cloudStarting || composerStarting}
|
||||
disabled={(orchestratorBlocksComposer || (openingStarting && !session && !followUpWhileOpening) || loadingQuietly || (snapshot.controller.state === "stopped" && !suppressStopped && !accountMoveQueues && (!resumingAgent || session?.provisionState === "failed" || terminated)) || (controllerTransitioning && !accountMoveQueues) || (newWorkDisabled && sendBlockedReason === undefined) || composerLockedPlaceholder !== undefined) && !queueEdit?.clientMessageId}
|
||||
starting={orchestratorStarting || arrivingInChat || cloudStarting || composerStarting || restoring}
|
||||
disabled={(orchestratorBlocksComposer || (openingStarting && !session && !followUpWhileOpening) || loadingQuietly || (snapshot.controller.state === "stopped" && !suppressStopped && !accountMoveQueues && !terminated && (!resumingAgent || session?.provisionState === "failed")) || (controllerTransitioning && !accountMoveQueues) || (newWorkDisabled && sendBlockedReason === undefined) || composerLockedPlaceholder !== undefined) && !queueEdit?.clientMessageId}
|
||||
sendBlockedReason={sendBlockedReason}
|
||||
// Signed out: nothing typed could be sent until the login takes. The box
|
||||
// keeps its look; the agent and model can still be changed.
|
||||
@@ -2555,8 +2564,10 @@ function ChatWorkspaceContent({
|
||||
? setupPlaceholder
|
||||
: controllerTransitioning || newWorkDisabled
|
||||
? ""
|
||||
: terminated && snapshot.controller.state === "stopped"
|
||||
? t(resumingAgent ? "shell.restoringSession" : "chat.archived.placeholder")
|
||||
: restoring
|
||||
? t("shell.restoringSession")
|
||||
: terminated
|
||||
? t("chat.archived.placeholder")
|
||||
: agentResuming
|
||||
? (sessionRole === "orchestrator" ? "Starting the orchestrator" : "Resuming agent")
|
||||
: startupReconnecting
|
||||
@@ -3137,7 +3148,6 @@ function ControllerBanner({
|
||||
transitioning,
|
||||
automaticWakePending,
|
||||
reconnecting,
|
||||
terminated = false,
|
||||
onResume,
|
||||
resuming,
|
||||
resumeError,
|
||||
@@ -3158,8 +3168,6 @@ function ControllerBanner({
|
||||
automaticWakePending?: boolean;
|
||||
/** The daemon is still reconnecting this session after a restart. */
|
||||
reconnecting?: boolean;
|
||||
/** The session is archived, so `onResume` restores it instead of resuming its agent. */
|
||||
terminated?: boolean;
|
||||
onResume?: () => void | Promise<unknown>;
|
||||
resuming?: boolean;
|
||||
resumeError?: string;
|
||||
@@ -3172,8 +3180,7 @@ function ControllerBanner({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
// An earlier failure can outlive a later successful resume; only a stopped agent is still held elsewhere.
|
||||
// An archived session is restored, never resumed, so it is not "open elsewhere".
|
||||
const openElsewhere = Boolean(resumeOpenElsewhere) && controller.state === "stopped" && !terminated;
|
||||
const openElsewhere = Boolean(resumeOpenElsewhere) && controller.state === "stopped";
|
||||
const resumeRef = useRef(onResume);
|
||||
resumeRef.current = onResume;
|
||||
// The other app releases the chat without telling AO (Codex can hold a closed
|
||||
@@ -3215,29 +3222,27 @@ function ControllerBanner({
|
||||
tone: "text-warning",
|
||||
},
|
||||
stopped: {
|
||||
title: terminated
|
||||
? t(waking ? "shell.restoringSession" : "terminal.sessionTerminated")
|
||||
: waking
|
||||
? "Waking agent…"
|
||||
: restarting
|
||||
? "Reconnecting to the agent…"
|
||||
: openElsewhere
|
||||
? t("chat.controller.openElsewhere")
|
||||
: needsResume
|
||||
? t("chat.controller.couldNotConnect")
|
||||
: "The agent controller stopped",
|
||||
tone: terminated || waking || restarting || needsResume ? "text-muted-foreground" : "text-destructive",
|
||||
title: waking
|
||||
? "Waking agent…"
|
||||
: restarting
|
||||
? "Reconnecting to the agent…"
|
||||
: openElsewhere
|
||||
? t("chat.controller.openElsewhere")
|
||||
: needsResume
|
||||
? t("chat.controller.couldNotConnect")
|
||||
: "The agent controller stopped",
|
||||
tone: waking || restarting || needsResume ? "text-muted-foreground" : "text-destructive",
|
||||
},
|
||||
};
|
||||
const shown = copy[controller.state];
|
||||
if (!shown) return null;
|
||||
const loading = controller.state === "connecting" || waking || restarting;
|
||||
const actionable = controller.state === "stopped" && !waking && !restarting;
|
||||
if (actionable && !terminated && signInRequired) return null;
|
||||
if (actionable && signInRequired) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
role={actionable && !terminated ? "alert" : "status"}
|
||||
role={actionable ? "alert" : "status"}
|
||||
aria-atomic="true"
|
||||
className="flex shrink-0 items-start gap-2.5 border-b border-border bg-surface px-4 py-2.5"
|
||||
>
|
||||
@@ -3246,14 +3251,12 @@ function ControllerBanner({
|
||||
aria-hidden="true"
|
||||
className="mt-0.5 size-3.5 shrink-0 animate-spin text-muted-foreground"
|
||||
/>
|
||||
) : terminated ? (
|
||||
<Archive aria-hidden="true" className={cn("mt-0.5 size-3.5 shrink-0", shown.tone)} />
|
||||
) : (
|
||||
<TriangleAlert aria-hidden="true" className={cn("mt-0.5 size-3.5 shrink-0", shown.tone)} />
|
||||
)}
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
|
||||
<strong className={cn("text-xs font-medium", shown.tone)}>{shown.title}</strong>
|
||||
{controller.state === "stopped" && waking && !terminated ? (
|
||||
{controller.state === "stopped" && waking ? (
|
||||
<span className="text-xs leading-snug text-muted-foreground">Restoring the agent. You can keep typing.</span>
|
||||
) : restarting ? (
|
||||
<span className="text-xs leading-snug text-muted-foreground">Orchestrator restarted. History is kept.</span>
|
||||
@@ -3263,15 +3266,13 @@ function ControllerBanner({
|
||||
{actionable ? (
|
||||
<>
|
||||
<span className="text-xs leading-snug text-muted-foreground">
|
||||
{terminated
|
||||
? t("chat.archived.body")
|
||||
: openElsewhere
|
||||
? [
|
||||
t("chat.controller.openElsewhereBody"),
|
||||
harness === "codex" ? t("chat.controller.openElsewhereCodex") : "",
|
||||
t("chat.controller.openElsewhereRecheck", { seconds: OPEN_ELSEWHERE_RECHECK_MS / 1000 }),
|
||||
].filter(Boolean).join(" ")
|
||||
: needsResume ? t("chat.controller.retryBody") : "History is kept. Resume the agent or open a shell in the same worktree."}
|
||||
{openElsewhere
|
||||
? [
|
||||
t("chat.controller.openElsewhereBody"),
|
||||
harness === "codex" ? t("chat.controller.openElsewhereCodex") : "",
|
||||
t("chat.controller.openElsewhereRecheck", { seconds: OPEN_ELSEWHERE_RECHECK_MS / 1000 }),
|
||||
].filter(Boolean).join(" ")
|
||||
: needsResume ? t("chat.controller.retryBody") : "History is kept. Resume the agent or open a shell in the same worktree."}
|
||||
</span>
|
||||
{!openElsewhere && (resumeError || shellError) ? (
|
||||
<span className="text-xs leading-snug text-destructive">
|
||||
@@ -3287,11 +3288,11 @@ function ControllerBanner({
|
||||
onClick={resumeClick}
|
||||
disabled={resuming}
|
||||
>
|
||||
{terminated ? t("terminal.restoreSession") : resuming ? "Resuming…" : needsResume || openElsewhere ? t("chat.controller.retry") : "Resume agent"}
|
||||
{resuming ? "Resuming…" : needsResume || openElsewhere ? t("chat.controller.retry") : "Resume agent"}
|
||||
</Button>
|
||||
) : null}
|
||||
{/* Once the worktree is gone a shell would open in the project root. */}
|
||||
{onOpenShell && !needsResume && !terminated ? (
|
||||
{onOpenShell && !needsResume ? (
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
|
||||
@@ -56,6 +56,8 @@ vi.mock("../../hooks/useCloudCp", () => ({
|
||||
useCloudCp: () => ({ ready: true, client: cloudMocks, baseUrl: cloudSetup.baseUrl, userId: "user-1" }),
|
||||
}));
|
||||
vi.mock("../../hooks/useCloudMeUserId", () => ({ useCloudMeUserId: () => cloudSetup.meUserId }));
|
||||
const restoreSession = vi.hoisted(() => vi.fn());
|
||||
vi.mock("../../hooks/useRestoreSession", () => ({ useRestoreSession: () => restoreSession }));
|
||||
vi.mock("../../hooks/useCloudOffering", () => ({
|
||||
useCloudOffering: () => ({
|
||||
features: [...(cloudSetup.maxAttachmentBytes === undefined ? [] : ["attachments"]), ...cloudSetup.features],
|
||||
@@ -2226,6 +2228,81 @@ describe("CloudSessionChatSurface", () => {
|
||||
expect(cloudMocks.chatProps.mock.lastCall?.[0].commandError).toBeUndefined();
|
||||
});
|
||||
|
||||
it("restores an archived session before its message, and sends nothing when the restore is refused", async () => {
|
||||
cloudMocks.listChatEvents.mockResolvedValue({ events: [], hasMore: false, nextAfter: 0 });
|
||||
cloudMocks.sendSessionMessage.mockReset().mockResolvedValue({ event: {} });
|
||||
restoreSession.mockReset()
|
||||
.mockResolvedValueOnce({ status: "error", message: "Restore refused" })
|
||||
.mockResolvedValueOnce({ status: "success" });
|
||||
const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
|
||||
const archived = { ...session, cloud: { orgId: "org-1" }, isTerminated: true, runtimeConnected: false };
|
||||
render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<CloudSessionChatSurface session={archived} />
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
await waitFor(() => expect(cloudMocks.chatProps).toHaveBeenCalled());
|
||||
// Opening it restored nothing.
|
||||
expect(restoreSession).not.toHaveBeenCalled();
|
||||
|
||||
await expect(cloudMocks.chatProps.mock.lastCall?.[0].onSend("hello", [], "message-1"))
|
||||
.rejects.toMatchObject({ code: "SESSION_RESTORE_FAILED", message: "Restore refused" });
|
||||
expect(cloudMocks.sendSessionMessage).not.toHaveBeenCalled();
|
||||
|
||||
await cloudMocks.chatProps.mock.lastCall?.[0].onSend("hello", [], "message-1");
|
||||
expect(restoreSession).toHaveBeenCalledTimes(2);
|
||||
expect(restoreSession).toHaveBeenLastCalledWith(session.id);
|
||||
expect(cloudMocks.sendSessionMessage).toHaveBeenCalledOnce();
|
||||
expect(cloudMocks.sendSessionMessage).toHaveBeenCalledWith("org-1", session.id, expect.objectContaining({ text: "hello" }), { idempotencyKey: "message-1" });
|
||||
expect(restoreSession.mock.invocationCallOrder[1]).toBeLessThan(cloudMocks.sendSessionMessage.mock.invocationCallOrder[0]!);
|
||||
});
|
||||
|
||||
it("sends a message held by a restore to its own session after another one opened", async () => {
|
||||
cloudMocks.listChatEvents.mockResolvedValue({ events: [], hasMore: false, nextAfter: 0 });
|
||||
cloudMocks.sendSessionMessage.mockReset().mockResolvedValue({ event: {} });
|
||||
let finishRestore: (result: { status: "success" }) => void = () => {};
|
||||
restoreSession.mockReset().mockReturnValueOnce(new Promise((resolve) => { finishRestore = resolve; }));
|
||||
const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
|
||||
const archived = { ...session, cloud: { orgId: "org-1" }, isTerminated: true, runtimeConnected: false };
|
||||
const other = { ...session, id: "cloud-other", cloud: { orgId: "org-2" } };
|
||||
const view = render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<CloudSessionChatSurface session={archived} />
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
await waitFor(() => expect(cloudMocks.chatProps).toHaveBeenCalled());
|
||||
const sent = cloudMocks.chatProps.mock.lastCall?.[0].onSend("hello", [], "message-1");
|
||||
// The composer shows the restore while it runs.
|
||||
await waitFor(() => expect(cloudMocks.chatProps.mock.lastCall?.[0].resumingAgent).toBe(true));
|
||||
|
||||
view.rerender(<QueryClientProvider client={queryClient}><CloudSessionChatSurface session={other} /></QueryClientProvider>);
|
||||
await act(async () => {
|
||||
finishRestore({ status: "success" });
|
||||
await sent;
|
||||
});
|
||||
expect(cloudMocks.sendSessionMessage).toHaveBeenCalledOnce();
|
||||
expect(cloudMocks.sendSessionMessage).toHaveBeenCalledWith("org-1", session.id, expect.objectContaining({ text: "hello" }), { idempotencyKey: "message-1" });
|
||||
// Not the other session's restore.
|
||||
expect(cloudMocks.chatProps.mock.lastCall?.[0].resumingAgent).toBe(false);
|
||||
});
|
||||
|
||||
it("leaves restoring a session shared from another organization to its owner", async () => {
|
||||
cloudMocks.listChatEvents.mockResolvedValue({ events: [], hasMore: false, nextAfter: 0 });
|
||||
cloudMocks.sendSessionMessage.mockReset().mockResolvedValue({ event: {} });
|
||||
restoreSession.mockReset();
|
||||
const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
|
||||
render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<CloudSessionChatSurface session={{ ...session, cloud: { orgId: "org-1", shared: true }, isTerminated: true, runtimeConnected: false }} />
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
await waitFor(() => expect(cloudMocks.chatProps).toHaveBeenCalled());
|
||||
// A message to it would wait unanswered, so the composer says who can restore it.
|
||||
expect(cloudMocks.chatProps.mock.lastCall?.[0].composerLockedPlaceholder).toBe("Only the owner can restore this archived session");
|
||||
await cloudMocks.chatProps.mock.lastCall?.[0].onSend("hello", [], "message-1").catch(() => undefined);
|
||||
expect(restoreSession).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("says a session deleted under the composer must be restored", async () => {
|
||||
cloudMocks.listChatEvents.mockResolvedValue({ events: [], hasMore: false, nextAfter: 0 });
|
||||
cloudMocks.listChatModels.mockReset();
|
||||
|
||||
@@ -8,6 +8,7 @@ import { invalidateCloudModelCatalogs } from "../../hooks/useCloudModelCatalog";
|
||||
import { useCloudOffering } from "../../hooks/useCloudOffering";
|
||||
import { QUEUED_DELETE_FEATURE, QUEUED_EDIT_FEATURE, QUEUED_STEER_FEATURE } from "../../lib/cloud-offering";
|
||||
import type { ShellTerminal } from "../../hooks/useShellTerminals";
|
||||
import { useRestoreSession } from "../../hooks/useRestoreSession";
|
||||
import { useChatMessageFocus, useChatNavigationRequest, type ChatMessageFocusTarget } from "../../hooks/useChatMessageFocus";
|
||||
import { useCloudPromptSuggestion } from "../../hooks/useCloudPromptSuggestion";
|
||||
import { sessionUiKey } from "../../lib/hosts";
|
||||
@@ -1536,6 +1537,10 @@ export function CloudSessionChatSurface({
|
||||
const openSessionLink = useSessionLinkNavigation(undefined, "cloud");
|
||||
const openLinkInBrowser = useSessionBrowserLink(session, onOpenLinkInBrowser);
|
||||
const { client, ready, userId, baseUrl } = useCloudCp();
|
||||
const restoreSession = useRestoreSession();
|
||||
// The archived session a sent message is restoring, so the composer shows the
|
||||
// restore. Kept by id: this surface outlives the session it shows.
|
||||
const [restoringId, setRestoringId] = useState<string>();
|
||||
// A shared session's live state: who else has it open, who holds its
|
||||
// composer (the lock on talking to the agent), and the model and settings
|
||||
// its owner chose.
|
||||
@@ -1858,13 +1863,19 @@ export function CloudSessionChatSurface({
|
||||
// so a record stops mattering once the chat has read that far.
|
||||
const [acceptedThrough, setAcceptedThrough] = useState<Readonly<Record<string, number>>>({});
|
||||
const send = useMutation({
|
||||
// `sessionId` names the session the send went to: this surface outlives it.
|
||||
mutationFn: async ({ text, attachmentIds, clientMessageId, display, afterSwitch }: { text: string; attachmentIds?: string[]; clientMessageId?: string; display?: { text: string; content: ConversationContentSummary[] }; afterSwitch?: boolean; sessionId: string }) => {
|
||||
if (!cloud) throw new Error("Cloud session context is unavailable.");
|
||||
// `sessionId` and `orgId` name the session the send went to: this surface
|
||||
// outlives it, and a send that first restored an archived session can run
|
||||
// after another session was opened here.
|
||||
mutationFn: async ({ text, attachmentIds, clientMessageId, display, afterSwitch, sessionId, orgId }: { text: string; attachmentIds?: string[]; clientMessageId?: string; display?: { text: string; content: ConversationContentSummary[] }; afterSwitch?: boolean; sessionId: string; orgId?: string }) => {
|
||||
if (!cloud || !orgId) throw new Error("Cloud session context is unavailable.");
|
||||
// The picks, mode and composer lease below are the shown session's. A
|
||||
// message to a session no longer shown goes without them, and its worker
|
||||
// derives them from that session.
|
||||
const shown = sessionId === session.id && orgId === cloud.orgId;
|
||||
// A message sent with an agent switch goes to the new agent, which
|
||||
// starts on the model and effort the switch named: the old agent's
|
||||
// picks are not its.
|
||||
const selectedSettings: CloudTurnSettings = !afterSwitch && settingsRef.current.key === settingsKey ? settingsRef.current.settings : {};
|
||||
const selectedSettings: CloudTurnSettings = shown && !afterSwitch && settingsRef.current.key === settingsKey ? settingsRef.current.settings : {};
|
||||
// Without the user's pick the turn carries no approval mode: the
|
||||
// worker derives it from the session's mode. A pick the turn's model
|
||||
// cannot run is sent as the mode the composer shows in its place.
|
||||
@@ -1872,9 +1883,9 @@ export function CloudSessionChatSurface({
|
||||
? selectedSettings.approvalMode : undefined;
|
||||
const turnModel = listedModels.find((model) => model.id === (selectedSettings.model ?? pendingModel)) ?? listedModels.find((model) => model.default);
|
||||
const approvalMode = picked && (effectiveApprovalMode(session.provider, picked, modelApprovalModes(sessionApprovalModes, turnModel)) ?? picked);
|
||||
const mode = selectedSettings.executionMode === "plan" && modelsQuery.data?.modes?.includes("plan")
|
||||
const mode = !shown ? undefined : selectedSettings.executionMode === "plan" && modelsQuery.data?.modes?.includes("plan")
|
||||
? "read-only" : cloud.permissionMode;
|
||||
const composerEpoch = leaseRef.current.epoch;
|
||||
const composerEpoch = shown ? leaseRef.current.epoch : undefined;
|
||||
const request = {
|
||||
text,
|
||||
...(attachmentIds?.length ? { attachmentIds } : {}),
|
||||
@@ -1885,21 +1896,21 @@ export function CloudSessionChatSurface({
|
||||
...(composerEpoch !== undefined ? { composerEpoch } : {}),
|
||||
};
|
||||
const message = cloudMessageBody(text, display);
|
||||
if (!message.content) return client.sendSessionMessage(cloud.orgId, session.id, request, { idempotencyKey: clientMessageId });
|
||||
if (!message.content) return client.sendSessionMessage(orgId, sessionId, request, { idempotencyKey: clientMessageId });
|
||||
try {
|
||||
return await client.sendSessionMessage(cloud.orgId, session.id, { ...request, ...message }, { idempotencyKey: clientMessageId });
|
||||
return await client.sendSessionMessage(orgId, sessionId, { ...request, ...message }, { idempotencyKey: clientMessageId });
|
||||
} catch (error) {
|
||||
// A control plane from before message displays refuses the fields,
|
||||
// and one that finds the display text missing from the text refuses
|
||||
// it (both 400). The text already carries the quotes and captures,
|
||||
// so it goes as text alone, with the same key.
|
||||
if (!(error instanceof CloudCpError) || error.status !== 400) throw error;
|
||||
return client.sendSessionMessage(cloud.orgId, session.id, request, { idempotencyKey: clientMessageId });
|
||||
return client.sendSessionMessage(orgId, sessionId, request, { idempotencyKey: clientMessageId });
|
||||
}
|
||||
},
|
||||
onSuccess: (data, { sessionId }) => {
|
||||
// The send released the lease to whoever is next in line.
|
||||
leaseRef.current.sent();
|
||||
if (sessionId === session.id) leaseRef.current.sent();
|
||||
const sequence = data?.event?.sequence;
|
||||
if (typeof sequence === "number") {
|
||||
setAcceptedThrough((current) => (current[sessionId] ?? 0) >= sequence ? current : { ...current, [sessionId]: sequence });
|
||||
@@ -2458,7 +2469,11 @@ export function CloudSessionChatSurface({
|
||||
{live && <SharedComposerNotice live={live} lease={lease} userId={me} />}
|
||||
</>
|
||||
) : undefined}
|
||||
composerLockedPlaceholder={readOnly
|
||||
// Only the sharer's organization can restore it, and a message to an archived
|
||||
// session would wait unanswered, so a guest cannot send one whatever their role.
|
||||
composerLockedPlaceholder={session.isTerminated === true && cloud?.shared
|
||||
? appI18n.t("chat.shared.archived")
|
||||
: readOnly
|
||||
? appI18n.t(myRole === "viewer" ? "chat.shared.viewOnly" : "chat.shared.checkingAccess")
|
||||
// The attached notice already names the writer and the place in line.
|
||||
// An empty placeholder keeps the input locked without repeating it.
|
||||
@@ -2507,6 +2522,7 @@ export function CloudSessionChatSurface({
|
||||
const agentText = numbered ? message.text + formatNumberedAnnotations(excerpts ?? [], fileReferences) : excerpts?.length ? message.text + cloudExcerptText(excerpts, snapshot) : message.text;
|
||||
const sendMessage = (afterSwitch?: boolean) => send.mutateAsync({
|
||||
sessionId: session.id,
|
||||
orgId: cloud?.orgId,
|
||||
// A message of only files and captures or quotes starts with them.
|
||||
text: message.displayText === "" ? agentText.replace(/^\s+/, "") : agentText,
|
||||
attachmentIds: message.attachmentIds,
|
||||
@@ -2516,33 +2532,47 @@ export function CloudSessionChatSurface({
|
||||
});
|
||||
// A new message replaces an earlier switch's failure.
|
||||
setSwitchError(undefined);
|
||||
if (!pendingSwitch) return sendMessage();
|
||||
// The switch starts first; the message, sent while it runs, waits for
|
||||
// the new agent. Nothing was sent if the switch is refused, so the
|
||||
// draft stays and the pick is dropped.
|
||||
return cloudSwitch.start(pendingSwitch).then(
|
||||
() => {
|
||||
setChosenSwitch(undefined);
|
||||
if (cloud) {
|
||||
const targetKey = `cloud-chat-settings:${cloud.orgId}:${session.id}:${pendingSwitch.harness}`;
|
||||
rememberAgentSwitchPick(targetKey, pendingSwitch);
|
||||
// Settings held from an earlier spell on that agent (a switch back) are
|
||||
// stale now: drop them, so the agent's saved choice is read once it runs.
|
||||
setSelected((current) => current.key === targetKey ? { key: "", settings: {} } : current);
|
||||
}
|
||||
return sendMessage(true);
|
||||
},
|
||||
(error: unknown) => {
|
||||
setChosenSwitch(undefined);
|
||||
setSwitchError(error);
|
||||
throw Object.assign(apiErrorException(error), { code: AGENT_SWITCH_FAILED });
|
||||
},
|
||||
);
|
||||
const deliver = () => {
|
||||
if (!pendingSwitch) return sendMessage();
|
||||
// The switch starts first; the message, sent while it runs, waits for
|
||||
// the new agent. Nothing was sent if the switch is refused, so the
|
||||
// draft stays and the pick is dropped.
|
||||
return cloudSwitch.start(pendingSwitch).then(
|
||||
() => {
|
||||
setChosenSwitch(undefined);
|
||||
if (cloud) {
|
||||
const targetKey = `cloud-chat-settings:${cloud.orgId}:${session.id}:${pendingSwitch.harness}`;
|
||||
rememberAgentSwitchPick(targetKey, pendingSwitch);
|
||||
// Settings held from an earlier spell on that agent (a switch back) are
|
||||
// stale now: drop them, so the agent's saved choice is read once it runs.
|
||||
setSelected((current) => current.key === targetKey ? { key: "", settings: {} } : current);
|
||||
}
|
||||
return sendMessage(true);
|
||||
},
|
||||
(error: unknown) => {
|
||||
setChosenSwitch(undefined);
|
||||
setSwitchError(error);
|
||||
throw Object.assign(apiErrorException(error), { code: AGENT_SWITCH_FAILED });
|
||||
},
|
||||
);
|
||||
};
|
||||
// An archived session is restored by sending to it, as a local one is: the
|
||||
// message goes once the control plane took the restore, and none goes if it
|
||||
// refused. One shared from another organization is the sharer's to restore.
|
||||
if (session.isTerminated !== true || readOnly || cloud?.shared) return deliver();
|
||||
const restoring = session.id;
|
||||
setRestoringId(restoring);
|
||||
return restoreSession(restoring).then((restored) => {
|
||||
if (restored.status !== "success") {
|
||||
throw Object.assign(new Error(restored.message), { code: "SESSION_RESTORE_FAILED" });
|
||||
}
|
||||
return deliver();
|
||||
}).finally(() => setRestoringId((current) => current === restoring ? undefined : current));
|
||||
}}
|
||||
session={chatSession}
|
||||
settingsReady={!startStopped}
|
||||
onResumeAgent={workspaceFailure ? () => retryStart.mutate() : undefined}
|
||||
resumingAgent={retryStart.isPending}
|
||||
resumingAgent={retryStart.isPending || restoringId === session.id}
|
||||
resumeError={retryStart.error instanceof Error ? retryStart.error.message : undefined}
|
||||
sessionRole={session.kind}
|
||||
sessionTabAction={sessionTabAction}
|
||||
|
||||
@@ -98,11 +98,14 @@ const sideMocks = vi.hoisted(() => ({
|
||||
activeId: "existing-side" as string | undefined,
|
||||
attach: undefined as undefined | ((excerpt: ChatDraftExcerptReference) => Promise<void>),
|
||||
agentSwitch: undefined as AgentSwitchProps | undefined,
|
||||
stageAttachments: undefined as unknown,
|
||||
settingsReady: undefined as boolean | undefined,
|
||||
workspaceSend: undefined as
|
||||
| undefined
|
||||
| ((text: string, attachments: undefined, clientMessageId: string) => Promise<unknown>),
|
||||
sentOutsideTranscript: Symbol("chat.sentOutsideTranscript"),
|
||||
}));
|
||||
const stageAttachmentsMock = vi.hoisted(() => vi.fn());
|
||||
vi.mock("./IndependentSideChats", () => ({
|
||||
useIndependentSideChats: () => ({ ...sideMocks, panel: null }),
|
||||
}));
|
||||
@@ -151,7 +154,7 @@ vi.mock("../../hooks/useConversation", () => ({
|
||||
}),
|
||||
useConversationModels: vi.fn(() => ({ models: [], loaded: true })),
|
||||
useConversationSkills: vi.fn(() => ({ skills: [] })),
|
||||
useStageAttachments: () => undefined,
|
||||
useStageAttachments: () => stageAttachmentsMock,
|
||||
useWorkspaceFilePaths: () => ({ paths: workspacePathsState.paths, truncated: false }),
|
||||
}));
|
||||
|
||||
@@ -181,6 +184,8 @@ vi.mock("./ChatWorkspace", async () => {
|
||||
shellTarget,
|
||||
onAddToSideChat,
|
||||
onSend,
|
||||
onStageAttachments,
|
||||
settingsReady,
|
||||
composerNotice,
|
||||
importBlock,
|
||||
findRequest,
|
||||
@@ -188,6 +193,8 @@ vi.mock("./ChatWorkspace", async () => {
|
||||
}: {
|
||||
importBlock?: string;
|
||||
onSend: typeof sideMocks.workspaceSend;
|
||||
onStageAttachments?: unknown;
|
||||
settingsReady?: boolean;
|
||||
onAddToSideChat?: typeof sideMocks.attach;
|
||||
composerNotice?: ReactNode;
|
||||
findRequest?: { id: string; query: string; messageId?: string };
|
||||
@@ -210,6 +217,8 @@ vi.mock("./ChatWorkspace", async () => {
|
||||
shellTarget?: { handleId: string };
|
||||
}) => {
|
||||
sideMocks.workspaceSend = onSend;
|
||||
sideMocks.stageAttachments = onStageAttachments;
|
||||
sideMocks.settingsReady = settingsReady;
|
||||
sideMocks.attach = onAddToSideChat;
|
||||
sideMocks.agentSwitch = agentSwitch;
|
||||
const [mountedSessionId] = useState(snapshot.sessionId);
|
||||
@@ -300,6 +309,8 @@ beforeEach(() => {
|
||||
sideMocks.agentSwitch = undefined;
|
||||
sideMocks.activeId = "existing-side";
|
||||
sideMocks.attach = undefined;
|
||||
sideMocks.stageAttachments = undefined;
|
||||
sideMocks.settingsReady = undefined;
|
||||
clearCatalogsMock.mockReset();
|
||||
invalidateCatalogsMock.mockReset();
|
||||
conversationState.snapshot = { capabilities: [] };
|
||||
@@ -337,6 +348,24 @@ describe("SessionChatSurface recovery", () => {
|
||||
expect(conversationCommandArgs.at(-1)).toEqual([target.id, undefined, terminated, false, undefined]);
|
||||
});
|
||||
|
||||
it("takes files only once an archived session is back", () => {
|
||||
const client = new QueryClient();
|
||||
const view = render(<Wrapper client={client}><SessionChatSurface session={{ ...session, isTerminated: true }} /></Wrapper>);
|
||||
expect(sideMocks.stageAttachments).toBeUndefined();
|
||||
view.rerender(<Wrapper client={client}><SessionChatSurface session={session} /></Wrapper>);
|
||||
expect(sideMocks.stageAttachments).toEqual(expect.any(Function));
|
||||
});
|
||||
|
||||
it("shows an archived chat's saved settings before a message restores it", () => {
|
||||
conversationState.snapshot = { ...snapshotFor(session.id), controller: { state: "stopped" }, settings: { model: "gpt-5" } };
|
||||
const client = new QueryClient();
|
||||
const view = render(<Wrapper client={client}><SessionChatSurface session={session} /></Wrapper>);
|
||||
// A live session's stopped agent has no settings to show.
|
||||
expect(sideMocks.settingsReady).toBe(false);
|
||||
view.rerender(<Wrapper client={client}><SessionChatSurface session={{ ...session, isTerminated: true }} /></Wrapper>);
|
||||
expect(sideMocks.settingsReady).toBe(true);
|
||||
});
|
||||
|
||||
it("tells the commands which turn is active", () => {
|
||||
conversationState.snapshot = {
|
||||
capabilities: [],
|
||||
|
||||
@@ -385,6 +385,10 @@ export const SessionChatSurface = memo(function SessionChatSurface({
|
||||
// A sleeping, waking or reconnecting agent cannot report its settings yet; the bar shows the saved ones.
|
||||
const waking = snapshot?.harness === session.provider &&
|
||||
(snapshot.controller?.state === "hibernated" || snapshot.controller?.state === "connecting" || snapshot.controller?.state === "recovering");
|
||||
// An archived chat has no agent until a message restores it; meanwhile its bar
|
||||
// shows the saved settings too, as a sleeping one does.
|
||||
const archivedAgent = !sessionIsActive(session) && snapshot?.harness === session.provider && snapshot.controller?.state === "stopped";
|
||||
const savedSettingsOnly = waking || archivedAgent;
|
||||
const controllerCatalogsEnabled = !hostUnreachable && targetChatControllerReady && !controllerTransitioning && !newWorkDisabled;
|
||||
const configOptions = useConversationConfigOptions(
|
||||
session.id,
|
||||
@@ -610,7 +614,7 @@ export const SessionChatSurface = memo(function SessionChatSurface({
|
||||
const word = reveal.text.trim();
|
||||
if (word && reveal.find) openFind({ id: crypto.randomUUID(), query: word, messageId: reveal.messageId });
|
||||
}, [conversationShown, heldReveal, navigateToAnnotation, openFind, uiSessionId]);
|
||||
const settingsLoading = waking || Boolean(renderSnapshot && can(renderSnapshot, "config_options") && !configOptions.loaded && !configOptions.error);
|
||||
const settingsLoading = savedSettingsOnly || Boolean(renderSnapshot && can(renderSnapshot, "config_options") && !configOptions.loaded && !configOptions.error);
|
||||
// The model the running agent reports, kept so this chat names it at once the next time it loads.
|
||||
const liveModel = settingsLoading || !targetChatControllerReady || controllerTransitioning ? undefined
|
||||
: providerOptions.find((option) => option.category === "model" || option.id === "model")?.currentValue ?? snapshot?.settings?.model;
|
||||
@@ -641,7 +645,7 @@ export const SessionChatSurface = memo(function SessionChatSurface({
|
||||
|
||||
// Until the agent's own settings arrive the bar shows the saved ones, disabled. With
|
||||
// none saved yet it waits, so defaults never pass for the chat's own.
|
||||
const settingsReady = Boolean(renderSnapshot) && !optimisticChat && (targetChatControllerReady || agentResuming || waking) &&
|
||||
const settingsReady = Boolean(renderSnapshot) && !optimisticChat && (targetChatControllerReady || agentResuming || savedSettingsOnly) &&
|
||||
(!settingsLoading || Boolean(renderSnapshot?.settings?.model || renderSnapshot?.settings?.approvalMode));
|
||||
// The session's own settings have taken over; a later restart must not bring the launch chips back.
|
||||
useEffect(() => {
|
||||
@@ -933,7 +937,9 @@ export const SessionChatSurface = memo(function SessionChatSurface({
|
||||
filePathsTruncated={truncated}
|
||||
filePathsLoading={filePathsLoading}
|
||||
localEchos={localEchos}
|
||||
onStageAttachments={stageAttachments}
|
||||
// An archived session's worktree is gone until the restore its first message
|
||||
// runs, so files are taken once it is back, as an archived Cloud chat does.
|
||||
onStageAttachments={sessionIsActive(session) ? stageAttachments : undefined}
|
||||
nativeImages={can(renderSnapshot, "images")}
|
||||
// Gated on what the daemon advertises, so the control is never drawn for a
|
||||
// harness that cannot steer. The refusal check stays as a backstop: it
|
||||
|
||||
@@ -1604,6 +1604,119 @@ describe("controller recovery", () => {
|
||||
await waitFor(() => expect(result.current.resumeError).toBe("Unable to restore session"));
|
||||
apiErrorMessageMock.mockReset();
|
||||
});
|
||||
|
||||
describe("sending to an archived chat", () => {
|
||||
const RESTORE = "/api/v1/sessions/{sessionId}/restore";
|
||||
const MESSAGES = "/api/v1/sessions/{sessionId}/conversation/messages";
|
||||
const archived = { id: "ao-1", workspaceId: "project-1", isTerminated: true, status: "terminated" };
|
||||
function archivedClient() {
|
||||
const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } });
|
||||
queryClient.setQueryData(workspaceQueryKey, [{ id: "project-1", sessions: [archived] }]);
|
||||
return queryClient;
|
||||
}
|
||||
const archivedInCache = (queryClient: QueryClient) =>
|
||||
(queryClient.getQueryData(workspaceQueryKey) as { sessions: { isTerminated?: boolean }[] }[])[0]?.sessions[0]?.isTerminated;
|
||||
const paths = () => postMock.mock.calls.map(([path]) => path);
|
||||
const sentIds = () => postMock.mock.calls
|
||||
.filter(([path]) => path === MESSAGES)
|
||||
.map(([, request]) => (request as { body: { clientMessageId: string } }).body.clientMessageId);
|
||||
|
||||
it("shows the message at once, restores, then sends it once after the restore", async () => {
|
||||
const restored = deferred<{ data: object; error: undefined }>();
|
||||
postMock.mockImplementation((path: string) => path === RESTORE
|
||||
? restored.promise
|
||||
: Promise.resolve({ data: { turnId: "turn-1", state: "running" }, error: undefined }));
|
||||
const queryClient = archivedClient();
|
||||
const { result } = renderHook(() => useConversationCommands("ao-1", undefined, true), {
|
||||
wrapper: ({ children }) => <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>,
|
||||
});
|
||||
|
||||
let sending: Promise<unknown> = Promise.resolve();
|
||||
act(() => {
|
||||
sending = result.current.send({ text: "pick this up", clientMessageId: "m1" });
|
||||
});
|
||||
await waitFor(() => expect(result.current.localEchos.map((echo) => echo.clientMessageId)).toEqual(["m1"]));
|
||||
expect(result.current.localEchos[0]?.text).toBe("pick this up");
|
||||
expect(paths()).toEqual([RESTORE]);
|
||||
// Nothing marks it active before the daemon confirms the restore.
|
||||
expect(archivedInCache(queryClient)).toBe(true);
|
||||
// A second Enter while restoring cannot send the message twice.
|
||||
await expect(result.current.send({ text: "pick this up", clientMessageId: "m2" })).rejects.toThrow();
|
||||
|
||||
await act(async () => {
|
||||
restored.resolve({ data: {}, error: undefined });
|
||||
await sending;
|
||||
});
|
||||
expect(paths().filter((path) => path === RESTORE)).toHaveLength(1);
|
||||
expect(paths().indexOf(RESTORE)).toBeLessThan(paths().indexOf(MESSAGES));
|
||||
expect(sentIds()).toEqual(["m1"]);
|
||||
});
|
||||
|
||||
it("sends nothing and keeps the session archived when the restore fails", async () => {
|
||||
apiErrorMessageMock.mockImplementation((error: { message?: string }, fallback: string) => error?.message ?? fallback);
|
||||
postMock.mockResolvedValue({ data: undefined, error: { code: "WORKSPACE_RESTORE_FAILED", message: "Workspace restore failed" }, response: { status: 500 } });
|
||||
const queryClient = archivedClient();
|
||||
const { result } = renderHook(() => useConversationCommands("ao-1", undefined, true), {
|
||||
wrapper: ({ children }) => <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>,
|
||||
});
|
||||
|
||||
let failure: unknown;
|
||||
await act(async () => {
|
||||
failure = await result.current.send({ text: "keep me", clientMessageId: "m1" }).catch((error: unknown) => error);
|
||||
});
|
||||
expect(failure).toMatchObject({ code: "SESSION_RESTORE_FAILED", message: "Workspace restore failed" });
|
||||
expect(paths()).toEqual([RESTORE]);
|
||||
expect(result.current.localEchos).toEqual([]);
|
||||
expect(archivedInCache(queryClient)).toBe(true);
|
||||
|
||||
// The failed attempt released the session: sending again retries the restore.
|
||||
await act(async () => {
|
||||
await result.current.send({ text: "keep me", clientMessageId: "m2" }).catch(() => undefined);
|
||||
});
|
||||
expect(paths()).toEqual([RESTORE, RESTORE]);
|
||||
});
|
||||
|
||||
it("sends when another window restored the session first", async () => {
|
||||
postMock.mockImplementation((path: string) => Promise.resolve(path === RESTORE
|
||||
? { data: undefined, error: { code: "SESSION_NOT_RESTORABLE", message: "Session is not restorable" }, response: { status: 409 } }
|
||||
: { data: { turnId: "turn-1", state: "running" }, error: undefined }));
|
||||
const { result } = renderHook(() => useConversationCommands("ao-1", undefined, true), { wrapper });
|
||||
|
||||
await act(async () => {
|
||||
await result.current.send({ text: "already back", clientMessageId: "m1" });
|
||||
});
|
||||
expect(paths()).toEqual([RESTORE, MESSAGES]);
|
||||
expect(sentIds()).toEqual(["m1"]);
|
||||
});
|
||||
|
||||
it("retries an unanswered send after a restore with the same message id", async () => {
|
||||
let restores = 0;
|
||||
let sends = 0;
|
||||
postMock.mockImplementation((path: string) => {
|
||||
if (path === RESTORE) {
|
||||
restores += 1;
|
||||
// The first restore took; the session is live by the retry.
|
||||
return Promise.resolve(restores === 1
|
||||
? { data: {}, error: undefined }
|
||||
: { data: undefined, error: { code: "SESSION_NOT_RESTORABLE", message: "Session is not restorable" }, response: { status: 409 } });
|
||||
}
|
||||
sends += 1;
|
||||
// The first send's answer is lost; the daemon answers the retry as a duplicate.
|
||||
return sends === 1 ? Promise.reject(new TypeError("Failed to fetch")) : Promise.resolve({ data: { duplicate: true }, error: undefined });
|
||||
});
|
||||
const { result } = renderHook(() => useConversationCommands("ao-1", undefined, true), { wrapper });
|
||||
|
||||
await act(async () => {
|
||||
await expect(result.current.send({ text: "once", clientMessageId: "m1" })).rejects.toBeInstanceOf(TypeError);
|
||||
});
|
||||
await act(async () => {
|
||||
await result.current.send({ text: "once", clientMessageId: "m1" });
|
||||
});
|
||||
expect(paths()).toEqual([RESTORE, MESSAGES, RESTORE, MESSAGES]);
|
||||
expect(sentIds()).toEqual(["m1", "m1"]);
|
||||
expect(result.current.localEchos).toEqual([]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("useConversationSkills polling", () => {
|
||||
|
||||
@@ -211,6 +211,25 @@ function switchEcho(
|
||||
return display && targetHarness ? { ...display, targetHarness, afterSequence } : undefined;
|
||||
}
|
||||
|
||||
/** The message as the transcript shows it while its send is on the way. */
|
||||
function sendLocalEcho(clientMessageId: string, input: ConversationSendInput): ConversationLocalEcho {
|
||||
return {
|
||||
clientMessageId,
|
||||
text: input.text,
|
||||
continuation: input.continuation,
|
||||
fileReferences: input.fileReferences,
|
||||
excerpts: input.excerpts?.map((excerpt) => ({
|
||||
id: excerpt.id, order: excerpt.order, snapshot: excerpt.snapshot,
|
||||
conversationId: excerpt.conversationId,
|
||||
text: excerpt.text,
|
||||
comment: excerpt.comment,
|
||||
messageId: excerpt.messageId,
|
||||
revision: excerpt.revision,
|
||||
})),
|
||||
createdAt: new Date().toISOString(),
|
||||
};
|
||||
}
|
||||
|
||||
function addConversationLocalEcho(
|
||||
queryClient: QueryClient,
|
||||
targetSessionId: string,
|
||||
@@ -933,6 +952,9 @@ export function useProviderSwitchCommand(sessionId: string, hostId?: string) {
|
||||
});
|
||||
}
|
||||
|
||||
/** Restoring an archived session before its message failed, so the message never left. ChatComposer treats this code as a definitive refusal. */
|
||||
const SESSION_RESTORE_FAILED = "SESSION_RESTORE_FAILED";
|
||||
|
||||
/**
|
||||
* Commands against a conversation. Each refetches the snapshot on success.
|
||||
* `turnActive` and `activeTurnId` come from the caller's snapshot: reading the
|
||||
@@ -1009,19 +1031,7 @@ export function useConversationCommands(
|
||||
page.turns.some((turn) => turn.state === "running" || turn.state === "queued"),
|
||||
) ?? false;
|
||||
addConversationLocalEcho(queryClient, stateKey(variables.targetSessionId), {
|
||||
clientMessageId: variables.clientMessageId,
|
||||
text: variables.input.text,
|
||||
continuation: variables.input.continuation,
|
||||
fileReferences: variables.input.fileReferences,
|
||||
excerpts: variables.input.excerpts?.map((excerpt) => ({
|
||||
id: excerpt.id, order: excerpt.order, snapshot: excerpt.snapshot,
|
||||
conversationId: excerpt.conversationId,
|
||||
text: excerpt.text,
|
||||
comment: excerpt.comment,
|
||||
messageId: excerpt.messageId,
|
||||
revision: excerpt.revision,
|
||||
})),
|
||||
createdAt: new Date().toISOString(),
|
||||
...sendLocalEcho(variables.clientMessageId, variables.input),
|
||||
backgroundWake,
|
||||
queued: turnActive && !backgroundWake,
|
||||
providerSwitch: switchEcho(variables.input.switchDisplay, variables.input.providerSwitch?.targetHarness, newestCachedSequence(queryClient, variables.targetSessionId, hostId)),
|
||||
@@ -1221,10 +1231,14 @@ export function useConversationCommands(
|
||||
// also brings its worktree back, can start it again.
|
||||
if (terminated) {
|
||||
const restored = await restoreSession(sessionId as string, hostId);
|
||||
if (restored.status !== "success") throw new Error(restored.message);
|
||||
// Restored meanwhile from another window or device: it is live, as asked.
|
||||
const alreadyLive = restored.status === "error" && restored.code === "SESSION_NOT_RESTORABLE";
|
||||
if (restored.status !== "success" && !alreadyLive) {
|
||||
throw Object.assign(new Error(restored.message), { code: SESSION_RESTORE_FAILED });
|
||||
}
|
||||
// Stay pending until the chat reads the live agent: its cached snapshot
|
||||
// still says stopped, which would flash as a crash. The composer stays
|
||||
// locked meanwhile, so nothing here can strand a send.
|
||||
// still says stopped, which would flash as a crash. A send that restored
|
||||
// the session waits on this too, so it reaches the live agent.
|
||||
await invalidateSession(sessionId as string).catch(() => {});
|
||||
return undefined;
|
||||
}
|
||||
@@ -1657,11 +1671,21 @@ export function useConversationCommands(
|
||||
return Promise.reject(new Error("Conversation work is already being sent for this session."));
|
||||
}
|
||||
recordDirectWorkerInteraction(sessionId, "chat", "worker", hostId);
|
||||
return send.mutateAsync({
|
||||
targetSessionId: sessionId,
|
||||
clientMessageId,
|
||||
input: normalizedInput,
|
||||
});
|
||||
const variables = { targetSessionId: sessionId, clientMessageId, input: normalizedInput };
|
||||
if (!terminated) return send.mutateAsync(variables);
|
||||
// An archived chat is restored by sending to it. The message shows at once,
|
||||
// as any send's does, and goes out only after the restore succeeded, so it
|
||||
// lands after it. A failed restore sent nothing: the composer gets the draft
|
||||
// back with the reason, and the session stays archived.
|
||||
addConversationLocalEcho(queryClient, stateKey(sessionId), sendLocalEcho(clientMessageId, normalizedInput));
|
||||
return resume.mutateAsync().then(
|
||||
() => send.mutateAsync(variables),
|
||||
(error: unknown) => {
|
||||
releaseConversationDispatch(queryClient, stateKey(sessionId), clientMessageId);
|
||||
releaseConversationLocalEcho(queryClient, stateKey(sessionId), clientMessageId);
|
||||
throw error;
|
||||
},
|
||||
);
|
||||
},
|
||||
pendingAcceptedTurnId:
|
||||
trackedDispatch?.state === "accepted" ? trackedDispatch.turnId : undefined,
|
||||
|
||||
@@ -12,7 +12,10 @@ import type { WorkspaceSummary } from "../types/workspace";
|
||||
import { recordDirectWorkerInteraction } from "../lib/session-management-telemetry";
|
||||
|
||||
export type RestoreSessionResult =
|
||||
{ status: "success" } | { status: "not_resumable"; message: string } | { status: "error"; message: string };
|
||||
| { status: "success" }
|
||||
| { status: "not_resumable"; message: string }
|
||||
/** `code` is the daemon's error code, when it answered with one. */
|
||||
| { status: "error"; message: string; code?: string };
|
||||
|
||||
/**
|
||||
* A deleted cloud session stays in the cloud sessions listing (flagged
|
||||
@@ -93,7 +96,7 @@ export function useRestoreSession(): (sessionId: string, hostId?: string) => Pro
|
||||
if (code === "SESSION_NOT_RESUMABLE") {
|
||||
return { status: "not_resumable", message };
|
||||
}
|
||||
return { status: "error", message };
|
||||
return { status: "error", message, code };
|
||||
}
|
||||
await queryClient.invalidateQueries({ queryKey: workspaceQueryKeyForHost(hostId) });
|
||||
if (data?.restoreMode === "saved_prompt") {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"issueArtifact.confirm": "Zum Issue hinzufügen",
|
||||
"issueArtifact.confirmNumber": "Zu Issue #{{number}} hinzufügen",
|
||||
"issueArtifact.adding": "Wird hinzugefügt…",
|
||||
"chat.archived.placeholder": "Sende eine Nachricht, um diese Sitzung wiederherzustellen",
|
||||
"chat.draft.excerptTextLimit": "Der ausgewählte Text überschreitet 24 KiB. Wähle einen kürzeren Auszug.",
|
||||
"chat.draft.excerptSourceLimit": "Der erfasste Rohtext überschreitet 24 KiB. Wähle einen kürzeren Auszug.",
|
||||
"chat.draft.excerptMessageLimit": "Nachricht und Auszüge überschreiten die maximale Nachrichtengröße. Kürze die Nachricht oder entferne einen Auszug.",
|
||||
@@ -101,7 +102,6 @@
|
||||
"chat.excerpt.quoted": "„{{text}}“",
|
||||
"chat.removeAnnotation": "Remove annotation {{count}}",
|
||||
"chat.startup.queuePlaceholder": "Folgenachricht einreihen, während {{agent}} startet",
|
||||
"chat.archived.body": "Der Verlauf bleibt erhalten. Stellen Sie die Sitzung wieder her, um fortzufahren.",
|
||||
"chat.controller.openElsewhere": "Dieser Chat ist woanders geöffnet",
|
||||
"chat.controller.couldNotConnect": "Verbindung zum Agenten fehlgeschlagen",
|
||||
"chat.draft.openElsewhere": "Dieser Chat ist in einer anderen Claude Code-Sitzung geöffnet, etwa in einem Terminal oder einer IDE. Beende sie dort und sende deine Nachricht dann erneut.",
|
||||
@@ -110,7 +110,6 @@
|
||||
"chat.controller.openElsewhereCodex": "Codex kann einen geschlossenen Chat eine Weile behalten.",
|
||||
"chat.controller.retryBody": "Erneut versuchen, um diese Unterhaltung fortzusetzen.",
|
||||
"chat.controller.retry": "Erneut versuchen",
|
||||
"chat.archived.placeholder": "Stellen Sie die Sitzung wieder her, um fortzufahren",
|
||||
"chat.projectSetup.succeeded": "Setup erfolgreich",
|
||||
"chat.projectSetup.succeededIn": "Setup in {{duration}} erfolgreich",
|
||||
"chat.projectSetup.timedOut": "Setup-Schritt {{step}} hat das Zeitlimit überschritten",
|
||||
@@ -4581,6 +4580,7 @@
|
||||
"chat.fileAnnotationAmbiguous": "Selected code appears in more than one location.",
|
||||
"chat.fileAnnotationTruncated": "Source navigation is unavailable for a truncated selection.",
|
||||
"chat.fileAnnotationRetry": "Retry source check",
|
||||
"chat.shared.archived": "Nur der Eigentümer kann diese archivierte Sitzung wiederherstellen",
|
||||
"chat.shared.viewOnly": "Du kannst diese Sitzung ansehen, aber nicht an den Agenten schreiben",
|
||||
"chat.shared.lockedBy": "{{name}} schreibt an den Agenten",
|
||||
"chat.shared.someone": "Jemand",
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"issueArtifact.confirm": "Add to issue",
|
||||
"issueArtifact.confirmNumber": "Add to issue #{{number}}",
|
||||
"issueArtifact.adding": "Adding…",
|
||||
"chat.archived.placeholder": "Send a message to restore this session",
|
||||
"chat.draft.excerptTextLimit": "Selected text exceeds 24 KiB. Select a smaller excerpt.",
|
||||
"chat.draft.excerptSourceLimit": "Captured raw source exceeds 24 KiB. Select a smaller excerpt.",
|
||||
"chat.draft.excerptMessageLimit": "Message and captured excerpts exceed the message size limit. Shorten the message or remove an excerpt.",
|
||||
@@ -101,7 +102,6 @@
|
||||
"chat.excerpt.quoted": "“{{text}}”",
|
||||
"chat.removeAnnotation": "Remove annotation {{count}}",
|
||||
"chat.startup.queuePlaceholder": "Queue a follow-up while {{agent}} gets ready",
|
||||
"chat.archived.body": "History is kept. Restore the session to continue.",
|
||||
"chat.controller.openElsewhere": "This is open elsewhere",
|
||||
"chat.controller.couldNotConnect": "Could not connect to the agent",
|
||||
"chat.draft.openElsewhere": "This chat is open in another Claude Code session, such as a terminal or an IDE. Quit it there, then send your message again.",
|
||||
@@ -110,7 +110,6 @@
|
||||
"chat.controller.openElsewhereCodex": "Codex can keep a closed chat for a while.",
|
||||
"chat.controller.retryBody": "Retry to continue this conversation.",
|
||||
"chat.controller.retry": "Retry",
|
||||
"chat.archived.placeholder": "Restore the session to continue",
|
||||
"chat.projectSetup.succeeded": "Setup passed",
|
||||
"chat.projectSetup.succeededIn": "Setup passed in {{duration}}",
|
||||
"chat.projectSetup.timedOut": "Setup step {{step}} timed out",
|
||||
@@ -4564,6 +4563,7 @@
|
||||
"chat.fileAnnotationAmbiguous": "Selected code appears in more than one location.",
|
||||
"chat.fileAnnotationTruncated": "Source navigation is unavailable for a truncated selection.",
|
||||
"chat.fileAnnotationRetry": "Retry source check",
|
||||
"chat.shared.archived": "Only the owner can restore this archived session",
|
||||
"chat.shared.viewOnly": "You can view this session but not write to the agent",
|
||||
"chat.shared.lockedBy": "{{name}} is writing to the agent",
|
||||
"chat.shared.someone": "Someone",
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"issueArtifact.confirm": "Añadir a la incidencia",
|
||||
"issueArtifact.confirmNumber": "Añadir a la incidencia #{{number}}",
|
||||
"issueArtifact.adding": "Añadiendo…",
|
||||
"chat.archived.placeholder": "Envía un mensaje para restaurar esta sesión",
|
||||
"chat.draft.excerptTextLimit": "El texto seleccionado supera los 24 KiB. Selecciona un fragmento más corto.",
|
||||
"chat.draft.excerptSourceLimit": "El texto fuente capturado supera los 24 KiB. Selecciona un fragmento más corto.",
|
||||
"chat.draft.excerptMessageLimit": "El mensaje y los fragmentos superan el tamaño máximo. Acorta el mensaje o elimina un fragmento.",
|
||||
@@ -102,7 +103,6 @@
|
||||
"chat.excerpt.quoted": "«{{text}}»",
|
||||
"chat.removeAnnotation": "Remove annotation {{count}}",
|
||||
"chat.startup.queuePlaceholder": "Añade un mensaje mientras {{agent}} se prepara",
|
||||
"chat.archived.body": "El historial se conserva. Restaura la sesión para continuar.",
|
||||
"chat.controller.openElsewhere": "Está abierto en otro lugar",
|
||||
"chat.controller.couldNotConnect": "No se pudo conectar con el agente",
|
||||
"chat.draft.openElsewhere": "Este chat está abierto en otra sesión de Claude Code, como una terminal o un IDE. Ciérrala allí y vuelve a enviar tu mensaje.",
|
||||
@@ -111,7 +111,6 @@
|
||||
"chat.controller.openElsewhereCodex": "Codex puede conservar un chat cerrado durante un tiempo.",
|
||||
"chat.controller.retryBody": "Vuelve a intentarlo para continuar esta conversación.",
|
||||
"chat.controller.retry": "Reintentar",
|
||||
"chat.archived.placeholder": "Restaura la sesión para continuar",
|
||||
"chat.projectSetup.succeeded": "Configuración correcta",
|
||||
"chat.projectSetup.succeededIn": "Configuración correcta en {{duration}}",
|
||||
"chat.projectSetup.timedOut": "El paso {{step}} de configuración superó el tiempo límite",
|
||||
@@ -4696,6 +4695,7 @@
|
||||
"chat.fileAnnotationAmbiguous": "Selected code appears in more than one location.",
|
||||
"chat.fileAnnotationTruncated": "Source navigation is unavailable for a truncated selection.",
|
||||
"chat.fileAnnotationRetry": "Retry source check",
|
||||
"chat.shared.archived": "Solo el propietario puede restaurar esta sesión archivada",
|
||||
"chat.shared.viewOnly": "Puedes ver esta sesión, pero no escribir al agente",
|
||||
"chat.shared.lockedBy": "{{name}} está escribiendo al agente",
|
||||
"chat.shared.someone": "Alguien",
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"issueArtifact.confirm": "Ajouter au ticket",
|
||||
"issueArtifact.confirmNumber": "Ajouter au ticket nº {{number}}",
|
||||
"issueArtifact.adding": "Ajout en cours…",
|
||||
"chat.archived.placeholder": "Envoyez un message pour restaurer cette session",
|
||||
"chat.draft.excerptTextLimit": "Le texte sélectionné dépasse 24 Kio. Sélectionnez un extrait plus court.",
|
||||
"chat.draft.excerptSourceLimit": "La source brute capturée dépasse 24 Kio. Sélectionnez un extrait plus court.",
|
||||
"chat.draft.excerptMessageLimit": "Le message et les extraits dépassent la taille maximale. Raccourcissez le message ou retirez un extrait.",
|
||||
@@ -102,7 +103,6 @@
|
||||
"chat.excerpt.quoted": "« {{text}} »",
|
||||
"chat.removeAnnotation": "Remove annotation {{count}}",
|
||||
"chat.startup.queuePlaceholder": "Ajoutez un message pendant que {{agent}} se prépare",
|
||||
"chat.archived.body": "L'historique est conservé. Restaurez la session pour continuer.",
|
||||
"chat.controller.openElsewhere": "Ouverte ailleurs",
|
||||
"chat.controller.couldNotConnect": "Impossible de se connecter à l’agent",
|
||||
"chat.draft.openElsewhere": "Cette conversation est ouverte dans une autre session Claude Code, par exemple un terminal ou un IDE. Quittez-la là-bas, puis renvoyez votre message.",
|
||||
@@ -111,7 +111,6 @@
|
||||
"chat.controller.openElsewhereCodex": "Codex peut conserver une discussion fermée un moment.",
|
||||
"chat.controller.retryBody": "Réessayez pour poursuivre cette conversation.",
|
||||
"chat.controller.retry": "Réessayer",
|
||||
"chat.archived.placeholder": "Restaurez la session pour continuer",
|
||||
"chat.projectSetup.succeeded": "Configuration réussie",
|
||||
"chat.projectSetup.succeededIn": "Configuration réussie en {{duration}}",
|
||||
"chat.projectSetup.timedOut": "L'étape {{step}} de configuration a dépassé le délai",
|
||||
@@ -4696,6 +4695,7 @@
|
||||
"chat.fileAnnotationAmbiguous": "Selected code appears in more than one location.",
|
||||
"chat.fileAnnotationTruncated": "Source navigation is unavailable for a truncated selection.",
|
||||
"chat.fileAnnotationRetry": "Retry source check",
|
||||
"chat.shared.archived": "Seul le propriétaire peut restaurer cette session archivée",
|
||||
"chat.shared.viewOnly": "Vous pouvez voir cette session, mais pas écrire à l'agent",
|
||||
"chat.shared.lockedBy": "{{name}} écrit à l'agent",
|
||||
"chat.shared.someone": "Quelqu'un",
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"issueArtifact.confirm": "Issue に追加",
|
||||
"issueArtifact.confirmNumber": "Issue #{{number}} に追加",
|
||||
"issueArtifact.adding": "追加中…",
|
||||
"chat.archived.placeholder": "メッセージを送信するとこのセッションが復元されます",
|
||||
"chat.draft.excerptTextLimit": "選択したテキストが24 KiBを超えています。短い範囲を選択してください。",
|
||||
"chat.draft.excerptSourceLimit": "取得したソースが24 KiBを超えています。短い範囲を選択してください。",
|
||||
"chat.draft.excerptMessageLimit": "メッセージと抜粋がサイズ上限を超えています。メッセージを短くするか、抜粋を削除してください。",
|
||||
@@ -101,7 +102,6 @@
|
||||
"chat.excerpt.quoted": "「{{text}}」",
|
||||
"chat.removeAnnotation": "Remove annotation {{count}}",
|
||||
"chat.startup.queuePlaceholder": "{{agent}} の準備中にメッセージを追加できます",
|
||||
"chat.archived.body": "履歴は保持されています。続行するにはセッションを復元してください。",
|
||||
"chat.controller.openElsewhere": "別の場所で開かれています",
|
||||
"chat.controller.couldNotConnect": "エージェントに接続できませんでした",
|
||||
"chat.draft.openElsewhere": "このチャットは別の Claude Code セッション(ターミナルや IDE など)で開かれています。そちらで終了してから、もう一度メッセージを送信してください。",
|
||||
@@ -110,7 +110,6 @@
|
||||
"chat.controller.openElsewhereCodex": "Codex は閉じたチャットをしばらく保持することがあります。",
|
||||
"chat.controller.retryBody": "この会話を続けるには再試行してください。",
|
||||
"chat.controller.retry": "再試行",
|
||||
"chat.archived.placeholder": "続行するにはセッションを復元してください",
|
||||
"chat.projectSetup.succeeded": "セットアップに成功しました",
|
||||
"chat.projectSetup.succeededIn": "セットアップが {{duration}} で成功しました",
|
||||
"chat.projectSetup.timedOut": "セットアップのステップ {{step}} がタイムアウトしました",
|
||||
@@ -4581,6 +4580,7 @@
|
||||
"chat.fileAnnotationAmbiguous": "Selected code appears in more than one location.",
|
||||
"chat.fileAnnotationTruncated": "Source navigation is unavailable for a truncated selection.",
|
||||
"chat.fileAnnotationRetry": "Retry source check",
|
||||
"chat.shared.archived": "このアーカイブ済みセッションを復元できるのはオーナーのみです",
|
||||
"chat.shared.viewOnly": "このセッションは閲覧のみで、エージェントに書き込めません",
|
||||
"chat.shared.lockedBy": "{{name}} がエージェントに書き込み中です",
|
||||
"chat.shared.someone": "誰か",
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"issueArtifact.confirm": "이슈에 추가",
|
||||
"issueArtifact.confirmNumber": "이슈 #{{number}}에 추가",
|
||||
"issueArtifact.adding": "추가 중…",
|
||||
"chat.archived.placeholder": "메시지를 보내면 이 세션이 복원됩니다",
|
||||
"chat.draft.excerptTextLimit": "선택한 텍스트가 24 KiB를 초과합니다. 더 짧은 부분을 선택하세요.",
|
||||
"chat.draft.excerptSourceLimit": "캡처한 원문이 24 KiB를 초과합니다. 더 짧은 부분을 선택하세요.",
|
||||
"chat.draft.excerptMessageLimit": "메시지와 발췌문이 크기 제한을 초과합니다. 메시지를 줄이거나 발췌문을 삭제하세요.",
|
||||
@@ -101,7 +102,6 @@
|
||||
"chat.excerpt.quoted": "“{{text}}”",
|
||||
"chat.removeAnnotation": "Remove annotation {{count}}",
|
||||
"chat.startup.queuePlaceholder": "{{agent}} 준비 중에 다음 메시지를 대기열에 추가하세요",
|
||||
"chat.archived.body": "기록은 유지됩니다. 계속하려면 세션을 복원하세요.",
|
||||
"chat.controller.openElsewhere": "다른 곳에서 열려 있습니다",
|
||||
"chat.controller.couldNotConnect": "에이전트에 연결할 수 없습니다",
|
||||
"chat.draft.openElsewhere": "이 채팅은 터미널이나 IDE 같은 다른 Claude Code 세션에서 열려 있습니다. 그곳에서 종료한 다음 메시지를 다시 보내세요.",
|
||||
@@ -110,7 +110,6 @@
|
||||
"chat.controller.openElsewhereCodex": "Codex는 닫힌 채팅을 한동안 유지할 수 있습니다.",
|
||||
"chat.controller.retryBody": "이 대화를 계속하려면 다시 시도하세요.",
|
||||
"chat.controller.retry": "다시 시도",
|
||||
"chat.archived.placeholder": "계속하려면 세션을 복원하세요",
|
||||
"chat.projectSetup.succeeded": "설정에 성공했습니다",
|
||||
"chat.projectSetup.succeededIn": "설정이 {{duration}} 만에 성공했습니다",
|
||||
"chat.projectSetup.timedOut": "설정 {{step}}단계가 시간 초과되었습니다",
|
||||
@@ -4581,6 +4580,7 @@
|
||||
"chat.fileAnnotationAmbiguous": "Selected code appears in more than one location.",
|
||||
"chat.fileAnnotationTruncated": "Source navigation is unavailable for a truncated selection.",
|
||||
"chat.fileAnnotationRetry": "Retry source check",
|
||||
"chat.shared.archived": "보관된 이 세션은 소유자만 복원할 수 있습니다",
|
||||
"chat.shared.viewOnly": "이 세션을 볼 수 있지만 에이전트에게 쓸 수는 없습니다",
|
||||
"chat.shared.lockedBy": "{{name}} 님이 에이전트에게 쓰는 중입니다",
|
||||
"chat.shared.someone": "누군가",
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"issueArtifact.confirm": "Adicionar à issue",
|
||||
"issueArtifact.confirmNumber": "Adicionar à issue #{{number}}",
|
||||
"issueArtifact.adding": "Adicionando…",
|
||||
"chat.archived.placeholder": "Envie uma mensagem para restaurar esta sessão",
|
||||
"chat.draft.excerptTextLimit": "O texto selecionado excede 24 KiB. Selecione um trecho menor.",
|
||||
"chat.draft.excerptSourceLimit": "O texto-fonte capturado excede 24 KiB. Selecione um trecho menor.",
|
||||
"chat.draft.excerptMessageLimit": "A mensagem e os trechos excedem o tamanho máximo. Encurte a mensagem ou remova um trecho.",
|
||||
@@ -102,7 +103,6 @@
|
||||
"chat.excerpt.quoted": "“{{text}}”",
|
||||
"chat.removeAnnotation": "Remove annotation {{count}}",
|
||||
"chat.startup.queuePlaceholder": "Adicione uma mensagem enquanto {{agent}} se prepara",
|
||||
"chat.archived.body": "O histórico é mantido. Restaure a sessão para continuar.",
|
||||
"chat.controller.openElsewhere": "Está aberto em outro lugar",
|
||||
"chat.controller.couldNotConnect": "Não foi possível conectar ao agente",
|
||||
"chat.draft.openElsewhere": "Este chat está aberto em outra sessão do Claude Code, como um terminal ou uma IDE. Feche-a lá e envie sua mensagem novamente.",
|
||||
@@ -111,7 +111,6 @@
|
||||
"chat.controller.openElsewhereCodex": "O Codex pode manter um chat fechado por um tempo.",
|
||||
"chat.controller.retryBody": "Tente novamente para continuar esta conversa.",
|
||||
"chat.controller.retry": "Tentar novamente",
|
||||
"chat.archived.placeholder": "Restaure a sessão para continuar",
|
||||
"chat.projectSetup.succeeded": "Configuração bem-sucedida",
|
||||
"chat.projectSetup.succeededIn": "Configuração bem-sucedida em {{duration}}",
|
||||
"chat.projectSetup.timedOut": "A etapa {{step}} da configuração excedeu o tempo limite",
|
||||
@@ -4696,6 +4695,7 @@
|
||||
"chat.fileAnnotationAmbiguous": "Selected code appears in more than one location.",
|
||||
"chat.fileAnnotationTruncated": "Source navigation is unavailable for a truncated selection.",
|
||||
"chat.fileAnnotationRetry": "Retry source check",
|
||||
"chat.shared.archived": "Somente o proprietário pode restaurar esta sessão arquivada",
|
||||
"chat.shared.viewOnly": "Você pode ver esta sessão, mas não escrever para o agente",
|
||||
"chat.shared.lockedBy": "{{name}} está escrevendo para o agente",
|
||||
"chat.shared.someone": "Alguém",
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"issueArtifact.confirm": "Добавить в задачу",
|
||||
"issueArtifact.confirmNumber": "Добавить в задачу № {{number}}",
|
||||
"issueArtifact.adding": "Добавление…",
|
||||
"chat.archived.placeholder": "Отправьте сообщение, чтобы восстановить этот сеанс",
|
||||
"chat.draft.excerptTextLimit": "Выбранный текст превышает 24 КиБ. Выберите более короткий фрагмент.",
|
||||
"chat.draft.excerptSourceLimit": "Сохранённый исходный текст превышает 24 КиБ. Выберите более короткий фрагмент.",
|
||||
"chat.draft.excerptMessageLimit": "Сообщение и фрагменты превышают допустимый размер. Сократите сообщение или удалите фрагмент.",
|
||||
@@ -95,7 +96,6 @@
|
||||
"chat.excerpt.quoted": "«{{text}}»",
|
||||
"chat.removeAnnotation": "Удалить аннотацию {{count}}",
|
||||
"chat.startup.queuePlaceholder": "Добавьте следующее сообщение в очередь, пока {{agent}} готовится",
|
||||
"chat.archived.body": "История сохранена. Восстановите сессию, чтобы продолжить.",
|
||||
"chat.controller.openElsewhere": "Открыт в другом месте",
|
||||
"chat.controller.couldNotConnect": "Не удалось подключиться к агенту",
|
||||
"chat.draft.openElsewhere": "Этот чат открыт в другом сеансе Claude Code, например в терминале или IDE. Завершите его там, затем отправьте сообщение ещё раз.",
|
||||
@@ -104,7 +104,6 @@
|
||||
"chat.controller.openElsewhereCodex": "Codex может какое-то время удерживать закрытый чат.",
|
||||
"chat.controller.retryBody": "Повторите попытку, чтобы продолжить этот разговор.",
|
||||
"chat.controller.retry": "Повторить",
|
||||
"chat.archived.placeholder": "Восстановите сессию, чтобы продолжить",
|
||||
"chat.projectSetup.succeeded": "Подготовка выполнена",
|
||||
"chat.projectSetup.succeededIn": "Подготовка выполнена за {{duration}}",
|
||||
"chat.projectSetup.timedOut": "Превышено время ожидания шага подготовки {{step}}",
|
||||
@@ -4572,6 +4571,7 @@
|
||||
"chat.fileAnnotationAmbiguous": "Выделенный код найден в нескольких местах.",
|
||||
"chat.fileAnnotationTruncated": "Переход к источнику недоступен для обрезанного фрагмента.",
|
||||
"chat.fileAnnotationRetry": "Повторить проверку источника",
|
||||
"chat.shared.archived": "Восстановить этот архивный сеанс может только владелец",
|
||||
"chat.shared.viewOnly": "Вы можете просматривать эту сессию, но не писать агенту",
|
||||
"chat.shared.lockedBy": "{{name}} пишет агенту",
|
||||
"chat.shared.someone": "Кто-то",
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"issueArtifact.confirm": "Kayda ekle",
|
||||
"issueArtifact.confirmNumber": "#{{number}} numaralı kayda ekle",
|
||||
"issueArtifact.adding": "Ekleniyor…",
|
||||
"chat.archived.placeholder": "Bu oturumu geri yüklemek için bir mesaj gönderin",
|
||||
"chat.draft.excerptTextLimit": "Seçilen metin 24 KiB sınırını aşıyor. Daha kısa bir alıntı seçin.",
|
||||
"chat.draft.excerptSourceLimit": "Yakalanan ham kaynak 24 KiB sınırını aşıyor. Daha kısa bir alıntı seçin.",
|
||||
"chat.draft.excerptMessageLimit": "Mesaj ve yakalanan alıntılar mesaj boyutu sınırını aşıyor. Mesajı kısaltın veya bir alıntıyı kaldırın.",
|
||||
@@ -101,7 +102,6 @@
|
||||
"chat.excerpt.quoted": "“{{text}}”",
|
||||
"chat.removeAnnotation": "{{count}} numaralı açıklama notunu kaldır",
|
||||
"chat.startup.queuePlaceholder": "{{agent}} hazırlanırken sonraki mesajınızı sıraya ekleyin",
|
||||
"chat.archived.body": "Geçmiş saklanır. Devam etmek için oturumu geri yükleyin.",
|
||||
"chat.controller.openElsewhere": "Başka bir yerde açık",
|
||||
"chat.controller.couldNotConnect": "Aracıya bağlanılamadı",
|
||||
"chat.draft.openElsewhere": "Bu sohbet, terminal veya IDE gibi başka bir yerdeki Claude Code oturumunda açık. Orada kapatıp mesajınızı yeniden gönderin.",
|
||||
@@ -110,7 +110,6 @@
|
||||
"chat.controller.openElsewhereCodex": "Codex, kapatılmış bir sohbeti bir süre açık tutabilir.",
|
||||
"chat.controller.retryBody": "Bu sohbete devam etmek için yeniden deneyin.",
|
||||
"chat.controller.retry": "Yeniden dene",
|
||||
"chat.archived.placeholder": "Devam etmek için oturumu geri yükleyin",
|
||||
"chat.projectSetup.succeeded": "Kurulum başarılı",
|
||||
"chat.projectSetup.succeededIn": "Kurulum {{duration}} içinde tamamlandı",
|
||||
"chat.projectSetup.timedOut": "{{step}} numaralı kurulum adımı zaman aşımına uğradı",
|
||||
@@ -4564,6 +4563,7 @@
|
||||
"chat.fileAnnotationAmbiguous": "Seçili kod birden fazla konumda bulunuyor.",
|
||||
"chat.fileAnnotationTruncated": "Kısaltılmış bir seçim için kaynağa gidilemiyor.",
|
||||
"chat.fileAnnotationRetry": "Kaynak kontrolünü yeniden dene",
|
||||
"chat.shared.archived": "Bu arşivlenmiş oturumu yalnızca sahibi geri yükleyebilir",
|
||||
"chat.shared.viewOnly": "Bu oturumu görüntüleyebilirsiniz, ancak aracıya yazamazsınız",
|
||||
"chat.shared.lockedBy": "{{name}} aracıya yazıyor",
|
||||
"chat.shared.someone": "Birisi",
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"issueArtifact.confirm": "添加到议题",
|
||||
"issueArtifact.confirmNumber": "添加到议题 #{{number}}",
|
||||
"issueArtifact.adding": "正在添加…",
|
||||
"chat.archived.placeholder": "发送消息即可恢复此会话",
|
||||
"chat.draft.excerptTextLimit": "所选文本超过 24 KiB。请选择更短的片段。",
|
||||
"chat.draft.excerptSourceLimit": "捕获的原始内容超过 24 KiB。请选择更短的片段。",
|
||||
"chat.draft.excerptMessageLimit": "消息和摘录超过大小限制。请缩短消息或移除摘录。",
|
||||
@@ -101,7 +102,6 @@
|
||||
"chat.excerpt.quoted": "“{{text}}”",
|
||||
"chat.removeAnnotation": "Remove annotation {{count}}",
|
||||
"chat.startup.queuePlaceholder": "{{agent}} 准备期间可先排队发送消息",
|
||||
"chat.archived.body": "历史记录已保留。恢复会话以继续。",
|
||||
"chat.controller.openElsewhere": "已在其他地方打开",
|
||||
"chat.controller.couldNotConnect": "无法连接到代理",
|
||||
"chat.draft.openElsewhere": "此聊天已在另一个 Claude Code 会话中打开,例如终端或 IDE。请在那里退出,然后重新发送你的消息。",
|
||||
@@ -110,7 +110,6 @@
|
||||
"chat.controller.openElsewhereCodex": "Codex 可能会将已关闭的聊天保留一段时间。",
|
||||
"chat.controller.retryBody": "重试以继续此对话。",
|
||||
"chat.controller.retry": "重试",
|
||||
"chat.archived.placeholder": "恢复会话以继续",
|
||||
"chat.projectSetup.succeeded": "设置成功",
|
||||
"chat.projectSetup.succeededIn": "设置已在 {{duration}} 内成功",
|
||||
"chat.projectSetup.timedOut": "设置步骤 {{step}} 超时",
|
||||
@@ -4563,6 +4562,7 @@
|
||||
"chat.fileAnnotationAmbiguous": "Selected code appears in more than one location.",
|
||||
"chat.fileAnnotationTruncated": "Source navigation is unavailable for a truncated selection.",
|
||||
"chat.fileAnnotationRetry": "Retry source check",
|
||||
"chat.shared.archived": "只有所有者可以恢复此已归档会话",
|
||||
"chat.shared.viewOnly": "你可以查看此会话,但不能向智能体发送内容",
|
||||
"chat.shared.lockedBy": "{{name}} 正在向智能体输入",
|
||||
"chat.shared.someone": "有人",
|
||||
|
||||
Reference in new issue
Block a user