Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
mobile: rename libsam.so and sam_ffi.dart to libagentmesh.so and agentmesh_ffi.dart
Antonio Ojeacf6f289515ca
diff --git a/Makefile b/Makefileindex b2434fcf..e3ea9e65 100644--- a/Makefile+++ b/Makefile@@ -37,14 +37,14 @@ build:.PHONY: mobile-ffi-host mobile-ffi-android mobile-ffi-android-x86_64 mobile-ffi-ios mobile-ffi mobile-app-apk mobile-app-apk-emulator mobile-app-bundlemobile-ffi-host:mkdir -p "$(OUT_DIR)"- CGO_ENABLED=1 go build -v -ldflags "$(VERSION_LDFLAGS)" -buildmode=c-shared -o "$(OUT_DIR)/libsam.so" ./mobile/agentmesh-node-ffi+ CGO_ENABLED=1 go build -v -ldflags "$(VERSION_LDFLAGS)" -buildmode=c-shared -o "$(OUT_DIR)/libagentmesh.so" ./mobile/agentmesh-node-ffimobile-ffi-android:@if [ -z "$(ANDROID_NDK_LATEST)" ]; then \echo "Error: Android NDK not found under $(ANDROID_HOME_RESOLVED)/ndk/. Please install NDK (Side-by-side) via Android Studio or sdkmanager." >&2; \exit 1; \fi- GOOS=android GOARCH=arm64 CGO_ENABLED=1 CC=$(ANDROID_CC_ARM64) go build -v -ldflags="-checklinkname=0 $(VERSION_LDFLAGS)" -buildmode=c-shared -o "$(OUT_DIR)/android/libsam.so" ./mobile/agentmesh-node-ffi+ GOOS=android GOARCH=arm64 CGO_ENABLED=1 CC=$(ANDROID_CC_ARM64) go build -v -ldflags="-checklinkname=0 $(VERSION_LDFLAGS)" -buildmode=c-shared -o "$(OUT_DIR)/android/libagentmesh.so" ./mobile/agentmesh-node-ffimobile-ffi-android-x86_64:@if [ -z "$(ANDROID_NDK_LATEST)" ]; then \@@ -52,11 +52,11 @@ mobile-ffi-android-x86_64:exit 1; \fimkdir -p "$(OUT_DIR)/android-x86_64"- GOOS=android GOARCH=amd64 CGO_ENABLED=1 CC=$(ANDROID_CC_X86_64) go build -v -ldflags="-checklinkname=0 $(VERSION_LDFLAGS)" -buildmode=c-shared -o "$(OUT_DIR)/android-x86_64/libsam.so" ./mobile/agentmesh-node-ffi+ GOOS=android GOARCH=amd64 CGO_ENABLED=1 CC=$(ANDROID_CC_X86_64) go build -v -ldflags="-checklinkname=0 $(VERSION_LDFLAGS)" -buildmode=c-shared -o "$(OUT_DIR)/android-x86_64/libagentmesh.so" ./mobile/agentmesh-node-ffimobile-ffi-ios:mkdir -p "$(OUT_DIR)/ios"- GOOS=ios GOARCH=arm64 CGO_ENABLED=1 go build -v -ldflags "$(VERSION_LDFLAGS)" -buildmode=c-archive -o "$(OUT_DIR)/ios/libsam.a" ./mobile/agentmesh-node-ffi+ GOOS=ios GOARCH=arm64 CGO_ENABLED=1 go build -v -ldflags "$(VERSION_LDFLAGS)" -buildmode=c-archive -o "$(OUT_DIR)/ios/libagentmesh.a" ./mobile/agentmesh-node-ffimobile-ffi: mobile-ffi-host mobile-ffi-android mobile-ffi-android-x86_64 mobile-ffi-ios@@ -89,11 +89,11 @@ mobile-app-google-services:.PHONY: mobile-app-jnilibs-arm64 mobile-app-jnilibs-x86_64mobile-app-jnilibs-arm64: mobile-ffi-androidmkdir -p $(MOBILE_APP_DIR)/android/app/src/main/jniLibs/arm64-v8a- cp "$(OUT_DIR)/android/libsam.so" $(MOBILE_APP_DIR)/android/app/src/main/jniLibs/arm64-v8a/libsam.so+ cp "$(OUT_DIR)/android/libagentmesh.so" $(MOBILE_APP_DIR)/android/app/src/main/jniLibs/arm64-v8a/libagentmesh.somobile-app-jnilibs-x86_64: mobile-ffi-android-x86_64mkdir -p $(MOBILE_APP_DIR)/android/app/src/main/jniLibs/x86_64- cp "$(OUT_DIR)/android-x86_64/libsam.so" $(MOBILE_APP_DIR)/android/app/src/main/jniLibs/x86_64/libsam.so+ cp "$(OUT_DIR)/android-x86_64/libagentmesh.so" $(MOBILE_APP_DIR)/android/app/src/main/jniLibs/x86_64/libagentmesh.somobile-app-apk: mobile-app-jnilibs-arm64 mobile-app-jnilibs-x86_64 mobile-app-google-servicescd $(MOBILE_APP_DIR) && flutter build apk --release --target-platform android-arm64,android-x64 $(MOBILE_FLUTTER_BUILD_FLAGS)@@ -107,7 +107,7 @@ mobile-app-apk-emulator: mobile-app-jnilibs-x86_64 mobile-app-google-services# ANDROID_KEY_PASSWORD environment variables (see mobile/agentmesh-node-app/README.md).## Play serves each device the split for its own ABI, so the bundle must only-# contain ABIs that have a libsam.so: Flutter's default set also includes+# contain ABIs that have a libagentmesh.so: Flutter's default set also includes# armeabi-v7a, which would install and then die opening the FFI library..PHONY: mobile-app-bundlemobile-app-bundle: mobile-app-jnilibs-arm64 mobile-app-jnilibs-x86_64 mobile-app-google-servicesdiff --git a/mobile/agentmesh-node-app/README.md b/mobile/agentmesh-node-app/README.mdindex 0de0e348..c63e98ad 100644--- a/mobile/agentmesh-node-app/README.md+++ b/mobile/agentmesh-node-app/README.md@@ -44,14 +44,14 @@ Run one of the following from the **repository root directory**. The `mobile-ffi```bashmake mobile-ffi-androidmkdir -p mobile/agentmesh-node-app/android/app/src/main/jniLibs/arm64-v8a- cp bin/android/libsam.so mobile/agentmesh-node-app/android/app/src/main/jniLibs/arm64-v8a/+ cp bin/android/libagentmesh.so mobile/agentmesh-node-app/android/app/src/main/jniLibs/arm64-v8a/```* **For Android x86_64 emulators (Intel and Linux hosts)**:```bashmake mobile-ffi-android-x86_64mkdir -p mobile/agentmesh-node-app/android/app/src/main/jniLibs/x86_64- cp bin/android-x86_64/libsam.so mobile/agentmesh-node-app/android/app/src/main/jniLibs/x86_64/+ cp bin/android-x86_64/libagentmesh.so mobile/agentmesh-node-app/android/app/src/main/jniLibs/x86_64/```### 2. Run the Appdiff --git a/mobile/agentmesh-node-app/android/app/build.gradle.kts b/mobile/agentmesh-node-app/android/app/build.gradle.ktsindex 3333bfe9..73f61042 100644--- a/mobile/agentmesh-node-app/android/app/build.gradle.kts+++ b/mobile/agentmesh-node-app/android/app/build.gradle.kts@@ -43,7 +43,7 @@ android {targetSdk = flutter.targetSdkVersionversionCode = flutter.versionCodeversionName = flutter.versionName- // Only ABIs that have a libsam.so (see the Makefile jnilibs targets)+ // Only ABIs that have a libagentmesh.so (see the Makefile jnilibs targets)// may be packaged. Plugin AARs (ML Kit, JNA, CameraX) ship// armeabi-v7a natives too; without this filter Play lists that ABI// as supported and serves the app to 32-bit devices, where it diesdiff --git a/mobile/agentmesh-node-app/android/app/src/main/kotlin/dev/sammesh/connect/SamFunctions.kt b/mobile/agentmesh-node-app/android/app/src/main/kotlin/dev/sammesh/connect/SamFunctions.ktindex c6ab55f5..4ae06119 100644--- a/mobile/agentmesh-node-app/android/app/src/main/kotlin/dev/sammesh/connect/SamFunctions.kt+++ b/mobile/agentmesh-node-app/android/app/src/main/kotlin/dev/sammesh/connect/SamFunctions.kt@@ -6,7 +6,7 @@ import com.sun.jna.Libraryimport com.sun.jna.Nativeimport com.sun.jna.Pointer-// JNA Interface for libsam.so+// JNA Interface for libagentmesh.sointerface SamLib : Library {fun GetMeshInfo(): Pointer?fun CallRemoteTool(peerId: String, toolName: String, argsJson: String): Pointer?@@ -17,11 +17,11 @@ class SamFunctions {// Load the library lazilyprivate val samLib: SamLib by lazy {- Native.load("sam", SamLib::class.java) as SamLib+ Native.load("agentmesh", SamLib::class.java) as SamLib}/**- * Retrieves the current status and statistics of the SAM mesh node.+ * Retrieves the current status and statistics of the Agent Mesh node.* Returns a JSON string containing connected_peers, dht_size, and node_id.*/@AppFunction(isDescribedByKDoc = true)@@ -41,7 +41,7 @@ class SamFunctions {}/**- * Calls an MCP tool on a remote peer in the SAM mesh.+ * Calls an MCP tool on a remote peer in Agent Mesh.* @param peerId The ID of the remote peer.* @param toolName The name of the tool to call (namespaced, e.g., 'scheme://service/tool').* @param argsJson The arguments for the tool call as a JSON string (e.g., '{"key": "value"}').diff --git a/mobile/agentmesh-node-app/android/gradle.properties b/mobile/agentmesh-node-app/android/gradle.propertiesindex 6f0b4a56..197c7dfd 100644--- a/mobile/agentmesh-node-app/android/gradle.properties+++ b/mobile/agentmesh-node-app/android/gradle.properties@@ -6,5 +6,5 @@ android.newDsl=falseandroid.builtInKotlin=false# The Flutter Gradle plugin otherwise resets ndk.abiFilters to its default# arm/arm64/x64 set; app/build.gradle.kts owns the list (only ABIs with a-# libsam.so).+# libagentmesh.so).disable-abi-filtering=truediff --git a/mobile/agentmesh-node-app/integration_test/e2e_test.dart b/mobile/agentmesh-node-app/integration_test/e2e_test.dartindex 4b16b96e..64a60723 100644--- a/mobile/agentmesh-node-app/integration_test/e2e_test.dart+++ b/mobile/agentmesh-node-app/integration_test/e2e_test.dart@@ -5,7 +5,7 @@ import 'package:flutter_test/flutter_test.dart';import 'package:http/http.dart' as http;import 'package:integration_test/integration_test.dart';import 'package:path_provider/path_provider.dart';-import 'package:sam_agent/sam_ffi.dart';+import 'package:sam_agent/agentmesh_ffi.dart';void main() {IntegrationTestWidgetsFlutterBinding.ensureInitialized();diff --git a/mobile/agentmesh-node-app/lib/sam_ffi.dart b/mobile/agentmesh-node-app/lib/agentmesh_ffi.dartsimilarity index 98%rename from mobile/agentmesh-node-app/lib/sam_ffi.dartrename to mobile/agentmesh-node-app/lib/agentmesh_ffi.dartindex 7f6f1a9e..f60c4466 100644--- a/mobile/agentmesh-node-app/lib/sam_ffi.dart+++ b/mobile/agentmesh-node-app/lib/agentmesh_ffi.dart@@ -80,11 +80,11 @@ class SamNodeLib {SamNodeLib() {if (Platform.isAndroid) {- _dylib = ffi.DynamicLibrary.open('libsam.so');+ _dylib = ffi.DynamicLibrary.open('libagentmesh.so');} else if (Platform.isIOS || Platform.isMacOS) {_dylib = ffi.DynamicLibrary.process();} else {- _dylib = ffi.DynamicLibrary.open('libsam.so'); // fallback+ _dylib = ffi.DynamicLibrary.open('libagentmesh.so'); // fallback}_startNode = _dylib.lookupFunction<StartNodeC, StartNodeDart>('StartNode');diff --git a/mobile/agentmesh-node-app/lib/main.dart b/mobile/agentmesh-node-app/lib/main.dartindex 0bd987f5..240b1ecb 100644--- a/mobile/agentmesh-node-app/lib/main.dart+++ b/mobile/agentmesh-node-app/lib/main.dart@@ -13,7 +13,7 @@ import 'package:path_provider/path_provider.dart';import 'package:qr_flutter/qr_flutter.dart';import 'package:url_launcher/url_launcher.dart';-import 'sam_ffi.dart';+import 'agentmesh_ffi.dart';import 'mcp_server.dart';import 'enroll_link.dart';import 'scan_page.dart';@@ -1029,7 +1029,7 @@ class _NodeControlPageState extends State<NodeControlPage> {'type': 'mcp','name': 'phone-sensors','description':- 'Exposes phone sensors like battery and location to the Agent Mesh',+ 'Exposes phone sensors like battery and location to Agent Mesh','targetUrl': _embeddedMcpServer.targetUrl,},if (_externalMcpUrlController.text.isNotEmpty &&diff --git a/mobile/mobile_e2e.sh b/mobile/mobile_e2e.shindex a08b2c92..c05f1932 100755--- a/mobile/mobile_e2e.sh+++ b/mobile/mobile_e2e.sh@@ -56,7 +56,7 @@ setup_env() {go build -v -o "$REPO_ROOT/bin/mcp-client" ./cmd/mcp-clientmake -j4 docker-build-control-plane docker-build-router docker-build-node docker-build-mock-oidc mobile-ffi-android-x86_64mkdir -p mobile/agentmesh-node-app/android/app/src/main/jniLibs/x86_64-cp bin/android-x86_64/libsam.so mobile/agentmesh-node-app/android/app/src/main/jniLibs/x86_64/libsam.so+cp bin/android-x86_64/libagentmesh.so mobile/agentmesh-node-app/android/app/src/main/jniLibs/x86_64/libagentmesh.so# Warm the app dependencies so the emulator-attached phase goes straight to# the gradle build.