amba 4.1.0
amba: ^4.1.0 copied to clipboard
amba SDK for Flutter — the full 4.0 surface (auth, users, sessions, sync, leagues + 29 more namespaces) for the agent-native backend-as-a-service.
Changelog #
All notable changes to the amba Flutter SDK are documented here.
Format follows Keep a Changelog;
versions follow SemVer.
4.1.0 — 2026-10-19 #
Added #
Amba.experiments.getVariant(key)assigns the signed-in user to experimentkeyand returns anExperimentAssignment(experimentKey,variant,bucketingId). The assignment is sticky: later calls return the same variant.bucketingIdis the user id the server hashed to pick the variant.Amba.experiments.trackExposure(key)records that the user saw it.Amba.onExperimentAssigned(listener)calls the listener once per experiment per user session (a sign-out starts a new session). An error the listener throws is caught and logged; it never reaches thegetVariantcaller. Returns a function that unsubscribes.- Requests carry
X-App-Version(the app's version, which the plugin reads from the native app info;Amba.configure(appVersion: ...)overrides it),X-Device-RegionandX-Device-OSwhen known. Segments can target these values. CallWidgetsFlutterBinding.ensureInitialized()beforeAmba.configureso the plugin can answer. AmbaBindingsgainsexperimentsGetVariant(String key)andexperimentsTrackExposure(String key). A class thatimplements AmbaBindings(a custom transport or a test fake) adds both; amocktailMockneeds no change.
Changed #
- Built on the 4.1.0 core.
4.0.10 — 2026-10-16 #
Fixed #
- After
linkAccountadds an Apple or Google identity, the SDK adopts theanonymous_idthe server returns for the user. Since 2026-10-15 the server gives the account a new anonymous id on such a link, and events tracked afterwards now carry it; they carried the pre-link id. - The native libraries carry no file path of the machine that built them. Source locations in the SDK's messages start at
/cargo/for dependencies and at the package for the SDK's own code. - The SDK reports the core's version,
amba-core/4.0.15, in theX-SDK-Versionheader and as each event'ssdk_version.
4.0.9 — 2026-10-15 #
Added #
- Crash reports symbolicate the SDK's native frames. The package ships the iOS device framework's debug symbols as
ios/Frameworks/amba_core.dSYMs/amba_core.framework.dSYM. CocoaPods copies them into the app's build, so an archive carries them indSYMs/(with either pod linkage): App Store Connect and crash reporters show function names, files and lines for the SDK's frames, and the upload no longer warns about a missing dSYM foramba_core.framework. The dSYM covers the device (arm64) binary. On an Intel Mac, a simulator build that buildsx86_64only logs CocoaPods' standard warning that this vendored dSYM's architecture doesn't match the build; the build itself is unaffected.
Changed #
- The iOS pod's version is the package version:
ios/amba.podspecreads it frompubspec.yaml(it said1.0.1). - The SDK's native core reports its own version,
4.0.14, asamba-core/<version>in theX-SDK-Versionheader and as each event'ssdk_version(it said4.0.2).
Documentation #
- The supported platforms are iOS 13+ and Android API 24+. The package ships no native code for macOS, Windows or Linux, and the SDK can't load in a build for them; earlier docs listed them as bundled.
4.0.8 — 2026-10-15 #
Added #
inventory.purchase(storeId: ...)buys through that store's listing, with its override price, per-user limit and segment. An item an active store limits per user is sold only this way; withoutstoreIdthe purchase answers409 STORE_PURCHASE_REQUIRED. The core used to dropstore_id, so such an item couldn't be bought withinventory.purchase.
Server behavior #
These ship with the API, so apps on earlier versions get them without an upgrade.
- A store's segment is enforced: a store with a
segment_idis listed, read and sold only to users the segment's last evaluation recorded as members (a user it has not evaluated yet sees it after the next evaluation), and answers404 NOT_FOUNDto everyone else. An item only segment-targeted stores list is sold from the catalog to their members only (403 STORE_ACCESS_REQUIRED). - A store purchase charges the listing's override price, the
price_centsthatstores.getPurchaseOptionsnow shows.
4.0.7 — 2026-10-15 #
Fixed #
- iOS apps can call the SDK. The package ships its native core as
ios/Frameworks/amba_core.xcframework, a dynamic framework that CocoaPods embeds in the app, and the Dart layer opens it withDynamicLibrary.open('amba_core.framework/amba_core'). Earlier versions shipped a static library (libamba_core.xcframework), and the app's linker kept none of its functions, because nothing in the app refers to them by name. The first call,Amba.configure, then threwInvalid argument(s): Failed to lookup symbol 'amba_init'. - iOS simulator builds work. The framework has an
ios-arm64_x86_64-simulatorslice next to theios-arm64device slice. Earlier versions had the device slice only, soflutter build ios --simulatorandflutter runon a simulator failed withLibrary 'amba_core' not found.
Packaging #
- The iOS framework is 17 MiB for both slices; the earlier device library alone was 99 MiB.
- Each slice targets iOS 13.0, the minimum
amba.podspecdeclares (arm64 simulators start at iOS 14.0). - The framework carries a privacy manifest (
PrivacyInfo.xcprivacy), the same one the Swift SDK ships. - It works with either CocoaPods linkage:
use_frameworks!, whichflutter createwrites, oruse_frameworks! :linkage => :static. Apps change nothing in their Podfile or Xcode settings. - An app that added its own linker flags for the earlier static library (such as
-force_loador-l"amba_core"inOTHER_LDFLAGSor a Podfilepost_installhook) removes them;libamba_core.ais gone, so those flags now fail the link.
4.0.5 — 2026-10-15 #
Changed #
FriendshiphasrequesterIdandaddresseeId: a pending row is incoming whenaddresseeIdequalsuserIdand outgoing whenrequesterIddoes.
Server behavior #
These ship with the API, so apps on earlier versions get them without an upgrade.
reviews.createworks:POST /v1/client/reviewsreads thetarget_type/target_idthe SDK sends (it read onlyitem_type/item_idand failed with a 500), andreviews.create/reviews.updatecome back withauthor_id,target_typeandtarget_id.target_typeiscontent_itemorcustom, andratingis a whole number from 1 to 5, such as4.0; other values answer400 INVALID_ITEM_TYPE/400 INVALID_RATING. The core checks the rating before sending.friends.list()returns the accepted friendships, then the pending requests in both directions; it returned the accepted ones only.friends.friends()still returns the accepted ones. Blocked rows stay out of both, and a list holds at most 1000 rows.inventory.purchasewith aquantityother than1answers400 QUANTITY_NOT_SUPPORTEDand charges nothing. It used to charge for and grant one item whatever the quantity; call it once per item to buy several.
4.0.4 — 2026-10-15 #
Changed #
inventory.purchasereturnsInventoryPurchase(purchased,currencyCode,price,balanceAfter). It was typed as anInventoryItem, which the route never returned; read the bought item withinventory.items().ReferralClaim.referrerIdis nullable: a code no user owns has no referrer.
Server behavior #
These ship with the API, so apps on earlier versions get them without an upgrade.
config.fetch()evaluates each key's segment and percentage conditions for the signed-in user. Before sign-in, or with an expired session token, it returns each key's default value as before.- Deep links, inventory, content items, friendships and referral codes come back with the fields the SDK types declare, so
deepLinks.get,inventory.getItems/getItem/consume,content.library/item/createItem/updateItem, everyfriendsmethod andreferrals.getReferralCode/claimReferralreturn their typed results. Earlier these calls failed reading the response, after the server had already made the change. Claiming a code no user owns needs this version. inventory.consume({ item_id })takes the catalog item id or theidof a row frominventory.getItems().- A single-item
inventory.purchaseresponse also carries the inventory row it added to, so earlier versions read it without failing; a bundle purchase needs this version. - Each Apple or Google sign-in nonce is accepted once; sending a sign-in or link request again with the same nonce returns
401 NONCE_REUSED. DELETE /v1/client/users/me/push-tokendeactivates only the signed-in user's own tokens.
4.0.3 — 2026-10-14 #
Security #
- Ids, keys, short codes and names placed in a request path are percent-encoded, so
/,?and#stay part of the value and the request keeps its route. An id of.,..or the empty string fails withVALIDATION_ERRORbefore any request is sent.
Server behavior #
- New free-tier projects can receive
402 FREE_TIER_LIMIT_REACHEDfrom the sign-in request calls (magic link, email OTP, SMS OTP) once the project's daily sign-in budget is spent, and from email sends, which are a paid feature on those projects. The error'sdetails.limitnames the limit anddetails.upgradecarries the one-call upgrade. Projects created before the free-tier limits keep their previous behavior, and no SDK upgrade is needed. - A free project owned by an agent sandbox account that nobody has claimed answers writes with
403 SANDBOX_CLAIM_REQUIREDonce it has spent 14 days in that account, until the account is claimed.
Added #
Amba.offerings([offeringId])/AmbaClient.offerings— subscription offerings (the packages your paywall renders, provider-neutral). Pass an offering id for one offering; omit it for all. Parity with Web/Node and the iOS/Android 4.1.0 SDKs.Amba.entitlements.restore()— Restore Purchases: re-syncs the user's owned entitlements server-side and returns the active set (the App Store 3.1.1 requirement). Fails without changing access when the validation engine is unreachable.
Both methods are generated from the same single-source surface manifest that drives every other Amba SDK, so the Flutter surface can no longer silently lag the rest of the family.
4.0.2 — 2026-05-27 #
Version-alignment release across every published Amba package. Brings
the infra-tier packages (@layers/amba, @layers/amba-shared,
@layers/amba-mcp — previously on 1.x) onto the same 4.x track as the
SDKs so customers can pin a single version everywhere. No surface or
behavior changes in this SDK.
Removed from the package family in this release: the deprecated
@layers/amba-functions and @layers/amba-client packages were
unpublished from npm. Amba functions are plain ES modules with the
standard export default { async fetch(req, env, ctx) } shape — no
wrapper. See docs.amba.dev/functions/runtime
for the full contract.
4.0.1 — 2026-05-26 #
Version-alignment release across every Amba SDK. No surface or behavior
changes — bumps every SDK (web, node, react, react-native, expo, core,
kotlin, swift, flutter, unity) to 4.0.1 so customers can pin to a single
version across stacks. See sdks/CANONICAL_API.md
for the 4.0 surface.
4.0.0 — 2026-05-25 #
Coordinated 4.0 release across every Amba SDK. All 9 SDKs ship the same
surface on the same day; see the canonical spec at
sdks/CANONICAL_API.md for the per-method contract.
Breaking #
Amba.messaging.getMessage(messageId)now takes(conversationId, messageId)and returnsMessage?(null when the message can't be found). The pre-4.0 single-arg form called a non-existent FFI symbol — every call threwArgumentErrorat dispatch, so no working customer code can be affected.
Added — net-new namespaces #
Amba.users—get(userId?),update(patch, {userId?}).Amba.sessions—list(),revoke(sessionId). List/revoke the customer-defined app sessions; distinct from the auth JWT envelope.Amba.sync—pushChanges([SyncChange]),pullChanges(entityType, checkpointToken?). Offline change replay with server-wins conflicts.Amba.leagues—me(),cohort(). Tiered weekly leaderboard cohorts; cohort listings are anonymised (display name only, no user ids).
Added — net-new methods on existing namespaces #
Amba.auth.requestMagicLink(email),verifyMagicLink(token),linkAccount(provider, credential).Amba.collections.findNearest(name, vectorField:, queryVector:, k:, filter?)andcount(name, filter?).Amba.storage.list(prefix?),delete(assetId),download(assetId)(returnsUint8List— the native core base64-encodes inside a{data:"…"}envelope to keep the FFI ABI string-only; the wrapper decodes on the platform side).Amba.messaging.createConversation({participants, conversationType?, name?}),listMessages(conversationId, {limit?, offset?}),markRead(conversationId).Amba.friends.sendRequest(userId),acceptRequest(friendshipId),declineRequest(friendshipId).Amba.catalog.get(id).
Fixed #
Amba.messaging.getMessage— the native core added the long-missingamba_messaging_get_message(conv_id, msg_id)symbol; the wrapper now actually dispatches instead ofArgumentError'ing out. Returnsnullwhen the message isn't in the first 5,000 entries of the conversation (the helper paginateslist_messagesinternally since the server has no GET-by-id route).
Test coverage #
- New tests for every method added above, including the OTP path (zero coverage pre-4.0).
1.0.2 — 2026-05-20 #
Added #
Amba.diagnostics.ping()— wire-verify primitive. Call once afterAmba.configure(...)to confirm the SDK is talking to the right project with the right API key in the right environment. Returns aPingResultwhose fields (serverProjectId,environment,keyFingerprint,latencyMs) are all server-decided, so comparingserverProjectIdagainst the configured project id catches "wrong key in .env" silent failures on the spot. Mirrors the TypeScript SDKs'Amba.diagnostics.ping()shape (added in 1.0.0).dart:developer log()calls from the SDK now usename: "amba-sdk", so Flutter DevTools /flutter logsfiltering on that name surfaces amba's own diagnostics without dragging in app-side log noise. The SDK never callsprint().
Known limitations #
- The published xcframework still ships the iOS device slice only (arm64) — unchanged from 1.0.1. Running on an iOS simulator requires building a simulator slice locally. iOS device builds, App Store archives, and Android (all four ABIs) are fully supported out-of-box. The simulator-slice download follow-up tracked in 1.0.1 is still pending.
1.0.1 — 2026-05-20 #
Fixed #
- Bundled prebuilt native binaries for Android (arm64-v8a, armeabi-v7a,
x86_64, x86) and iOS device (arm64) so
flutter build apkandflutter build ipasucceed without any local build step. - Added
android/src/main/kotlin/com/layers/amba/AmbaPlugin.ktandios/Classes/AmbaPlugin.swiftplugin stubs required by Flutter's plugin registration mechanism. - Added
android/build.gradle,android/src/main/AndroidManifest.xml, andios/amba.podspecneeded for Flutter to discover and link the plugin. - Fixed
Amba.versionconstant to match the published package version.
Known limitations #
- The published xcframework ships the iOS device slice only (arm64).
Running on an iOS simulator requires building a simulator slice
locally — a follow-up release will add an automated podspec
prepare_commandthat downloads the matching slice onpod install. iOS device builds, App Store archives, and Android (all four ABIs) are fully supported out-of-box.
1.0.0 — 2026-05-16 #
Initial public release of the amba Flutter SDK on pub.dev.
Added #
Ambaclient class wrapping the Amba backend API for Flutter apps: configure with project id + client key; track events; anonymous sign-in; authenticated sign-in via magic link; collection CRUD; AI prompt invocation.- Smoke test fixtures under
test/integration/exercising the public surface against a live tenant.