дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-03 16:51:16 +02:00
feat(agents): show the command a tool call ran in the session UI (#6429)
A command tool call showed only the agent's own title ("Run command"). The timeline now keeps the command from the call's structured input (rawInput.command / rawInput.cmd, a string or an argv array, <shell> -c <script> unwrapped), and the session UI uses it as the row title, its tooltip and the $ line of the expanded terminal block, falling back to the output's $ line and then the title. Saved sessions without the field still load.
Closes #6428
Co-authored-by: xuejike <[email protected]>
Цей коміт міститься в:
1 джерело
e2a5a5db81
коміт
f64dbe65b4
7 files changed
+54
-9
No files matched your search
@@ -2799,7 +2799,9 @@ images?: AgentImage[];
|
||||
/** Text the tool reported (command output…), truncated. */
|
||||
output: string | null; diffs: AgentToolDiff[];
|
||||
/** When the call started and ended (ms since the epoch); `None` in tasks saved before. */
|
||||
startedMs?: number | null; endedMs?: number | null } | { type: "plan"; items: AgentPlanItem[] } |
|
||||
startedMs?: number | null; endedMs?: number | null;
|
||||
/** The command an `execute` call runs, from its structured input; `None` when the agent gave none. */
|
||||
command?: string | null } | { type: "plan"; items: AgentPlanItem[] } |
|
||||
/** A subagent the agent started: its own session, whose entries are listed separately. */
|
||||
{ type: "subagent";
|
||||
/** The subagent's session id. */
|
||||
|
||||
@@ -105,9 +105,12 @@ export const ToolEntry = memo(function ToolEntry({
|
||||
const took = toolDuration(entry);
|
||||
const run = entry.kind === "execute" ? toolRun(entry) : null;
|
||||
// Commands lose the `cd <dir> &&` agents start them with; another folder shows as a tag.
|
||||
// The structured command, when the agent sent one, names what ran better than a generic title ("Run command").
|
||||
const commandText = entry.kind === "execute" ? entry.command?.trim() || run?.command || null : null;
|
||||
const fullTitle = commandText ?? (entry.title || entry.kind);
|
||||
const { title, dir } =
|
||||
entry.kind === "execute"
|
||||
? commandTitle(task, entry.title || entry.kind)
|
||||
? commandTitle(task, fullTitle)
|
||||
: { title: shortTitle(task, entry.title || entry.kind), dir: null };
|
||||
// A title that already names the file ("Read pom.xml") needs no second link to it.
|
||||
const links =
|
||||
@@ -120,7 +123,7 @@ export const ToolEntry = memo(function ToolEntry({
|
||||
{basename(dir)}
|
||||
</span>
|
||||
)}
|
||||
<span className={styles.toolTitle} title={entry.title || entry.kind}>
|
||||
<span className={styles.toolTitle} title={fullTitle}>
|
||||
{title}
|
||||
</span>
|
||||
{links.map((path) => (
|
||||
@@ -194,12 +197,12 @@ export const ToolEntry = memo(function ToolEntry({
|
||||
</summary>
|
||||
}
|
||||
>
|
||||
{run?.command ? (
|
||||
{commandText ? (
|
||||
<div className={styles.terminalBlock}>
|
||||
<pre className={styles.terminalCommand}>
|
||||
<span className={styles.prompt}>$</span> {run.command}
|
||||
<span className={styles.prompt}>$</span> {commandText}
|
||||
</pre>
|
||||
{run.output && <pre className={styles.terminalOutput}>{run.output}</pre>}
|
||||
{run?.output && <pre className={styles.terminalOutput}>{run.output}</pre>}
|
||||
</div>
|
||||
) : (
|
||||
<pre className={styles.output}>{entry.output}</pre>
|
||||
|
||||
Reference in new issue
Заблокувати користувача