agents_flutter 0.7.0
agents_flutter: ^0.7.0 copied to clipboard
Flutter integration for the agents framework: a preconfigured harness agent, device-capability context providers and tools, chat history persistence, and configurable model profiles.
Changelog #
0.7.0 #
- Breaking:
ConfiguredChatClientFactory.customClientResolvergains anAgentScope? scopeparameter, forwarded fromcreateChatClient. Host resolvers can now key per-conversation state (for example a local model's KV-cache lineage) to the conversation a client serves, removing the need for scope-aware factory subclasses. - Removed the empty, never-exported
src/ai_agent_provider.dartplaceholder. - New
telemetry/subsystem, folded in from the downstream app:UsageStore(the durableusage_recordsledger implementingUsageRecordSink, now living besideUsageTrackingChatClient),AgentRunTelemetryStorewith crash recovery (recoverInterrupted),AgentRunScope(anAgentScopecarrying agent and run ids for usage attribution), andAgentCenterOverviewtime-series aggregation over the two ledgers. - New
activity/subsystem:AppActivityMonitor(app-wide idle signal; hosts report foreground transitions viareportForeground(bool)— a deliberate change from the app'sreportLifecycle(AppLifecycleState)so the class stays free of Flutter imports) and theToolActivityregistry withToolActivityTrackingChatClient. a2a/gains the host side to match its existing pairing client:A2AHostService(ashelf-backed HTTP server exposing local configured agents to paired devices, with single-use pairing tokens, SHA-256 bearer authorization, and per-caller session isolation) behind an io/stub conditional facade, plusNetworkSharingSettings. Addsshelfandpooldependencies (server platforms only at runtime; the web stub reports hosting unsupported).web/gains the search side folded in from the app:SearchUrlWebSearchSource(query anyq=-style endpoint; JSON/SearXNG or HTML parsing with redirect unwrapping),WebSearchSettings(SecretStore-backed multi-endpoint config with categories and user-agent profiles),WebSearchTraceLog+TracingWebPageLoader(opt-in HTTP tracing), andWebPageHtmlRenderer(renamed from the app'sWebPageRendererto avoid colliding with this package'sweb_page_renderer.dartmarkdown helpers) withHeadlessWebViewHtmlRenderer— a reimplementation of the app's webview_flutter renderer onflutter_inappwebview, gated by a staticisSupported(Android/iOS/macOS/Windows). The app no longer needswebview_flutter; one WebView stack serves both loading and rendering.- Settings colocated with the subsystems they configure:
PushoverSettings(→pushover/),EmbeddingSettings(→memory/, it is theMemoryScorerhanded toRecordStoreVectorStore),ThinkingSettings(→configured_agents/), and a newuser_profile/capability folder (UserProfileSettings+UserProfileContextProvider). Persisted key literals are unchanged (including historicalagents_app.prefixes) so existing installs keep their data. activity/also gains the chat terminal subsystem, reworked during the fold-in from an xterm-backed buffer to a terminal-widget-free design:ChatTerminalSessionrecords a capped ring of semanticTerminalEvents (command started / output chunk / completed / failed / cleared) with a sync broadcastonEventstream andeventsreplay, theTerminalActivityregistry keys sessions per conversation (delegate scopes fold onto the parent), andTerminalMirroringShellExecutormirrors anyShellExecutorinto a session. Presentation — prompt markers, ANSI colors, CRLF, status lines — is the host renderer's job (the reference app binds events to an xterm buffer).- New
package:agents_flutter/chat_provider.dartentry point: the chat view-model contract folded in from the downstream app —LlmProvider, the UI-facingChatMessage/Attachment/MessageOrigin/ToolApprovaltypes,LlmException,TokenSmoother,AgentLlmProvider(bridges anAIAgentinto the contract with tool-approval pause/resume, run telemetry, and activity reporting), andEchoLlmProvider(renamed from the app'sEchoProvider; useful as a UI test double). It is a separate library, not part of the main barrel, because the UI-facingChatMessagewould collide withpackage:extensions/ai.dart's wire-levelChatMessagein any file importing both. - New
conversations/subsystem: theConversation/ConversationSession/Channeldomain,ConversationStore+ConversationSessionStore+ChannelStore(RecordStore-backed, collection names unchanged from the app),ConversationService, theChatsQueryfilter model, theChatTitleSummarizerbackground service, and anaddConversations()/addChatTitleSummarizer(residentTitleClient:)registration pair. - New
tasks/subsystem:AgentTask(+ recurrence),AgentTaskStore,TaskSchedulerService, andaddTaskScheduler(). The scheduler stays a plain singleton the host starts explicitly. chat_history/gainsChatTranscriptStore, co-located withChatMessageCodec/ChatMessageRecordswhose record shape it reads; a contract test now pins the record field literals and the write→read round-trip.logging/gainsPromptLogandPromptLoggingChatClient(+renderRequest);configured_agents/gainsLoggingConfiguredChatClientFactory(prompt capture, usage attribution, tool-activity tracking in one decorator stack) andchooseLocalWarmupTargetfor pre-loading a local model at startup. The chat-client decorator is namedPromptLoggingChatClient— not the app's originalLoggingChatClient— to avoid colliding withpackage:extensions/ai.dart's class of that name.
0.6.1 #
HeadlessWebViewPageLoaderaccepts an optionaluserAgent, sent with every page load in place of the platform WebView's default. Hosts opt in explicitly (for example from a user-managed profile); when omitted, behavior is unchanged and the system default is sent.
0.6.0 #
- Query-aware ranking (Phase 3 of the web evidence plan) completes the
four-tool web surface:
open_web_pageaccepts an optionalobjective; the returnedcontentis then the blocks most relevant to that question — ranked by a BM25-style lexical scorer with heading-path credit, block-type weights (tables and definitions boosted for numeric questions), and a positional prior — instead of the page's lead content. AFocused on:header line and[…]gap markers keep the selection honest; an unmatched objective falls back to lead content with a note.- Adjacency grouping: a selected block always brings the headings
above it and a short intro paragraph directly before it, so a bare
$25table row never travels without its "Fees" heading. - New
find_in_page(pageId, query)function ranks a cached page's blocks for a new question and returns the best matches with theirb<n>ids; unmatched queries return the outline instead of guesses. - Repeated blocks are marked
duplicateOfand skipped in rendering and ranking (duplicateBlockscount on page results), so syndication banners and print footers are never mistaken for independent confirmation. BlockScorerseam (FlutterHarnessAgentOptions.webBlockScorer,createWebSearchTools(blockScorer:)) lets hosts substitute a semantic scorer later; scores stay internal and are never exposed to the model.
0.5.0 #
- Page sessions and the escalation loop (Phase 2 of the web evidence
plan): opened pages are cached per tool set so agents can pull more of
a page without reloading it.
WebPageSessionStore— a small LRU (default 8 pages, configurable viaWebSearchToolOptions.maxCachedPages) created percreateWebSearchToolscall, sopage-Nids are scoped to one agent build and never leak across conversations. Reopening a URL replaces its earlier entry.open_web_pageresults now include apageIdfor block-bearing loads, and its description teaches the loop: package → outline →expand_page.- New
expand_page(pageId, blockIds?, heading?)function returns the full text of chosen blocks or a whole outline section, each run prefixed with itsUnder: A > Bheading context. Expired ids get a "reopen the URL" result; malformed requests return the outline to steer the next call. Budget caps are reported, never silent.
0.4.0 #
open_web_pagereturns structured evidence packages (Phase 1 of the web evidence plan,doc/WEB_EVIDENCE_PLAN.md). The extraction script is now a thin DOM walker emitting typed blocks; Dart classifies them, assigns heading paths, builds the page outline, and renders compact markdown:WebPageContentgainsblocks(WebContentBlockwith heading paths, links, and table cells),outline,structuredData(JSON-LD, labeled by origin),siteName/publishedTime/modifiedTime/author,contentMarkdown, andomittedBlocks/boilerplateBlockscounts.- Tool results carry
contentmarkdown plus anoutlinewithb<n>block ranges instead of flattext; the flat shape remains the fallback when block extraction yields nothing. Navigation, header, footer, and aside chrome is suppressed from the markdown and counted, never silently dropped; in-script caps and the character budget are reported throughomittedBlocksandtruncated. WebPageLoader's interface is unchanged and all newWebPageContentfields are additive with defaults.
0.3.1 #
- Focus-category search routing for the local
web_searchfunction:FlutterHarnessAgentOptions.webSearchSourcesByCategory(and the matchingcreateWebSearchToolsandaddFlutterHarnessContextparameters) maps category labels — "finance", "technology" — to dedicated search sources. The labels become an enum on the function'scategoryparameter so the model can steer a query to the source suited to its topic; they are the only part of the host's search configuration the model sees. Uncategorized calls usewebSearchSource; with no default source,categoryis required.
0.3.0 #
- Add vendor-neutral local web search and direct page-opening tools for the
Flutter harness.
open_web_pagerenders JavaScript in an isolated, incognito headless WebView, extracts readable text and metadata, and applies a configurable public-network navigation policy. - A configured local search source replaces the hosted web-search marker. A
page loader may instead add only
open_web_pagewhile retaining hosted search. Both retain the existing per-agent web-search access gate. - Add native headless page loading on Android, iOS, macOS, and Windows using
flutter_inappwebview, with structured timeout, navigation, HTTP, loading, empty-content, and challenge-detection results. Flutter web reports the capability as unsupported.
0.2.1 #
- Pushover as a harness capability with per-agent gating:
FlutterHarnessAgentOptions.pushoverClient(pluspushoverToolOptions) — when a host attaches a configuredPushoverClient, the harness adds the Pushover tools. Client-gated rather than flag-gated: the tools send real notifications, so they exist exactly when the host attached a client.AgentAccessConfig.enablePushover— opt-in per saved agent,falseby default.ConfiguredAgentFactorystrips the client from agents that have an access record without the opt-in, wherever the client was attached; agents without an access record keep the harness default.createPushoverToolsandPushoverToolOptions— builds the send, quota, and receipt tool set from one configuration.
0.2.0 #
- Require
agents: ^1.6.0, including the new live shell output stream and callback APIs and persistent-shell stderr capture.
0.1.0 #
First public release. Flutter integration layer for the
agents framework.
FlutterHarnessAgent— a one-callHarnessAgentpreconfigured with the Flutter capabilities, compaction, function invocation, and per-call chat history persistence. Reachable from aChatClientviaasFlutterHarnessAgent(...), or through dependency injection withaddFlutterHarness(...)/useFlutterHarnessAgent(...).- Device-capability context providers and tools, each registrable on a
ServiceCollectionor directly onChatClientAgentOptions:- Temporal —
TemporalContextProviderplus theget_current_timetool. - Connectivity —
ConnectivityContextProvider(withConnectivityMonitor) plus theget_connectivitytool. - Device and app info —
DeviceContextProvider,get_device_info, andget_app_info, withDeviceInfoHostedServiceandPackageInfoHostedServicefor the DI path. - Location —
LocationContextProvider,get_current_location, andgeocode_address. - Network —
NetworkContextProviderandget_current_network_info. - Wake lock — the
set_wake_locktool. - Pushover —
PushoverClientplus thesend_pushover_notification,get_pushover_limits, andcheck_pushover_receipttools, registrable withaddPushover(...). Credentials stay out of the tool schema, so a model chooses what a notification says but never who receives it. Supports multipart image attachments, resolved from a model-supplied reference through a host-providedPushoverAttachmentResolver, and end-to-end encryption viaPushoverAesEncryptor.
- Temporal —
- Configured agents (
configured_agents/):ConfiguredAgentsManager,ConfiguredAgentFactory,AgentScope, and persistentAgentConfigurationStore/ModelSourceStorefor defining and switching agents at runtime. - Model profiles (
configured_agents/model_profile/): per-model chat and tool-call formats (Hermes, Llama 3, Mistral, LFM2), streaming tool-call decoding, think-tag filtering, GGUF metadata inspection, andOpenAiCompatibleChatClient. - Chat history persistence:
FlutterChatHistoryProvider,ChatMessageCodec, and stale tool-result redaction. - Storage and memory built on
sembast:RecordStorewith in-memory and sembast backends,RecordStoreAgentFileStore, andRecordStoreVectorStorewith a memory scorer. - Downloads:
DownloadServicebacked bybackground_downloader, plus a Hugging Face API client and model downloader. - Logging:
AppLogStore, anAppLogStoreLoggerProvider, andAgentTrafficLoggingAgentfor recording agent request/response traffic. - Chat client decorators:
UsageTrackingChatClientandTextFileInliningChatClient. - A2A pairing helpers under
a2a/. - Adaptive layout widgets under
layout/.