feat: add FlowTool, the tool-call card, and its message part - #44
Merged
Conversation
…t-plan-5bad8e # Conflicts: # CHANGELOG.md # README.md # docs/public/_redirects # docs/src/content/docs/theming.mdx # lib/flow_ui.dart # lib/src/theme/flow_theme.dart # playground/lib/src/demo_registry.dart # playground/lib/src/playground_item.dart
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 94c026c. Configure here.
…t-plan-5bad8e # Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds
FlowTool, roadmap item 17: the tool-call card.successonce complete,error_outlineinerroron failure. Nothing new to localize for status.FlowCodeBlocks (jsonand plain by default, wrapping) under host-localized section labels, behind a widget-owned disclosure (initiallyExpanded+onExpandedChanged, theExpansionTilecontract).errorMessagerenders under the header, outside the disclosure, as a live region.FlowToolPartjoins the sealed part model withFlowToolStatus { pending, running, complete, error }.FlowMessagerenders it and keys the card by the provider's callid;FlowThreadforwardstoolInputLabelandtoolOutputLabel. Copy reuses the existingonCodeCopy/copiedCodePartcontract through synthesizedFlowCodeParts, the markdown-fence precedent.FlowToolStylejoins the component styles with aFlowTheme.toolStyledefault. The four accents recolor the mark, never the words.surfaceContainerLowest,outlinefirming tooutlineVarianton hover), not the confirmation's raised one: a tool call is a record of the runtime's work, the confirmation is the host's gate._redirectsline, roadmap rows and changelog entry included.Reviewer notes:
PageStorage, keyed through aPageStorageKeyon the part's wrapper, becauseFlowThreadremounts its subtree when a conversation first outgrows the viewport, which opening a card in a short thread triggers. It is stored under a private identifier built from the key chain rather than the framework's computed one: the blocks'SelectableTextrestores its scroll offset from the same chain and casts it todouble?, which aboolthere crashes. Found in the playground and fixed before this PR.ClipRect+Align(heightFactor:)on one controller shared with the chevron, sinceAnimatedSizedrops the content on the first frame of a collapse.FlowConfirmationPartbeside the tool part.Flexible, so under pressure each gets at most half the row; a priority layout is a possible follow-up. A host-rendered output slot and grouping consecutive calls are out of scope.Screenshots
New component, so no before column.
How this was verified
toolstage in Chrome (web-server build): all five variants, light and dark. Expanding a card inside the 420px thread stays open across the viewport flip, collapses without a bounce, and the two cards keep independent state. Copy shows the check on the right block, the running mark turns, and the phone stage ellipsizes the title and chip.?embed=tool&variant=...&theme=...).flutter analyzeclean at the root and inplayground/;example/reports only its pre-existing missingenv.g.dart.dart format .applied.Checklist
flutter analyze libandflutter analyzeinexample/andplayground/are cleandart format .applieddependencies:inpubspec.yaml(Flutter SDK and flutter.dev packages only)lib/flow_ui.dartand documented indocs/and the README tableCHANGELOG.mdupdated for user-facing changes, with breaking changes called outfeat:,fix:,refactor:,docs:,chore:)Note
Medium Risk
Expands the sealed
FlowMessagePartAPI (hosts with exhaustive switches must add a case) and changes message part layout/keying for tool cards; behavior is presentation-only with no auth or network logic.Overview
Ships
FlowTool, the tool-call card for agent turns, and wires it through the message model and thread.The card is host-driven state only:
FlowToolStatus(pending→running→complete/error) drives a morphing header mark (still vs turning asterisk, check, error glyph) and optional title shimmer—no built-in status strings. Input and output show as nested, wrapping **FlowCodeBlock**s behind a collapsible header; failures surface viaerrorMessageoutside the disclosure (live region). Copy reuses the existingonCodeCopy/copiedCodePartpath via synthesizedFlowCodePartinstances.FlowToolPartjoins the sealedFlowMessagePartset;FlowMessagerenders it and keys wrappers withPageStorageKey(part.id)so expand/collapse survives streaming reshapes and thread viewport remounts (disclosure stored inPageStoragewith a private id to avoid colliding with code-block scroll state).FlowThreadforwardstoolInputLabelandtoolOutputLabel. Theming addsFlowToolStyleandFlowTheme.toolStyle.Also updates 0.4.0 changelog, roadmap/docs/README, a
tooldocs page and playground demo (live / complete / running / error / thread), and/playground/toolredirect.Reviewed by Cursor Bugbot for commit c630d35. Bugbot is set up for automated code reviews on this repo. Configure here.