fix: support root execution and factory-registered tool lookup

- Replace --dangerously-skip-permissions with --allowedTools whitelist
  to support running Claude Code as root (root blocks the former flag)
- Fix /mcp/execute tool lookup for plugins that register tools via
  factory functions (e.g. padded-cell pcexec) where the global registry
  names array is empty — now falls back to instantiating factories and
  matching by returned tool name

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
zhi
2026-04-17 12:23:43 +00:00
parent 49af2129ae
commit e73a7ea049
2 changed files with 25 additions and 17 deletions

View File

@@ -98,7 +98,7 @@ export async function* dispatchToClaude(
workspace,
agentId = "",
resumeSessionId,
permissionMode = "bypassPermissions",
permissionMode = "default",
openclawTools,
bridgePort = 18800,
bridgeApiKey = "",
@@ -112,8 +112,7 @@ export async function* dispatchToClaude(
prompt,
"--output-format", "stream-json",
"--verbose",
"--permission-mode", permissionMode,
"--dangerously-skip-permissions",
"--allowedTools", "Bash Edit Write Read Glob Grep WebFetch WebSearch NotebookEdit Monitor TodoWrite mcp__openclaw__*",
];
// --append-system-prompt appends to Claude Code's built-in system prompt rather