mugib_sdk 1.0.45
mugib_sdk: ^1.0.45 copied to clipboard
Official Flutter SDK for Mugib chat sessions, voice agents, and session payload with one apiKey.
Changelog #
1.0.45 #
- A team member's line is no longer shown as Mujib's reply. While a
person has the chat,
sendMessageStreamused to yield their reply asMugibStreamText, so apps drew it as Mujib (and twice withwatchHandoff()). It now yields oneMugibStreamMetadatawithhumanMode: trueandagentMessages(each with the member'sname), and no text. Show those as the team's lines; keepwatchHandoff()running for the ones that come later. MugibStreamMetadatagainshumanModeandagentMessages(optional, default off and empty). No other change.
1.0.44 #
- Photos from knowledge collections. Menu dishes, packages, products and
any other list with a photo column use the same
attachmentsfield as catalog items. No new endpoint. - New:
MugibChatAttachmentsViewdraws those photos (optional Material helper).mugibImageAttachmentsreturns only image entries with a URL. - Apps that already render
reply.attachments/MugibStreamAttachmentsneed no code change.
1.0.43 #
- Android: the microphone runs only while the call screen is open.
Removed
FOREGROUND_SERVICEandFOREGROUND_SERVICE_MICROPHONE, and removedMugibCallService. Locking the screen or leaving the app stops the microphone. While the call is on screen, the display stays awake so the inactivity timeout does not blank it.RECORD_AUDIOduring an open call is unchanged.androidKeepAliveInBackgroundand the call-notification title/text are ignored.
1.0.42 #
- Android: native voice-call audio engine (barge-in on the loudspeaker).
Calls now capture with
VOICE_COMMUNICATIONand play withUSAGE_VOICE_COMMUNICATIONunderMODE_IN_COMMUNICATION, so the device's hardware echo canceller, noise suppressor and AGC work — the caller can talk over the agent on speakerphone without the agent hearing itself. Routes to a wired / USB / Bluetooth headset automatically and follows plug/unplug. Hardware volume keys control the call while it runs. Falls back to the previous plugin path automatically when a device can't open it, the mic stays silent, or capture errors mid-call. Opt out withvoice.client(id, androidNativeAudio: false). - Fix: caller not heard on some Android phones (Xiaomi/Redmi). The plugin
path now records from
VOICE_RECOGNITION(wasUNPROCESSED, which is near-silent on many builds) and replaces the per-chunk ×16 normaliser — it lifted room noise and speaker echo to speech level and broke server VAD and barge-in — with a gated, bounded AGC that never boosts silence. A dead-mic watchdog switches source if the first 1.5 s is digital silence. Never pins the top/back noise-reference mic. - Fix: barge-in blocked for the whole agent turn. The client echo-guard window was re-armed on every streamed audio chunk, so it never expired while the agent spoke. It now starts at playback onset only, like the server gate.
- New:
MugibVoiceClient.setSpeaker(bool?)switches loudspeaker mid-call (iOS + Android);audioRoute/currentAudioRoutereport speaker / earpiece / headset / bluetooth;audioInfoexposes the engine and whether hardware AEC/NS/AGC are active. - Barge-in that doesn't cut the agent off by mistake. A barge-in now
needs the caller's level above the threshold for a sustained burst
(120 ms with hardware AEC, 300 ms and ≥0.5 without), so a cough, a door or
the agent's own echo no longer stops it. Frames held while confirming are
sent with the confirming frame, so the first syllable isn't lost. On a
confirmed barge-in the client stops playback at once, drops the rest of the
agent's in-flight turn until the server sends
interrupted, and tells the server (client_state.barge_in) so its gate lets the rest of the sentence through. The Android software AGC freezes while the agent is audible. - Calls can't step on each other. A new call waits for the previous call's teardown; native audio runs per call (run ids), so a late teardown of a cancelled call can no longer stop the next call's mic and speaker.
- Never stuck deaf: watchdogs force a playback drain if the player never reports one, fall back if the native mic delivers no frames, and resume agent audio if the server never confirms a barge-in. A transient focus loss (phone call) holds agent audio and uplink; a permanent one no longer mutes the mic for the rest of the call. System-silenced capture (app in background) pauses uplink instead of abandoning the native engine.
- iOS: the mic stream is reopened after a phone call / Siri interruption;
setSpeakermid-call only overrides the output port. MugibVoiceClient.start()no longer opens a session afterdispose().- Android: calls keep working with the screen locked or the app in the
background. A
microphoneforeground service with an ongoing-call notification runs for the call (androidKeepAliveInBackground, default true; localize it withandroidCallNotificationTitle/…Text). Adds theFOREGROUND_SERVICEandFOREGROUND_SERVICE_MICROPHONEpermissions; apps on Google Play declare the microphone foreground-service use in the Play Console. Override the icon with@drawable/mugib_sdk_call_icon. showMugibPostCallCsat: newcommentLabel/errorTextfor localization.- Package is now a Flutter plugin (Android native code); no setup change.
- Voice Edge hops.
/tokenfailover[]is walked in order (next healthy Edge, then Core), each hop with its own stream token. Gemini Live and OpenAI Realtime use the same path.fallback_urlstays as the last resort.
1.0.41 #
- Voice Core fallback.
/tokenfallback_urlis now used when the Edgestream_urlis unreachable (same behavior asvoice-widget.js). Reconnects stay on Core after a fallback so a dead Edge does not loop. - Localhost / raw-IP Edge hosts are skipped on the device (self-signed certs).
1.0.40 #
- Inbox photos on history.
MugibChatMessage.attachmentsnow carries the same catalog images (rooms, cars, products, courses, trips) that streamed replies already expose viaMugibStreamAttachments.getHistory()and pollrecentturns stay in sync with the widget and desk.
1.0.39 #
- Docs: README now documents the optional
mugib_sdk_pushadd-on (proactive push with automatic App ID) and updated version references. No API changes.
1.0.38 #
- Automatic App ID.
getPushConfig({bundleId, platform})now lets Mujib resolve the Firebase App ID for the exact app automatically (it looks up or registers the matching app in the central Firebase project and caches it), so developers never paste an App ID. Called without arguments, behavior is unchanged (globally-configured App IDs are returned).
1.0.37 #
- Central Firebase for push (no per-app Firebase setup). New
mugib.getPushConfig()fetches the non-secret Firebase client identifiers from Mujib (project id, sender id, api key, per-platform app id). Apps initialize a dedicated Firebase app from these values — no bundledgoogle-services.json/GoogleService-Info.plist. The Firebase service account (the send credential) stays encrypted on the Mujib server and never reaches the device. - Adds
MugibPushConfigmodel withandroidOptions/iosOptionshelpers. setPushToken/device_idbehavior unchanged; see docs §3.6 for the full centralized push flow.
1.0.36 #
- Mobile SDK is now its own
sdkchannel. SDK traffic is separated from the web widget: every request carries anX-Channel: sdkheader so Mujib tracks app installations as distinct contacts. - Managed device identity. The SDK generates and persists a stable
device_idper installation and sends it automatically as thesdkcontact identity — you never add it to your businesspayload. Read it viamugib.deviceId()if needed. - Outbound push. New
mugib.setPushToken(...)registers the app's FCM token (sent as a top-level field, never insidepayload). This lets Mujib reach the user with a push notification for follow-ups, surveys, and marketing campaigns when the app is backgrounded or closed. Configure the Firebase service account in Portal → Channels → Mobile App (SDK). - Adds
shared_preferencesdependency for durable device-id storage.
1.0.35 #
- Adaptive barge-in. The voice barge-in threshold now rises above the
caller's ambient noise floor (tracked live), so background noise in a loud room
is not mistaken for an interruption. The server/
/tokenvalue is always kept as a lower bound. - Self-tuning echo guard. The post-playback grace window widens automatically when residual speaker echo is detected and decays back once the environment is clean (bounded to 600 ms), improving robustness on devices with weak hardware AEC.
- Audio interruption handling. Voice calls now react to OS audio interruptions (incoming phone call, Siri/Assistant, another app taking focus): mic capture/uplink pauses and buffered agent audio is preserved, then the session reactivates and resumes automatically when focus returns.
client_statenow also reports the livenoise_floorso the server can co-tune its own VAD/echo gating.- No public API changes.
1.0.34 #
- Image attachments in chat. Mujib can now show/send catalog images (inbox apps: inventory, cars, hotel, courses, trips).
MugibChatReply.attachments—List<MugibChatAttachment>on blocking replies (send()), each withtype(image),url, optionalcaption.- New SSE event: streamed replies emit
MugibStreamAttachments(viasendStream()); the JSON contents are no longer leaked into reply text. - New public types:
MugibChatAttachment,MugibStreamAttachments, helperparseMugibAttachments. - No breaking change. Existing
send()/sendStream()/sendStreamText()callers keep working; attachments are additive and optional to render.
1.0.33 #
- Add UPGRADE.md — copy-paste notice for app teams (Arabic + English)
- Please upgrade:
mugib_sdk: ^1.0.33 - No endpoint or call-API change. Same
/token,start(),send(),payload - Voice Edge routing is already in 1.0.29+ (Core returns
stream_url) - Optional UI:
MugibCallState.searchingduring KB / tool waits - App voice handoff = Inbox follow-up, not a live join; use
watchHandoff()for chat - Server strips unresolved
{{VAR}}placeholders — do not substitute in the app - Flush playback on
interruptedonly
1.0.32 #
- Example: show
MugibCallState.searching("Looking that up…") during KB/tool waits so the demo matches the live protocol - Docs:
statelist includessearching; web/Flutter voice handoff flags Inbox follow-up (nobody joins the live audio); flush playback oninterruptedonly - Comments: reconnect opens a new server bridge —
session/resumequery params are forward-compat only
1.0.31 #
- Chat: live-agent replies use the same
session.send()andreplyfield as the bot — no new endpoint and no app code change required - Additive:
MugibChatReply.agentMessagesandMugibHandoffPoll.recent sendStreamaccepts a JSON handoff response (samereplytext)- Compatibility: existing
send()/poll()/watchHandoff()unchanged
1.0.30 #
- Chat: additive
session.watchHandoff()auto-poll stream (cancel to stop); existingpoll()unchanged - Voice/UI: optional Material post-call CSAT via
showMugibPostCallCsatandMugibPostCallCsatListenerwhenMugibVoiceCallOptions.chatSessionIdis set - Voice: expose
linkedChatSessionId/canOfferPostCallCsatafterstart - Compatibility: no breaking API changes for existing apps
1.0.29 #
- Voice: honor Core-routed
stream_urlfrom/tokenso calls can land on a Mugib Edge host (with Core fallback when no Edge is online)
1.0.28 #
- Voice: new
MugibCallState.searchingwhen the agent runs KB / MCP / tools (serverstate: searching) so UIs can show a "looking that up" indicator
1.0.27 #
- Docs: pin install examples to
^1.0.26+and clarify Gemini Live / OpenAI Realtime use the same SDK voice API
1.0.26 #
- Voice: accept OpenAI Realtime agents (
openai_realtime) on the same Mugib stream path as Gemini Live — no app API changes; provider is chosen on the agent - Voice:
isMugibVoiceAicovers bothgemini_liveandopenai_realtime - Compatibility: Gemini Live agents and existing
start()/ token / stream usage are unchanged for customers
1.0.25 #
- Docs: explain stream-token security, 45-second handshake TTL, unlimited established-call duration, reconnect behavior, and legacy SDK migration
- Docs: update Portal examples and all Flutter dependency references
1.0.24 #
- Voice: authenticate WebSocket handshakes with the short-lived, single-use
stream_tokenreturned by/voice-agents/{id}/token - Voice: request a fresh stream token for every automatic reconnect
- Compatibility: retain API-key WebSocket fallback for older Mugib backends
1.0.23 #
- Voice: lower playback buffer default (960 frames ≈ 40ms @ 24kHz, was 166ms) for faster time-to-first-audio and response latency
- Voice: parallel WebSocket connect + playback setup during call start
1.0.22 #
- Voice:
echo_guard_msandbarge_in_thresholdcome from Mugib/tokenand WebSocketready— no per-app tuning; Admin settings are the single source of truth - Voice:
MugibVoiceTokenincludes server echo-guard fields;VoiceEchoGuard.applyServerConfig
1.0.21 #
- Voice: echo guard — suppresses mic uplink during agent playback unless input
level exceeds a barge-in threshold; sends
client_stateto the server every ~150 ms - Voice:
preferSpeaker(defaultfalse) onMugibVoiceClient/MugibVoiceSession— earpiece/receiver routing on iOS and Android for cleaner AEC; opt in to loudspeaker when needed (preferSpeaker: true) - Voice:
VoiceEchoGuard— coordinates client-side gating withVoicePlaybackCoordinator(grace window + level-based barge-in) - Voice: Android
speakerphonefollowspreferSpeakerinstead of always forcing speaker - Voice: iOS audio session no longer forces
defaultToSpeakerunlesspreferSpeakeris true - Server (Mugib backend): matching uplink gate via
voice.echo_guard_msandvoice.barge_in_thresholdsettings (migration 130) - Voice:
MugibVoiceService.client()— forwardspreferSpeakertoMugibVoiceClient
Upgrade note: If you previously worked around echo with allow_interruption: false
in Portal, you can re-enable barge-in and rely on echo guard instead.
1.0.20 #
- Voice: rollback to the stable 1.0.12 stack — removes Silero VAD, uplink level gates, and post-greeting mic blocks that caused cut-offs, delay, and silent uplink on iOS/web
- Voice: mic uplink stays open when barge-in is enabled; pauses only when the agent has interruption disabled and PCM is still playing
- Voice:
VoicePlaybackCoordinatordeferslisteninguntil agent audio drains
1.0.12 #
- Voice: defer
listeningUI/state until buffered agent PCM finishes playing, so false VAD/echo signals no longer cut agent speech mid-sentence - Voice: wire
allowInterruptionfrom/token— mic uplink stays open when barge-in is enabled (default); uplink pauses during agent playback only when the agent has interruption disabled - Voice:
VoicePlaybackCoordinatorkeeps playback and call state in sync; realinterruptedevents still flush audio immediately for user barge-in
1.0.11 #
- Voice:
MugibVoiceClient.inputLevel— smoothed mic input level stream (0.0–1.0) for building a live level meter so users can confirm their mic is captured - Example: full voice-call screen — connect/end, mute, live transcript bubbles,
call state pill + timer, animated mic orb + input level meter, and friendly
error UI mapped from
MugibVoiceErrorCode - Deps: upgrade
web_socket_channel2 → 3,record5 → 6,http→ 1.5,flutter_lints4 → 5 (no breaking public API changes) - Deps: drop unused
permission_handler— microphone permission is handled byrecord.hasPermission(), so consumers no longer pull its heavier Android setup
1.0.10 #
- Voice:
MugibTranscript.partial— server streams incremental STT; replace the last line for the same role whenpartialis true - Voice:
MugibVoiceClient.transcriptLines— ready-to-render transcript list (no manual partial handling in your UI) - Voice:
MugibTranscriptBufferhelper for custom transcript UIs - Requires Mugib backend with accumulated voice transcript +
partialWebSocket field
1.0.9 #
- Fix: configure VoIP audio session for speaker-mode voice chat (like ChatGPT/Gemini)
— iOS
voiceChat+defaultToSpeaker, AndroidVOICE_COMMUNICATION+MODE_IN_COMMUNICATION+ speakerphone for hardware AEC - Add
audio_sessiondependency; mic stays open during agent speech (barge-in is enforced server-side via Portalallow_interruption, not in the SDK)
1.0.8 #
- Fix: stop clearing agent audio on
state: listening(onlyinterruptedclears playback) - Fix: pause mic uplink while agent speaks when
allow_interruptionis false (reduces phone echo) - Read
allow_interruptionfrom/tokenresponse (voice agent setting)
1.0.7 #
- Fix: voice
userContextpayload — sendexpect_context=1on WebSocket URL so the server waits for the context frame (matches browser widget reliability) - Fix: open WebSocket before PCM playback setup for faster context delivery
- Requires backend with voice payload/KB fixes (
expect_context; KB viasearch_knowledge_basetool + prefetch)
1.0.6 #
- Docs: explain proactive triggers — configured in Portal (
projects/{id}/triggers), optional read viagetWidgetTriggers(); returns[]when none configured - Docs: remove legacy
mugib_voicepackage references — usemugib_sdkonly - Requires backend with fix for
GET /api/v1/widget/triggers(200 + empty array, not 500)
1.0.5 #
- Docs: sync install version to
^1.0.4+ across repo guides - Add
@DeprecatedisGeminiLivealias →isMugibVoiceAi(migration from 1.0.3) - Remove stale
gemini_session.dartfrom package tree
1.0.4 #
- Fix: SSE streaming no longer drops spaces between tokens — parse
data:lines per the SSE spec (strip at most one optional separator space, not all leading whitespace). Fixes merged words insendStream().
1.0.3 #
- Rebrand voice stack as Mugib Voice AI in docs and public API (remove Gemini naming)
- Rename
GeminiVoiceSession→MugibVoiceSession(internal) - Rename
isGeminiLive→isMugibVoiceAion agent/token models
1.0.2 #
- Docs: clarify SDK scope — app connects to Agent; KB/MCP/tools run server-side
- Docs: move handoff poll and tool approval buttons to optional Advanced section
- Docs: minimal quick-start example (
send()+send("yes")for confirmations) - Code comments: label
poll()/confirmTool()as optional UI helpers
1.0.1 #
- Focus SDK on chat + voice + session payload; widget config/triggers read-only on [MugibClient]
- Remove KB/stats from main client facade (advanced via [MugibApiClient] / [MugibKbService])
- Add
getWidgetTriggers()for/api/v1/widget/triggers
1.0.0 #
- Unified
mugib_sdkpackage: chat + voice + KB + widget APIs - Chat: sessions, messages (JSON + SSE), payload, handoff poll, tool confirmations, conversions, CSAT
- Voice: Mugib Voice AI calls (from former
mugib_voice) - KB: list / add / update / delete via tenant API
- Widget config, stats, metrics