capacitor-native-agent 0.1.5 → 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.
@@ -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
- Task {
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.5",
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",