fix: refactor tool execution to use generateText with proper tool handling
Major changes: - Fixed package executor URL protocol handling (add https:// if missing) - Switched from streamText to generateText for proper tool execution - AI now calls tool AND generates natural language response - Tool results no longer show raw JSON metadata Tool executor (tool-executor-agent.ts): - Use generateText() instead of streamText() for tool execution - Add system prompt to guide AI to summarize tool results - Return result.text for natural language output - Tool definition uses inputSchema (AI SDK v6 format) Package executor: - Add getSandboxUrl() to ensure URL has https:// protocol - Fixes "Failed to parse URL" error in production 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ac8f6d239c
commit
fce4eece1a
2 changed files with 36 additions and 75 deletions
|
|
@ -6,7 +6,18 @@
|
|||
import type { ExecutionResult, ExecutorOptions } from './types.js';
|
||||
|
||||
const DEFAULT_TIMEOUT = 10000; // 10 seconds
|
||||
const SANDBOX_URL = process.env.SANDBOX_EXECUTOR_URL || 'http://localhost:3000';
|
||||
|
||||
// Ensure URL has protocol
|
||||
function getSandboxUrl(): string {
|
||||
const url = process.env.SANDBOX_EXECUTOR_URL || 'http://localhost:3000';
|
||||
// If URL doesn't start with http:// or https://, add https://
|
||||
if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
||||
return `https://${url}`;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
const SANDBOX_URL = getSandboxUrl();
|
||||
|
||||
/**
|
||||
* Execute a package function with parameters via remote sandbox
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue