agentHost: make file paths in tool invocation messages nicer#310813
agentHost: make file paths in tool invocation messages nicer#310813connor4312 merged 1 commit intomainfrom
Conversation
Does proper markdown linking
| * as a clickable file widget in the chat UI. | ||
| */ | ||
| function formatPathAsMarkdownLink(path: string): string { | ||
| return `[](${URI.file(path).toString()})`; |
There was a problem hiding this comment.
I think this should be on the client side, not the agent host
There was a problem hiding this comment.
Pull request overview
Updates Agent Host/Copilot tool messaging to support richer rendering (notably file “pills” via markdown links) and consolidates permission-request display logic alongside existing tool display helpers.
Changes:
- Switch tool invocation/past-tense messages to return
StringOrMarkdownand render file paths as[](file://...)links for clickable file widgets. - Move/centralize SDK permission request display derivation into
copilotToolDisplay.ts(including typed request helpers). - Update
IAgentToolStartEvent.invocationMessagetoStringOrMarkdownto align with protocol/tool UI rendering.
Show a summary per file
| File | Description |
|---|---|
| src/vs/platform/agentHost/node/copilot/copilotToolDisplay.ts | Adds markdown-link formatting for file paths; returns StringOrMarkdown; introduces permission display helpers. |
| src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts | Consumes the new permission display helper and propagates permissionPath from it. |
| src/vs/platform/agentHost/common/agentService.ts | Changes tool_start invocationMessage type to StringOrMarkdown. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 1
| return { | ||
| confirmationTitle: serverName ? `${serverName}: ${title}` : title, | ||
| invocationMessage: serverName ? `${serverName}: ${title}` : title, |
There was a problem hiding this comment.
The MCP permission title/message is built with a template literal (e.g. ${serverName}: ${title}), which bypasses localization and violates the repo’s pattern of using localize() with placeholders for user-facing strings. Please format this via a localized string (e.g. localize('…', "{0}: {1}", serverName, title)) and reuse it for both confirmationTitle and invocationMessage to keep them consistent.
| return { | |
| confirmationTitle: serverName ? `${serverName}: ${title}` : title, | |
| invocationMessage: serverName ? `${serverName}: ${title}` : title, | |
| const message = serverName ? localize('copilot.permission.mcp.serverAndTool', "{0}: {1}", serverName, title) : title; | |
| return { | |
| confirmationTitle: message, | |
| invocationMessage: message, |
Does proper markdown linking