chain-studio-flow-editor/lib/fai_studio_flow_editor.dart
flemming-it b1fe765468 feat(editor): per-field input/output ports + i18n tooltips + 4 jai_client patterns
Phase A of the per-field-output-ports roadmap.

FlowRunDriver gains optional moduleInfo(capability) hook
that returns a ModuleSpec carrying declared inputs +
outputs (each ModuleField has name, type, locale->
description map). Default returns null so legacy hosts
that didn't implement the hook keep compiling — the editor
falls back to YAML-reference-derived ports.

FlowCanvas caches ModuleSpec per step capability, kicked
off lazily on each build. When the spec lands, the canvas
rebuilds with:

- Per-field input ports on the LEFT (declared input names,
  in stable manifest order) — replaces the with_-keys-as-
  port-labels shape.
- Per-field output ports on the RIGHT — one anchor per
  declared output field. A flow like summarize that
  declares response/model_endpoint/model_name/model_digest
  now exposes four distinct anchors instead of fanning
  every downstream reference out of one collapsed point.
- Tooltips on each port label, picked from the field's
  description.<locale> with English fallback.

NodeGeometry refactored: heightFor(inputs, outputs) takes
max(inputs, outputs); outputPortY(index) for the new
multi-port output side; outputAnchorY() preserves the
legacy single-anchor fallback so edges still draw before
the spec resolves.

Edges + hit-tester now use _outputPortPosition(stepId,
fieldName: edge.fromField). Field index lookup falls
through to outputAnchorY when the spec isn't loaded yet.

Patterns: ported modern, classic, blueprint, minimal from
jai_client's CanvasPatternPainter. Dropdown now has seven
choices (dots, grid, modern, classic, blueprint, minimal,
blank).

Bumps fai_studio_flow_editor to 0.9.0.

Signed-off-by: flemming-it <sf@flemming.it>
2026-06-01 22:32:26 +02:00

42 lines
1.5 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/run_driver.dart'
show
FlowRunDriver,
FlowRunEvent,
StepStarted,
StepCompleted,
StepFailed,
StepAwaitingApproval,
FlowOutputValue,
FlowOutputText,
FlowOutputJson,
FlowOutputBytes,
ModuleSpec,
ModuleField;