fix: pass custom tools via customTools parameter to pi-coding-agent SDK
The SDK's tools parameter only accepts built-in tools (read, bash, edit, write). Custom clawdbot tools (browser, canvas, nodes, cron, etc.) were being filtered out, causing 'Tool not found' errors at runtime. Split tools into built-in and custom, passing them via the correct parameters.
This commit is contained in:
committed by
Peter Steinberger
parent
ec26ad81be
commit
110e2255c4
@@ -409,6 +409,11 @@ export async function runEmbeddedPiAgent(params: {
|
|||||||
agentDir,
|
agentDir,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Split tools into built-in (recognized by pi-coding-agent SDK) and custom (clawdbot-specific)
|
||||||
|
const builtInToolNames = new Set(["read", "bash", "edit", "write"]);
|
||||||
|
const builtInTools = tools.filter((t) => builtInToolNames.has(t.name));
|
||||||
|
const customTools = tools.filter((t) => !builtInToolNames.has(t.name));
|
||||||
|
|
||||||
const { session } = await createAgentSession({
|
const { session } = await createAgentSession({
|
||||||
cwd: resolvedWorkspace,
|
cwd: resolvedWorkspace,
|
||||||
agentDir,
|
agentDir,
|
||||||
@@ -417,8 +422,10 @@ export async function runEmbeddedPiAgent(params: {
|
|||||||
model,
|
model,
|
||||||
thinkingLevel,
|
thinkingLevel,
|
||||||
systemPrompt,
|
systemPrompt,
|
||||||
// Custom tool set: extra bash/process + read image sanitization.
|
// Built-in tools recognized by pi-coding-agent SDK
|
||||||
tools,
|
tools: builtInTools,
|
||||||
|
// Custom clawdbot tools (browser, canvas, nodes, cron, etc.)
|
||||||
|
customTools,
|
||||||
sessionManager,
|
sessionManager,
|
||||||
settingsManager,
|
settingsManager,
|
||||||
skills: promptSkills,
|
skills: promptSkills,
|
||||||
|
|||||||
Reference in New Issue
Block a user