agentivity_ag_ui 0.2.7
agentivity_ag_ui: ^0.2.7 copied to clipboard
Flutter package for AI agent UIs — AG-UI protocol, SSE streaming, chat panel, HIL forms, AI assistant, and agent run monitor. Bring your own backend.
Changelog #
0.2.0 #
Generative UI, protocol alignment, state sync, and frontend tools.
New capabilities #
- Generative UI —
AgUiGenerativeControllerprocessesStream<AgUiEvent>and maintains a sealedAgUiGenerativeItemlist (AgUiTextItem,AgUiReasoningItem,AgUiComponentItem,AgUiToolCallItem).AgUiGenerativeViewrenders it reactively with streaming indicators, collapsible reasoning blocks, and tool-call status cards. - Widget registry —
AgUiWidgetRegistrymaps component names to Flutter widget builders. The agent calls a tool whose name matches a registered component → the controller seamlessly replaces the placeholder with the live widget. Also supported viaCUSTOMevents withname == 'render'. - Frontend tools —
AgUiFrontendToolRegistry/AgUiFrontendToollet the agent call client-side code (no backend round-trip). Results are shown inline. UsetoApiDescriptions()to include frontend tools in the agent's tool list. - State sync —
AgUiStateControllerappliesSTATE_SNAPSHOTandSTATE_DELTA(RFC 6902 JSON Patch: add, remove, replace, move, copy) to a reactive state map.AgUiStateBuilderprovides aListenableBuilderwrapper.
Protocol alignment (breaking if you used internal names) #
ToolCallStartEvent: JSON key changed fromtoolName→toolCallName(legacytoolNamestill read as fallback).ToolCallArgsDeltaEvent: now handles both spec nameTOOL_CALL_ARGSand legacyTOOL_CALL_ARGS_DELTA.ToolCallResultEvent: field renamedresult→content(legacyresultread as fallback);messageIdis now a requiredString.RunStartedEvent: addedthreadId,parentRunId.RunFinishedEvent: addedthreadId,outcome(AgUiSuccessOutcomeorAgUiInterruptOutcomewithList<AgUiInterrupt>).isInterruptedconvenience getter.- Added event types:
TextMessageChunkEvent,ToolCallChunkEvent,ReasoningMessageStartEvent,ReasoningMessageContentEvent,ReasoningMessageEndEvent,ReasoningStartEvent,ReasoningEndEvent,ActivitySnapshotEvent,ActivityDeltaEvent,RawEvent. StateDeltaEvent.deltais now typedList<dynamic>(RFC 6902 patch array).
Tests #
- 150 unit tests covering protocol parsing, JSON Patch operations (including
~0/~1escaping and-array append), generative controller event handling, and controller notification behaviour.
0.1.0 #
Initial release.
- AG-UI protocol — sealed
AgUiEventhierarchy covering all standard event types (run lifecycle, text messages, tool calls, state, custom). Ready-madeagUiEventParserfor use withAgUiSseChannel. - SSE channel —
AgUiSseChannel<T>with RFC 8895 frame parsing, exponential backoff reconnection, Last-Event-ID tracking, and a 45-second watchdog timer. - Abstract provider interfaces —
IChatProvider,IHilProvider,IAiAssistantProvider,IAgentRunProvider. Implement against your backend; the package stays backend-agnostic. - ChangeNotifier controllers —
ChatController,HilController,AiAssistantController,AgentRunController. Drop into any Flutter state management setup (Riverpod, Provider, BLoC, rawListenableBuilder). - Flutter widgets —
AgUiChatPanel,AgUiHilForm,AgUiAssistantPanel,AgUiRunPanel,AgUiRunStatusBadge. - ThemeExtension styling —
AgUiChatTheme,AgUiHilTheme,AgUiAssistantThemeintegrate with your existingThemeData. Each widget also accepts a per-instancestyleoverride and builder callbacks for full structural replacement.