Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

feat: add threads

Gus20cf5dffce9e
diff --git a/src/web/src/components/agent-chat/agent-chat-view.tsx b/src/web/src/components/agent-chat/agent-chat-view.tsx
index 2c4cb8cc4..4ccd731d4 100644
--- a/src/web/src/components/agent-chat/agent-chat-view.tsx
+++ b/src/web/src/components/agent-chat/agent-chat-view.tsx
@@ -353,6 +353,16 @@ export function AgentChatView() {
.then(setStepCounts)
.catch(() => {});
}
+ const task = await getTask(scrollToTaskId, workspaceId).catch(() => null);
+ if (task && !["completed", "failed", "cancelled", "superseded"].includes(task.status)) {
+ setActiveTask(task);
+ const tmsgs = await getTaskMessages(scrollToTaskId, workspaceId).catch(() => [] as TaskMessage[]);
+ setTaskMessages(tmsgs);
+ if (tmsgs.length > 0) {
+ lastSeqRef.current = Math.max(...tmsgs.map((m) => m.seq));
+ }
+ startPollingRef.current(task.id, targetConvId, lastSeqRef.current);
+ }
} catch {
const data = await chatInit(agentId, workspaceId, activeChannel);
setConversation(data.conversation);
diff --git a/src/web/src/components/app-sidebar.tsx b/src/web/src/components/app-sidebar.tsx
index fd7a3fcb8..f000448e5 100644
--- a/src/web/src/components/app-sidebar.tsx
+++ b/src/web/src/components/app-sidebar.tsx
@@ -207,7 +207,7 @@ export function AppSidebar({ onNavigate }: { onNavigate?: () => void } = {}) {
return (
<nav className="flex h-full w-14 flex-col items-center pt-1 pb-2 gap-0.5">
{/* Top — logo as Home link */}
- <div className="pb-1.5 border-b border-border/50 mb-1">
+ <div className="pb-1.5 mb-1">
<div
className="flex shrink-0 items-center justify-center size-8 cursor-pointer [&>button]:pointer-events-none"
onClick={() => { router.push(`${prefix}/home`); onNavigate?.(); }}
@@ -216,6 +216,26 @@ export function AppSidebar({ onNavigate }: { onNavigate?: () => void } = {}) {
</div>
</div>
+ {/* Threads */}
+ <div className="pb-1.5 border-b border-border/50 mb-1">
+ <Tooltip>
+ <TooltipTrigger render={
+ <button
+ type="button"
+ onClick={() => { router.push(`${prefix}/traces`); onNavigate?.(); }}
+ className={cn(
+ "flex items-center justify-center size-10 rounded-xl transition-colors duration-200 cursor-pointer",
+ "bg-primary text-primary-foreground hover:bg-primary/80",
+ isTraces && "ring-2 ring-primary/50"
+ )}
+ />
+ }>
+ <GitBranch className="size-4" />
+ </TooltipTrigger>
+ <TooltipContent side="right">Threads</TooltipContent>
+ </Tooltip>
+ </div>
+
{/* Agent avatars */}
<div className="flex flex-1 w-full flex-col items-center gap-1.5 overflow-y-auto py-1 scrollbar-none">
{loading ? (
@@ -307,23 +327,6 @@ export function AppSidebar({ onNavigate }: { onNavigate?: () => void } = {}) {
<TooltipContent side="right">Calendar</TooltipContent>
</Tooltip>
- <Tooltip>
- <TooltipTrigger render={
- <button
- type="button"
- onClick={() => { router.push(`${prefix}/traces`); onNavigate?.(); }}
- className={cn(
- "flex items-center justify-center size-10 rounded-xl transition-colors duration-200 cursor-pointer",
- "text-muted-foreground hover:text-foreground hover:bg-accent",
- isTraces && "bg-accent text-foreground"
- )}
- />
- }>
- <GitBranch className="size-4" />
- </TooltipTrigger>
- <TooltipContent side="right">Traces</TooltipContent>
- </Tooltip>
-
<Tooltip>
<TooltipTrigger render={
<button
diff --git a/src/web/src/components/channel-bar.tsx b/src/web/src/components/channel-bar.tsx
index 332f6768c..f4e974acc 100644
--- a/src/web/src/components/channel-bar.tsx
+++ b/src/web/src/components/channel-bar.tsx
@@ -265,11 +265,17 @@ function RenameInput({
}) {
const ref = useRef<HTMLInputElement>(null);
const savedRef = useRef(false);
+ const readyRef = useRef(false);
const [value, setValue] = useState(currentName);
useEffect(() => {
- ref.current?.focus();
- ref.current?.select();
+ // Delay focus so the ContextMenu finishes its close transition first
+ const id = requestAnimationFrame(() => {
+ ref.current?.focus();
+ ref.current?.select();
+ readyRef.current = true;
+ });
+ return () => cancelAnimationFrame(id);
}, []);
const handleSubmit = useCallback(() => {
@@ -291,7 +297,7 @@ function RenameInput({
if (e.key === "Enter") handleSubmit();
if (e.key === "Escape") onCancel();
}}
- onBlur={() => { if (!savedRef.current) onCancel(); }}
+ onBlur={() => { if (readyRef.current && !savedRef.current) onCancel(); }}
className="h-5 w-24 px-1.5 rounded-md text-[11px] bg-transparent border border-input focus:border-ring focus:ring-2 focus:ring-ring/50 outline-none shrink-0"
/>
);