capacitor-native-agent 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -20,6 +20,9 @@ Pod::Spec.new do |s|
|
|
|
20
20
|
# Prebuilt Rust xcframework (static library)
|
|
21
21
|
s.vendored_frameworks = 'ios/Frameworks/NativeAgentFFI.xcframework'
|
|
22
22
|
|
|
23
|
+
# libgit2 (bundled in Rust FFI) requires libiconv on iOS
|
|
24
|
+
s.libraries = 'iconv'
|
|
25
|
+
|
|
23
26
|
# Expose the xcframework's C headers so the Swift compiler can `canImport(native_agent_ffiFFI)`
|
|
24
27
|
s.pod_target_xcconfig = {
|
|
25
28
|
'OTHER_SWIFT_FLAGS[sdk=iphoneos*]' => '$(inherited) -Xcc -fmodule-map-file=${PODS_TARGET_SRCROOT}/ios/Frameworks/NativeAgentFFI.xcframework/ios-arm64/Headers/native_agent_ffiFFI.modulemap',
|
package/Package.swift
CHANGED
|
@@ -84,7 +84,10 @@ public class NativeAgentPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
84
84
|
guard let h = handle else {
|
|
85
85
|
return call.reject("NativeAgent not initialized — call initialize() first")
|
|
86
86
|
}
|
|
87
|
-
Task
|
|
87
|
+
// Use GCD instead of Task{} — Rust FFI calls use block_on() which blocks
|
|
88
|
+
// the calling thread. Swift Task{} uses a cooperative thread pool that can
|
|
89
|
+
// deadlock when threads are blocked. GCD's concurrent queue is safe for blocking.
|
|
90
|
+
DispatchQueue.global(qos: .userInitiated).async {
|
|
88
91
|
block(h)
|
|
89
92
|
}
|
|
90
93
|
}
|
|
@@ -102,12 +105,12 @@ public class NativeAgentPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
102
105
|
return call.reject("authProfilesPath is required")
|
|
103
106
|
}
|
|
104
107
|
|
|
105
|
-
|
|
108
|
+
DispatchQueue.global(qos: .userInitiated).async { [self] in
|
|
106
109
|
do {
|
|
107
110
|
let config = InitConfig(
|
|
108
|
-
dbPath: resolvePath(dbPath),
|
|
109
|
-
workspacePath: resolvePath(workspacePath),
|
|
110
|
-
authProfilesPath: resolvePath(authProfilesPath)
|
|
111
|
+
dbPath: self.resolvePath(dbPath),
|
|
112
|
+
workspacePath: self.resolvePath(workspacePath),
|
|
113
|
+
authProfilesPath: self.resolvePath(authProfilesPath)
|
|
111
114
|
)
|
|
112
115
|
let h = try NativeAgentHandle(config: config)
|
|
113
116
|
try h.setEventCallback(callback: NativeAgentEventBridge(plugin: self))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capacitor-native-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Native AI agent loop for Capacitor — runs LLM completions, tool execution, and cron jobs in native Rust, enabling background execution.",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|