fix(coding-agent): built-in tools work like extension tools

Export readToolDefinition / createReadToolDefinition and the equivalent built-in ToolDefinition APIs from @mariozechner/pi-coding-agent.
This commit is contained in:
Mario Zechner
2026-03-22 04:20:28 +01:00
parent 80f527ec22
commit 235b247f1f
32 changed files with 2594 additions and 1408 deletions

View File

@@ -1181,9 +1181,7 @@ export class InteractiveMode {
* Get a registered tool definition by name (for custom rendering).
*/
private getRegisteredToolDefinition(toolName: string) {
const tools = this.session.extensionRunner?.getAllRegisteredTools() ?? [];
const registeredTool = tools.find((t) => t.definition.name === toolName);
return registeredTool?.definition;
return this.session.getToolDefinition(toolName);
}
/**
@@ -2198,6 +2196,7 @@ export class InteractiveMode {
if (!this.pendingTools.has(content.id)) {
const component = new ToolExecutionComponent(
content.name,
content.id,
content.arguments,
{
showImages: this.settingsManager.getShowImages(),
@@ -2264,6 +2263,7 @@ export class InteractiveMode {
if (!component) {
component = new ToolExecutionComponent(
event.toolName,
event.toolCallId,
event.args,
{
showImages: this.settingsManager.getShowImages(),
@@ -2568,6 +2568,7 @@ export class InteractiveMode {
if (content.type === "toolCall") {
const component = new ToolExecutionComponent(
content.name,
content.id,
content.arguments,
{ showImages: this.settingsManager.getShowImages() },
this.getRegisteredToolDefinition(content.name),