fix(coding-agent): remove process-cwd tool singletons and use tool-name allowlists

- switch SDK/CLI tool selection to name-based allowlists
- apply allowlists across built-in, extension, and SDK tools
- remove ambient process.cwd defaults from core tooling and resource helpers
- update tests, examples, and TUI callers for explicit cwd plumbing
- add regression coverage for extension tool filtering

closes #3452
closes #2835
This commit is contained in:
Mario Zechner
2026-04-20 21:57:31 +02:00
parent 27c1544839
commit 5a4e22ea44
42 changed files with 254 additions and 201 deletions

View File

@@ -1,6 +1,6 @@
import { Box, type Component, Container, getCapabilities, Image, Spacer, Text, type TUI } from "@mariozechner/pi-tui";
import type { ToolDefinition, ToolRenderContext } from "../../../core/extensions/types.js";
import { allToolDefinitions } from "../../../core/tools/index.js";
import { createAllToolDefinitions, type ToolName } from "../../../core/tools/index.js";
import { getTextOutput as getRenderedTextOutput } from "../../../core/tools/render-utils.js";
import { convertToPng } from "../../../utils/image-convert.js";
import { theme } from "../theme/theme.js";
@@ -45,14 +45,14 @@ export class ToolExecutionComponent extends Container {
options: ToolExecutionOptions = {},
toolDefinition: ToolDefinition<any, any> | undefined,
ui: TUI,
cwd: string = process.cwd(),
cwd: string,
) {
super();
this.toolName = toolName;
this.toolCallId = toolCallId;
this.args = args;
this.toolDefinition = toolDefinition;
this.builtInToolDefinition = allToolDefinitions[toolName as keyof typeof allToolDefinitions];
this.builtInToolDefinition = createAllToolDefinitions(cwd)[toolName as ToolName];
this.showImages = options.showImages ?? true;
this.ui = ui;
this.cwd = cwd;