diff --git a/backend/app/services/flowpilot_engine.py b/backend/app/services/flowpilot_engine.py index e97c36b9..a2c4c6a0 100644 --- a/backend/app/services/flowpilot_engine.py +++ b/backend/app/services/flowpilot_engine.py @@ -48,7 +48,7 @@ Your response MUST be a valid JSON object with one of these shapes: {"type": "question", "content": "Brief description", "reasoning": "Internal why", "context_message": "Shown to engineer", "options": [{"label": "Human text", "value": "machine_value", "followup_hint": "or null"}], "allow_free_text": true, "allow_skip": true, "confidence": 0.65} 2. Suggested action: -{"type": "action", "content": "What to do", "reasoning": "Internal why", "context_message": "Here's what to try", "action_type": "instruction | script_generation | verification | info_request", "expected_outcome": "What success looks like", "confidence": 0.78} +{"type": "action", "content": "What to do", "reasoning": "Internal why", "context_message": "Here's what to try", "action_type": "instruction | script_generation | verification | info_request | open_script_builder", "expected_outcome": "What success looks like", "confidence": 0.78} 3. Resolution suggestion: {"type": "resolution_suggestion", "content": "Summary of what we did", "reasoning": "Internal why", "resolution_summary": "Issue was caused by X, fixed by Y", "confidence": 0.92, "follow_up_recommendations": ["Monitor for 24 hours"]}\ @@ -76,6 +76,7 @@ Every response must have a "type" field: "question", "action", or "resolution_su - confidence is a float 0.0-1.0 reflecting how certain you are about the diagnosis path - When multiple symptoms point to one root cause with >90% confidence, suggest resolution - If you detect the engineer needs a PowerShell script, suggest a script_generation action +- When the engineer needs a custom script that doesn't match an existing template, suggest opening the Script Builder. Use action_type "open_script_builder" with a "script_prompt" field containing a clear description of what the script should do, and a "script_language" field (powershell, bash, or python). - Never suggest restarting or rebooting as a first step — diagnose first - Be specific: "Check Event Viewer > System > source NTFS" not "check the logs" diff --git a/frontend/src/components/flowpilot/FlowPilotStepCard.tsx b/frontend/src/components/flowpilot/FlowPilotStepCard.tsx index b74b4458..86405c5d 100644 --- a/frontend/src/components/flowpilot/FlowPilotStepCard.tsx +++ b/frontend/src/components/flowpilot/FlowPilotStepCard.tsx @@ -167,8 +167,26 @@ export function FlowPilotStepCard({ step, isCurrentStep, isProcessing, sessionId /> )} + {/* Script Builder handoff */} + {!isResolutionSuggestion && step.step_type === 'action' && (content.action_type as string) === 'open_script_builder' && ( + + )} + {/* Action step buttons */} - {!isResolutionSuggestion && step.step_type === 'action' && (content.action_type as string) !== 'script_generation' && ( + {!isResolutionSuggestion && step.step_type === 'action' && (content.action_type as string) !== 'script_generation' && (content.action_type as string) !== 'open_script_builder' && (