diff --git a/backend/agent/gemini_prompt.py b/backend/agent/gemini_prompt.py index b1bbfb25..69b239cf 100644 --- a/backend/agent/gemini_prompt.py +++ b/backend/agent/gemini_prompt.py @@ -543,13 +543,16 @@ For casual conversation and social interactions: ## 7.3 ATTACHMENT PROTOCOL - **CRITICAL: ALL VISUALIZATIONS MUST BE ATTACHED:** * When using the 'ask' tool , ALWAYS attach ALL visualizations, markdown files, charts, graphs, reports, and any viewable content created + * **MANDATORY RULE: If you have created ANY files during this conversation, you MUST include them as attachments when using the ask tool** * This includes but is not limited to: HTML files, PDF documents, markdown files, images, data visualizations, presentations, reports, dashboards, and UI mockups + * **NEVER use the ask tool without attachments if you have created files** - this is a critical error * NEVER mention a visualization or viewable content without attaching it * If you've created multiple visualizations, attach ALL of them * Always make visualizations available to the user BEFORE marking tasks as complete * For web applications or interactive content, always attach the main HTML file * When creating data analysis results, charts must be attached, not just described * Remember: If the user should SEE it, you must ATTACH it with the 'ask' tool + * **EXAMPLE: If you create files like main.py, README.md, config.json, notes.txt, you MUST use: ** * Verify that ALL visual outputs have been attached before proceeding - **Attachment Checklist:** @@ -562,7 +565,7 @@ For casual conversation and social interactions: * Analysis results with visual components * UI designs and mockups * Any file intended for user viewing or interaction - + * **ANY FILES CREATED DURING THE CONVERSATION - ALWAYS ATTACH THEM** # 8. COMPLETION PROTOCOLS diff --git a/backend/agent/tools/message_tool.py b/backend/agent/tools/message_tool.py index 6b07e437..eef3ef59 100644 --- a/backend/agent/tools/message_tool.py +++ b/backend/agent/tools/message_tool.py @@ -1,5 +1,6 @@ from typing import List, Optional, Union from agentpress.tool import Tool, ToolResult, openapi_schema, xml_schema +from utils.logger import logger class MessageTool(Tool): """Tool for user communication and interaction. @@ -68,11 +69,11 @@ This information will help me make sure the cake meets your expectations for the Returns: ToolResult indicating the question was successfully sent """ - try: + try: # Convert single attachment to list for consistent handling if attachments and isinstance(attachments, str): attachments = [attachments] - + return self.success_response({"status": "Awaiting user response..."}) except Exception as e: return self.fail_response(f"Error asking user: {str(e)}") diff --git a/backend/agent/tools/sb_deploy_tool.py b/backend/agent/tools/sb_deploy_tool.py index bbd0d3e2..5c52f394 100644 --- a/backend/agent/tools/sb_deploy_tool.py +++ b/backend/agent/tools/sb_deploy_tool.py @@ -107,7 +107,8 @@ class SandboxDeployTool(SandboxToolsBase): npx wrangler pages deploy {full_path} --project-name {project_name}))''' # Execute the command directly using the sandbox's process.exec method - response = self.sandbox.process.exec(deploy_cmd, timeout=300) + response = self.sandbox.process.exec(f"/bin/sh -c \"{deploy_cmd}\"", + timeout=300) print(f"Deployment command output: {response.result}") diff --git a/frontend/src/components/thread/tool-views/ask-tool/AskToolView.tsx b/frontend/src/components/thread/tool-views/ask-tool/AskToolView.tsx index ee924e3d..18e77db8 100644 --- a/frontend/src/components/thread/tool-views/ask-tool/AskToolView.tsx +++ b/frontend/src/components/thread/tool-views/ask-tool/AskToolView.tsx @@ -35,7 +35,7 @@ export function AskToolView({ onFileClick, project, }: AskToolViewProps) { - + const { text, attachments, @@ -190,12 +190,7 @@ export function AskToolView({ })} - {actualAssistantTimestamp && ( -
- - {formatTimestamp(actualAssistantTimestamp)} -
- )} + ) : (
diff --git a/frontend/src/components/thread/tool-views/command-tool/CommandToolView.tsx b/frontend/src/components/thread/tool-views/command-tool/CommandToolView.tsx index 34f79d48..ae9ad6b1 100644 --- a/frontend/src/components/thread/tool-views/command-tool/CommandToolView.tsx +++ b/frontend/src/components/thread/tool-views/command-tool/CommandToolView.tsx @@ -68,16 +68,16 @@ export function CommandToolView({ } } catch (e) { } - + processedOutput = String(processedOutput); processedOutput = processedOutput.replace(/\\\\/g, '\\'); - + processedOutput = processedOutput .replace(/\\n/g, '\n') .replace(/\\t/g, '\t') .replace(/\\"/g, '"') .replace(/\\'/g, "'"); - + processedOutput = processedOutput.replace(/\\u([0-9a-fA-F]{4})/g, (match, group) => { return String.fromCharCode(parseInt(group, 16)); }); @@ -102,13 +102,13 @@ export function CommandToolView({
- + {!isStreaming && ( - @@ -117,8 +117,8 @@ export function CommandToolView({ ) : ( )} - {actualIsSuccess ? - (name === 'check-command-output' ? 'Output retrieved successfully' : 'Command executed successfully') : + {actualIsSuccess ? + (name === 'check-command-output' ? 'Output retrieved successfully' : 'Command executed successfully') : (name === 'check-command-output' ? 'Failed to retrieve output' : 'Command failed') } @@ -128,7 +128,7 @@ export function CommandToolView({ {isStreaming ? ( -
-
-
- - {displayLabel} - {sessionName && cwd && ( - - {cwd} - - )} -
-
- {displayPrefix} - {displayText} -
-
+ {output && (
-
-

- - Output -

-
- {completed !== null && ( - - {completed ? 'Completed' : 'Running'} - - )} - {exitCode !== null && ( - - {exitCode === 0 ? 'Success' : `Exit ${exitCode}`} - - )} -
-
- + +
@@ -201,8 +161,8 @@ export function CommandToolView({
                         {linesToShow.map((line, index) => (
-                          
{line || ' '} @@ -218,7 +178,7 @@ export function CommandToolView({
)} - + {!output && !isStreaming && (
@@ -238,7 +198,7 @@ export function CommandToolView({ {name === 'check-command-output' ? 'No Session Found' : 'No Command Found'}

- {name === 'check-command-output' + {name === 'check-command-output' ? 'No session name was detected. Please provide a valid session name to check.' : 'No command was detected. Please provide a valid command to execute.' } @@ -246,7 +206,7 @@ export function CommandToolView({

)} - +
{!isStreaming && displayText && ( @@ -256,7 +216,7 @@ export function CommandToolView({ )}
- +
{actualToolTimestamp && !isStreaming