дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-03 16:51:16 +02:00
SessionEditor.tsx (about 3,500 lines) is split into modules under src/features/agents/session/: the status line, composer, stream, messages, tool entries, question form, changes pane, find bar, folds, process and working rows. The declarations move unchanged apart from their exports; SessionEditor.tsx keeps the task session shell. Changes main made to the session editor after the split was prepared (#3961, #4013, #4015) are carried into the modules that now hold that code. Co-authored-by: Mr0Bread <[email protected]>
23 рядки
810 B
TypeScript
23 рядки
810 B
TypeScript
import type { AgentEntry, AgentTask } from "@/bindings";
|
|
import { useEffect, useState } from "react";
|
|
import { useAgents } from "../store";
|
|
|
|
export function providerName(id: string) {
|
|
return useAgents.getState().providers.find((p) => p.id === id)?.name ?? id;
|
|
}
|
|
|
|
/** `Date.now()`, updated every `interval` ms. */
|
|
export function useNow(interval: number): number {
|
|
const [now, setNow] = useState(() => Date.now());
|
|
useEffect(() => {
|
|
const t = setInterval(() => setNow(Date.now()), interval);
|
|
return () => clearInterval(t);
|
|
}, [interval]);
|
|
return now;
|
|
}
|
|
|
|
export type UserEntry = Extract<AgentEntry, { type: "user" }>;
|
|
|
|
/** Agent-written titles with the task's own folder dropped from paths. */
|
|
export const shortTitle = (task: AgentTask, title: string) => title.replaceAll(`${task.cwd}/`, "");
|