feat: connect FlowPilot to Script Builder with handoff action
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
@@ -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' && (
|
||||
<button
|
||||
onClick={() => {
|
||||
sessionStorage.setItem('scriptBuilderContext', JSON.stringify({
|
||||
from_session: sessionId,
|
||||
prompt: (content.script_prompt as string) || '',
|
||||
language: (content.script_language as string) || 'powershell',
|
||||
}))
|
||||
window.open('/script-builder?from=flowpilot', '_blank')
|
||||
onRespond({ action_result: { success: true, details: 'Opened Script Builder' } })
|
||||
}}
|
||||
className="flex-1 min-h-[44px] rounded-lg bg-gradient-brand px-4 py-2.5 text-sm font-semibold text-[#101114] hover:opacity-90 active:scale-[0.97] transition-all"
|
||||
>
|
||||
Open Script Builder
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* 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' && (
|
||||
<div className="flex flex-col gap-2 sm:flex-row">
|
||||
<button
|
||||
onClick={() => handleActionComplete(true)}
|
||||
|
||||
Reference in New Issue
Block a user