Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
fix: task stream lagging
Gus0cf831764239
diff --git a/.env.example b/.env.exampleindex 4f7213712..397857e26 100644--- a/.env.example+++ b/.env.example@@ -90,7 +90,7 @@# ALOOK_MESSAGE_BATCH_SIZE=20# Message flush interval — max time before a partial batch is sent (ms)-# ALOOK_MESSAGE_FLUSH_INTERVAL_MS=2000+# ALOOK_MESSAGE_FLUSH_INTERVAL_MS=100# Time (seconds) before a dispatched task is considered stale and failed# ALOOK_STALE_DISPATCH_TIMEOUT_S=20diff --git a/src/cli/daemon/session-runner.ts b/src/cli/daemon/session-runner.tsindex 90134cee9..49ec51bc7 100644--- a/src/cli/daemon/session-runner.ts+++ b/src/cli/daemon/session-runner.ts@@ -72,7 +72,7 @@ export async function runSession(input: SessionRunnerInput): Promise<void> {}[] = [];let seq = 0;const BATCH_SIZE = Number(process.env.ALOOK_MESSAGE_BATCH_SIZE) || 20;- const FLUSH_INTERVAL_MS = Number(process.env.ALOOK_MESSAGE_FLUSH_INTERVAL_MS) || 2000;+ const FLUSH_INTERVAL_MS = Number(process.env.ALOOK_MESSAGE_FLUSH_INTERVAL_MS) || 100;const flushMessages = async () => {if (pendingMessages.length === 0) return;diff --git a/src/web/src/components/agent-chat/agent-chat-view.tsx b/src/web/src/components/agent-chat/agent-chat-view.tsxindex 77981ac1b..066c04c12 100644--- a/src/web/src/components/agent-chat/agent-chat-view.tsx+++ b/src/web/src/components/agent-chat/agent-chat-view.tsx@@ -48,7 +48,10 @@ export function AgentChatView() {const [conversation, setConversation] = useState<Conversation | null>(null);const [messages, setMessages] = useState<Message[]>([]);- const [input, setInput] = useState("");+ const [input, setInput] = useState(() => {+ if (typeof window === "undefined") return "";+ return localStorage.getItem(`chat-draft:${agentId}`) ?? "";+ });const [sending, setSending] = useState(false);const [activeTask, setActiveTask] = useState<Task | null>(null);const [taskMessages, setTaskMessages] = useState<TaskMessage[]>([]);@@ -66,6 +69,15 @@ export function AgentChatView() {const isNearBottom = useRef(true);const startPollingRef = useRef<(taskId: string, conversationId: string, initialSeq?: number) => void>(null!);+ useEffect(() => {+ const key = `chat-draft:${agentId}`;+ if (input) {+ localStorage.setItem(key, input);+ } else {+ localStorage.removeItem(key);+ }+ }, [input, agentId]);+const scrollToBottom = useCallback(() => {isNearBottom.current = true;setTimeout(() => {@@ -118,11 +130,11 @@ export function AgentChatView() {}}, [loading, messages.length]);- // Auto-scroll as new task steps arrive while running+ // Auto-scroll when task badge appears or new task steps arriveconst taskStatus = activeTask?.status;useEffect(() => {const isRunning = taskStatus === "running" || taskStatus === "queued";- if (isRunning && taskMessages.length > 0 && isNearBottom.current) {+ if (isRunning && isNearBottom.current) {scrollToBottom();}}, [taskMessages.length, taskStatus, scrollToBottom]);@@ -466,7 +478,7 @@ export function AgentChatView() {className={cn("field-sizing-content w-full resize-none bg-transparent px-3.5 pt-2.5 text-base outline-none","placeholder:text-muted-foreground disabled:cursor-not-allowed",- "min-h-[38px] max-h-[200px]"+ "min-h-[38px] max-h-[200px] thin-scrollbar")}/><div className="flex items-center justify-end px-2 pb-2 pt-0.5">