feat: display command details in tool call permission requests

This commit is contained in:
RAIT-09 2026-01-31 13:12:03 +09:00
parent e764c215af
commit c8f5cc7dbe
5 changed files with 41 additions and 1 deletions

View file

@ -985,6 +985,9 @@ export class AcpAdapter implements IAgentClient, IAcpClient {
kind: update.kind ?? undefined,
content: AcpTypeConverter.toToolCallContent(update.content),
locations: update.locations ?? undefined,
rawInput: update.rawInput as
| { [k: string]: unknown }
| undefined,
});
break;
}
@ -1196,6 +1199,9 @@ export class AcpAdapter implements IAgentClient, IAcpClient {
content: AcpTypeConverter.toToolCallContent(
toolCallInfo?.content as acp.ToolCallContent[] | undefined,
),
rawInput: toolCallInfo?.rawInput as
| { [k: string]: unknown }
| undefined,
permissionRequest: permissionRequestData,
});

View file

@ -34,7 +34,7 @@ export function ToolCallRenderer({
toolCallId,
permissionRequest,
locations,
// rawInput,
rawInput,
content: toolContent,
} = content;
@ -102,6 +102,18 @@ export function ToolCallRenderer({
)}
{title}
</div>
{kind === "execute" &&
rawInput &&
typeof rawInput.command === "string" && (
<div className="agent-client-message-tool-call-command">
<code>
{rawInput.command}
{Array.isArray(rawInput.args) &&
rawInput.args.length > 0 &&
` ${(rawInput.args as string[]).join(" ")}`}
</code>
</div>
)}
{locations && locations.length > 0 && (
<div className="agent-client-message-tool-call-locations">
{locations.map((loc, idx) => (

View file

@ -75,6 +75,7 @@ export interface ToolCall extends SessionUpdateBase {
kind?: ToolKind;
content?: ToolCallContent[];
locations?: ToolCallLocation[];
rawInput?: { [k: string]: unknown };
permissionRequest?: {
requestId: string;
options: PermissionOption[];
@ -97,6 +98,7 @@ export interface ToolCallUpdate extends SessionUpdateBase {
kind?: ToolKind;
content?: ToolCallContent[];
locations?: ToolCallLocation[];
rawInput?: { [k: string]: unknown };
permissionRequest?: {
requestId: string;
options: PermissionOption[];

View file

@ -185,6 +185,11 @@ function mergeToolCallContent(
update.locations !== undefined
? update.locations
: existing.locations,
rawInput:
update.rawInput !== undefined &&
Object.keys(update.rawInput).length > 0
? update.rawInput
: existing.rawInput,
permissionRequest:
update.permissionRequest !== undefined
? update.permissionRequest
@ -466,6 +471,7 @@ export function useChat(
kind: update.kind,
content: update.content,
locations: update.locations,
rawInput: update.rawInput,
permissionRequest: update.permissionRequest,
});
break;

View file

@ -184,6 +184,20 @@ If your plugin does not need CSS, delete this file.
font-size: 0.9em;
}
.agent-client-message-tool-call-command {
color: var(--text-muted);
margin: 4px 0;
}
.agent-client-message-tool-call-command code {
display: block;
font-family: var(--font-monospace);
font-size: 0.9em;
background: var(--background-secondary);
padding: 2px 6px;
border-radius: 3px;
}
.agent-client-message-tool-call-status {
color: var(--text-muted);
user-select: text;