feat(35-03): add subgraph extraction and scoped context to chat API
- Import extractSubgraph from subgraphExtractor
- Parse selectedNodeIds from request body
- Call extractSubgraph before building workflow context
- Pass subgraph.selectedNodes and selectedEdges to buildWorkflowContext
- Update buildEditSystemPrompt to accept optional restSummary parameter
- Add WORKFLOW CONTEXT (SELECTED SUBSET) section when scoped
- Include rest-of-workflow summary with type breakdown and boundary connections
- Add metadata placeholder note to system prompt
- Enhance error handling to return 413 for oversized payloads
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
// Base domain expertise from existing SYSTEM_PROMPT
// Base domain expertise from existing SYSTEM_PROMPT
constbaseDomainExpertise=`You are a workflow expert for Node Banana, a visual node-based AI image generation tool. Be concise and direct — short bullet points, no fluff. Use the same language the user sees in the UI. Never expose internal property names, JSON structure, or code.
constbaseDomainExpertise=`You are a workflow expert for Node Banana, a visual node-based AI image generation tool. Be concise and direct — short bullet points, no fluff. Use the same language the user sees in the UI. Never expose internal property names, JSON structure, or code.
@ -92,12 +97,39 @@ Displays the final generated image or video. Connect any image or video output h
-Askoneclarifyingquestionatatimeifgoalisunclear`;
-Askoneclarifyingquestionatatimeifgoalisunclear`;
// Current workflow context
// Current workflow context
constcontextSection=`
letcontextSection=`
##CURRENTWORKFLOW
##CURRENTWORKFLOW
${formatContextForPrompt(workflowContext)}`;
${formatContextForPrompt(workflowContext)}`;
// Add subgraph summary if scoped to selected nodes