mirror of
https://github.com/rait-09/obsidian-agent-client.git
synced 2026-07-22 16:30:32 +00:00
feat: display command details in tool call permission requests
This commit is contained in:
parent
e764c215af
commit
c8f5cc7dbe
5 changed files with 41 additions and 1 deletions
|
|
@ -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,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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) => (
|
||||
|
|
|
|||
|
|
@ -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[];
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
14
styles.css
14
styles.css
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue