capacitor-native-agent 0.6.4 → 0.7.0

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.
@@ -117,9 +117,11 @@ class NativeAgentPlugin : Plugin() {
117
117
 
118
118
  @PluginMethod
119
119
  fun sendMessage(call: PluginCall) = withHandle(call) { h ->
120
+ val sessionKey = call.getString("sessionKey") ?: return@withHandle call.reject("sessionKey is required")
121
+ android.util.Log.i("TRACE:kt", "sendMessage sessionKey=$sessionKey")
120
122
  val params = SendMessageParams(
121
123
  prompt = call.getString("prompt") ?: return@withHandle call.reject("prompt is required"),
122
- sessionKey = call.getString("sessionKey") ?: return@withHandle call.reject("sessionKey is required"),
124
+ sessionKey = sessionKey,
123
125
  model = call.getString("model"),
124
126
  provider = call.getString("provider"),
125
127
  systemPrompt = call.getString("systemPrompt") ?: "",
@@ -128,6 +130,7 @@ class NativeAgentPlugin : Plugin() {
128
130
  priorMessagesJson = call.getString("priorMessagesJson"),
129
131
  )
130
132
  val runId = h.sendMessage(params)
133
+ android.util.Log.i("TRACE:kt", "sendMessage OK runId=$runId")
131
134
  val ret = JSObject()
132
135
  ret.put("runId", runId)
133
136
  call.resolve(ret)
@@ -135,7 +138,10 @@ class NativeAgentPlugin : Plugin() {
135
138
 
136
139
  @PluginMethod
137
140
  fun followUp(call: PluginCall) = withHandle(call) { h ->
138
- h.followUp(call.getString("prompt") ?: "")
141
+ val prompt = call.getString("prompt") ?: ""
142
+ android.util.Log.i("TRACE:kt", "followUp prompt_len=${prompt.length}")
143
+ h.followUp(prompt)
144
+ android.util.Log.i("TRACE:kt", "followUp OK")
139
145
  call.resolve()
140
146
  }
141
147
 
@@ -242,7 +248,10 @@ class NativeAgentPlugin : Plugin() {
242
248
 
243
249
  @PluginMethod
244
250
  fun listSessions(call: PluginCall) = withHandle(call) { h ->
245
- val json = h.listSessions(call.getString("agentId") ?: "main")
251
+ val agentId = call.getString("agentId") ?: "main"
252
+ android.util.Log.i("TRACE:kt", "listSessions agentId=$agentId")
253
+ val json = h.listSessions(agentId)
254
+ android.util.Log.i("TRACE:kt", "listSessions result_len=${json.length}")
246
255
  val ret = JSObject()
247
256
  ret.put("sessionsJson", json)
248
257
  call.resolve(ret)
@@ -251,7 +260,9 @@ class NativeAgentPlugin : Plugin() {
251
260
  @PluginMethod
252
261
  fun loadSession(call: PluginCall) = withHandle(call) { h ->
253
262
  val sessKey = call.getString("sessionKey") ?: return@withHandle call.reject("sessionKey is required")
263
+ android.util.Log.i("TRACE:kt", "loadSession sessionKey=$sessKey")
254
264
  val json = h.loadSession(sessKey)
265
+ android.util.Log.i("TRACE:kt", "loadSession result_len=${json.length}")
255
266
  val ret = JSObject()
256
267
  ret.put("sessionKey", sessKey)
257
268
  ret.put("messagesJson", json)
@@ -260,13 +271,17 @@ class NativeAgentPlugin : Plugin() {
260
271
 
261
272
  @PluginMethod
262
273
  fun resumeSession(call: PluginCall) = withHandle(call) { h ->
274
+ val sessKey = call.getString("sessionKey") ?: return@withHandle call.reject("sessionKey is required")
275
+ val agentId = call.getString("agentId") ?: "main"
276
+ android.util.Log.i("TRACE:kt", "resumeSession sessionKey=$sessKey agentId=$agentId")
263
277
  h.resumeSession(
264
- call.getString("sessionKey") ?: return@withHandle call.reject("sessionKey is required"),
265
- call.getString("agentId") ?: "main",
278
+ sessKey,
279
+ agentId,
266
280
  call.getString("messagesJson"),
267
281
  call.getString("provider"),
268
282
  call.getString("model"),
269
283
  )
284
+ android.util.Log.i("TRACE:kt", "resumeSession OK")
270
285
  call.resolve()
271
286
  }
272
287
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-native-agent",
3
- "version": "0.6.4",
3
+ "version": "0.7.0",
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",