chain-studio-flow-editor/lib/fai_studio_flow_editor.dart
flemming-it f43c1ac6cf feat(editor): copyable diagnostics + hover tooltip + quick fixes
Three operator-UX gaps closed in one pass — the diagnostic
strip stayed plain Text (no copy), the wavy underline gave no
hover tooltip (had to read the strip), and there was no way to
act on an issue without leaving the editor.

  - **Selectable + copyable strip**. Both the header summary
    and the per-row issue message are now SelectableText. Per-
    row Copy button (compact icon) lives next to the message;
    header carries a 'Copy all' that copies every issue as
    'L7: <message>' lines. Trackpad-only operators no longer
    have to use the system selection gesture.

  - **Hover tooltip on the wavy underline**. The controller
    attaches TextSpan.onEnter / onExit handlers to every
    issue-overlapping leaf and publishes IssueHoverRequest via
    a ValueNotifier. FlowEditorPage listens and inserts an
    OverlayEntry tooltip card near the cursor. Card carries
    its own MouseRegion that cancels the dismiss timer so the
    operator can slide INTO it to click the action buttons.

  - **Quick fixes for the two most common issues**:
      · 'Unknown capability X' → InstallCapabilityFix (delegated
        to host via the new onInstallCapability callback). On
        success, controller.setAvailableCapabilities + reanalyze
        clear the issue automatically.
      · 'Unknown type Y' with a Levenshtein-distance-≤2 match
        → ReplaceLineValueFix. Applied by the editor itself:
        line is mutated, key + indent preserved, comment
        preserved, then reanalyze.
    Distance > 2 stays unfixed — pushing 'zonglefax' to 'bytes'
    would be worse than no suggestion.

New public surface (exported from the package):

  - QuickFix sealed base + InstallCapabilityFix + ReplaceLineValueFix
  - InstallCapabilityCallback typedef
  - IssueHoverRequest + IssueHoverSeverity
  - FlowEditorPage.onInstallCapability prop

Tests:
  - FlowAnalyzer attaches InstallCapabilityFix to capability
    issues
  - FlowAnalyzer suggests the closest valid type for typos
  - FlowAnalyzer emits no fix when the typo is too far

All 33 editor tests green. Bumped to 0.17.0.

Signed-off-by: flemming-it <sf@flemming.it>
2026-06-09 00:01:51 +02:00

50 lines
1.7 KiB
Dart

/// Inline flow editor for F∆I Studio — swappable.
///
/// Studio depends on this package via pubspec.yaml. To use
/// a different editor, fork this repo, change the
/// implementation, point Studio's pubspec at the fork,
/// rebuild Studio.
///
/// Public surface:
///
/// * [FlowEditorPage] — the page widget Studio embeds as
/// its Flows destination. Three tabs over one in-memory
/// flow: graph (drag-and-drop WYSIWYG), text (raw YAML),
/// run (inputs form + live step progress + outputs).
/// * [FlowEditorLocale] — render language for inline
/// strings. Studio passes its active Locale through.
/// * [FlowRunDriver] — host-supplied bridge to the hub.
/// Studio implements it with the gRPC SDK; a CLI host
/// could shell out; a test harness can stub it in-memory.
/// * [FlowRunEvent] family — events the driver streams
/// during a run (StepStarted, StepCompleted, …).
/// * [FlowOutputValue] family — typed outputs the driver
/// returns when the run finishes.
library;
export 'src/editor_style.dart'
show FaiEditorStyle, EditorCanvasBackdrop, EditorPanelStyle;
export 'src/flow_editor_page.dart' show FlowEditorPage;
export 'src/l10n.dart' show FlowEditorLocale;
export 'src/quick_fix.dart'
show
InstallCapabilityCallback,
QuickFix,
InstallCapabilityFix,
ReplaceLineValueFix,
IssueHoverRequest,
IssueHoverSeverity;
export 'src/run_driver.dart'
show
FlowRunDriver,
FlowRunEvent,
StepStarted,
StepCompleted,
StepFailed,
StepAwaitingApproval,
FlowOutputValue,
FlowOutputText,
FlowOutputJson,
FlowOutputBytes,
ModuleSpec,
ModuleField;