* feat: add flow export/import backend (migration, endpoints, schemas)
Add .rfflow file export/import support:
- Migration 050: import_metadata JSONB column on trees
- GET /trees/{id}/export?format=json|xml endpoint
- POST /trees/import endpoint (creates draft, resolves categories/tags)
- FlowExportEnvelope, FlowImportRequest/Response schemas
- import_metadata field on TreeResponse
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add flow export/import frontend + backend tests
Frontend:
- ExportFlowModal with JSON/XML format selection + download
- ImportFlowModal with drag-drop file picker + preview step
- rfflowParser for client-side JSON/XML .rfflow parsing
- Export buttons on editor toolbar and library action menus
- Import button on library page next to Create New
- Provenance display for imported flows in editor
- flowTransfer API client + types
Backend:
- Fix regex->pattern deprecation in export endpoint
- 12 integration tests covering export, import, round-trip,
access control, tag/category creation, version validation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: remove XML export, JSON-only for .rfflow files
- Remove XML builder, format query param, and XML tests
- Simplify ExportFlowModal (no format picker)
- Simplify rfflowParser (JSON-only)
- Remove format field from schemas and types
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: match Flow Assist chat input to AI Assistant styling + strengthen one-question prompt
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add procedural flow support to AI chat builder (Flow Assist)
- Add procedural-specific system prompts (schema, interview protocol, response format)
- Dispatch prompts by flow_type: procedural/maintenance use flat steps schema, troubleshooting uses decision tree schema
- Parse [STEPS_UPDATE] and [INTAKE_FORM] markers in AI responses
- Add validate_generated_procedural_steps() validator
- Handle intake form extraction in AI chat import endpoint
- Add StaticStepsPreview component for procedural flow preview
- Update store and page to render correct preview by flow type
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add flow type selection to Flow Assist entry points
- CreateFlowDropdown now shows "Build with Flow Assist" under each flow type
- Library page "Flow Assist" button respects current type filter
- Clean up unused AIFlowBuilderModal references
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update CLAUDE.md with AI chat builder and intake form learnings
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: refine assistant chat prompt for concise answers and focused questions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: switch AI provider to Claude Sonnet 4.6 + add shift+enter hint to chat inputs
- Default AI_PROVIDER changed from gemini to anthropic
- AI_MODEL and AI_MODEL_ANTHROPIC updated to claude-sonnet-4-6
- Added "Shift + Enter for a new line" hint below all chat textareas
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update CLAUDE.md with AI provider and chat input learnings
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add editor-embedded Flow Assist design document
Design for replacing the standalone /ai/chat page with context-aware
AI side panels embedded in each editor (Troubleshooting + Procedural).
Covers ghost node suggestion system, output-based thresholds,
config-driven model routing, knowledge integration, and per-flow
chat persistence.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add editor-embedded Flow Assist implementation plan
25-task plan across 9 phases covering backend foundation, frontend
infrastructure, tree/procedural editor integration, AI-assisted create,
old code removal, action-type dispatch, suggestion audit trail, and
build verification.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use actual root node ID in orphan validation check
AI-generated trees use descriptive IDs (e.g., "verify-account-exists")
instead of "root", causing the root node to be falsely flagged as orphaned.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add config-driven AI model tier routing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: extend AI chat session with tree_id and archived_at
Add tree_id FK (CASCADE) for editor-embedded sessions and archived_at
timestamp column to ai_chat_sessions table.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add AI suggestion audit trail table
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add action_type and focal_node_id to AI chat message API
- Add VALID_ACTION_TYPES literal and action_type/focal_node_id fields to
AIChatMessageRequest schema
- Add tree_id field to AIChatStartRequest schema for editor-embedded sessions
- Update send_message() signature with action_type and focal_node_id params
- Update start_chat_session() signature with tree_id param
- Pass new params through endpoints to service functions
- All new params have defaults so existing behavior is unchanged
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: route AI model selection through action-type config
Update get_ai_provider() to accept an optional model override parameter
(applied only to AnthropicProvider; Gemini always uses its own model).
Thread action_type-based model resolution through send_message() and
generate_final_tree() in the AI chat service.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add TypeScript types for editor-embedded AI
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add shared ContextMenu component
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add useEditorAI hook and editorAI API client
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add EditorAIPanel component with Chat and Suggestions tabs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: integrate AI panel, context menu, and ghost nodes in tree editor
- Add AI Assist panel toggle button to tree editor toolbar
- Wire EditorAIPanel alongside TreeEditorLayout with single-panel rule
- Thread onNodeContextMenu through TreeEditorLayout → FlowCanvas → FlowCanvasNode
- Add right-click context menu with Generate Branch, Explain Node, Delete actions
- Add ghost node detection (_suggestion flag) with dashed border + opacity styling
- Add Accept/Dismiss overlay buttons on ghost nodes for future suggestion handling
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: integrate AI panel, context menu, and ghost steps in procedural editor
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add AI prompt dialog and wire into CreateFlowDropdown
Replace navigation to /ai/chat with an inline AIPromptDialog modal
that collects a single prompt, generates a flow via the editor AI API,
imports it, and navigates to the editor with the AI panel open.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: add glassmorphism to AI prompt dialog + maintenance Flow Assist button
- Use .glass-card-static on AIPromptDialog card for consistent design system
- Add "Build with Flow Assist" button to maintenance section in CreateFlowDropdown
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: remove standalone Flow Assist page and old AI chat components
Remove the old /ai/chat page, AI wizard modal, and all associated
components/stores/types now replaced by the editor-embedded AI panel.
Deleted:
- AIChatBuilderPage, ai-chat/ components, aiChatStore, aiChat API, ai-chat types
- AIFlowBuilderModal, ai-builder/ components, aiFlowBuilderStore
Cleaned up:
- Router (removed /ai/chat route)
- Sidebar (removed Flow Assist nav item)
- MyTreesPage (removed AI builder modal and button)
- TreeLibraryPage (removed Flow Assist button)
- API and type barrel exports
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add delta response parsing and action-type prompt dispatch
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add AI suggestion audit trail endpoints
Create/list/resolve endpoints for tracking AI-applied changes to flows.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add APScheduler task to auto-archive stale AI chat sessions
Archives AI chat sessions with no activity for 30 days, runs daily at 3 AM.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update project status for editor-embedded Flow Assist
- Add Editor-Embedded Flow Assist to CURRENT-STATE.md in-progress items
- Update CLAUDE.md: fix stale lessons (#41, #46), add new patterns (#47 editor AI architecture, #48 orphan validation)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use correct model alias in AI_MODEL_TIERS standard tier
The dated model ID `claude-sonnet-4-6-20250514` was causing 502 errors.
Use the alias `claude-sonnet-4-6` which matches AI_MODEL_ANTHROPIC.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: send live flow context to AI Assist for full editor awareness
The AI panel now sends the current tree structure (troubleshooting) or
steps + intake form (procedural/maintenance) with each message. This
gives the AI full visibility into node details, questions, descriptions,
options, and intake form fields — not just the node ID.
- Backend: add flow_context param to schema, endpoint, and service
- Frontend: add getFlowContext callback to useEditorAI hook
- TreeEditorPage: passes treeStructure as flow context
- ProceduralEditorPage: passes steps + intakeForm as flow context
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: include flow name and description in AI Assist context
Both editors now send name and description alongside the flow structure,
so the AI can reference what the flow is about when responding.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: increase AI timeout to 120s and limit retries to 1
The 45s timeout was too short for generation tasks with full flow
context in the system prompt. The Anthropic SDK's default 2 retries
caused requests to hang for ~136s before failing. Now: 120s timeout
with max 1 retry = faster failure if it does timeout.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wire AI-generated flow structures into editor stores
The useEditorAI hook was ignoring result.working_tree from AI responses,
so generated steps/trees never appeared in the editor. Now:
- useEditorAI calls onFlowUpdate when working_tree is present in response
- ProceduralEditorPage handles steps + intake form updates via replaceSteps
- TreeEditorPage handles tree structure updates via replaceTreeStructure
- Both stores have new bulk-replace methods for AI integration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add lessons learned for full-stack integration, Anthropic retries, model tiers
#49 Always verify frontend consumes backend response fields
#50 Anthropic SDK max_retries=1 to avoid 3× timeout
#51 AI model tier routing via settings.get_model_for_action()
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: move AI Assist panel to full-height side layout in both editors
The AI panel was nested inside the content area, only spanning the
step list / canvas section. Now it sits at the outermost flex level,
spanning the full page height alongside all content (toolbar,
collapsible sections, steps/canvas). This prevents the panel from
overlapping content and lets the editor area properly shrink.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: AI Assist panel as fixed right drawer (matching Copilot/Scratchpad)
Convert EditorAIPanel from in-flow flex child to fixed right-side drawer
overlay, same pattern as CopilotPanel and ScratchpadSidebar. The panel
is fixed at right:0 spanning full viewport height, and editor pages add
pr-[380px] padding when open so content shifts left without overlap.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: AI Assist panel sits below topbar with slide-in animation
- Panel now uses top:56px to sit below the app shell topbar instead of
covering it (matches the main-content grid cell area)
- Added slideInRight CSS animation for smooth drawer entrance
- Editor pages use dynamic paddingRight via PANEL_WIDTH constant
- ChatTab upgraded: markdown rendering, CopilotPanel-style message
bubbles, auto-focus input, Shift+Enter hint
- All borders use --glass-border for consistent glassmorphism
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: AI Assist panel as in-flow flex sibling (not fixed/overlay)
Replace fixed positioning with in-flow flex layout. The outermost div
is now a horizontal flex row: content column (flex-1 min-w-0) + panel
(w-[380px] shrink-0). When the panel opens, the content column
automatically shrinks — no padding hacks or z-index stacking needed.
This guarantees the content shifts left and stays fully visible.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: AI Copilot panel as in-flow flex sibling in session navigation pages
Changed CopilotPanel from fixed overlay to flex layout sibling so it
pushes main content instead of covering it during active sessions.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: remove duplicate CLAUDE.md lessons #47-48
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
14 KiB
Editor-Embedded Flow Assist - Design Document
Date: 2026-03-06 Status: Approved Replaces: Standalone AI Chat Builder (
/ai/chat)
Overview
Replace the standalone /ai/chat page with a context-aware AI side panel embedded directly in each editor (Troubleshooting + Procedural). The panel knows which node/step is focused, supports targeted and open-ended actions, and applies changes via a tiered suggestion system. Knowledge integration and variable inference are phased features built on the same panel architecture.
Key Principles:
- Context-aware: panel knows the full tree/step structure + focal node
- Targeted actions auto-apply; open-ended suggestions require acceptance
- Output-based thresholds determine suggestion UX
- Model routing is config-driven, not hardcoded
- Chat history persists per-flow, per-user
Panel Layout & Behavior
Dimensions & Styling
- Width: 320px fixed, right side
- Styling: Glassmorphism (
.glass-card-staticbg, backdrop blur,border-l border-border) - Z-index: Same layer as node editor panel (not overlay)
Single-Panel Rule
- Tree editor: AI panel occupies the right panel slot, closing the node editor panel. When AI panel closes, if a node was previously being edited, the node editor panel reopens for that node.
- Procedural editor: AI panel slides in from right, narrowing the step list (step list takes
flex-1). No existing panel to replace.
Top Section: Context Summary
- Node/step selected: Read-only summary showing type, title, question/description of the focused item.
- No selection: Flow summary showing name, node/step count, flow type.
- Switching selection updates the summary live.
Tabs
- Chat — conversation + inline suggestions
- Suggestions — audit trail of all AI-applied changes to this flow (accepted, dismissed, pending)
Visibility
- Hidden by default
- Auto-opens on: AI-assisted flow creation, right-click AI action, toolbar toggle
- Auto-contextual: opens with focal node already set when triggered via context menu
Entry Points
1. Create Flow Dropdown (AI-Assisted)
- "Blank" or "AI-assisted" option per flow type (Troubleshooting, Project, Maintenance)
- AI-assisted shows a simple prompt dialog modal:
- Text area: "Describe the flow you want to build"
- Flow type already known from dropdown selection
- Loading state during generation
- On failure: error message + retry button (stays in dialog)
- On success: creates tree via API, navigates to editor with AI panel auto-opened and generation chat history loaded
- No multi-phase interview, no preview — just prompt and go
2. Right-Click Context Menu
- New
<ContextMenu>component (no existing context menus in either editor) - Positioned absolutely at right-click point
- Closes on click-away, Escape, or action selection
- Tree editor items: Generate branch, Add decision/action/solution, Explain node, Find known fixes, Delete
- Procedural editor items: Generate steps after, Add verification step, Expand step, Generate section, Delete
- Selecting an AI action sets the focal node/step and opens the AI panel
3. Toolbar Toggle
- "AI Assist" button in editor toolbar to manually open/close the panel
4. Existing Flows
- AI panel works on any flow — new or existing, AI-created or manually built
- No restriction to AI-created flows
Suggestion & Apply System
Ghost Node/Step Mechanics
Ghost nodes/steps are added to treeStructure/steps array with a _suggestion: true flag:
- Canvas/step list renders them normally (auto-layout works) but with dashed borders + reduced opacity
- Zundo temporal store paused while suggestions are pending
- On accept: remove
_suggestionflag, unpause zundo (creates one clean undo point) - On dismiss: remove ghost nodes from structure, unpause zundo (no undo point created)
- Ghost nodes participate in auto-layout and connection drawing but are visually distinct
Addition vs Modification
| Change Type | Visual Treatment |
|---|---|
| New nodes/steps | Ghost nodes: dashed borders, reduced opacity |
| Modified existing nodes | Subtle highlight + badge showing what changed |
| Modified selected node | Before/after shown in chat message with Apply button (not inline ghost) |
Output-Based Threshold
| Output Size | Behavior |
|---|---|
| 1 node/step | Auto-apply + toast notification with undo link |
| 2-4 nodes/steps | Individual ghost suggestions + "Accept All" shortcut button |
| 5+ nodes/steps | Ghost suggestions grouped by branch (tree) or section (procedural) with "Accept Branch"/"Accept Section" and "Accept All" controls + summary card in panel |
All changes (accepted or dismissed) logged in the Suggestions tab as an audit trail.
Backend Action Types
Each message to the AI includes an action_type that determines prompt construction, response schema, and model routing:
| Action Type | Description | Model Tier | Response Format |
|---|---|---|---|
generate_full |
Initial skeleton from prompt dialog | standard | Full tree structure or step array |
generate_branch |
Generate children for a specific node | standard | Subtree delta (node + children) |
modify_node |
Update a specific node's content | fast | Single node delta (before/after) |
add_steps |
Add steps after a specific step | standard | Step array delta |
quick_action |
Single-node operations (explain, expand) | fast | Single node delta or text response |
open_chat |
General conversation about the flow | standard | Text + optional delta |
variable_inference |
Detect implicit variables in step content | fast | Variable suggestions |
Prompt Construction
Each action type gets a tailored system prompt:
- Full tree context always included (so AI understands the complete flow)
- Focal node highlighted when present (the specific node/step being acted on)
- Action instruction describes what the AI should return
- Response schema constrains output format (full tree, subtree delta, single node, text)
Delta Response Format
For partial updates, the AI returns a delta object:
{
"action": "add" | "modify" | "delete",
"target_node_id": "node-to-modify-or-insert-after",
"nodes": [{ /* node objects */ }],
"explanation": "What was changed and why"
}
The frontend applies the delta to the tree structure and renders ghost nodes as appropriate.
Model Routing (Config-Driven)
Configuration
# backend/app/core/config.py
AI_MODEL_TIERS = {
"fast": "claude-haiku-4-5-20251001",
"standard": "claude-sonnet-4-6-20250514",
}
ACTION_MODEL_MAP = {
"generate_full": "standard",
"generate_branch": "standard",
"modify_node": "fast",
"add_steps": "standard",
"quick_action": "fast",
"open_chat": "standard",
"variable_inference": "fast",
}
Routing Logic
- Message endpoint receives
action_typeparameter - Look up tier from
ACTION_MODEL_MAP - Resolve model name from
AI_MODEL_TIERS - Pass to Anthropic API call
Both tiers can map to the same model initially. Changing model assignment is a config change, not a code change.
Knowledge Integration (Phased)
Phase 1 (Initial Release)
- Uses existing Microsoft Learn MCP server
- AI can cite KB articles, known issues, and official fix procedures in chat responses
- Citations rendered inline as collapsible cards with source URL and title
- AI response marker:
[KNOWLEDGE]{"title": "...", "url": "...", "excerpt": "..."}[/KNOWLEDGE]
Phase 2 (Future)
- Additional vendor documentation sources
- Community knowledge bases
- Proactive suggestions ("Microsoft released KB5034441 addressing this scenario")
Chat Persistence
Session Model
ai_chat_sessionmodel extended with:tree_idFK (which flow this session belongs to)archived_attimestamp (null = active)
- Per-flow, per-user sessions: multiple engineers on the same flow get separate chat histories
- Session loads on panel open if one exists for this flow + user
Suggestions Audit Trail
New ai_suggestion table:
| Column | Type | Description |
|---|---|---|
id |
UUID | Primary key |
tree_id |
UUID FK | Which flow |
user_id |
UUID FK | Who triggered |
session_id |
UUID FK | Which chat session |
action_type |
String | Action that generated this suggestion |
target_node_id |
String | Node/step acted on (nullable) |
changes_json |
JSONB | Before/after snapshot |
status |
Enum | pending, accepted, dismissed |
created_at |
DateTime(tz) | When suggested |
resolved_at |
DateTime(tz) | When accepted/dismissed (nullable) |
Auto-Archive
- APScheduler task runs daily
- Archives sessions with no activity for 30 days (
archived_at = now()) - Archived sessions viewable in Suggestions tab but not resumable for chat
Troubleshooting Editor Integration
Panel Context
- Full tree structure included in AI context
- Focal node (when selected/right-clicked) highlighted in context
- Node summary at panel top shows: type icon, node ID, question/title, option count
Context Menu Actions
| Action | Description | Model Tier |
|---|---|---|
| Generate branch | Create child nodes from this decision | standard |
| Add decision node | Add a decision child | fast |
| Add action node | Add an action child | fast |
| Add solution node | Add a solution child | fast |
| Explain node | AI explains what this node does | fast |
| Find known fixes | Search knowledge sources for this scenario | standard |
Ghost Node Rendering
- Dashed
border-dashed border-primary/40borders opacity-60on the node card- Connection lines drawn with dashed stroke
- Accept/dismiss buttons overlaid on each ghost node
- "Accept All" button in the panel when 2+ ghost nodes
Procedural Editor Integration
Panel Context
- Full step list included in AI context
- Focal step (when selected/right-clicked) highlighted in context
- Step summary at panel top shows: step number, type badge, title, content type
Context Menu Actions
| Action | Description | Model Tier |
|---|---|---|
| Generate steps after | Add steps following this one | standard |
| Add verification step | Insert a verification step | fast |
| Expand step | Break this step into substeps | standard |
| Generate section | Create a section header + steps | standard |
Ghost Step Rendering
- Dashed left border (
border-l-2 border-dashed border-primary/40) opacity-60background- Accept/dismiss buttons on each ghost step
- Grouped by section when 5+ suggestions
Intake Variable Detection (Three Tiers)
| Tier | Trigger | Timing | Model Tier |
|---|---|---|---|
| Explicit | [VAR:name] syntax in step content |
Immediate on content save | None (regex match) |
| Inference | Natural language suggests variable ("check the customer's server") | Debounced on step save/blur | fast |
| Cross-step | Same implicit variable in 2+ steps | On panel open + when steps modified | fast |
Behavior:
- Explicit: immediate inline suggestion card in panel ("Add
server_nameto intake form?") - Inference: non-blocking suggestion in panel, lower confidence indicator
- Cross-step: promoted suggestion with gap flag ("Variable
server_nameused in steps 3, 7, 12 but not captured in intake form") - Results cached per-session until step content changes
What Gets Removed
| Item | Location |
|---|---|
AIChatBuilderPage.tsx |
frontend/src/pages/ |
aiChatStore.ts |
frontend/src/store/ |
ai-chat/ component directory |
frontend/src/components/ |
AIFlowBuilderModal |
frontend/src/components/ |
/ai/chat route |
frontend/src/router.tsx |
| Flow type selection routing | URL params ?type=... |
What Gets Repurposed
| Item | Changes |
|---|---|
ai_chat_service.py |
Action-type dispatch, partial generation prompts, model routing, focal node context |
ai_tree_validator.py |
Validates AI-generated fragments (subtree, step batch) in addition to full trees |
ai_chat_session model |
Extended with tree_id FK, archived_at timestamp |
| AI chat endpoints | Tree-scoped sessions, action_type parameter, model tier routing |
What Gets Built (New)
| Item | Description |
|---|---|
EditorAIPanel component |
Shared panel with Chat + Suggestions tabs, node summary, input |
ContextMenu component |
Shared right-click menu for nodes and steps |
useEditorAI hook |
Panel state, focal node, suggestion management, ghost node lifecycle |
| Prompt dialog modal | Simple "describe your flow" modal for AI-assisted create |
ai_suggestion DB model |
Audit trail table + Alembic migration |
| Ghost node CSS | Dashed borders, reduced opacity, accept/dismiss overlays |
| Model tier config | AI_MODEL_TIERS + ACTION_MODEL_MAP in config.py |
| APScheduler archive task | Daily job to archive stale sessions |
What Gets Modified
| Item | Changes |
|---|---|
TreeEditorPage |
Right panel slot for AI, context menu handler, ghost node support |
TreeCanvas / TreeCanvasNode |
Ghost node rendering (dashed borders, overlays) |
ProceduralEditorPage |
Flex layout for AI panel, context menu on steps |
StepList / StepEditor |
Ghost step rendering |
treeEditorStore |
Ghost node state slice, zundo pause/resume, orphan bug fix |
proceduralEditorStore |
Ghost step state slice |
ai_chat_service.py |
Action-type dispatch, delta response format, model routing |
ai_chat_session model |
tree_id FK, archived_at |
config.py |
Model tier configuration |
CreateFlowDropdown |
AI-assisted option + prompt dialog trigger |
router.tsx |
Remove /ai/chat route |
Bug Fix (Included)
File: frontend/src/store/treeEditorStore.ts line 858
Current code:
if (id !== 'root' && !referencedIds.has(id)) {
Fixed code:
if (id !== state.treeStructure?.id && !referencedIds.has(id)) {
Root cause: Orphan check hardcodes 'root' as the expected root node ID. AI-generated trees use descriptive IDs (e.g., "verify-account-exists"). Since the root is never referenced by any other node's next_node_id, it gets flagged as orphaned. This is a false positive.