refactor(web): remove the dead right-panel and subagent-preview code
v0.1.1 replaced both surfaces: the session tray took the right panel's todo/tasks, and the in-place `?sub=` child view took the subagent preview. - delete `features/chat/side-panel.tsx` (nothing imported it since the tray landed) - delete `SubagentModal` and its private helpers (`SUB_BADGE`, `SUB_DOT`, `SubagentEntry`, `parseSubagentLines`, `SUB_ROLES`); the child view builds its timeline from the parent's entries instead of `subagent.read` - drop `chatCommands.readSubagent` (its only caller is gone) - drop the deprecated store slice `PreviewTarget` / `preview` / `setPreview`, including the session-migration re-key and the `PanelTab` alias - drop their exclusive CSS (`.sub-item*`, `.sub-preview*`, `.sub-steer`) and the 6 orphan catalog keys (chat.subagentTitle, chat.preview, chat.previewNote, chat.task, chat.currentSubagents, chat.steerRequired) - tests: remove the two SubagentModal cases and the preview/readSubagent expectations (295 tests, down from 297 — exactly the deleted cases) Verification: typecheck clean, vitest 295/295, vite build green, visual matrix 24/24 clean.
This commit is contained in:
1 parent
bcf50b516f
commit
3789394c85
12 files changed
+12
-653
No files matched your search
@@ -111,8 +111,6 @@ export const chatCommands = {
|
||||
steerSubagent: (sessionId: string, target: string, message: string): ChatCommand =>
|
||||
command("subagent.steer", sessionId, { target, message }),
|
||||
|
||||
readSubagent: (sessionId: string, target: string): ChatCommand =>
|
||||
command("subagent.read", sessionId, { target }),
|
||||
|
||||
stopTask: (sessionId: string, taskId: string): ChatCommand => command("task.stop", sessionId, { taskId }),
|
||||
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
import type { ModelRef, SessionState, Subagent, TaskItem, ThinkingLevel } from "@protocol/types";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import type { ModelRef, SessionState, TaskItem, ThinkingLevel } from "@protocol/types";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { RelativeTime } from "@/components/shared/relative-time";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Modal } from "@/components/ui/dialog";
|
||||
import { KV } from "@/components/ui/kv";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { toast } from "@/components/ui/toast";
|
||||
import { ApiError, errorI18nKey } from "@/lib/api";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { chatCommands, runCommand } from "./commands";
|
||||
import type { ModelGroup } from "./data";
|
||||
import { withCurrentModel } from "./data";
|
||||
import { formatDuration, THINKING_LEVELS } from "./format";
|
||||
import { flattenSubagents } from "./session-state";
|
||||
|
||||
function rec(value: unknown): Record<string, unknown> | undefined {
|
||||
return value && typeof value === "object" && !Array.isArray(value) ? (value as Record<string, unknown>) : undefined;
|
||||
@@ -195,230 +191,6 @@ export function DispatchModal({ open, session, models, onClose, onDispatch }: Di
|
||||
);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* subagent conversation (read-only tail + steer) */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
const SUB_BADGE: Record<Subagent["status"], { tone: "info" | "ok" | "err" | "warn" | "default"; key: string }> = {
|
||||
active: { tone: "info", key: "active" },
|
||||
completed: { tone: "ok", key: "completed" },
|
||||
failed: { tone: "err", key: "failed" },
|
||||
interrupted: { tone: "warn", key: "interrupted" },
|
||||
dormant: { tone: "default", key: "dormant" },
|
||||
};
|
||||
|
||||
const SUB_DOT: Record<Subagent["status"], string> = {
|
||||
active: "dot--busy",
|
||||
completed: "dot--ok",
|
||||
failed: "dot--err",
|
||||
interrupted: "dot--attention",
|
||||
dormant: "dot--exited",
|
||||
};
|
||||
|
||||
/**
|
||||
* One projected line of a sub-session file.
|
||||
*
|
||||
* `subagent.read` returns `{sessionFile, lines}` where each line is the plugin's
|
||||
* text projection of a raw pi entry (`"[12] user: please fix it"`, see
|
||||
* `pi.subsessions.read.project_entry`).
|
||||
*/
|
||||
export interface SubagentEntry {
|
||||
id: string;
|
||||
role: string;
|
||||
text: string;
|
||||
}
|
||||
|
||||
const SUB_ROLES = new Set(["user", "assistant", "system", "notice", "toolResult", "toolUse"]);
|
||||
|
||||
/** Parse `[<index>] <role>: <text>` back into role + text rows. */
|
||||
export function parseSubagentLines(lines: unknown): SubagentEntry[] {
|
||||
if (!Array.isArray(lines)) return [];
|
||||
const out: SubagentEntry[] = [];
|
||||
lines.forEach((value, position) => {
|
||||
const line = typeof value === "string" ? value : JSON.stringify(value);
|
||||
if (!line) return;
|
||||
const match = /^\[(\d+)\]\s*([A-Za-z_]+):\s?([\s\S]*)$/.exec(line);
|
||||
if (match && SUB_ROLES.has(match[2] ?? "")) {
|
||||
out.push({ id: `sub-${match[1]}`, role: match[2] ?? "system", text: match[3] ?? "" });
|
||||
return;
|
||||
}
|
||||
out.push({ id: `sub-line-${position}`, role: "system", text: line });
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
export interface SubagentModalProps {
|
||||
open: boolean;
|
||||
session: SessionState;
|
||||
subagent: Subagent | null;
|
||||
onClose: () => void;
|
||||
onBack: () => void;
|
||||
onSteer: (subagent: Subagent, message: string) => void;
|
||||
}
|
||||
|
||||
export function SubagentModal({ open, session, subagent, onClose, onBack, onSteer }: SubagentModalProps) {
|
||||
const { t } = useTranslation();
|
||||
const [steer, setSteer] = useState("");
|
||||
const [feed, setFeed] = useState<SubagentEntry[]>([]);
|
||||
const [sessionFile, setSessionFile] = useState<string | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const badge = subagent ? (SUB_BADGE[subagent.status] ?? { tone: "default" as const, key: subagent.status }) : null;
|
||||
|
||||
useEffect(() => {
|
||||
if (!open || !subagent) return;
|
||||
let cancelled = false;
|
||||
setFeed([]);
|
||||
setSessionFile(null);
|
||||
setError(null);
|
||||
setLoading(true);
|
||||
const target = subagent.name ?? subagent.id;
|
||||
void runCommand(chatCommands.readSubagent(session.sessionId, target))
|
||||
.then((response) => {
|
||||
if (cancelled) return;
|
||||
const raw = rec(response) ?? {};
|
||||
setSessionFile(str(raw.sessionFile) ?? null);
|
||||
setFeed(parseSubagentLines(raw.lines ?? raw.entries));
|
||||
})
|
||||
.catch((cause: unknown) => {
|
||||
if (cancelled) return;
|
||||
setError(commandErrorText(cause, t));
|
||||
})
|
||||
.finally(() => {
|
||||
if (!cancelled) setLoading(false);
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [open, session.sessionId, subagent, t]);
|
||||
|
||||
const children = useMemo(() => (subagent ? flattenSubagents(subagent.children) : []), [subagent]);
|
||||
|
||||
function sendSteer() {
|
||||
if (!steer.trim()) {
|
||||
toast.error(t("chat.steerRequired"));
|
||||
return;
|
||||
}
|
||||
if (subagent) onSteer(subagent, steer.trim());
|
||||
setSteer("");
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal
|
||||
open={open}
|
||||
onOpenChange={(next) => {
|
||||
if (!next) onClose();
|
||||
}}
|
||||
title={t("chat.subagentTitle", { name: subagent?.name ?? subagent?.id ?? "" })}
|
||||
size="wide"
|
||||
footer={
|
||||
<>
|
||||
<Button variant="ghost" onClick={onClose}>
|
||||
{t("common.close")}
|
||||
</Button>
|
||||
<Button variant="primary" onClick={onBack}>
|
||||
{t("chat.backToParent")}
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
{subagent ? (
|
||||
<div className="sub-preview">
|
||||
<div className="row">
|
||||
<span className={`dot ${SUB_DOT[subagent.status] ?? "dot--exited"}`} />
|
||||
{badge ? <Badge tone={badge.tone}>{t(`state.${badge.key}`)}</Badge> : null}
|
||||
<span className="muted mono truncate">{subagent.id}</span>
|
||||
</div>
|
||||
<div>
|
||||
<KV label={t("chat.task")}>{subagent.task ?? "—"}</KV>
|
||||
<KV label={t("chat.model")} mono>
|
||||
{subagent.model ?? "—"}
|
||||
{subagent.thinking ? ` · ${subagent.thinking}` : ""}
|
||||
</KV>
|
||||
<KV label={t("status.created")}>
|
||||
<RelativeTime ts={subagent.createdAt} />
|
||||
</KV>
|
||||
<KV label={t("status.lastActive")}>
|
||||
<RelativeTime ts={subagent.lastActiveAt} />
|
||||
</KV>
|
||||
</div>
|
||||
{children.length ? (
|
||||
<div className="stack">
|
||||
<div className="muted">{t("chat.currentSubagents", { n: children.length })}</div>
|
||||
{children.map(({ subagent: child, depth }) => (
|
||||
<div
|
||||
key={child.id}
|
||||
className="sub-item sub-item--nested"
|
||||
style={{ marginLeft: `${depth * 16}px` }}
|
||||
>
|
||||
<span className={`dot ${SUB_DOT[child.status] ?? "dot--exited"}`} />
|
||||
<span className="sub-item__main">
|
||||
<span className="sub-item__name truncate">{child.name ?? child.id}</span>
|
||||
<span className="sub-item__meta muted truncate">{child.model ?? "—"}</span>
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
<div className="sub-preview__feed" aria-label={t("chat.preview")}>
|
||||
{loading ? (
|
||||
<div className="row muted">
|
||||
<Spinner /> {t("chat.loading")}
|
||||
</div>
|
||||
) : error ? (
|
||||
<div className="msg__error" role="alert">
|
||||
<div className="msg__error-meta">
|
||||
<span className="who who--err">{t("chat.error")}</span>
|
||||
</div>
|
||||
<div className="msg__text">{error}</div>
|
||||
</div>
|
||||
) : feed.length ? (
|
||||
feed.map((entry) => (
|
||||
<article
|
||||
key={entry.id}
|
||||
className={cn("msg", `msg--${entry.role === "user" ? "user" : "assistant"}`)}
|
||||
data-entry-id={entry.id}
|
||||
data-role={entry.role}
|
||||
>
|
||||
<div className="msg__meta">
|
||||
<span className={cn("who", entry.role === "user" ? "who--user" : "who--agent")}>
|
||||
{entry.role}
|
||||
</span>
|
||||
<span className="muted msg__time mono">{entry.id}</span>
|
||||
</div>
|
||||
<div className="msg__text">{entry.text}</div>
|
||||
</article>
|
||||
))
|
||||
) : (
|
||||
<div className="muted">{t("chat.noOutput")}</div>
|
||||
)}
|
||||
</div>
|
||||
{sessionFile ? <div className="muted mono truncate">{sessionFile}</div> : null}
|
||||
<div className="muted sub-preview__note">{t("chat.previewNote")}</div>
|
||||
<div className="row sub-steer">
|
||||
<input
|
||||
className="input"
|
||||
value={steer}
|
||||
placeholder={t("chat.steerPlaceholder")}
|
||||
aria-label={t("chat.steer")}
|
||||
onChange={(event) => setSteer(event.target.value)}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === "Enter" && !event.nativeEvent.isComposing) {
|
||||
event.preventDefault();
|
||||
sendSteer();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button size="sm" onClick={sendSteer}>
|
||||
{t("chat.steer")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* task output */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
@@ -1,268 +0,0 @@
|
||||
/**
|
||||
* @deprecated v0.1.1 Chat IA v3 — the right panel is gone. Subagents live in the
|
||||
* session tree / child view, and Todo + Tasks moved to the anchored session tray
|
||||
* (`./session-tray.tsx`, triggered by the stream-head chips). This file is kept
|
||||
* only because it still typechecks against the store and other pages may import
|
||||
* it; nothing in the Chat page renders it any more. Delete once no importer
|
||||
* remains.
|
||||
*/
|
||||
import type { SessionState, Subagent, TaskItem } from "@protocol/types";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Icon } from "@/components/icons";
|
||||
import { Badge, type BadgeProps } from "@/components/ui/badge";
|
||||
import { Empty } from "@/components/ui/empty";
|
||||
import { Progress } from "@/components/ui/progress";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { StatusDot } from "@/components/ui/status-dot";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { TodoList } from "./blocks";
|
||||
import { formatDuration } from "./format";
|
||||
import { flattenSubagents } from "./session-state";
|
||||
import type { PanelTab } from "./store";
|
||||
|
||||
const SUB_BADGE: Record<string, { tone: BadgeProps["tone"]; label: string }> = {
|
||||
active: { tone: "info", label: "active" },
|
||||
completed: { tone: "ok", label: "completed" },
|
||||
failed: { tone: "err", label: "failed" },
|
||||
interrupted: { tone: "warn", label: "interrupted" },
|
||||
dormant: { tone: "default", label: "dormant" },
|
||||
};
|
||||
|
||||
function subagentStatus(status: Subagent["status"]) {
|
||||
return SUB_BADGE[status] ?? { tone: "default" as const, label: status };
|
||||
}
|
||||
|
||||
function taskDot(status: TaskItem["status"]): "busy" | "ok" | "err" | "idle" {
|
||||
if (status === "running") return "busy";
|
||||
if (status === "completed") return "ok";
|
||||
if (status === "failed") return "err";
|
||||
return "idle";
|
||||
}
|
||||
|
||||
export interface SidePanelProps {
|
||||
session: SessionState;
|
||||
/** Legacy three-tab vocabulary; the deprecated `subagents` tab is still accepted. */
|
||||
tab: PanelTab | "subagents";
|
||||
onTab: (tab: PanelTab | "subagents") => void;
|
||||
onDispatch: () => void;
|
||||
onOpenSubagent: (subagent: Subagent) => void;
|
||||
onOpenTask: (task: TaskItem) => void;
|
||||
onStopTask: (task: TaskItem) => void;
|
||||
onCloseDrawer?: () => void;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
/** Right panel: Subagents / Todo / Tasks (tabs + counts + empty states). */
|
||||
export function SidePanel({
|
||||
session,
|
||||
tab,
|
||||
onTab,
|
||||
onDispatch,
|
||||
onOpenSubagent,
|
||||
onOpenTask,
|
||||
onStopTask,
|
||||
onCloseDrawer,
|
||||
className,
|
||||
}: SidePanelProps) {
|
||||
const { t } = useTranslation();
|
||||
const subagents = flattenSubagents(session.subagents);
|
||||
const tasks = session.tasks;
|
||||
const tabs: { id: PanelTab | "subagents"; label: string; count: number }[] = [
|
||||
{ id: "subagents", label: t("chat.tabSubagents"), count: subagents.length },
|
||||
{ id: "todo", label: t("chat.tabTodo"), count: session.todos.length },
|
||||
{ id: "tasks", label: t("chat.tabTasks"), count: tasks.length },
|
||||
];
|
||||
|
||||
return (
|
||||
<div className={cn("panel-pane__inner", className)}>
|
||||
<div className="tabs panel-tabs" role="tablist" aria-label={t("chat.panel")}>
|
||||
{tabs.map((item) => (
|
||||
<button
|
||||
key={item.id}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={tab === item.id}
|
||||
className={cn("tab", tab === item.id && "active")}
|
||||
data-testid={`panel-tab-${item.id}`}
|
||||
onClick={() => onTab(item.id)}
|
||||
>
|
||||
{item.label}
|
||||
{item.count ? <span className="badge">{item.count}</span> : null}
|
||||
</button>
|
||||
))}
|
||||
<div className="spacer" />
|
||||
{onCloseDrawer ? (
|
||||
<button
|
||||
type="button"
|
||||
className="icon-btn panel-close"
|
||||
title={t("chat.closePanel")}
|
||||
aria-label={t("chat.closePanel")}
|
||||
onClick={onCloseDrawer}
|
||||
>
|
||||
<Icon name="x" />
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="panel-scroll">
|
||||
<div className="panel__body stack">
|
||||
{tab === "subagents" ? (
|
||||
<>
|
||||
<div className="row">
|
||||
<span className="muted grow">
|
||||
{t("chat.currentSubagents", { n: subagents.length })}
|
||||
</span>
|
||||
<button type="button" className="btn btn--sm btn--primary" onClick={onDispatch}>
|
||||
<Icon name="plus" />
|
||||
{t("chat.dispatch")}
|
||||
</button>
|
||||
</div>
|
||||
{subagents.length ? (
|
||||
<div className="stack">
|
||||
{subagents.map(({ subagent, depth }) => {
|
||||
const badge = subagentStatus(subagent.status);
|
||||
return (
|
||||
<div
|
||||
key={subagent.id}
|
||||
className={cn("sub-item", depth > 0 && "sub-item--nested")}
|
||||
style={depth ? { marginLeft: `${depth * 16}px` } : undefined}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onClick={() => onOpenSubagent(subagent)}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
event.preventDefault();
|
||||
onOpenSubagent(subagent);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
"dot",
|
||||
subagent.status === "active"
|
||||
? "dot--busy"
|
||||
: subagent.status === "completed"
|
||||
? "dot--ok"
|
||||
: subagent.status === "failed"
|
||||
? "dot--err"
|
||||
: subagent.status === "interrupted"
|
||||
? "dot--attention"
|
||||
: "dot--exited",
|
||||
)}
|
||||
/> <span className="sub-item__main">
|
||||
<span className="sub-item__name truncate">
|
||||
{subagent.name ?? subagent.id}
|
||||
</span>
|
||||
<span className="sub-item__meta muted truncate">
|
||||
{subagent.model ?? "—"}
|
||||
{subagent.thinking ? ` · ${subagent.thinking}` : ""}
|
||||
</span>
|
||||
</span>
|
||||
<Badge tone={badge.tone}>{t(`state.${badge.label}`)}</Badge>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<Empty
|
||||
icon={<Icon name="branch" />}
|
||||
title={t("chat.noSubagents")}
|
||||
description={t("chat.noSubagentsText")}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
) : null}
|
||||
|
||||
{tab === "todo" ? (
|
||||
session.todos.length ? (
|
||||
<>
|
||||
<div className="row">
|
||||
<span className="muted grow">
|
||||
{t("chat.progress", {
|
||||
done: session.todos.filter((item) => item.status === "completed").length,
|
||||
total: session.todos.length,
|
||||
})}
|
||||
</span>
|
||||
<Badge>{t("common.readonly")}</Badge>
|
||||
</div>
|
||||
<Progress
|
||||
value={session.todos.filter((item) => item.status === "completed").length}
|
||||
max={session.todos.length || 1}
|
||||
/>
|
||||
<TodoList items={session.todos} idPrefix="panel-todo" />
|
||||
<div className="muted panel__note">{t("chat.todoNote")}</div>
|
||||
</>
|
||||
) : (
|
||||
<Empty
|
||||
icon={<Icon name="todo" />}
|
||||
title={t("chat.noTodo")}
|
||||
description={t("chat.noTodoText")}
|
||||
/>
|
||||
)
|
||||
) : null}
|
||||
|
||||
{tab === "tasks" ? (
|
||||
tasks.length ? (
|
||||
tasks.map((task) => {
|
||||
const running = task.status === "running";
|
||||
const duration = running ? Date.now() - task.startTime : (task.durationMs ?? 0);
|
||||
return (
|
||||
<div
|
||||
key={task.id}
|
||||
className="task-item"
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
data-task-id={task.id}
|
||||
onClick={() => onOpenTask(task)}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
event.preventDefault();
|
||||
onOpenTask(task);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<StatusDot status={taskDot(task.status)} />
|
||||
<span className="grow">
|
||||
<span className="task-item__cmd mono truncate" title={task.command}>
|
||||
{task.command}
|
||||
</span>
|
||||
<span className="task-item__meta muted">
|
||||
{running ? <Spinner /> : null}
|
||||
<span>{formatDuration(duration)}</span>
|
||||
{task.exitCode != null ? (
|
||||
<Badge tone={task.exitCode === 0 ? "ok" : "err"}>
|
||||
{`exit ${task.exitCode}`}
|
||||
</Badge>
|
||||
) : (
|
||||
<span>{t(`state.${task.status}`)}</span>
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
{running ? (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn--sm btn--danger"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
onStopTask(task);
|
||||
}}
|
||||
>
|
||||
{t("common.stop")}
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
) : (
|
||||
<Empty
|
||||
icon={<Icon name="terminal" />}
|
||||
title={t("chat.noTasks")}
|
||||
description={t("chat.noTasksText")}
|
||||
/>
|
||||
)
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -11,12 +11,6 @@ import { prependUnique } from "@/lib/entry-projection";
|
||||
*/
|
||||
export type TrayTab = "todo" | "tasks";
|
||||
|
||||
/**
|
||||
* @deprecated v0.1.1 IA: the right panel is gone. Kept as an alias so callers
|
||||
* written against the panel still typecheck while they migrate to `TrayTab`.
|
||||
*/
|
||||
export type PanelTab = TrayTab;
|
||||
|
||||
/** localStorage key for the IA "active only" filter (default on). */
|
||||
export const ACTIVE_ONLY_KEY = "pi2-active-only";
|
||||
|
||||
@@ -69,16 +63,6 @@ export const EMPTY_HISTORY: HistoryState = {
|
||||
resyncToken: 0,
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated v0.1.1 replaced the "subagent preview modal" with the in-place
|
||||
* child view (`?sub=<id>` + `activeSubagentId`). The field is kept because the
|
||||
* session-id migration still re-keys it; the UI no longer reads it.
|
||||
*/
|
||||
export interface PreviewTarget {
|
||||
sessionId: string;
|
||||
subagentId: string;
|
||||
}
|
||||
|
||||
export interface ChatStore {
|
||||
history: Record<string, HistoryState>;
|
||||
/** Active tray tab (`todo` / `tasks`). */
|
||||
@@ -103,8 +87,6 @@ export interface ChatStore {
|
||||
wsMenuOpen: boolean;
|
||||
sending: { sessionId: string; text: string } | null;
|
||||
attachments: Attachment[];
|
||||
/** @deprecated see `PreviewTarget`. */
|
||||
preview: PreviewTarget | null;
|
||||
taskOutput: TaskItem | null;
|
||||
dispatchOpen: boolean;
|
||||
|
||||
@@ -129,8 +111,6 @@ export interface ChatStore {
|
||||
addAttachment: (attachment: Attachment) => void;
|
||||
removeAttachment: (id: string) => void;
|
||||
clearAttachments: () => void;
|
||||
/** @deprecated see `PreviewTarget`. */
|
||||
setPreview: (preview: PreviewTarget | null) => void;
|
||||
setTaskOutput: (task: TaskItem | null) => void;
|
||||
setDispatchOpen: (open: boolean) => void;
|
||||
|
||||
@@ -144,7 +124,7 @@ export interface ChatStore {
|
||||
/**
|
||||
* Re-key every per-session slice after the plugin migrates `tmp-N` → the
|
||||
* real id: history (so an in-flight prompt and its page are not lost),
|
||||
* the optimistic `sending` chip and the (deprecated) preview target.
|
||||
* and the optimistic `sending` chip.
|
||||
*/
|
||||
migrateSession: (from: string, to: string) => void;
|
||||
}
|
||||
@@ -172,7 +152,6 @@ export const useChatStore = create<ChatStore>((set) => ({
|
||||
wsMenuOpen: false,
|
||||
sending: null,
|
||||
attachments: [],
|
||||
preview: null,
|
||||
taskOutput: null,
|
||||
dispatchOpen: false,
|
||||
|
||||
@@ -211,7 +190,6 @@ export const useChatStore = create<ChatStore>((set) => ({
|
||||
addAttachment: (attachment) => set((state) => ({ attachments: [...state.attachments, attachment] })),
|
||||
removeAttachment: (id) => set((state) => ({ attachments: state.attachments.filter((item) => item.id !== id) })),
|
||||
clearAttachments: () => set({ attachments: [] }),
|
||||
setPreview: (preview) => set({ preview }),
|
||||
setTaskOutput: (taskOutput) => set({ taskOutput }),
|
||||
setDispatchOpen: (dispatchOpen) => set({ dispatchOpen }),
|
||||
|
||||
@@ -281,7 +259,6 @@ export const useChatStore = create<ChatStore>((set) => ({
|
||||
return {
|
||||
history,
|
||||
sending: state.sending?.sessionId === from ? { ...state.sending, sessionId: to } : state.sending,
|
||||
preview: state.preview?.sessionId === from ? { ...state.preview, sessionId: to } : state.preview,
|
||||
};
|
||||
}),
|
||||
}));
|
||||
@@ -39,7 +39,6 @@
|
||||
"chat.composerAria": "Message input",
|
||||
"chat.composerPlaceholder": "Message pi2…",
|
||||
"chat.contextUsage": "Context usage {used} of {window}",
|
||||
"chat.currentSubagents": "Subagents in this session · {n}",
|
||||
"chat.denied": "Request denied",
|
||||
"chat.deny": "Deny",
|
||||
"chat.details": "Arguments",
|
||||
@@ -172,8 +171,6 @@
|
||||
"chat.plan.snapshot": "Snapshot {time}",
|
||||
"chat.plan.title": "Plan",
|
||||
"chat.planAria": "View the todo plan",
|
||||
"chat.preview": "Read-only preview",
|
||||
"chat.previewNote": "Read-only preview · subagent messages are not written to the parent session",
|
||||
"chat.previewRunning": "Running…",
|
||||
"chat.previewSubagent": "Preview subagent",
|
||||
"chat.progress": "Progress {done}/{total}",
|
||||
@@ -229,7 +226,6 @@
|
||||
"chat.steer": "Steer",
|
||||
"chat.steerMode": "Steering mode: {mode}",
|
||||
"chat.steerPlaceholder": "Send a steer instruction to this subagent…",
|
||||
"chat.steerRequired": "Enter a steer instruction",
|
||||
"chat.steerSent": "Steer sent: {text}",
|
||||
"chat.stopTask": "Stop task",
|
||||
"chat.stopTaskText": "Stop background task \"{command}\"?",
|
||||
@@ -261,7 +257,6 @@
|
||||
"chat.subagentFilter": "Subagent filter",
|
||||
"chat.subagentName": "Subagent name",
|
||||
"chat.subagentNamePlaceholder": "e.g. ui-research",
|
||||
"chat.subagentTitle": "Subagent · {name}",
|
||||
"chat.subview.back": "Parent",
|
||||
"chat.subview.backTo": "Back to {name}",
|
||||
"chat.subview.copyId": "Copy subagent ID",
|
||||
@@ -282,7 +277,6 @@
|
||||
"chat.tabSubagents": "Subagents",
|
||||
"chat.tabTasks": "Tasks",
|
||||
"chat.tabTodo": "Todo",
|
||||
"chat.task": "Task",
|
||||
"chat.taskExitCode": "Exit code",
|
||||
"chat.taskLabel": "Task *",
|
||||
"chat.taskOutput": "Task output · {id}",
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
"chat.composerAria": "输入消息",
|
||||
"chat.composerPlaceholder": "给 pi2 发消息…",
|
||||
"chat.contextUsage": "上下文占用 {used} / {window}",
|
||||
"chat.currentSubagents": "当前 session 的子代理 · {n}",
|
||||
"chat.denied": "已拒绝该请求",
|
||||
"chat.deny": "拒绝",
|
||||
"chat.details": "参数详情",
|
||||
@@ -172,8 +171,6 @@
|
||||
"chat.plan.snapshot": "快照 {time}",
|
||||
"chat.plan.title": "计划",
|
||||
"chat.planAria": "查看待办计划",
|
||||
"chat.preview": "只读预览",
|
||||
"chat.previewNote": "只读预览 · 子代理对话不会写入父会话",
|
||||
"chat.previewRunning": "正在执行…",
|
||||
"chat.previewSubagent": "预览子代理",
|
||||
"chat.progress": "进度 {done}/{total}",
|
||||
@@ -229,7 +226,6 @@
|
||||
"chat.steer": "Steer",
|
||||
"chat.steerMode": "转向模式:{mode}",
|
||||
"chat.steerPlaceholder": "发送 steer 指令给该子代理…",
|
||||
"chat.steerRequired": "请输入 steer 指令",
|
||||
"chat.steerSent": "已发送 steer 指令:{text}",
|
||||
"chat.stopTask": "停止任务",
|
||||
"chat.stopTaskText": "确认停止后台任务「{command}」?",
|
||||
@@ -261,7 +257,6 @@
|
||||
"chat.subagentFilter": "子代理筛选",
|
||||
"chat.subagentName": "子代理名称",
|
||||
"chat.subagentNamePlaceholder": "例如 ui-research",
|
||||
"chat.subagentTitle": "子代理 · {name}",
|
||||
"chat.subview.back": "父级",
|
||||
"chat.subview.backTo": "返回 {name}",
|
||||
"chat.subview.copyId": "复制子代理 ID",
|
||||
@@ -282,7 +277,6 @@
|
||||
"chat.tabSubagents": "子代理",
|
||||
"chat.tabTasks": "任务",
|
||||
"chat.tabTodo": "待办",
|
||||
"chat.task": "任务",
|
||||
"chat.taskExitCode": "退出码",
|
||||
"chat.taskLabel": "任务 task *",
|
||||
"chat.taskOutput": "任务输出 · {id}",
|
||||
|
||||
@@ -935,33 +935,6 @@
|
||||
color: var(--warn);
|
||||
}
|
||||
|
||||
/* ---------- right panel: removed in v0.1.1(tray 取代;仅保留子代理条目样式) ---------- */
|
||||
.sub-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
padding: var(--space-2);
|
||||
border-radius: var(--radius);
|
||||
cursor: pointer;
|
||||
transition: background 0.15s ease;
|
||||
}
|
||||
.sub-item:hover {
|
||||
background: var(--accent);
|
||||
}
|
||||
.sub-item__main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.sub-item__name {
|
||||
font-size: 0.875rem;
|
||||
font-weight: 550;
|
||||
}
|
||||
.sub-item__meta {
|
||||
font-size: 0.6875rem;
|
||||
}
|
||||
|
||||
/* ---------- drawers(仅 <1000:会话树是抽屉) ---------- */
|
||||
.drawer-backdrop {
|
||||
position: fixed;
|
||||
@@ -1085,30 +1058,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- subagent preview modal ---------- */
|
||||
.sub-preview {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-3);
|
||||
}
|
||||
.sub-preview__feed {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-3);
|
||||
max-height: 38dvh;
|
||||
overflow-y: auto;
|
||||
padding: var(--space-3);
|
||||
border-radius: var(--radius);
|
||||
background: var(--background);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
.sub-preview__note {
|
||||
font-size: 0.6875rem;
|
||||
}
|
||||
.sub-steer {
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
/* ---------- attachment / dispatch ---------- */
|
||||
.drop-zone {
|
||||
display: flex;
|
||||
|
||||
Reference in new issue
Block a user