capacitor-native-agent 0.3.6 → 0.3.8
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.
- package/android/src/main/java/com/t6x/plugins/nativeagent/NativeAgentPlugin.kt +10 -0
- package/android/src/main/java/uniffi/native_agent_ffi/native_agent_ffi.kt +30 -0
- package/android/src/main/jniLibs/arm64-v8a/libnative_agent_ffi.so +0 -0
- package/dist/esm/definitions.d.ts +11 -0
- package/dist/esm/definitions.d.ts.map +1 -1
- package/dist/esm/plugin.d.ts.map +1 -1
- package/dist/esm/plugin.js +1 -0
- package/dist/esm/plugin.js.map +1 -1
- package/ios/Frameworks/NativeAgentFFI.xcframework/Info.plist +4 -4
- package/ios/Frameworks/NativeAgentFFI.xcframework/ios-arm64/Headers/native_agent_ffi/native_agent_ffi.swift +2594 -0
- package/ios/Frameworks/NativeAgentFFI.xcframework/ios-arm64/Headers/native_agent_ffi/native_agent_ffiFFI.h +11 -0
- package/ios/Frameworks/NativeAgentFFI.xcframework/ios-arm64/libnative_agent_ffi.a +0 -0
- package/ios/Frameworks/NativeAgentFFI.xcframework/ios-arm64-simulator/Headers/native_agent_ffi/native_agent_ffi.swift +2594 -0
- package/ios/Frameworks/NativeAgentFFI.xcframework/ios-arm64-simulator/Headers/native_agent_ffi/native_agent_ffiFFI.h +11 -0
- package/ios/Frameworks/NativeAgentFFI.xcframework/ios-arm64-simulator/libnative_agent_ffi.a +0 -0
- package/ios/Sources/NativeAgentPlugin/Generated/native_agent_ffi.swift +21 -0
- package/ios/Sources/NativeAgentPlugin/Generated/native_agent_ffiFFI.h +11 -0
- package/ios/Sources/NativeAgentPlugin/NativeAgentPlugin.swift +28 -0
- package/package.json +2 -2
|
@@ -373,6 +373,11 @@ void uniffi_native_agent_ffi_fn_method_nativeagenthandle_delete_auth(void*_Nonnu
|
|
|
373
373
|
void uniffi_native_agent_ffi_fn_method_nativeagenthandle_end_skill(void*_Nonnull ptr, RustBuffer skill_id, RustCallStatus *_Nonnull out_status
|
|
374
374
|
);
|
|
375
375
|
#endif
|
|
376
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_FN_METHOD_NATIVEAGENTHANDLE_EXCHANGE_OAUTH_CODE
|
|
377
|
+
#define UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_FN_METHOD_NATIVEAGENTHANDLE_EXCHANGE_OAUTH_CODE
|
|
378
|
+
RustBuffer uniffi_native_agent_ffi_fn_method_nativeagenthandle_exchange_oauth_code(void*_Nonnull ptr, RustBuffer token_url, RustBuffer body_json, RustBuffer content_type, RustCallStatus *_Nonnull out_status
|
|
379
|
+
);
|
|
380
|
+
#endif
|
|
376
381
|
#ifndef UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_FN_METHOD_NATIVEAGENTHANDLE_FOLLOW_UP
|
|
377
382
|
#define UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_FN_METHOD_NATIVEAGENTHANDLE_FOLLOW_UP
|
|
378
383
|
void uniffi_native_agent_ffi_fn_method_nativeagenthandle_follow_up(void*_Nonnull ptr, RustBuffer prompt, RustCallStatus *_Nonnull out_status
|
|
@@ -899,6 +904,12 @@ uint16_t uniffi_native_agent_ffi_checksum_method_nativeagenthandle_delete_auth(v
|
|
|
899
904
|
#define UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_CHECKSUM_METHOD_NATIVEAGENTHANDLE_END_SKILL
|
|
900
905
|
uint16_t uniffi_native_agent_ffi_checksum_method_nativeagenthandle_end_skill(void
|
|
901
906
|
|
|
907
|
+
);
|
|
908
|
+
#endif
|
|
909
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_CHECKSUM_METHOD_NATIVEAGENTHANDLE_EXCHANGE_OAUTH_CODE
|
|
910
|
+
#define UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_CHECKSUM_METHOD_NATIVEAGENTHANDLE_EXCHANGE_OAUTH_CODE
|
|
911
|
+
uint16_t uniffi_native_agent_ffi_checksum_method_nativeagenthandle_exchange_oauth_code(void
|
|
912
|
+
|
|
902
913
|
);
|
|
903
914
|
#endif
|
|
904
915
|
#ifndef UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_CHECKSUM_METHOD_NATIVEAGENTHANDLE_FOLLOW_UP
|
|
Binary file
|
|
@@ -533,6 +533,11 @@ public protocol NativeAgentHandleProtocol : AnyObject {
|
|
|
533
533
|
*/
|
|
534
534
|
func endSkill(skillId: String) throws
|
|
535
535
|
|
|
536
|
+
/**
|
|
537
|
+
* Exchange an OAuth authorization code for tokens.
|
|
538
|
+
*/
|
|
539
|
+
func exchangeOauthCode(tokenUrl: String, bodyJson: String, contentType: String?) throws -> String
|
|
540
|
+
|
|
536
541
|
/**
|
|
537
542
|
* Follow up on the current conversation.
|
|
538
543
|
*/
|
|
@@ -825,6 +830,19 @@ open func endSkill(skillId: String)throws {try rustCallWithError(FfiConverterTy
|
|
|
825
830
|
FfiConverterString.lower(skillId),$0
|
|
826
831
|
)
|
|
827
832
|
}
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Exchange an OAuth authorization code for tokens.
|
|
837
|
+
*/
|
|
838
|
+
open func exchangeOauthCode(tokenUrl: String, bodyJson: String, contentType: String?)throws -> String {
|
|
839
|
+
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeNativeAgentError.lift) {
|
|
840
|
+
uniffi_native_agent_ffi_fn_method_nativeagenthandle_exchange_oauth_code(self.uniffiClonePointer(),
|
|
841
|
+
FfiConverterString.lower(tokenUrl),
|
|
842
|
+
FfiConverterString.lower(bodyJson),
|
|
843
|
+
FfiConverterOptionString.lower(contentType),$0
|
|
844
|
+
)
|
|
845
|
+
})
|
|
828
846
|
}
|
|
829
847
|
|
|
830
848
|
/**
|
|
@@ -2423,6 +2441,9 @@ private var initializationResult: InitializationResult = {
|
|
|
2423
2441
|
if (uniffi_native_agent_ffi_checksum_method_nativeagenthandle_end_skill() != 49984) {
|
|
2424
2442
|
return InitializationResult.apiChecksumMismatch
|
|
2425
2443
|
}
|
|
2444
|
+
if (uniffi_native_agent_ffi_checksum_method_nativeagenthandle_exchange_oauth_code() != 22859) {
|
|
2445
|
+
return InitializationResult.apiChecksumMismatch
|
|
2446
|
+
}
|
|
2426
2447
|
if (uniffi_native_agent_ffi_checksum_method_nativeagenthandle_follow_up() != 816) {
|
|
2427
2448
|
return InitializationResult.apiChecksumMismatch
|
|
2428
2449
|
}
|
|
@@ -373,6 +373,11 @@ void uniffi_native_agent_ffi_fn_method_nativeagenthandle_delete_auth(void*_Nonnu
|
|
|
373
373
|
void uniffi_native_agent_ffi_fn_method_nativeagenthandle_end_skill(void*_Nonnull ptr, RustBuffer skill_id, RustCallStatus *_Nonnull out_status
|
|
374
374
|
);
|
|
375
375
|
#endif
|
|
376
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_FN_METHOD_NATIVEAGENTHANDLE_EXCHANGE_OAUTH_CODE
|
|
377
|
+
#define UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_FN_METHOD_NATIVEAGENTHANDLE_EXCHANGE_OAUTH_CODE
|
|
378
|
+
RustBuffer uniffi_native_agent_ffi_fn_method_nativeagenthandle_exchange_oauth_code(void*_Nonnull ptr, RustBuffer token_url, RustBuffer body_json, RustBuffer content_type, RustCallStatus *_Nonnull out_status
|
|
379
|
+
);
|
|
380
|
+
#endif
|
|
376
381
|
#ifndef UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_FN_METHOD_NATIVEAGENTHANDLE_FOLLOW_UP
|
|
377
382
|
#define UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_FN_METHOD_NATIVEAGENTHANDLE_FOLLOW_UP
|
|
378
383
|
void uniffi_native_agent_ffi_fn_method_nativeagenthandle_follow_up(void*_Nonnull ptr, RustBuffer prompt, RustCallStatus *_Nonnull out_status
|
|
@@ -899,6 +904,12 @@ uint16_t uniffi_native_agent_ffi_checksum_method_nativeagenthandle_delete_auth(v
|
|
|
899
904
|
#define UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_CHECKSUM_METHOD_NATIVEAGENTHANDLE_END_SKILL
|
|
900
905
|
uint16_t uniffi_native_agent_ffi_checksum_method_nativeagenthandle_end_skill(void
|
|
901
906
|
|
|
907
|
+
);
|
|
908
|
+
#endif
|
|
909
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_CHECKSUM_METHOD_NATIVEAGENTHANDLE_EXCHANGE_OAUTH_CODE
|
|
910
|
+
#define UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_CHECKSUM_METHOD_NATIVEAGENTHANDLE_EXCHANGE_OAUTH_CODE
|
|
911
|
+
uint16_t uniffi_native_agent_ffi_checksum_method_nativeagenthandle_exchange_oauth_code(void
|
|
912
|
+
|
|
902
913
|
);
|
|
903
914
|
#endif
|
|
904
915
|
#ifndef UNIFFI_FFIDEF_UNIFFI_NATIVE_AGENT_FFI_CHECKSUM_METHOD_NATIVEAGENTHANDLE_FOLLOW_UP
|
|
@@ -25,6 +25,7 @@ public class NativeAgentPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
25
25
|
CAPPluginMethod(name: "deleteAuth", returnType: CAPPluginReturnPromise),
|
|
26
26
|
CAPPluginMethod(name: "refreshToken", returnType: CAPPluginReturnPromise),
|
|
27
27
|
CAPPluginMethod(name: "getAuthStatus", returnType: CAPPluginReturnPromise),
|
|
28
|
+
CAPPluginMethod(name: "exchangeOAuthCode", returnType: CAPPluginReturnPromise),
|
|
28
29
|
// Sessions
|
|
29
30
|
CAPPluginMethod(name: "listSessions", returnType: CAPPluginReturnPromise),
|
|
30
31
|
CAPPluginMethod(name: "loadSession", returnType: CAPPluginReturnPromise),
|
|
@@ -360,6 +361,33 @@ public class NativeAgentPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
360
361
|
}
|
|
361
362
|
}
|
|
362
363
|
|
|
364
|
+
@objc func exchangeOAuthCode(_ call: CAPPluginCall) {
|
|
365
|
+
withHandle(call) { h in
|
|
366
|
+
guard let tokenUrl = call.getString("tokenUrl") else {
|
|
367
|
+
return call.reject("tokenUrl is required")
|
|
368
|
+
}
|
|
369
|
+
guard let bodyJson = call.getString("bodyJson") else {
|
|
370
|
+
return call.reject("bodyJson is required")
|
|
371
|
+
}
|
|
372
|
+
do {
|
|
373
|
+
let resultJson = try h.exchangeOauthCode(
|
|
374
|
+
tokenUrl: tokenUrl,
|
|
375
|
+
bodyJson: bodyJson,
|
|
376
|
+
contentType: call.getString("contentType")
|
|
377
|
+
)
|
|
378
|
+
// Parse the JSON string into a dictionary and resolve
|
|
379
|
+
if let data = resultJson.data(using: .utf8),
|
|
380
|
+
let dict = try? JSONSerialization.jsonObject(with: data) as? [String: Any] {
|
|
381
|
+
call.resolve(dict)
|
|
382
|
+
} else {
|
|
383
|
+
call.resolve(["resultJson": resultJson])
|
|
384
|
+
}
|
|
385
|
+
} catch {
|
|
386
|
+
call.reject("exchangeOAuthCode failed: \(error.localizedDescription)")
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
363
391
|
// ── Sessions ─────────────────────────────────────────────────────────────
|
|
364
392
|
|
|
365
393
|
@objc func listSessions(_ call: CAPPluginCall) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capacitor-native-agent",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
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",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@capacitor/core": "^6.0.0 || ^7.0.0 || ^8.0.0",
|
|
60
|
-
"capacitor-lancedb": "^0.2.
|
|
60
|
+
"capacitor-lancedb": "^0.2.2"
|
|
61
61
|
},
|
|
62
62
|
"peerDependenciesMeta": {
|
|
63
63
|
"capacitor-lancedb": {
|