nativemind_copilot 2.1.0
nativemind_copilot: ^2.1.0 copied to clipboard
The NativeMind copilot for Flutter: agent panel, decisions and spending policy, voice and attachments, protocol client, OAuth / MCP connect screens.
nativemind_copilot #
The NativeMind copilot for Flutter: an agent panel (NmCopilotPanel under NmCopilotScope with an
NmCopilotController), engines (cloud providers, on-device models, hybrid), voice and attachment ports, approvals
and the AI loupe. Part of the NativeMind framework.
Built on nativemind_core: about 0.9 MB of assets (test/size_test.dart checks it); the only plugin is flutter_llama
(on-device models) — keep this package out of apps or editions that must not ship native model code. Extra languages:
add nativemind_translations and call NmTranslations.install(). Customisation:
doc/customisation.md. Upgrading from 0.x or from nativemind_widgets/ai.dart:
doc/migration-1.0.md.
Install #
dependencies:
nativemind_copilot: ^2.1.0
import 'package:nativemind_copilot/nativemind_copilot.dart';
Register NmCopilot.delegate with the app's localizations delegates.
Phone layout, continuing a conversation, localized labels (1.3.0) #
NmCopilotPreviewBar(onOpen: …)under theNmCopilotScopeis the collapsed copilot of a phone screen. It shows the first words of the streaming reply, andonOpenopens the fullNmCopilotPanel, e.g. in a sheet.controller.adopt(conversationId, turns: history)continues a conversation the app already has, without sending a message.- Labels that depend on the language take builders with a
BuildContext:NmCopilotConfig(suggestionsBuilder:, stepLabelBuilder:, strategyLabelBuilder:, memoryKeyLabelsBuilder:). NmCopilotIssue.detailscarries the error's details, e.g. plan limit numbers, to anissuebuilder slot.NmCopilotDecisionCard(acceptLabel:, declineLabel:)andNmCopilotChangeRow(undoKey:)are optional.
OAuth consent and connected apps (1.4.0) #
NmOAuthConsent draws the consent page of a service that lets AI apps connect by OAuth: with showPair: true the app ↔
service tiles (NmConnectPair) and the verified / where badges (NmClientBadges), «Signed in as» (account: NmConsentAccount(…)), your own block in body: (e.g. a project picker), scope rows with «required» or a switch
(NmConsentScope(…, description:, required: false)), «It won't be able to» (NmConsentRequest.denied), a note,
technical details and, with stickyActions: true, Deny / Allow in an NmStickyActionBar on phones. The phases
granted, denied and invalidClient show the outcome (NmConsentOutcome). NmConnectedApps lists the grants with
the same tile and badges, onEdit and your own actions (actionsBuilder). Texts in en, ru, th, zh, hi and ja.
Dialog flows (protocol v1.1, 2.1.0) #
A server-driven dialog flow (e.g. /expert: pick an expert → type the question → confirm) asks with the event
flow.prompt {runId, rev, nodeId, type: text|choice|confirm, text, options[{label, value}], min?, max?}; the panel shows
it as NmCopilotFlowPromptCard (builder slot flowPrompt): option buttons for choice, Yes / No (or the options) for
confirm, and for text a hint that the answer goes into the composer. A tap sends
OutgoingMessage.flowInput {runId, value, rev} with the label as text (controller.answerFlow); while a text
prompt is open the next composer message answers it. actions {items[{id, label}]} are continuation buttons
(NmAgentTurn.actions); the ones that mirror the prompt's options are not repeated. Without NmCopilotConfig.onAction
a tapped action goes back to the server as OutgoingMessage.action (controller.sendAction). A prompt closes when a
newer turn exists, when done says finished / the run is over, or after a notice such as FLOW_STALE
(NmFlowNoticeCode; such notices only offer «dismiss»). NmRemoteEngine is an NmFlowEngine:
NmCopilotConfig(loadCurrentFlowOnOpen: true) loads GET /flows/current when the panel opens, so a flow started in
a messenger continues in the app (controller.loadCurrentFlow(), controller.flowTriggers).
Voice and attachments #
Ports with web implementations in this package (package:web, no plugins; stubs elsewhere) and fakes for tests:
| Port | Web implementation | Default for the platform | Fake |
|---|---|---|---|
NmVoiceInput |
NmWebSpeechInput (SpeechRecognition / webkitSpeechRecognition, partial results), or NmServerVoiceInput over NmWebAudioRecorder (MediaRecorder, level meter via NmAudioRecorderControls) |
nmDefaultVoiceInput(engine) |
NmFakeVoiceInput |
NmAudioRecorder |
NmWebAudioRecorder |
nmDefaultAudioRecorder() |
— |
NmSpeechOutput |
NmWebSpeechOutput (speechSynthesis, voice for the locale) |
nmDefaultSpeechOutput() |
NmFakeSpeechOutput |
NmAttachmentPicker |
NmWebAttachmentPicker (hidden <input type=file>, camera via capture) |
nmDefaultAttachmentPicker() |
NmFakeAttachmentPicker |
The defaults return null off the web. Native implementations (Android, iOS, desktop) live in the separate package
nativemind_copilot_media, so this package stays without media plugins. When the server cannot transcribe, pass
onNoTranscript to NmServerVoiceInput and the recording comes back as an audio attachment draft. With attachments on,
NmCopilotPanel takes files dropped on the page and pasted images on the web (NmAttachmentDropTarget, feature flag
dropFiles); nmPasteDraft(images: true) reads an image from the web clipboard.
Voice assistant mode. Set NmCopilotConfig(voiceAssistant: NmVoiceAssistantConfig(enabled: true)) and the panel
header gets a «Voice mode» button (feature flag voiceAssistant) with a status bar above the composer (slot
NmCopilotBuilders.voiceAssistantBar). NmVoiceAssistantController runs the loop: listen → send the finished utterance
(autoSend) → think → say a short version of the reply (markdown and links removed, cut at a sentence within
maxSpokenChars) → listen again (relisten); silenceTimeout pauses it. While it speaks it keeps listening: a stop word
(«стоп», «подожди», «stop», «wait», «หยุด» …), new speech or «Stop» silences it at once — the copilot's turn is never
cancelled — and new speech becomes the next message. Without a voice input the mode is unavailable; without speech output
replies stay text; a refused microphone turns it off with a hint. Input and output default to the copilot's voice
input and the platform defaults above.
NmCopilotConfig(
engine: engine,
attachments: NmAttachmentPolicy(enabled: true, picker: nmDefaultAttachmentPicker()),
voice: NmVoiceConfig(mode: NmVoiceMode.device, input: nmDefaultVoiceInput(engine)),
voiceAssistant: const NmVoiceAssistantConfig(enabled: true),
)
Authors #
The copilot was written with AI assistants in 2026 (SDD flows sdd-nativemind-copilot, sdd-nativemind-widgets-*);
it contains no handmade code — 0 % handmade, see PROVENANCE.md. The handmade parts of the framework
are in nativemind_core, nativemind_vpn, nativemind_sound, nativemind_sound_generator, nativemind_deals and
nativemind_call.
Links #
- pub.dev: nativemind_copilot · publisher framework.nativemind.net
- Source: gitlab.com/nativemind/widgets.nativemind.net,
flutter/nativemind_copilot; server side:js/copilot-server, protocolprotocol/openapi.yaml - CHANGELOG.md · NOTICE
License #
NativeMindNONC (see LICENSE), as the whole NativeMind framework. flutter_llama and downloaded models keep their own
licenses (see NOTICE).