capacitor-native-agent 0.9.4 → 0.9.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.
@@ -59,7 +59,7 @@ open class RustBuffer : Structure() {
59
59
  companion object {
60
60
  internal fun alloc(size: ULong = 0UL) = uniffiRustCall() { status ->
61
61
  // Note: need to convert the size to a `Long` value to make this work with JVM.
62
- UniffiLib.INSTANCE.ffi_native_agent_ffi_rustbuffer_alloc(size.toLong(), status)
62
+ UniffiLib.ffi_native_agent_ffi_rustbuffer_alloc(size.toLong(), status)
63
63
  }.also {
64
64
  if(it.data == null) {
65
65
  throw RuntimeException("RustBuffer.alloc() returned null data pointer (size=${size})")
@@ -75,51 +75,17 @@ open class RustBuffer : Structure() {
75
75
  }
76
76
 
77
77
  internal fun free(buf: RustBuffer.ByValue) = uniffiRustCall() { status ->
78
- UniffiLib.INSTANCE.ffi_native_agent_ffi_rustbuffer_free(buf, status)
78
+ UniffiLib.ffi_native_agent_ffi_rustbuffer_free(buf, status)
79
79
  }
80
80
  }
81
81
 
82
82
  @Suppress("TooGenericExceptionThrown")
83
83
  fun asByteBuffer() =
84
- this.data?.getByteBuffer(0, this.len.toLong())?.also {
84
+ this.data?.getByteBuffer(0, this.len)?.also {
85
85
  it.order(ByteOrder.BIG_ENDIAN)
86
86
  }
87
87
  }
88
88
 
89
- /**
90
- * The equivalent of the `*mut RustBuffer` type.
91
- * Required for callbacks taking in an out pointer.
92
- *
93
- * Size is the sum of all values in the struct.
94
- *
95
- * @suppress
96
- */
97
- class RustBufferByReference : ByReference(16) {
98
- /**
99
- * Set the pointed-to `RustBuffer` to the given value.
100
- */
101
- fun setValue(value: RustBuffer.ByValue) {
102
- // NOTE: The offsets are as they are in the C-like struct.
103
- val pointer = getPointer()
104
- pointer.setLong(0, value.capacity)
105
- pointer.setLong(8, value.len)
106
- pointer.setPointer(16, value.data)
107
- }
108
-
109
- /**
110
- * Get a `RustBuffer.ByValue` from this reference.
111
- */
112
- fun getValue(): RustBuffer.ByValue {
113
- val pointer = getPointer()
114
- val value = RustBuffer.ByValue()
115
- value.writeField("capacity", pointer.getLong(0))
116
- value.writeField("len", pointer.getLong(8))
117
- value.writeField("data", pointer.getLong(16))
118
-
119
- return value
120
- }
121
- }
122
-
123
89
  // This is a helper for safely passing byte references into the rust code.
124
90
  // It's not actually used at the moment, because there aren't many things that you
125
91
  // can take a direct pointer to in the JVM, and if we're going to copy something
@@ -316,8 +282,9 @@ internal inline fun<T> uniffiTraitInterfaceCall(
316
282
  try {
317
283
  writeReturn(makeCall())
318
284
  } catch(e: kotlin.Exception) {
285
+ val err = try { e.stackTraceToString() } catch(_: Throwable) { "" }
319
286
  callStatus.code = UNIFFI_CALL_UNEXPECTED_ERROR
320
- callStatus.error_buf = FfiConverterString.lower(e.toString())
287
+ callStatus.error_buf = FfiConverterString.lower(err)
321
288
  }
322
289
  }
323
290
 
@@ -334,28 +301,41 @@ internal inline fun<T, reified E: Throwable> uniffiTraitInterfaceCallWithError(
334
301
  callStatus.code = UNIFFI_CALL_ERROR
335
302
  callStatus.error_buf = lowerError(e)
336
303
  } else {
304
+ val err = try { e.stackTraceToString() } catch(_: Throwable) { "" }
337
305
  callStatus.code = UNIFFI_CALL_UNEXPECTED_ERROR
338
- callStatus.error_buf = FfiConverterString.lower(e.toString())
306
+ callStatus.error_buf = FfiConverterString.lower(err)
339
307
  }
340
308
  }
341
309
  }
310
+ // Initial value and increment amount for handles.
311
+ // These ensure that Kotlin-generated handles always have the lowest bit set
312
+ private const val UNIFFI_HANDLEMAP_INITIAL = 1.toLong()
313
+ private const val UNIFFI_HANDLEMAP_DELTA = 2.toLong()
314
+
342
315
  // Map handles to objects
343
316
  //
344
317
  // This is used pass an opaque 64-bit handle representing a foreign object to the Rust code.
345
318
  internal class UniffiHandleMap<T: Any> {
346
319
  private val map = ConcurrentHashMap<Long, T>()
347
- private val counter = java.util.concurrent.atomic.AtomicLong(0)
320
+ // Start
321
+ private val counter = java.util.concurrent.atomic.AtomicLong(UNIFFI_HANDLEMAP_INITIAL)
348
322
 
349
323
  val size: Int
350
324
  get() = map.size
351
325
 
352
326
  // Insert a new object into the handle map and get a handle for it
353
327
  fun insert(obj: T): Long {
354
- val handle = counter.getAndAdd(1)
328
+ val handle = counter.getAndAdd(UNIFFI_HANDLEMAP_DELTA)
355
329
  map.put(handle, obj)
356
330
  return handle
357
331
  }
358
332
 
333
+ // Clone a handle, creating a new one
334
+ fun clone(handle: Long): Long {
335
+ val obj = map.get(handle) ?: throw InternalException("UniffiHandleMap.clone: Invalid handle")
336
+ return insert(obj)
337
+ }
338
+
359
339
  // Get an object from the handle map
360
340
  fun get(handle: Long): T {
361
341
  return map.get(handle) ?: throw InternalException("UniffiHandleMap.get: Invalid handle")
@@ -378,281 +358,260 @@ private fun findLibraryName(componentName: String): String {
378
358
  return "native_agent_ffi"
379
359
  }
380
360
 
381
- private inline fun <reified Lib : Library> loadIndirect(
382
- componentName: String
383
- ): Lib {
384
- return Native.load<Lib>(findLibraryName(componentName), Lib::class.java)
385
- }
386
-
387
361
  // Define FFI callback types
388
362
  internal interface UniffiRustFutureContinuationCallback : com.sun.jna.Callback {
389
363
  fun callback(`data`: Long,`pollResult`: Byte,)
390
364
  }
391
- internal interface UniffiForeignFutureFree : com.sun.jna.Callback {
365
+ internal interface UniffiForeignFutureDroppedCallback : com.sun.jna.Callback {
392
366
  fun callback(`handle`: Long,)
393
367
  }
394
368
  internal interface UniffiCallbackInterfaceFree : com.sun.jna.Callback {
395
369
  fun callback(`handle`: Long,)
396
370
  }
371
+ internal interface UniffiCallbackInterfaceClone : com.sun.jna.Callback {
372
+ fun callback(`handle`: Long,)
373
+ : Long
374
+ }
397
375
  @Structure.FieldOrder("handle", "free")
398
- internal open class UniffiForeignFuture(
376
+ internal open class UniffiForeignFutureDroppedCallbackStruct(
399
377
  @JvmField internal var `handle`: Long = 0.toLong(),
400
- @JvmField internal var `free`: UniffiForeignFutureFree? = null,
378
+ @JvmField internal var `free`: UniffiForeignFutureDroppedCallback? = null,
401
379
  ) : Structure() {
402
380
  class UniffiByValue(
403
381
  `handle`: Long = 0.toLong(),
404
- `free`: UniffiForeignFutureFree? = null,
405
- ): UniffiForeignFuture(`handle`,`free`,), Structure.ByValue
382
+ `free`: UniffiForeignFutureDroppedCallback? = null,
383
+ ): UniffiForeignFutureDroppedCallbackStruct(`handle`,`free`,), Structure.ByValue
406
384
 
407
- internal fun uniffiSetValue(other: UniffiForeignFuture) {
385
+ internal fun uniffiSetValue(other: UniffiForeignFutureDroppedCallbackStruct) {
408
386
  `handle` = other.`handle`
409
387
  `free` = other.`free`
410
388
  }
411
389
 
412
390
  }
413
391
  @Structure.FieldOrder("returnValue", "callStatus")
414
- internal open class UniffiForeignFutureStructU8(
392
+ internal open class UniffiForeignFutureResultU8(
415
393
  @JvmField internal var `returnValue`: Byte = 0.toByte(),
416
394
  @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
417
395
  ) : Structure() {
418
396
  class UniffiByValue(
419
397
  `returnValue`: Byte = 0.toByte(),
420
398
  `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
421
- ): UniffiForeignFutureStructU8(`returnValue`,`callStatus`,), Structure.ByValue
399
+ ): UniffiForeignFutureResultU8(`returnValue`,`callStatus`,), Structure.ByValue
422
400
 
423
- internal fun uniffiSetValue(other: UniffiForeignFutureStructU8) {
401
+ internal fun uniffiSetValue(other: UniffiForeignFutureResultU8) {
424
402
  `returnValue` = other.`returnValue`
425
403
  `callStatus` = other.`callStatus`
426
404
  }
427
405
 
428
406
  }
429
407
  internal interface UniffiForeignFutureCompleteU8 : com.sun.jna.Callback {
430
- fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU8.UniffiByValue,)
408
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureResultU8.UniffiByValue,)
431
409
  }
432
410
  @Structure.FieldOrder("returnValue", "callStatus")
433
- internal open class UniffiForeignFutureStructI8(
411
+ internal open class UniffiForeignFutureResultI8(
434
412
  @JvmField internal var `returnValue`: Byte = 0.toByte(),
435
413
  @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
436
414
  ) : Structure() {
437
415
  class UniffiByValue(
438
416
  `returnValue`: Byte = 0.toByte(),
439
417
  `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
440
- ): UniffiForeignFutureStructI8(`returnValue`,`callStatus`,), Structure.ByValue
418
+ ): UniffiForeignFutureResultI8(`returnValue`,`callStatus`,), Structure.ByValue
441
419
 
442
- internal fun uniffiSetValue(other: UniffiForeignFutureStructI8) {
420
+ internal fun uniffiSetValue(other: UniffiForeignFutureResultI8) {
443
421
  `returnValue` = other.`returnValue`
444
422
  `callStatus` = other.`callStatus`
445
423
  }
446
424
 
447
425
  }
448
426
  internal interface UniffiForeignFutureCompleteI8 : com.sun.jna.Callback {
449
- fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI8.UniffiByValue,)
427
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureResultI8.UniffiByValue,)
450
428
  }
451
429
  @Structure.FieldOrder("returnValue", "callStatus")
452
- internal open class UniffiForeignFutureStructU16(
430
+ internal open class UniffiForeignFutureResultU16(
453
431
  @JvmField internal var `returnValue`: Short = 0.toShort(),
454
432
  @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
455
433
  ) : Structure() {
456
434
  class UniffiByValue(
457
435
  `returnValue`: Short = 0.toShort(),
458
436
  `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
459
- ): UniffiForeignFutureStructU16(`returnValue`,`callStatus`,), Structure.ByValue
437
+ ): UniffiForeignFutureResultU16(`returnValue`,`callStatus`,), Structure.ByValue
460
438
 
461
- internal fun uniffiSetValue(other: UniffiForeignFutureStructU16) {
439
+ internal fun uniffiSetValue(other: UniffiForeignFutureResultU16) {
462
440
  `returnValue` = other.`returnValue`
463
441
  `callStatus` = other.`callStatus`
464
442
  }
465
443
 
466
444
  }
467
445
  internal interface UniffiForeignFutureCompleteU16 : com.sun.jna.Callback {
468
- fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU16.UniffiByValue,)
446
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureResultU16.UniffiByValue,)
469
447
  }
470
448
  @Structure.FieldOrder("returnValue", "callStatus")
471
- internal open class UniffiForeignFutureStructI16(
449
+ internal open class UniffiForeignFutureResultI16(
472
450
  @JvmField internal var `returnValue`: Short = 0.toShort(),
473
451
  @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
474
452
  ) : Structure() {
475
453
  class UniffiByValue(
476
454
  `returnValue`: Short = 0.toShort(),
477
455
  `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
478
- ): UniffiForeignFutureStructI16(`returnValue`,`callStatus`,), Structure.ByValue
456
+ ): UniffiForeignFutureResultI16(`returnValue`,`callStatus`,), Structure.ByValue
479
457
 
480
- internal fun uniffiSetValue(other: UniffiForeignFutureStructI16) {
458
+ internal fun uniffiSetValue(other: UniffiForeignFutureResultI16) {
481
459
  `returnValue` = other.`returnValue`
482
460
  `callStatus` = other.`callStatus`
483
461
  }
484
462
 
485
463
  }
486
464
  internal interface UniffiForeignFutureCompleteI16 : com.sun.jna.Callback {
487
- fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI16.UniffiByValue,)
465
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureResultI16.UniffiByValue,)
488
466
  }
489
467
  @Structure.FieldOrder("returnValue", "callStatus")
490
- internal open class UniffiForeignFutureStructU32(
468
+ internal open class UniffiForeignFutureResultU32(
491
469
  @JvmField internal var `returnValue`: Int = 0,
492
470
  @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
493
471
  ) : Structure() {
494
472
  class UniffiByValue(
495
473
  `returnValue`: Int = 0,
496
474
  `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
497
- ): UniffiForeignFutureStructU32(`returnValue`,`callStatus`,), Structure.ByValue
475
+ ): UniffiForeignFutureResultU32(`returnValue`,`callStatus`,), Structure.ByValue
498
476
 
499
- internal fun uniffiSetValue(other: UniffiForeignFutureStructU32) {
477
+ internal fun uniffiSetValue(other: UniffiForeignFutureResultU32) {
500
478
  `returnValue` = other.`returnValue`
501
479
  `callStatus` = other.`callStatus`
502
480
  }
503
481
 
504
482
  }
505
483
  internal interface UniffiForeignFutureCompleteU32 : com.sun.jna.Callback {
506
- fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU32.UniffiByValue,)
484
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureResultU32.UniffiByValue,)
507
485
  }
508
486
  @Structure.FieldOrder("returnValue", "callStatus")
509
- internal open class UniffiForeignFutureStructI32(
487
+ internal open class UniffiForeignFutureResultI32(
510
488
  @JvmField internal var `returnValue`: Int = 0,
511
489
  @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
512
490
  ) : Structure() {
513
491
  class UniffiByValue(
514
492
  `returnValue`: Int = 0,
515
493
  `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
516
- ): UniffiForeignFutureStructI32(`returnValue`,`callStatus`,), Structure.ByValue
494
+ ): UniffiForeignFutureResultI32(`returnValue`,`callStatus`,), Structure.ByValue
517
495
 
518
- internal fun uniffiSetValue(other: UniffiForeignFutureStructI32) {
496
+ internal fun uniffiSetValue(other: UniffiForeignFutureResultI32) {
519
497
  `returnValue` = other.`returnValue`
520
498
  `callStatus` = other.`callStatus`
521
499
  }
522
500
 
523
501
  }
524
502
  internal interface UniffiForeignFutureCompleteI32 : com.sun.jna.Callback {
525
- fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI32.UniffiByValue,)
503
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureResultI32.UniffiByValue,)
526
504
  }
527
505
  @Structure.FieldOrder("returnValue", "callStatus")
528
- internal open class UniffiForeignFutureStructU64(
506
+ internal open class UniffiForeignFutureResultU64(
529
507
  @JvmField internal var `returnValue`: Long = 0.toLong(),
530
508
  @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
531
509
  ) : Structure() {
532
510
  class UniffiByValue(
533
511
  `returnValue`: Long = 0.toLong(),
534
512
  `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
535
- ): UniffiForeignFutureStructU64(`returnValue`,`callStatus`,), Structure.ByValue
513
+ ): UniffiForeignFutureResultU64(`returnValue`,`callStatus`,), Structure.ByValue
536
514
 
537
- internal fun uniffiSetValue(other: UniffiForeignFutureStructU64) {
515
+ internal fun uniffiSetValue(other: UniffiForeignFutureResultU64) {
538
516
  `returnValue` = other.`returnValue`
539
517
  `callStatus` = other.`callStatus`
540
518
  }
541
519
 
542
520
  }
543
521
  internal interface UniffiForeignFutureCompleteU64 : com.sun.jna.Callback {
544
- fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU64.UniffiByValue,)
522
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureResultU64.UniffiByValue,)
545
523
  }
546
524
  @Structure.FieldOrder("returnValue", "callStatus")
547
- internal open class UniffiForeignFutureStructI64(
525
+ internal open class UniffiForeignFutureResultI64(
548
526
  @JvmField internal var `returnValue`: Long = 0.toLong(),
549
527
  @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
550
528
  ) : Structure() {
551
529
  class UniffiByValue(
552
530
  `returnValue`: Long = 0.toLong(),
553
531
  `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
554
- ): UniffiForeignFutureStructI64(`returnValue`,`callStatus`,), Structure.ByValue
532
+ ): UniffiForeignFutureResultI64(`returnValue`,`callStatus`,), Structure.ByValue
555
533
 
556
- internal fun uniffiSetValue(other: UniffiForeignFutureStructI64) {
534
+ internal fun uniffiSetValue(other: UniffiForeignFutureResultI64) {
557
535
  `returnValue` = other.`returnValue`
558
536
  `callStatus` = other.`callStatus`
559
537
  }
560
538
 
561
539
  }
562
540
  internal interface UniffiForeignFutureCompleteI64 : com.sun.jna.Callback {
563
- fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI64.UniffiByValue,)
541
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureResultI64.UniffiByValue,)
564
542
  }
565
543
  @Structure.FieldOrder("returnValue", "callStatus")
566
- internal open class UniffiForeignFutureStructF32(
544
+ internal open class UniffiForeignFutureResultF32(
567
545
  @JvmField internal var `returnValue`: Float = 0.0f,
568
546
  @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
569
547
  ) : Structure() {
570
548
  class UniffiByValue(
571
549
  `returnValue`: Float = 0.0f,
572
550
  `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
573
- ): UniffiForeignFutureStructF32(`returnValue`,`callStatus`,), Structure.ByValue
551
+ ): UniffiForeignFutureResultF32(`returnValue`,`callStatus`,), Structure.ByValue
574
552
 
575
- internal fun uniffiSetValue(other: UniffiForeignFutureStructF32) {
553
+ internal fun uniffiSetValue(other: UniffiForeignFutureResultF32) {
576
554
  `returnValue` = other.`returnValue`
577
555
  `callStatus` = other.`callStatus`
578
556
  }
579
557
 
580
558
  }
581
559
  internal interface UniffiForeignFutureCompleteF32 : com.sun.jna.Callback {
582
- fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructF32.UniffiByValue,)
560
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureResultF32.UniffiByValue,)
583
561
  }
584
562
  @Structure.FieldOrder("returnValue", "callStatus")
585
- internal open class UniffiForeignFutureStructF64(
563
+ internal open class UniffiForeignFutureResultF64(
586
564
  @JvmField internal var `returnValue`: Double = 0.0,
587
565
  @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
588
566
  ) : Structure() {
589
567
  class UniffiByValue(
590
568
  `returnValue`: Double = 0.0,
591
569
  `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
592
- ): UniffiForeignFutureStructF64(`returnValue`,`callStatus`,), Structure.ByValue
570
+ ): UniffiForeignFutureResultF64(`returnValue`,`callStatus`,), Structure.ByValue
593
571
 
594
- internal fun uniffiSetValue(other: UniffiForeignFutureStructF64) {
572
+ internal fun uniffiSetValue(other: UniffiForeignFutureResultF64) {
595
573
  `returnValue` = other.`returnValue`
596
574
  `callStatus` = other.`callStatus`
597
575
  }
598
576
 
599
577
  }
600
578
  internal interface UniffiForeignFutureCompleteF64 : com.sun.jna.Callback {
601
- fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructF64.UniffiByValue,)
602
- }
603
- @Structure.FieldOrder("returnValue", "callStatus")
604
- internal open class UniffiForeignFutureStructPointer(
605
- @JvmField internal var `returnValue`: Pointer = Pointer.NULL,
606
- @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
607
- ) : Structure() {
608
- class UniffiByValue(
609
- `returnValue`: Pointer = Pointer.NULL,
610
- `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
611
- ): UniffiForeignFutureStructPointer(`returnValue`,`callStatus`,), Structure.ByValue
612
-
613
- internal fun uniffiSetValue(other: UniffiForeignFutureStructPointer) {
614
- `returnValue` = other.`returnValue`
615
- `callStatus` = other.`callStatus`
616
- }
617
-
618
- }
619
- internal interface UniffiForeignFutureCompletePointer : com.sun.jna.Callback {
620
- fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructPointer.UniffiByValue,)
579
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureResultF64.UniffiByValue,)
621
580
  }
622
581
  @Structure.FieldOrder("returnValue", "callStatus")
623
- internal open class UniffiForeignFutureStructRustBuffer(
582
+ internal open class UniffiForeignFutureResultRustBuffer(
624
583
  @JvmField internal var `returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(),
625
584
  @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
626
585
  ) : Structure() {
627
586
  class UniffiByValue(
628
587
  `returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(),
629
588
  `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
630
- ): UniffiForeignFutureStructRustBuffer(`returnValue`,`callStatus`,), Structure.ByValue
589
+ ): UniffiForeignFutureResultRustBuffer(`returnValue`,`callStatus`,), Structure.ByValue
631
590
 
632
- internal fun uniffiSetValue(other: UniffiForeignFutureStructRustBuffer) {
591
+ internal fun uniffiSetValue(other: UniffiForeignFutureResultRustBuffer) {
633
592
  `returnValue` = other.`returnValue`
634
593
  `callStatus` = other.`callStatus`
635
594
  }
636
595
 
637
596
  }
638
597
  internal interface UniffiForeignFutureCompleteRustBuffer : com.sun.jna.Callback {
639
- fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructRustBuffer.UniffiByValue,)
598
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureResultRustBuffer.UniffiByValue,)
640
599
  }
641
600
  @Structure.FieldOrder("callStatus")
642
- internal open class UniffiForeignFutureStructVoid(
601
+ internal open class UniffiForeignFutureResultVoid(
643
602
  @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
644
603
  ) : Structure() {
645
604
  class UniffiByValue(
646
605
  `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
647
- ): UniffiForeignFutureStructVoid(`callStatus`,), Structure.ByValue
606
+ ): UniffiForeignFutureResultVoid(`callStatus`,), Structure.ByValue
648
607
 
649
- internal fun uniffiSetValue(other: UniffiForeignFutureStructVoid) {
608
+ internal fun uniffiSetValue(other: UniffiForeignFutureResultVoid) {
650
609
  `callStatus` = other.`callStatus`
651
610
  }
652
611
 
653
612
  }
654
613
  internal interface UniffiForeignFutureCompleteVoid : com.sun.jna.Callback {
655
- fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructVoid.UniffiByValue,)
614
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureResultVoid.UniffiByValue,)
656
615
  }
657
616
  internal interface UniffiCallbackInterfaceGovernanceProviderMethod0 : com.sun.jna.Callback {
658
617
  fun callback(`uniffiHandle`: Long,`toolName`: RustBuffer.ByValue,`paramsJson`: RustBuffer.ByValue,`uniffiOutReturn`: RustBuffer,uniffiCallStatus: UniffiRustCallStatus,)
@@ -693,674 +652,566 @@ internal interface UniffiCallbackInterfaceNativeEventCallbackMethod0 : com.sun.j
693
652
  internal interface UniffiCallbackInterfaceNativeNotifierMethod0 : com.sun.jna.Callback {
694
653
  fun callback(`uniffiHandle`: Long,`title`: RustBuffer.ByValue,`body`: RustBuffer.ByValue,`dataJson`: RustBuffer.ByValue,`uniffiOutReturn`: RustBuffer,uniffiCallStatus: UniffiRustCallStatus,)
695
654
  }
696
- @Structure.FieldOrder("checkLoop", "recordOutcome", "recordAudit", "checkSink", "reset", "recordUsage", "uniffiFree")
655
+ internal interface UniffiCallbackInterfaceAuthProfileStoreMethod0 : com.sun.jna.Callback {
656
+ fun callback(`uniffiHandle`: Long,`uniffiOutReturn`: RustBuffer,uniffiCallStatus: UniffiRustCallStatus,)
657
+ }
658
+ internal interface UniffiCallbackInterfaceAuthProfileStoreMethod1 : com.sun.jna.Callback {
659
+ fun callback(`uniffiHandle`: Long,`profilesJson`: RustBuffer.ByValue,`uniffiOutReturn`: Pointer,uniffiCallStatus: UniffiRustCallStatus,)
660
+ }
661
+ @Structure.FieldOrder("uniffiFree", "uniffiClone", "checkLoop", "recordOutcome", "recordAudit", "checkSink", "reset", "recordUsage")
697
662
  internal open class UniffiVTableCallbackInterfaceGovernanceProvider(
663
+ @JvmField internal var `uniffiFree`: UniffiCallbackInterfaceFree? = null,
664
+ @JvmField internal var `uniffiClone`: UniffiCallbackInterfaceClone? = null,
698
665
  @JvmField internal var `checkLoop`: UniffiCallbackInterfaceGovernanceProviderMethod0? = null,
699
666
  @JvmField internal var `recordOutcome`: UniffiCallbackInterfaceGovernanceProviderMethod1? = null,
700
667
  @JvmField internal var `recordAudit`: UniffiCallbackInterfaceGovernanceProviderMethod2? = null,
701
668
  @JvmField internal var `checkSink`: UniffiCallbackInterfaceGovernanceProviderMethod3? = null,
702
669
  @JvmField internal var `reset`: UniffiCallbackInterfaceGovernanceProviderMethod4? = null,
703
670
  @JvmField internal var `recordUsage`: UniffiCallbackInterfaceGovernanceProviderMethod5? = null,
704
- @JvmField internal var `uniffiFree`: UniffiCallbackInterfaceFree? = null,
705
671
  ) : Structure() {
706
672
  class UniffiByValue(
673
+ `uniffiFree`: UniffiCallbackInterfaceFree? = null,
674
+ `uniffiClone`: UniffiCallbackInterfaceClone? = null,
707
675
  `checkLoop`: UniffiCallbackInterfaceGovernanceProviderMethod0? = null,
708
676
  `recordOutcome`: UniffiCallbackInterfaceGovernanceProviderMethod1? = null,
709
677
  `recordAudit`: UniffiCallbackInterfaceGovernanceProviderMethod2? = null,
710
678
  `checkSink`: UniffiCallbackInterfaceGovernanceProviderMethod3? = null,
711
679
  `reset`: UniffiCallbackInterfaceGovernanceProviderMethod4? = null,
712
680
  `recordUsage`: UniffiCallbackInterfaceGovernanceProviderMethod5? = null,
713
- `uniffiFree`: UniffiCallbackInterfaceFree? = null,
714
- ): UniffiVTableCallbackInterfaceGovernanceProvider(`checkLoop`,`recordOutcome`,`recordAudit`,`checkSink`,`reset`,`recordUsage`,`uniffiFree`,), Structure.ByValue
681
+ ): UniffiVTableCallbackInterfaceGovernanceProvider(`uniffiFree`,`uniffiClone`,`checkLoop`,`recordOutcome`,`recordAudit`,`checkSink`,`reset`,`recordUsage`,), Structure.ByValue
715
682
 
716
683
  internal fun uniffiSetValue(other: UniffiVTableCallbackInterfaceGovernanceProvider) {
684
+ `uniffiFree` = other.`uniffiFree`
685
+ `uniffiClone` = other.`uniffiClone`
717
686
  `checkLoop` = other.`checkLoop`
718
687
  `recordOutcome` = other.`recordOutcome`
719
688
  `recordAudit` = other.`recordAudit`
720
689
  `checkSink` = other.`checkSink`
721
690
  `reset` = other.`reset`
722
691
  `recordUsage` = other.`recordUsage`
723
- `uniffiFree` = other.`uniffiFree`
724
692
  }
725
693
 
726
694
  }
727
- @Structure.FieldOrder("store", "recall", "forget", "search", "list", "uniffiFree")
695
+ @Structure.FieldOrder("uniffiFree", "uniffiClone", "store", "recall", "forget", "search", "list")
728
696
  internal open class UniffiVTableCallbackInterfaceMemoryProvider(
697
+ @JvmField internal var `uniffiFree`: UniffiCallbackInterfaceFree? = null,
698
+ @JvmField internal var `uniffiClone`: UniffiCallbackInterfaceClone? = null,
729
699
  @JvmField internal var `store`: UniffiCallbackInterfaceMemoryProviderMethod0? = null,
730
700
  @JvmField internal var `recall`: UniffiCallbackInterfaceMemoryProviderMethod1? = null,
731
701
  @JvmField internal var `forget`: UniffiCallbackInterfaceMemoryProviderMethod2? = null,
732
702
  @JvmField internal var `search`: UniffiCallbackInterfaceMemoryProviderMethod3? = null,
733
703
  @JvmField internal var `list`: UniffiCallbackInterfaceMemoryProviderMethod4? = null,
734
- @JvmField internal var `uniffiFree`: UniffiCallbackInterfaceFree? = null,
735
704
  ) : Structure() {
736
705
  class UniffiByValue(
706
+ `uniffiFree`: UniffiCallbackInterfaceFree? = null,
707
+ `uniffiClone`: UniffiCallbackInterfaceClone? = null,
737
708
  `store`: UniffiCallbackInterfaceMemoryProviderMethod0? = null,
738
709
  `recall`: UniffiCallbackInterfaceMemoryProviderMethod1? = null,
739
710
  `forget`: UniffiCallbackInterfaceMemoryProviderMethod2? = null,
740
711
  `search`: UniffiCallbackInterfaceMemoryProviderMethod3? = null,
741
712
  `list`: UniffiCallbackInterfaceMemoryProviderMethod4? = null,
742
- `uniffiFree`: UniffiCallbackInterfaceFree? = null,
743
- ): UniffiVTableCallbackInterfaceMemoryProvider(`store`,`recall`,`forget`,`search`,`list`,`uniffiFree`,), Structure.ByValue
713
+ ): UniffiVTableCallbackInterfaceMemoryProvider(`uniffiFree`,`uniffiClone`,`store`,`recall`,`forget`,`search`,`list`,), Structure.ByValue
744
714
 
745
715
  internal fun uniffiSetValue(other: UniffiVTableCallbackInterfaceMemoryProvider) {
716
+ `uniffiFree` = other.`uniffiFree`
717
+ `uniffiClone` = other.`uniffiClone`
746
718
  `store` = other.`store`
747
719
  `recall` = other.`recall`
748
720
  `forget` = other.`forget`
749
721
  `search` = other.`search`
750
722
  `list` = other.`list`
751
- `uniffiFree` = other.`uniffiFree`
752
723
  }
753
724
 
754
725
  }
755
- @Structure.FieldOrder("onEvent", "uniffiFree")
726
+ @Structure.FieldOrder("uniffiFree", "uniffiClone", "onEvent")
756
727
  internal open class UniffiVTableCallbackInterfaceNativeEventCallback(
757
- @JvmField internal var `onEvent`: UniffiCallbackInterfaceNativeEventCallbackMethod0? = null,
758
728
  @JvmField internal var `uniffiFree`: UniffiCallbackInterfaceFree? = null,
729
+ @JvmField internal var `uniffiClone`: UniffiCallbackInterfaceClone? = null,
730
+ @JvmField internal var `onEvent`: UniffiCallbackInterfaceNativeEventCallbackMethod0? = null,
759
731
  ) : Structure() {
760
732
  class UniffiByValue(
761
- `onEvent`: UniffiCallbackInterfaceNativeEventCallbackMethod0? = null,
762
733
  `uniffiFree`: UniffiCallbackInterfaceFree? = null,
763
- ): UniffiVTableCallbackInterfaceNativeEventCallback(`onEvent`,`uniffiFree`,), Structure.ByValue
734
+ `uniffiClone`: UniffiCallbackInterfaceClone? = null,
735
+ `onEvent`: UniffiCallbackInterfaceNativeEventCallbackMethod0? = null,
736
+ ): UniffiVTableCallbackInterfaceNativeEventCallback(`uniffiFree`,`uniffiClone`,`onEvent`,), Structure.ByValue
764
737
 
765
738
  internal fun uniffiSetValue(other: UniffiVTableCallbackInterfaceNativeEventCallback) {
766
- `onEvent` = other.`onEvent`
767
739
  `uniffiFree` = other.`uniffiFree`
740
+ `uniffiClone` = other.`uniffiClone`
741
+ `onEvent` = other.`onEvent`
768
742
  }
769
743
 
770
744
  }
771
- @Structure.FieldOrder("sendNotification", "uniffiFree")
745
+ @Structure.FieldOrder("uniffiFree", "uniffiClone", "sendNotification")
772
746
  internal open class UniffiVTableCallbackInterfaceNativeNotifier(
773
- @JvmField internal var `sendNotification`: UniffiCallbackInterfaceNativeNotifierMethod0? = null,
774
747
  @JvmField internal var `uniffiFree`: UniffiCallbackInterfaceFree? = null,
748
+ @JvmField internal var `uniffiClone`: UniffiCallbackInterfaceClone? = null,
749
+ @JvmField internal var `sendNotification`: UniffiCallbackInterfaceNativeNotifierMethod0? = null,
775
750
  ) : Structure() {
776
751
  class UniffiByValue(
777
- `sendNotification`: UniffiCallbackInterfaceNativeNotifierMethod0? = null,
778
752
  `uniffiFree`: UniffiCallbackInterfaceFree? = null,
779
- ): UniffiVTableCallbackInterfaceNativeNotifier(`sendNotification`,`uniffiFree`,), Structure.ByValue
753
+ `uniffiClone`: UniffiCallbackInterfaceClone? = null,
754
+ `sendNotification`: UniffiCallbackInterfaceNativeNotifierMethod0? = null,
755
+ ): UniffiVTableCallbackInterfaceNativeNotifier(`uniffiFree`,`uniffiClone`,`sendNotification`,), Structure.ByValue
780
756
 
781
757
  internal fun uniffiSetValue(other: UniffiVTableCallbackInterfaceNativeNotifier) {
782
- `sendNotification` = other.`sendNotification`
783
758
  `uniffiFree` = other.`uniffiFree`
759
+ `uniffiClone` = other.`uniffiClone`
760
+ `sendNotification` = other.`sendNotification`
784
761
  }
785
762
 
786
763
  }
764
+ @Structure.FieldOrder("uniffiFree", "uniffiClone", "load", "save")
765
+ internal open class UniffiVTableCallbackInterfaceAuthProfileStore(
766
+ @JvmField internal var `uniffiFree`: UniffiCallbackInterfaceFree? = null,
767
+ @JvmField internal var `uniffiClone`: UniffiCallbackInterfaceClone? = null,
768
+ @JvmField internal var `load`: UniffiCallbackInterfaceAuthProfileStoreMethod0? = null,
769
+ @JvmField internal var `save`: UniffiCallbackInterfaceAuthProfileStoreMethod1? = null,
770
+ ) : Structure() {
771
+ class UniffiByValue(
772
+ `uniffiFree`: UniffiCallbackInterfaceFree? = null,
773
+ `uniffiClone`: UniffiCallbackInterfaceClone? = null,
774
+ `load`: UniffiCallbackInterfaceAuthProfileStoreMethod0? = null,
775
+ `save`: UniffiCallbackInterfaceAuthProfileStoreMethod1? = null,
776
+ ): UniffiVTableCallbackInterfaceAuthProfileStore(`uniffiFree`,`uniffiClone`,`load`,`save`,), Structure.ByValue
787
777
 
778
+ internal fun uniffiSetValue(other: UniffiVTableCallbackInterfaceAuthProfileStore) {
779
+ `uniffiFree` = other.`uniffiFree`
780
+ `uniffiClone` = other.`uniffiClone`
781
+ `load` = other.`load`
782
+ `save` = other.`save`
783
+ }
788
784
 
789
-
790
-
791
-
792
-
793
-
794
-
795
-
796
-
797
-
798
-
799
-
800
-
801
-
802
-
803
-
804
-
805
-
806
-
807
-
808
-
809
-
810
-
811
-
812
-
813
-
814
-
815
-
816
-
817
-
818
-
819
-
820
-
821
-
822
-
823
-
824
-
825
-
826
-
827
-
828
-
829
-
830
-
831
-
832
-
833
-
834
-
835
-
836
-
837
-
838
-
839
-
840
-
841
-
842
-
843
-
844
-
845
-
846
-
847
-
848
-
849
-
850
-
851
-
852
-
853
-
854
-
855
-
856
-
857
-
858
-
859
-
860
-
861
-
862
-
863
-
864
-
865
-
866
-
867
-
868
-
869
-
870
-
871
-
872
-
873
-
874
-
875
-
876
-
877
-
878
-
879
-
880
-
881
-
882
-
883
-
884
-
885
-
886
-
887
-
888
-
889
-
890
-
891
-
892
-
893
-
894
-
895
-
896
-
897
-
898
-
899
-
900
-
901
-
902
-
903
-
904
-
905
-
906
-
907
-
908
-
909
-
910
-
911
-
912
-
913
-
914
-
915
-
916
-
917
-
918
-
919
-
920
-
921
-
922
-
923
-
924
-
925
-
926
-
927
-
928
-
929
-
930
-
931
-
932
-
933
-
934
-
935
-
936
-
937
-
938
-
939
-
940
-
941
-
942
-
943
-
944
-
945
-
946
-
947
-
948
-
949
-
950
-
951
-
952
-
953
-
954
-
955
-
956
-
957
-
958
-
959
-
960
-
961
-
962
-
963
-
964
-
785
+ }
965
786
 
966
787
  // A JNA Library to expose the extern-C FFI definitions.
967
788
  // This is an implementation detail which will be called internally by the public API.
968
789
 
969
- internal interface UniffiLib : Library {
970
- companion object {
971
- internal val INSTANCE: UniffiLib by lazy {
972
- loadIndirect<UniffiLib>(componentName = "native_agent_ffi")
973
- .also { lib: UniffiLib ->
974
- uniffiCheckContractApiVersion(lib)
975
- uniffiCheckApiChecksums(lib)
976
- uniffiCallbackInterfaceGovernanceProvider.register(lib)
977
- uniffiCallbackInterfaceMemoryProvider.register(lib)
978
- uniffiCallbackInterfaceNativeEventCallback.register(lib)
979
- uniffiCallbackInterfaceNativeNotifier.register(lib)
980
- }
981
- }
982
-
983
- // The Cleaner for the whole library
984
- internal val CLEANER: UniffiCleaner by lazy {
985
- UniffiCleaner.create()
986
- }
987
- }
988
-
989
- fun uniffi_native_agent_ffi_fn_clone_nativeagenthandle(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
990
- ): Pointer
991
- fun uniffi_native_agent_ffi_fn_free_nativeagenthandle(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
992
- ): Unit
993
- fun uniffi_native_agent_ffi_fn_constructor_nativeagenthandle_new(`config`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
994
- ): Pointer
995
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_abort(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
996
- ): Unit
997
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_add_cron_job(`ptr`: Pointer,`inputJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
998
- ): RustBuffer.ByValue
999
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_add_skill(`ptr`: Pointer,`inputJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1000
- ): RustBuffer.ByValue
1001
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_clear_session(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
1002
- ): Unit
1003
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_delete_auth(`ptr`: Pointer,`provider`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1004
- ): Unit
1005
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_end_skill(`ptr`: Pointer,`skillId`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1006
- ): Unit
1007
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_exchange_oauth_code(`ptr`: Pointer,`tokenUrl`: RustBuffer.ByValue,`bodyJson`: RustBuffer.ByValue,`contentType`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1008
- ): RustBuffer.ByValue
1009
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_follow_up(`ptr`: Pointer,`prompt`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1010
- ): Unit
1011
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_auth_status(`ptr`: Pointer,`provider`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1012
- ): RustBuffer.ByValue
1013
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_auth_token(`ptr`: Pointer,`provider`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1014
- ): RustBuffer.ByValue
1015
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_heartbeat_config(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
1016
- ): RustBuffer.ByValue
1017
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_models(`ptr`: Pointer,`provider`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1018
- ): RustBuffer.ByValue
1019
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_scheduler_config(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
1020
- ): RustBuffer.ByValue
1021
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_handle_wake(`ptr`: Pointer,`source`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1022
- ): Unit
1023
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_invoke_tool(`ptr`: Pointer,`toolName`: RustBuffer.ByValue,`argsJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1024
- ): RustBuffer.ByValue
1025
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_cron_jobs(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
1026
- ): RustBuffer.ByValue
1027
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_cron_runs(`ptr`: Pointer,`jobId`: RustBuffer.ByValue,`limit`: Long,uniffi_out_err: UniffiRustCallStatus,
1028
- ): RustBuffer.ByValue
1029
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_sessions(`ptr`: Pointer,`agentId`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1030
- ): RustBuffer.ByValue
1031
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_skills(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
1032
- ): RustBuffer.ByValue
1033
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_tool_permissions(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
1034
- ): RustBuffer.ByValue
1035
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_load_session(`ptr`: Pointer,`sessionKey`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1036
- ): RustBuffer.ByValue
1037
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_load_surfaced_messages(`ptr`: Pointer,`limit`: Long,uniffi_out_err: UniffiRustCallStatus,
1038
- ): RustBuffer.ByValue
1039
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_persist_config(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
1040
- ): Unit
1041
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_refresh_token(`ptr`: Pointer,`provider`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1042
- ): RustBuffer.ByValue
1043
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_remove_cron_job(`ptr`: Pointer,`id`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1044
- ): Unit
1045
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_remove_skill(`ptr`: Pointer,`id`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1046
- ): Unit
1047
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_reset_tool_permissions(`ptr`: Pointer,uniffi_out_err: UniffiRustCallStatus,
1048
- ): Unit
1049
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_respond_to_approval(`ptr`: Pointer,`toolCallId`: RustBuffer.ByValue,`approved`: Byte,`reason`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1050
- ): Unit
1051
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_respond_to_cron_approval(`ptr`: Pointer,`requestId`: RustBuffer.ByValue,`approved`: Byte,uniffi_out_err: UniffiRustCallStatus,
1052
- ): Unit
1053
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_respond_to_mcp_tool(`ptr`: Pointer,`toolCallId`: RustBuffer.ByValue,`resultJson`: RustBuffer.ByValue,`isError`: Byte,uniffi_out_err: UniffiRustCallStatus,
1054
- ): Unit
1055
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_restart_mcp(`ptr`: Pointer,`toolsJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1056
- ): Int
1057
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_resume_session(`ptr`: Pointer,`sessionKey`: RustBuffer.ByValue,`agentId`: RustBuffer.ByValue,`messagesJson`: RustBuffer.ByValue,`provider`: RustBuffer.ByValue,`model`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1058
- ): Byte
1059
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_run_cron_job(`ptr`: Pointer,`jobId`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1060
- ): Unit
1061
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_seed_tool_permissions(`ptr`: Pointer,`defaultsJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1062
- ): Int
1063
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_send_message(`ptr`: Pointer,`params`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1064
- ): RustBuffer.ByValue
1065
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_auth_key(`ptr`: Pointer,`key`: RustBuffer.ByValue,`provider`: RustBuffer.ByValue,`authType`: RustBuffer.ByValue,`refresh`: RustBuffer.ByValue,`expiresAt`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1066
- ): Unit
1067
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_event_callback(`ptr`: Pointer,`callback`: Long,uniffi_out_err: UniffiRustCallStatus,
1068
- ): Unit
1069
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_governance_provider(`ptr`: Pointer,`provider`: Long,uniffi_out_err: UniffiRustCallStatus,
1070
- ): Unit
1071
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_heartbeat_config(`ptr`: Pointer,`configJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1072
- ): Unit
1073
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_memory_provider(`ptr`: Pointer,`provider`: Long,uniffi_out_err: UniffiRustCallStatus,
1074
- ): Unit
1075
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_notifier(`ptr`: Pointer,`notifier`: Long,uniffi_out_err: UniffiRustCallStatus,
1076
- ): Unit
1077
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_scheduler_config(`ptr`: Pointer,`configJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1078
- ): Unit
1079
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_tool_permission(`ptr`: Pointer,`toolName`: RustBuffer.ByValue,`permission`: RustBuffer.ByValue,`enabled`: Byte,uniffi_out_err: UniffiRustCallStatus,
1080
- ): Unit
1081
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_start_mcp(`ptr`: Pointer,`toolsJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1082
- ): Int
1083
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_start_skill(`ptr`: Pointer,`skillId`: RustBuffer.ByValue,`configJson`: RustBuffer.ByValue,`provider`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1084
- ): RustBuffer.ByValue
1085
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_steer(`ptr`: Pointer,`text`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1086
- ): Unit
1087
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_update_cron_job(`ptr`: Pointer,`id`: RustBuffer.ByValue,`patchJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1088
- ): Unit
1089
- fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_update_skill(`ptr`: Pointer,`id`: RustBuffer.ByValue,`patchJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1090
- ): Unit
1091
- fun uniffi_native_agent_ffi_fn_init_callback_vtable_governanceprovider(`vtable`: UniffiVTableCallbackInterfaceGovernanceProvider,
1092
- ): Unit
1093
- fun uniffi_native_agent_ffi_fn_init_callback_vtable_memoryprovider(`vtable`: UniffiVTableCallbackInterfaceMemoryProvider,
1094
- ): Unit
1095
- fun uniffi_native_agent_ffi_fn_init_callback_vtable_nativeeventcallback(`vtable`: UniffiVTableCallbackInterfaceNativeEventCallback,
1096
- ): Unit
1097
- fun uniffi_native_agent_ffi_fn_init_callback_vtable_nativenotifier(`vtable`: UniffiVTableCallbackInterfaceNativeNotifier,
1098
- ): Unit
1099
- fun uniffi_native_agent_ffi_fn_func_create_handle_from_persisted_config(`configPath`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1100
- ): Pointer
1101
- fun uniffi_native_agent_ffi_fn_func_init_workspace(`config`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1102
- ): Unit
1103
- fun ffi_native_agent_ffi_rustbuffer_alloc(`size`: Long,uniffi_out_err: UniffiRustCallStatus,
1104
- ): RustBuffer.ByValue
1105
- fun ffi_native_agent_ffi_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue,uniffi_out_err: UniffiRustCallStatus,
1106
- ): RustBuffer.ByValue
1107
- fun ffi_native_agent_ffi_rustbuffer_free(`buf`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1108
- ): Unit
1109
- fun ffi_native_agent_ffi_rustbuffer_reserve(`buf`: RustBuffer.ByValue,`additional`: Long,uniffi_out_err: UniffiRustCallStatus,
1110
- ): RustBuffer.ByValue
1111
- fun ffi_native_agent_ffi_rust_future_poll_u8(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1112
- ): Unit
1113
- fun ffi_native_agent_ffi_rust_future_cancel_u8(`handle`: Long,
1114
- ): Unit
1115
- fun ffi_native_agent_ffi_rust_future_free_u8(`handle`: Long,
1116
- ): Unit
1117
- fun ffi_native_agent_ffi_rust_future_complete_u8(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1118
- ): Byte
1119
- fun ffi_native_agent_ffi_rust_future_poll_i8(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1120
- ): Unit
1121
- fun ffi_native_agent_ffi_rust_future_cancel_i8(`handle`: Long,
1122
- ): Unit
1123
- fun ffi_native_agent_ffi_rust_future_free_i8(`handle`: Long,
1124
- ): Unit
1125
- fun ffi_native_agent_ffi_rust_future_complete_i8(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1126
- ): Byte
1127
- fun ffi_native_agent_ffi_rust_future_poll_u16(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1128
- ): Unit
1129
- fun ffi_native_agent_ffi_rust_future_cancel_u16(`handle`: Long,
1130
- ): Unit
1131
- fun ffi_native_agent_ffi_rust_future_free_u16(`handle`: Long,
1132
- ): Unit
1133
- fun ffi_native_agent_ffi_rust_future_complete_u16(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1134
- ): Short
1135
- fun ffi_native_agent_ffi_rust_future_poll_i16(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1136
- ): Unit
1137
- fun ffi_native_agent_ffi_rust_future_cancel_i16(`handle`: Long,
1138
- ): Unit
1139
- fun ffi_native_agent_ffi_rust_future_free_i16(`handle`: Long,
1140
- ): Unit
1141
- fun ffi_native_agent_ffi_rust_future_complete_i16(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1142
- ): Short
1143
- fun ffi_native_agent_ffi_rust_future_poll_u32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1144
- ): Unit
1145
- fun ffi_native_agent_ffi_rust_future_cancel_u32(`handle`: Long,
1146
- ): Unit
1147
- fun ffi_native_agent_ffi_rust_future_free_u32(`handle`: Long,
1148
- ): Unit
1149
- fun ffi_native_agent_ffi_rust_future_complete_u32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1150
- ): Int
1151
- fun ffi_native_agent_ffi_rust_future_poll_i32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1152
- ): Unit
1153
- fun ffi_native_agent_ffi_rust_future_cancel_i32(`handle`: Long,
1154
- ): Unit
1155
- fun ffi_native_agent_ffi_rust_future_free_i32(`handle`: Long,
1156
- ): Unit
1157
- fun ffi_native_agent_ffi_rust_future_complete_i32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1158
- ): Int
1159
- fun ffi_native_agent_ffi_rust_future_poll_u64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1160
- ): Unit
1161
- fun ffi_native_agent_ffi_rust_future_cancel_u64(`handle`: Long,
1162
- ): Unit
1163
- fun ffi_native_agent_ffi_rust_future_free_u64(`handle`: Long,
1164
- ): Unit
1165
- fun ffi_native_agent_ffi_rust_future_complete_u64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1166
- ): Long
1167
- fun ffi_native_agent_ffi_rust_future_poll_i64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1168
- ): Unit
1169
- fun ffi_native_agent_ffi_rust_future_cancel_i64(`handle`: Long,
1170
- ): Unit
1171
- fun ffi_native_agent_ffi_rust_future_free_i64(`handle`: Long,
1172
- ): Unit
1173
- fun ffi_native_agent_ffi_rust_future_complete_i64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1174
- ): Long
1175
- fun ffi_native_agent_ffi_rust_future_poll_f32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1176
- ): Unit
1177
- fun ffi_native_agent_ffi_rust_future_cancel_f32(`handle`: Long,
1178
- ): Unit
1179
- fun ffi_native_agent_ffi_rust_future_free_f32(`handle`: Long,
1180
- ): Unit
1181
- fun ffi_native_agent_ffi_rust_future_complete_f32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1182
- ): Float
1183
- fun ffi_native_agent_ffi_rust_future_poll_f64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1184
- ): Unit
1185
- fun ffi_native_agent_ffi_rust_future_cancel_f64(`handle`: Long,
1186
- ): Unit
1187
- fun ffi_native_agent_ffi_rust_future_free_f64(`handle`: Long,
1188
- ): Unit
1189
- fun ffi_native_agent_ffi_rust_future_complete_f64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1190
- ): Double
1191
- fun ffi_native_agent_ffi_rust_future_poll_pointer(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1192
- ): Unit
1193
- fun ffi_native_agent_ffi_rust_future_cancel_pointer(`handle`: Long,
1194
- ): Unit
1195
- fun ffi_native_agent_ffi_rust_future_free_pointer(`handle`: Long,
1196
- ): Unit
1197
- fun ffi_native_agent_ffi_rust_future_complete_pointer(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1198
- ): Pointer
1199
- fun ffi_native_agent_ffi_rust_future_poll_rust_buffer(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1200
- ): Unit
1201
- fun ffi_native_agent_ffi_rust_future_cancel_rust_buffer(`handle`: Long,
1202
- ): Unit
1203
- fun ffi_native_agent_ffi_rust_future_free_rust_buffer(`handle`: Long,
1204
- ): Unit
1205
- fun ffi_native_agent_ffi_rust_future_complete_rust_buffer(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1206
- ): RustBuffer.ByValue
1207
- fun ffi_native_agent_ffi_rust_future_poll_void(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1208
- ): Unit
1209
- fun ffi_native_agent_ffi_rust_future_cancel_void(`handle`: Long,
1210
- ): Unit
1211
- fun ffi_native_agent_ffi_rust_future_free_void(`handle`: Long,
1212
- ): Unit
1213
- fun ffi_native_agent_ffi_rust_future_complete_void(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1214
- ): Unit
1215
- fun uniffi_native_agent_ffi_checksum_func_create_handle_from_persisted_config(
790
+ // For large crates we prevent `MethodTooLargeException` (see #2340)
791
+ // N.B. the name of the extension is very misleading, since it is
792
+ // rather `InterfaceTooLargeException`, caused by too many methods
793
+ // in the interface for large crates.
794
+ //
795
+ // By splitting the otherwise huge interface into two parts
796
+ // * UniffiLib (this)
797
+ // * IntegrityCheckingUniffiLib
798
+ // And all checksum methods are put into `IntegrityCheckingUniffiLib`
799
+ // we allow for ~2x as many methods in the UniffiLib interface.
800
+ //
801
+ // Note: above all written when we used JNA's `loadIndirect` etc.
802
+ // We now use JNA's "direct mapping" - unclear if same considerations apply exactly.
803
+ internal object IntegrityCheckingUniffiLib {
804
+ init {
805
+ Native.register(IntegrityCheckingUniffiLib::class.java, findLibraryName(componentName = "native_agent_ffi"))
806
+ uniffiCheckContractApiVersion(this)
807
+ uniffiCheckApiChecksums(this)
808
+ }
809
+ external fun uniffi_native_agent_ffi_checksum_func_create_handle_from_persisted_config(
1216
810
  ): Short
1217
- fun uniffi_native_agent_ffi_checksum_func_init_workspace(
811
+ external fun uniffi_native_agent_ffi_checksum_func_init_workspace(
1218
812
  ): Short
1219
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_abort(
813
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_abort(
1220
814
  ): Short
1221
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_add_cron_job(
815
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_add_cron_job(
1222
816
  ): Short
1223
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_add_skill(
817
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_add_skill(
1224
818
  ): Short
1225
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_clear_session(
819
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_clear_session(
1226
820
  ): Short
1227
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_delete_auth(
821
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_delete_auth(
1228
822
  ): Short
1229
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_end_skill(
823
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_dispatch_agent_command_json(
1230
824
  ): Short
1231
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_exchange_oauth_code(
825
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_end_skill(
1232
826
  ): Short
1233
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_follow_up(
827
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_exchange_oauth_code(
1234
828
  ): Short
1235
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_auth_status(
829
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_follow_up(
1236
830
  ): Short
1237
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_auth_token(
831
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_auth_status(
1238
832
  ): Short
1239
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_heartbeat_config(
833
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_auth_token(
1240
834
  ): Short
1241
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_models(
835
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_heartbeat_config(
1242
836
  ): Short
1243
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_scheduler_config(
837
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_models(
1244
838
  ): Short
1245
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_handle_wake(
839
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_scheduler_config(
1246
840
  ): Short
1247
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_invoke_tool(
841
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_handle_wake(
1248
842
  ): Short
1249
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_list_cron_jobs(
843
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_invoke_tool(
1250
844
  ): Short
1251
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_list_cron_runs(
845
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_list_cron_jobs(
1252
846
  ): Short
1253
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_list_sessions(
847
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_list_cron_runs(
1254
848
  ): Short
1255
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_list_skills(
849
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_list_native_tools(
1256
850
  ): Short
1257
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_list_tool_permissions(
851
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_list_sessions(
1258
852
  ): Short
1259
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_load_session(
853
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_list_skills(
1260
854
  ): Short
1261
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_load_surfaced_messages(
855
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_list_tool_permissions(
1262
856
  ): Short
1263
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_persist_config(
857
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_load_session(
1264
858
  ): Short
1265
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_refresh_token(
859
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_load_surfaced_messages(
1266
860
  ): Short
1267
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_remove_cron_job(
861
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_persist_config(
1268
862
  ): Short
1269
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_remove_skill(
863
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_refresh_token(
1270
864
  ): Short
1271
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_reset_tool_permissions(
865
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_remove_cron_job(
1272
866
  ): Short
1273
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_respond_to_approval(
867
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_remove_skill(
1274
868
  ): Short
1275
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_respond_to_cron_approval(
869
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_reset_tool_permissions(
1276
870
  ): Short
1277
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_respond_to_mcp_tool(
871
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_respond_to_approval(
1278
872
  ): Short
1279
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_restart_mcp(
873
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_respond_to_cron_approval(
1280
874
  ): Short
1281
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_resume_session(
875
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_respond_to_mcp_tool(
1282
876
  ): Short
1283
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_run_cron_job(
877
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_restart_mcp(
1284
878
  ): Short
1285
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_seed_tool_permissions(
879
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_resume_session(
1286
880
  ): Short
1287
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_send_message(
881
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_run_cron_job(
1288
882
  ): Short
1289
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_auth_key(
883
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_seed_tool_permissions(
1290
884
  ): Short
1291
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_event_callback(
885
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_send_message(
1292
886
  ): Short
1293
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_governance_provider(
887
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_serialize_agent_event_json(
1294
888
  ): Short
1295
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_heartbeat_config(
889
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_auth_key(
1296
890
  ): Short
1297
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_memory_provider(
891
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_event_callback(
1298
892
  ): Short
1299
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_notifier(
893
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_governance_provider(
1300
894
  ): Short
1301
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_scheduler_config(
895
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_heartbeat_config(
1302
896
  ): Short
1303
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_tool_permission(
897
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_memory_provider(
1304
898
  ): Short
1305
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_start_mcp(
899
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_notifier(
1306
900
  ): Short
1307
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_start_skill(
901
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_scheduler_config(
1308
902
  ): Short
1309
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_steer(
903
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_tool_permission(
1310
904
  ): Short
1311
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_update_cron_job(
905
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_start_mcp(
1312
906
  ): Short
1313
- fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_update_skill(
907
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_start_skill(
1314
908
  ): Short
1315
- fun uniffi_native_agent_ffi_checksum_constructor_nativeagenthandle_new(
909
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_steer(
1316
910
  ): Short
1317
- fun uniffi_native_agent_ffi_checksum_method_governanceprovider_check_loop(
911
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_update_cron_job(
1318
912
  ): Short
1319
- fun uniffi_native_agent_ffi_checksum_method_governanceprovider_record_outcome(
913
+ external fun uniffi_native_agent_ffi_checksum_method_nativeagenthandle_update_skill(
1320
914
  ): Short
1321
- fun uniffi_native_agent_ffi_checksum_method_governanceprovider_record_audit(
915
+ external fun uniffi_native_agent_ffi_checksum_constructor_nativeagenthandle_new(
1322
916
  ): Short
1323
- fun uniffi_native_agent_ffi_checksum_method_governanceprovider_check_sink(
917
+ external fun uniffi_native_agent_ffi_checksum_method_governanceprovider_check_loop(
1324
918
  ): Short
1325
- fun uniffi_native_agent_ffi_checksum_method_governanceprovider_reset(
919
+ external fun uniffi_native_agent_ffi_checksum_method_governanceprovider_record_outcome(
1326
920
  ): Short
1327
- fun uniffi_native_agent_ffi_checksum_method_governanceprovider_record_usage(
921
+ external fun uniffi_native_agent_ffi_checksum_method_governanceprovider_record_audit(
1328
922
  ): Short
1329
- fun uniffi_native_agent_ffi_checksum_method_memoryprovider_store(
923
+ external fun uniffi_native_agent_ffi_checksum_method_governanceprovider_check_sink(
1330
924
  ): Short
1331
- fun uniffi_native_agent_ffi_checksum_method_memoryprovider_recall(
925
+ external fun uniffi_native_agent_ffi_checksum_method_governanceprovider_reset(
1332
926
  ): Short
1333
- fun uniffi_native_agent_ffi_checksum_method_memoryprovider_forget(
927
+ external fun uniffi_native_agent_ffi_checksum_method_governanceprovider_record_usage(
1334
928
  ): Short
1335
- fun uniffi_native_agent_ffi_checksum_method_memoryprovider_search(
929
+ external fun uniffi_native_agent_ffi_checksum_method_memoryprovider_store(
1336
930
  ): Short
1337
- fun uniffi_native_agent_ffi_checksum_method_memoryprovider_list(
931
+ external fun uniffi_native_agent_ffi_checksum_method_memoryprovider_recall(
1338
932
  ): Short
1339
- fun uniffi_native_agent_ffi_checksum_method_nativeeventcallback_on_event(
933
+ external fun uniffi_native_agent_ffi_checksum_method_memoryprovider_forget(
1340
934
  ): Short
1341
- fun uniffi_native_agent_ffi_checksum_method_nativenotifier_send_notification(
935
+ external fun uniffi_native_agent_ffi_checksum_method_memoryprovider_search(
1342
936
  ): Short
1343
- fun ffi_native_agent_ffi_uniffi_contract_version(
937
+ external fun uniffi_native_agent_ffi_checksum_method_memoryprovider_list(
938
+ ): Short
939
+ external fun uniffi_native_agent_ffi_checksum_method_nativeeventcallback_on_event(
940
+ ): Short
941
+ external fun uniffi_native_agent_ffi_checksum_method_nativenotifier_send_notification(
942
+ ): Short
943
+ external fun uniffi_native_agent_ffi_checksum_method_authprofilestore_load(
944
+ ): Short
945
+ external fun uniffi_native_agent_ffi_checksum_method_authprofilestore_save(
946
+ ): Short
947
+ external fun ffi_native_agent_ffi_uniffi_contract_version(
1344
948
  ): Int
1345
-
949
+
950
+
1346
951
  }
1347
952
 
1348
- private fun uniffiCheckContractApiVersion(lib: UniffiLib) {
953
+ internal object UniffiLib {
954
+
955
+ // The Cleaner for the whole library
956
+ internal val CLEANER: UniffiCleaner by lazy {
957
+ UniffiCleaner.create()
958
+ }
959
+
960
+
961
+ init {
962
+ Native.register(UniffiLib::class.java, findLibraryName(componentName = "native_agent_ffi"))
963
+ uniffiCallbackInterfaceAuthProfileStore.register(this)
964
+ uniffiCallbackInterfaceGovernanceProvider.register(this)
965
+ uniffiCallbackInterfaceMemoryProvider.register(this)
966
+ uniffiCallbackInterfaceNativeEventCallback.register(this)
967
+ uniffiCallbackInterfaceNativeNotifier.register(this)
968
+
969
+ }
970
+ external fun uniffi_native_agent_ffi_fn_clone_nativeagenthandle(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
971
+ ): Long
972
+ external fun uniffi_native_agent_ffi_fn_free_nativeagenthandle(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
973
+ ): Unit
974
+ external fun uniffi_native_agent_ffi_fn_constructor_nativeagenthandle_new(`config`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
975
+ ): Long
976
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_abort(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
977
+ ): Unit
978
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_add_cron_job(`ptr`: Long,`inputJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
979
+ ): RustBuffer.ByValue
980
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_add_skill(`ptr`: Long,`inputJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
981
+ ): RustBuffer.ByValue
982
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_clear_session(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
983
+ ): Unit
984
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_delete_auth(`ptr`: Long,`provider`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
985
+ ): Unit
986
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_dispatch_agent_command_json(`ptr`: Long,`json`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
987
+ ): RustBuffer.ByValue
988
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_end_skill(`ptr`: Long,`skillId`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
989
+ ): Unit
990
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_exchange_oauth_code(`ptr`: Long,`tokenUrl`: RustBuffer.ByValue,`bodyJson`: RustBuffer.ByValue,`contentType`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
991
+ ): RustBuffer.ByValue
992
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_follow_up(`ptr`: Long,`prompt`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
993
+ ): Unit
994
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_auth_status(`ptr`: Long,`provider`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
995
+ ): RustBuffer.ByValue
996
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_auth_token(`ptr`: Long,`provider`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
997
+ ): RustBuffer.ByValue
998
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_heartbeat_config(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
999
+ ): RustBuffer.ByValue
1000
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_models(`ptr`: Long,`provider`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1001
+ ): RustBuffer.ByValue
1002
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_scheduler_config(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
1003
+ ): RustBuffer.ByValue
1004
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_handle_wake(`ptr`: Long,`source`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1005
+ ): Unit
1006
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_invoke_tool(`ptr`: Long,`toolName`: RustBuffer.ByValue,`argsJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1007
+ ): RustBuffer.ByValue
1008
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_cron_jobs(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
1009
+ ): RustBuffer.ByValue
1010
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_cron_runs(`ptr`: Long,`jobId`: RustBuffer.ByValue,`limit`: Long,uniffi_out_err: UniffiRustCallStatus,
1011
+ ): RustBuffer.ByValue
1012
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_native_tools(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
1013
+ ): RustBuffer.ByValue
1014
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_sessions(`ptr`: Long,`agentId`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1015
+ ): RustBuffer.ByValue
1016
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_skills(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
1017
+ ): RustBuffer.ByValue
1018
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_tool_permissions(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
1019
+ ): RustBuffer.ByValue
1020
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_load_session(`ptr`: Long,`sessionKey`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1021
+ ): RustBuffer.ByValue
1022
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_load_surfaced_messages(`ptr`: Long,`limit`: Long,uniffi_out_err: UniffiRustCallStatus,
1023
+ ): RustBuffer.ByValue
1024
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_persist_config(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
1025
+ ): Unit
1026
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_refresh_token(`ptr`: Long,`provider`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1027
+ ): RustBuffer.ByValue
1028
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_remove_cron_job(`ptr`: Long,`id`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1029
+ ): Unit
1030
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_remove_skill(`ptr`: Long,`id`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1031
+ ): Unit
1032
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_reset_tool_permissions(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
1033
+ ): Unit
1034
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_respond_to_approval(`ptr`: Long,`toolCallId`: RustBuffer.ByValue,`approved`: Byte,`reason`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1035
+ ): Unit
1036
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_respond_to_cron_approval(`ptr`: Long,`requestId`: RustBuffer.ByValue,`approved`: Byte,uniffi_out_err: UniffiRustCallStatus,
1037
+ ): Unit
1038
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_respond_to_mcp_tool(`ptr`: Long,`toolCallId`: RustBuffer.ByValue,`resultJson`: RustBuffer.ByValue,`isError`: Byte,uniffi_out_err: UniffiRustCallStatus,
1039
+ ): Unit
1040
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_restart_mcp(`ptr`: Long,`toolsJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1041
+ ): Int
1042
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_resume_session(`ptr`: Long,`sessionKey`: RustBuffer.ByValue,`agentId`: RustBuffer.ByValue,`messagesJson`: RustBuffer.ByValue,`provider`: RustBuffer.ByValue,`model`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1043
+ ): Byte
1044
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_run_cron_job(`ptr`: Long,`jobId`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1045
+ ): Unit
1046
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_seed_tool_permissions(`ptr`: Long,`defaultsJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1047
+ ): Int
1048
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_send_message(`ptr`: Long,`params`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1049
+ ): RustBuffer.ByValue
1050
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_serialize_agent_event_json(`ptr`: Long,`eventType`: RustBuffer.ByValue,`payloadJson`: RustBuffer.ByValue,`sessionKey`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1051
+ ): RustBuffer.ByValue
1052
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_auth_key(`ptr`: Long,`key`: RustBuffer.ByValue,`provider`: RustBuffer.ByValue,`authType`: RustBuffer.ByValue,`refresh`: RustBuffer.ByValue,`expiresAt`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1053
+ ): Unit
1054
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_event_callback(`ptr`: Long,`callback`: Long,uniffi_out_err: UniffiRustCallStatus,
1055
+ ): Unit
1056
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_governance_provider(`ptr`: Long,`provider`: Long,uniffi_out_err: UniffiRustCallStatus,
1057
+ ): Unit
1058
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_heartbeat_config(`ptr`: Long,`configJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1059
+ ): Unit
1060
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_memory_provider(`ptr`: Long,`provider`: Long,uniffi_out_err: UniffiRustCallStatus,
1061
+ ): Unit
1062
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_notifier(`ptr`: Long,`notifier`: Long,uniffi_out_err: UniffiRustCallStatus,
1063
+ ): Unit
1064
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_scheduler_config(`ptr`: Long,`configJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1065
+ ): Unit
1066
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_tool_permission(`ptr`: Long,`toolName`: RustBuffer.ByValue,`permission`: RustBuffer.ByValue,`enabled`: Byte,uniffi_out_err: UniffiRustCallStatus,
1067
+ ): Unit
1068
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_start_mcp(`ptr`: Long,`toolsJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1069
+ ): Int
1070
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_start_skill(`ptr`: Long,`skillId`: RustBuffer.ByValue,`configJson`: RustBuffer.ByValue,`provider`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1071
+ ): RustBuffer.ByValue
1072
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_steer(`ptr`: Long,`text`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1073
+ ): Unit
1074
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_update_cron_job(`ptr`: Long,`id`: RustBuffer.ByValue,`patchJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1075
+ ): Unit
1076
+ external fun uniffi_native_agent_ffi_fn_method_nativeagenthandle_update_skill(`ptr`: Long,`id`: RustBuffer.ByValue,`patchJson`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1077
+ ): Unit
1078
+ external fun uniffi_native_agent_ffi_fn_init_callback_vtable_governanceprovider(`vtable`: UniffiVTableCallbackInterfaceGovernanceProvider,
1079
+ ): Unit
1080
+ external fun uniffi_native_agent_ffi_fn_init_callback_vtable_memoryprovider(`vtable`: UniffiVTableCallbackInterfaceMemoryProvider,
1081
+ ): Unit
1082
+ external fun uniffi_native_agent_ffi_fn_init_callback_vtable_nativeeventcallback(`vtable`: UniffiVTableCallbackInterfaceNativeEventCallback,
1083
+ ): Unit
1084
+ external fun uniffi_native_agent_ffi_fn_init_callback_vtable_nativenotifier(`vtable`: UniffiVTableCallbackInterfaceNativeNotifier,
1085
+ ): Unit
1086
+ external fun uniffi_native_agent_ffi_fn_init_callback_vtable_authprofilestore(`vtable`: UniffiVTableCallbackInterfaceAuthProfileStore,
1087
+ ): Unit
1088
+ external fun uniffi_native_agent_ffi_fn_func_create_handle_from_persisted_config(`configPath`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1089
+ ): Long
1090
+ external fun uniffi_native_agent_ffi_fn_func_init_workspace(`config`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1091
+ ): Unit
1092
+ external fun ffi_native_agent_ffi_rustbuffer_alloc(`size`: Long,uniffi_out_err: UniffiRustCallStatus,
1093
+ ): RustBuffer.ByValue
1094
+ external fun ffi_native_agent_ffi_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue,uniffi_out_err: UniffiRustCallStatus,
1095
+ ): RustBuffer.ByValue
1096
+ external fun ffi_native_agent_ffi_rustbuffer_free(`buf`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
1097
+ ): Unit
1098
+ external fun ffi_native_agent_ffi_rustbuffer_reserve(`buf`: RustBuffer.ByValue,`additional`: Long,uniffi_out_err: UniffiRustCallStatus,
1099
+ ): RustBuffer.ByValue
1100
+ external fun ffi_native_agent_ffi_rust_future_poll_u8(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1101
+ ): Unit
1102
+ external fun ffi_native_agent_ffi_rust_future_cancel_u8(`handle`: Long,
1103
+ ): Unit
1104
+ external fun ffi_native_agent_ffi_rust_future_free_u8(`handle`: Long,
1105
+ ): Unit
1106
+ external fun ffi_native_agent_ffi_rust_future_complete_u8(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1107
+ ): Byte
1108
+ external fun ffi_native_agent_ffi_rust_future_poll_i8(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1109
+ ): Unit
1110
+ external fun ffi_native_agent_ffi_rust_future_cancel_i8(`handle`: Long,
1111
+ ): Unit
1112
+ external fun ffi_native_agent_ffi_rust_future_free_i8(`handle`: Long,
1113
+ ): Unit
1114
+ external fun ffi_native_agent_ffi_rust_future_complete_i8(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1115
+ ): Byte
1116
+ external fun ffi_native_agent_ffi_rust_future_poll_u16(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1117
+ ): Unit
1118
+ external fun ffi_native_agent_ffi_rust_future_cancel_u16(`handle`: Long,
1119
+ ): Unit
1120
+ external fun ffi_native_agent_ffi_rust_future_free_u16(`handle`: Long,
1121
+ ): Unit
1122
+ external fun ffi_native_agent_ffi_rust_future_complete_u16(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1123
+ ): Short
1124
+ external fun ffi_native_agent_ffi_rust_future_poll_i16(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1125
+ ): Unit
1126
+ external fun ffi_native_agent_ffi_rust_future_cancel_i16(`handle`: Long,
1127
+ ): Unit
1128
+ external fun ffi_native_agent_ffi_rust_future_free_i16(`handle`: Long,
1129
+ ): Unit
1130
+ external fun ffi_native_agent_ffi_rust_future_complete_i16(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1131
+ ): Short
1132
+ external fun ffi_native_agent_ffi_rust_future_poll_u32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1133
+ ): Unit
1134
+ external fun ffi_native_agent_ffi_rust_future_cancel_u32(`handle`: Long,
1135
+ ): Unit
1136
+ external fun ffi_native_agent_ffi_rust_future_free_u32(`handle`: Long,
1137
+ ): Unit
1138
+ external fun ffi_native_agent_ffi_rust_future_complete_u32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1139
+ ): Int
1140
+ external fun ffi_native_agent_ffi_rust_future_poll_i32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1141
+ ): Unit
1142
+ external fun ffi_native_agent_ffi_rust_future_cancel_i32(`handle`: Long,
1143
+ ): Unit
1144
+ external fun ffi_native_agent_ffi_rust_future_free_i32(`handle`: Long,
1145
+ ): Unit
1146
+ external fun ffi_native_agent_ffi_rust_future_complete_i32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1147
+ ): Int
1148
+ external fun ffi_native_agent_ffi_rust_future_poll_u64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1149
+ ): Unit
1150
+ external fun ffi_native_agent_ffi_rust_future_cancel_u64(`handle`: Long,
1151
+ ): Unit
1152
+ external fun ffi_native_agent_ffi_rust_future_free_u64(`handle`: Long,
1153
+ ): Unit
1154
+ external fun ffi_native_agent_ffi_rust_future_complete_u64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1155
+ ): Long
1156
+ external fun ffi_native_agent_ffi_rust_future_poll_i64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1157
+ ): Unit
1158
+ external fun ffi_native_agent_ffi_rust_future_cancel_i64(`handle`: Long,
1159
+ ): Unit
1160
+ external fun ffi_native_agent_ffi_rust_future_free_i64(`handle`: Long,
1161
+ ): Unit
1162
+ external fun ffi_native_agent_ffi_rust_future_complete_i64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1163
+ ): Long
1164
+ external fun ffi_native_agent_ffi_rust_future_poll_f32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1165
+ ): Unit
1166
+ external fun ffi_native_agent_ffi_rust_future_cancel_f32(`handle`: Long,
1167
+ ): Unit
1168
+ external fun ffi_native_agent_ffi_rust_future_free_f32(`handle`: Long,
1169
+ ): Unit
1170
+ external fun ffi_native_agent_ffi_rust_future_complete_f32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1171
+ ): Float
1172
+ external fun ffi_native_agent_ffi_rust_future_poll_f64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1173
+ ): Unit
1174
+ external fun ffi_native_agent_ffi_rust_future_cancel_f64(`handle`: Long,
1175
+ ): Unit
1176
+ external fun ffi_native_agent_ffi_rust_future_free_f64(`handle`: Long,
1177
+ ): Unit
1178
+ external fun ffi_native_agent_ffi_rust_future_complete_f64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1179
+ ): Double
1180
+ external fun ffi_native_agent_ffi_rust_future_poll_rust_buffer(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1181
+ ): Unit
1182
+ external fun ffi_native_agent_ffi_rust_future_cancel_rust_buffer(`handle`: Long,
1183
+ ): Unit
1184
+ external fun ffi_native_agent_ffi_rust_future_free_rust_buffer(`handle`: Long,
1185
+ ): Unit
1186
+ external fun ffi_native_agent_ffi_rust_future_complete_rust_buffer(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1187
+ ): RustBuffer.ByValue
1188
+ external fun ffi_native_agent_ffi_rust_future_poll_void(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
1189
+ ): Unit
1190
+ external fun ffi_native_agent_ffi_rust_future_cancel_void(`handle`: Long,
1191
+ ): Unit
1192
+ external fun ffi_native_agent_ffi_rust_future_free_void(`handle`: Long,
1193
+ ): Unit
1194
+ external fun ffi_native_agent_ffi_rust_future_complete_void(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
1195
+ ): Unit
1196
+
1197
+
1198
+ }
1199
+
1200
+ private fun uniffiCheckContractApiVersion(lib: IntegrityCheckingUniffiLib) {
1349
1201
  // Get the bindings contract version from our ComponentInterface
1350
- val bindings_contract_version = 26
1202
+ val bindings_contract_version = 30
1351
1203
  // Get the scaffolding contract version by calling the into the dylib
1352
1204
  val scaffolding_contract_version = lib.ffi_native_agent_ffi_uniffi_contract_version()
1353
1205
  if (bindings_contract_version != scaffolding_contract_version) {
1354
1206
  throw RuntimeException("UniFFI contract version mismatch: try cleaning and rebuilding your project")
1355
1207
  }
1356
1208
  }
1357
-
1358
1209
  @Suppress("UNUSED_PARAMETER")
1359
- private fun uniffiCheckApiChecksums(lib: UniffiLib) {
1210
+ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
1360
1211
  if (lib.uniffi_native_agent_ffi_checksum_func_create_handle_from_persisted_config() != 41643.toShort()) {
1361
1212
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1362
1213
  }
1363
- if (lib.uniffi_native_agent_ffi_checksum_func_init_workspace() != 39423.toShort()) {
1214
+ if (lib.uniffi_native_agent_ffi_checksum_func_init_workspace() != 313.toShort()) {
1364
1215
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1365
1216
  }
1366
1217
  if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_abort() != 58908.toShort()) {
@@ -1378,6 +1229,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
1378
1229
  if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_delete_auth() != 2640.toShort()) {
1379
1230
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1380
1231
  }
1232
+ if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_dispatch_agent_command_json() != 26137.toShort()) {
1233
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1234
+ }
1381
1235
  if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_end_skill() != 49984.toShort()) {
1382
1236
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1383
1237
  }
@@ -1387,10 +1241,10 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
1387
1241
  if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_follow_up() != 816.toShort()) {
1388
1242
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1389
1243
  }
1390
- if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_auth_status() != 31550.toShort()) {
1244
+ if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_auth_status() != 19426.toShort()) {
1391
1245
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1392
1246
  }
1393
- if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_auth_token() != 58380.toShort()) {
1247
+ if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_auth_token() != 36642.toShort()) {
1394
1248
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1395
1249
  }
1396
1250
  if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_get_heartbeat_config() != 1627.toShort()) {
@@ -1414,6 +1268,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
1414
1268
  if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_list_cron_runs() != 27743.toShort()) {
1415
1269
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1416
1270
  }
1271
+ if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_list_native_tools() != 614.toShort()) {
1272
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1273
+ }
1417
1274
  if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_list_sessions() != 20894.toShort()) {
1418
1275
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1419
1276
  }
@@ -1432,7 +1289,7 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
1432
1289
  if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_persist_config() != 63110.toShort()) {
1433
1290
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1434
1291
  }
1435
- if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_refresh_token() != 13290.toShort()) {
1292
+ if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_refresh_token() != 43469.toShort()) {
1436
1293
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1437
1294
  }
1438
1295
  if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_remove_cron_job() != 55519.toShort()) {
@@ -1465,7 +1322,10 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
1465
1322
  if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_seed_tool_permissions() != 39225.toShort()) {
1466
1323
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1467
1324
  }
1468
- if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_send_message() != 53296.toShort()) {
1325
+ if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_send_message() != 35046.toShort()) {
1326
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1327
+ }
1328
+ if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_serialize_agent_event_json() != 40873.toShort()) {
1469
1329
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1470
1330
  }
1471
1331
  if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_set_auth_key() != 1639.toShort()) {
@@ -1507,7 +1367,7 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
1507
1367
  if (lib.uniffi_native_agent_ffi_checksum_method_nativeagenthandle_update_skill() != 42452.toShort()) {
1508
1368
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1509
1369
  }
1510
- if (lib.uniffi_native_agent_ffi_checksum_constructor_nativeagenthandle_new() != 18383.toShort()) {
1370
+ if (lib.uniffi_native_agent_ffi_checksum_constructor_nativeagenthandle_new() != 28156.toShort()) {
1511
1371
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1512
1372
  }
1513
1373
  if (lib.uniffi_native_agent_ffi_checksum_method_governanceprovider_check_loop() != 64194.toShort()) {
@@ -1549,6 +1409,22 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
1549
1409
  if (lib.uniffi_native_agent_ffi_checksum_method_nativenotifier_send_notification() != 9573.toShort()) {
1550
1410
  throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1551
1411
  }
1412
+ if (lib.uniffi_native_agent_ffi_checksum_method_authprofilestore_load() != 44333.toShort()) {
1413
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1414
+ }
1415
+ if (lib.uniffi_native_agent_ffi_checksum_method_authprofilestore_save() != 41441.toShort()) {
1416
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
1417
+ }
1418
+ }
1419
+
1420
+ /**
1421
+ * @suppress
1422
+ */
1423
+ public fun uniffiEnsureInitialized() {
1424
+ IntegrityCheckingUniffiLib
1425
+ // UniffiLib() initialized as objects are used, but we still need to explicitly
1426
+ // reference it so initialization across crates works as expected.
1427
+ UniffiLib
1552
1428
  }
1553
1429
 
1554
1430
  // Async support
@@ -1568,8 +1444,33 @@ interface Disposable {
1568
1444
  fun destroy()
1569
1445
  companion object {
1570
1446
  fun destroy(vararg args: Any?) {
1571
- args.filterIsInstance<Disposable>()
1572
- .forEach(Disposable::destroy)
1447
+ for (arg in args) {
1448
+ when (arg) {
1449
+ is Disposable -> arg.destroy()
1450
+ is ArrayList<*> -> {
1451
+ for (idx in arg.indices) {
1452
+ val element = arg[idx]
1453
+ if (element is Disposable) {
1454
+ element.destroy()
1455
+ }
1456
+ }
1457
+ }
1458
+ is Map<*, *> -> {
1459
+ for (element in arg.values) {
1460
+ if (element is Disposable) {
1461
+ element.destroy()
1462
+ }
1463
+ }
1464
+ }
1465
+ is Iterable<*> -> {
1466
+ for (element in arg) {
1467
+ if (element is Disposable) {
1468
+ element.destroy()
1469
+ }
1470
+ }
1471
+ }
1472
+ }
1473
+ }
1573
1474
  }
1574
1475
  }
1575
1476
  }
@@ -1589,12 +1490,118 @@ inline fun <T : Disposable?, R> T.use(block: (T) -> R) =
1589
1490
  }
1590
1491
  }
1591
1492
 
1493
+ /**
1494
+ * Placeholder object used to signal that we're constructing an interface with a FFI handle.
1495
+ *
1496
+ * This is the first argument for interface constructors that input a raw handle. It exists is that
1497
+ * so we can avoid signature conflicts when an interface has a regular constructor than inputs a
1498
+ * Long.
1499
+ *
1500
+ * @suppress
1501
+ * */
1502
+ object UniffiWithHandle
1503
+
1592
1504
  /**
1593
1505
  * Used to instantiate an interface without an actual pointer, for fakes in tests, mostly.
1594
1506
  *
1595
1507
  * @suppress
1596
1508
  * */
1597
- object NoPointer
1509
+ object NoHandle// Magic number for the Rust proxy to call using the same mechanism as every other method,
1510
+ // to free the callback once it's dropped by Rust.
1511
+ internal const val IDX_CALLBACK_FREE = 0
1512
+ // Callback return codes
1513
+ internal const val UNIFFI_CALLBACK_SUCCESS = 0
1514
+ internal const val UNIFFI_CALLBACK_ERROR = 1
1515
+ internal const val UNIFFI_CALLBACK_UNEXPECTED_ERROR = 2
1516
+
1517
+ /**
1518
+ * @suppress
1519
+ */
1520
+ public abstract class FfiConverterCallbackInterface<CallbackInterface: Any>: FfiConverter<CallbackInterface, Long> {
1521
+ internal val handleMap = UniffiHandleMap<CallbackInterface>()
1522
+
1523
+ internal fun drop(handle: Long) {
1524
+ handleMap.remove(handle)
1525
+ }
1526
+
1527
+ override fun lift(value: Long): CallbackInterface {
1528
+ return handleMap.get(value)
1529
+ }
1530
+
1531
+ override fun read(buf: ByteBuffer) = lift(buf.getLong())
1532
+
1533
+ override fun lower(value: CallbackInterface) = handleMap.insert(value)
1534
+
1535
+ override fun allocationSize(value: CallbackInterface) = 8UL
1536
+
1537
+ override fun write(value: CallbackInterface, buf: ByteBuffer) {
1538
+ buf.putLong(lower(value))
1539
+ }
1540
+ }
1541
+ /**
1542
+ * The cleaner interface for Object finalization code to run.
1543
+ * This is the entry point to any implementation that we're using.
1544
+ *
1545
+ * The cleaner registers objects and returns cleanables, so now we are
1546
+ * defining a `UniffiCleaner` with a `UniffiClenaer.Cleanable` to abstract the
1547
+ * different implmentations available at compile time.
1548
+ *
1549
+ * @suppress
1550
+ */
1551
+ interface UniffiCleaner {
1552
+ interface Cleanable {
1553
+ fun clean()
1554
+ }
1555
+
1556
+ fun register(value: Any, cleanUpTask: Runnable): UniffiCleaner.Cleanable
1557
+
1558
+ companion object
1559
+ }
1560
+
1561
+ // The fallback Jna cleaner, which is available for both Android, and the JVM.
1562
+ private class UniffiJnaCleaner : UniffiCleaner {
1563
+ private val cleaner = com.sun.jna.internal.Cleaner.getCleaner()
1564
+
1565
+ override fun register(value: Any, cleanUpTask: Runnable): UniffiCleaner.Cleanable =
1566
+ UniffiJnaCleanable(cleaner.register(value, cleanUpTask))
1567
+ }
1568
+
1569
+ private class UniffiJnaCleanable(
1570
+ private val cleanable: com.sun.jna.internal.Cleaner.Cleanable,
1571
+ ) : UniffiCleaner.Cleanable {
1572
+ override fun clean() = cleanable.clean()
1573
+ }
1574
+
1575
+
1576
+ // We decide at uniffi binding generation time whether we were
1577
+ // using Android or not.
1578
+ // There are further runtime checks to chose the correct implementation
1579
+ // of the cleaner.
1580
+ private fun UniffiCleaner.Companion.create(): UniffiCleaner =
1581
+ try {
1582
+ // For safety's sake: if the library hasn't been run in android_cleaner = true
1583
+ // mode, but is being run on Android, then we still need to think about
1584
+ // Android API versions.
1585
+ // So we check if java.lang.ref.Cleaner is there, and use that…
1586
+ java.lang.Class.forName("java.lang.ref.Cleaner")
1587
+ JavaLangRefCleaner()
1588
+ } catch (e: ClassNotFoundException) {
1589
+ // … otherwise, fallback to the JNA cleaner.
1590
+ UniffiJnaCleaner()
1591
+ }
1592
+
1593
+ private class JavaLangRefCleaner : UniffiCleaner {
1594
+ val cleaner = java.lang.ref.Cleaner.create()
1595
+
1596
+ override fun register(value: Any, cleanUpTask: Runnable): UniffiCleaner.Cleanable =
1597
+ JavaLangRefCleanable(cleaner.register(value, cleanUpTask))
1598
+ }
1599
+
1600
+ private class JavaLangRefCleanable(
1601
+ val cleanable: java.lang.ref.Cleaner.Cleanable
1602
+ ) : UniffiCleaner.Cleanable {
1603
+ override fun clean() = cleanable.clean()
1604
+ }
1598
1605
 
1599
1606
  /**
1600
1607
  * @suppress
@@ -1723,21 +1730,18 @@ public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
1723
1730
  }
1724
1731
 
1725
1732
 
1726
- // This template implements a class for working with a Rust struct via a Pointer/Arc<T>
1733
+ // This template implements a class for working with a Rust struct via a handle
1727
1734
  // to the live Rust struct on the other side of the FFI.
1728
1735
  //
1729
- // Each instance implements core operations for working with the Rust `Arc<T>` and the
1730
- // Kotlin Pointer to work with the live Rust struct on the other side of the FFI.
1731
- //
1732
1736
  // There's some subtlety here, because we have to be careful not to operate on a Rust
1733
1737
  // struct after it has been dropped, and because we must expose a public API for freeing
1734
1738
  // theq Kotlin wrapper object in lieu of reliable finalizers. The core requirements are:
1735
1739
  //
1736
- // * Each instance holds an opaque pointer to the underlying Rust struct.
1737
- // Method calls need to read this pointer from the object's state and pass it in to
1740
+ // * Each instance holds an opaque handle to the underlying Rust struct.
1741
+ // Method calls need to read this handle from the object's state and pass it in to
1738
1742
  // the Rust FFI.
1739
1743
  //
1740
- // * When an instance is no longer needed, its pointer should be passed to a
1744
+ // * When an instance is no longer needed, its handle should be passed to a
1741
1745
  // special destructor function provided by the Rust FFI, which will drop the
1742
1746
  // underlying Rust struct.
1743
1747
  //
@@ -1762,13 +1766,13 @@ public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
1762
1766
  // 2. the thread is shared across the whole library. This can be tuned by using `android_cleaner = true`,
1763
1767
  // or `android = true` in the [`kotlin` section of the `uniffi.toml` file](https://mozilla.github.io/uniffi-rs/kotlin/configuration.html).
1764
1768
  //
1765
- // If we try to implement this with mutual exclusion on access to the pointer, there is the
1769
+ // If we try to implement this with mutual exclusion on access to the handle, there is the
1766
1770
  // possibility of a race between a method call and a concurrent call to `destroy`:
1767
1771
  //
1768
- // * Thread A starts a method call, reads the value of the pointer, but is interrupted
1769
- // before it can pass the pointer over the FFI to Rust.
1772
+ // * Thread A starts a method call, reads the value of the handle, but is interrupted
1773
+ // before it can pass the handle over the FFI to Rust.
1770
1774
  // * Thread B calls `destroy` and frees the underlying Rust struct.
1771
- // * Thread A resumes, passing the already-read pointer value to Rust and triggering
1775
+ // * Thread A resumes, passing the already-read handle value to Rust and triggering
1772
1776
  // a use-after-free.
1773
1777
  //
1774
1778
  // One possible solution would be to use a `ReadWriteLock`, with each method call taking
@@ -1818,72 +1822,9 @@ public object FfiConverterString: FfiConverter<String, RustBuffer.ByValue> {
1818
1822
  // 3. The memory is reclaimed when the process terminates.
1819
1823
  //
1820
1824
  // [1] https://stackoverflow.com/questions/24376768/can-java-finalize-an-object-when-it-is-still-in-scope/24380219
1821
- //
1822
-
1823
-
1824
- /**
1825
- * The cleaner interface for Object finalization code to run.
1826
- * This is the entry point to any implementation that we're using.
1827
- *
1828
- * The cleaner registers objects and returns cleanables, so now we are
1829
- * defining a `UniffiCleaner` with a `UniffiClenaer.Cleanable` to abstract the
1830
- * different implmentations available at compile time.
1831
- *
1832
- * @suppress
1833
- */
1834
- interface UniffiCleaner {
1835
- interface Cleanable {
1836
- fun clean()
1837
- }
1838
-
1839
- fun register(value: Any, cleanUpTask: Runnable): UniffiCleaner.Cleanable
1840
-
1841
- companion object
1842
- }
1843
-
1844
- // The fallback Jna cleaner, which is available for both Android, and the JVM.
1845
- private class UniffiJnaCleaner : UniffiCleaner {
1846
- private val cleaner = com.sun.jna.internal.Cleaner.getCleaner()
1847
-
1848
- override fun register(value: Any, cleanUpTask: Runnable): UniffiCleaner.Cleanable =
1849
- UniffiJnaCleanable(cleaner.register(value, cleanUpTask))
1850
- }
1851
-
1852
- private class UniffiJnaCleanable(
1853
- private val cleanable: com.sun.jna.internal.Cleaner.Cleanable,
1854
- ) : UniffiCleaner.Cleanable {
1855
- override fun clean() = cleanable.clean()
1856
- }
1857
-
1858
- // We decide at uniffi binding generation time whether we were
1859
- // using Android or not.
1860
- // There are further runtime checks to chose the correct implementation
1861
- // of the cleaner.
1862
- private fun UniffiCleaner.Companion.create(): UniffiCleaner =
1863
- try {
1864
- // For safety's sake: if the library hasn't been run in android_cleaner = true
1865
- // mode, but is being run on Android, then we still need to think about
1866
- // Android API versions.
1867
- // So we check if java.lang.ref.Cleaner is there, and use that…
1868
- java.lang.Class.forName("java.lang.ref.Cleaner")
1869
- JavaLangRefCleaner()
1870
- } catch (e: ClassNotFoundException) {
1871
- // … otherwise, fallback to the JNA cleaner.
1872
- UniffiJnaCleaner()
1873
- }
1874
-
1875
- private class JavaLangRefCleaner : UniffiCleaner {
1876
- val cleaner = java.lang.ref.Cleaner.create()
1877
-
1878
- override fun register(value: Any, cleanUpTask: Runnable): UniffiCleaner.Cleanable =
1879
- JavaLangRefCleanable(cleaner.register(value, cleanUpTask))
1880
- }
1881
-
1882
- private class JavaLangRefCleanable(
1883
- val cleanable: java.lang.ref.Cleaner.Cleanable
1884
- ) : UniffiCleaner.Cleanable {
1885
- override fun clean() = cleanable.clean()
1886
- }
1825
+ //
1826
+
1827
+
1887
1828
  /**
1888
1829
  * Long-lived handle — one per app lifecycle.
1889
1830
  */
@@ -1916,6 +1857,19 @@ public interface NativeAgentHandleInterface {
1916
1857
  */
1917
1858
  fun `deleteAuth`(`provider`: kotlin.String)
1918
1859
 
1860
+ /**
1861
+ * Parse a canonical `wire::AgentCommand` JSON string, dispatch to the
1862
+ * matching internal method, and return the JSON-encoded
1863
+ * `wire::CommandAck`. The boundary is JSON strings only — see the
1864
+ * wire module docs for shape details.
1865
+ *
1866
+ * `ListSessions` and `ResumeSession` commands assume agent_id `"main"`
1867
+ * (aigenthive runs one agent per pod). Hosts that need a different
1868
+ * agent_id should call `list_sessions(agent_id)` / `resume_session(...)`
1869
+ * directly.
1870
+ */
1871
+ fun `dispatchAgentCommandJson`(`json`: kotlin.String): kotlin.String
1872
+
1919
1873
  /**
1920
1874
  * End a skill session.
1921
1875
  */
@@ -1976,6 +1930,13 @@ public interface NativeAgentHandleInterface {
1976
1930
  */
1977
1931
  fun `listCronRuns`(`jobId`: kotlin.String?, `limit`: kotlin.Long): kotlin.String
1978
1932
 
1933
+ /**
1934
+ * Return the embedded native tool catalog. Hosts use this to seed
1935
+ * permissions UI / tables on first run, and to check that local
1936
+ * callers stay in sync with the FFI's known tools.
1937
+ */
1938
+ fun `listNativeTools`(): List<NativeToolDescriptor>
1939
+
1979
1940
  /**
1980
1941
  * List sessions for an agent.
1981
1942
  */
@@ -2065,6 +2026,13 @@ public interface NativeAgentHandleInterface {
2065
2026
  */
2066
2027
  fun `sendMessage`(`params`: SendMessageParams): kotlin.String
2067
2028
 
2029
+ /**
2030
+ * Build a canonical `wire::AgentEvent` JSON envelope from the raw
2031
+ * event-type + payload pair the agent loop emits, stamping a fresh
2032
+ * `received_at`. Hosts call this to produce wire bytes for AMQP/STOMP.
2033
+ */
2034
+ fun `serializeAgentEventJson`(`eventType`: kotlin.String, `payloadJson`: kotlin.String, `sessionKey`: kotlin.String?): kotlin.String
2035
+
2068
2036
  /**
2069
2037
  * Set an auth key for a provider.
2070
2038
  */
@@ -2131,36 +2099,44 @@ public interface NativeAgentHandleInterface {
2131
2099
  /**
2132
2100
  * Long-lived handle — one per app lifecycle.
2133
2101
  */
2134
- open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterface {
2102
+ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterface
2103
+ {
2135
2104
 
2136
- constructor(pointer: Pointer) {
2137
- this.pointer = pointer
2138
- this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer))
2105
+ @Suppress("UNUSED_PARAMETER")
2106
+ /**
2107
+ * @suppress
2108
+ */
2109
+ constructor(withHandle: UniffiWithHandle, handle: Long) {
2110
+ this.handle = handle
2111
+ this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(handle))
2139
2112
  }
2140
2113
 
2141
2114
  /**
2115
+ * @suppress
2116
+ *
2142
2117
  * This constructor can be used to instantiate a fake object. Only used for tests. Any
2143
2118
  * attempt to actually use an object constructed this way will fail as there is no
2144
2119
  * connected Rust object.
2145
2120
  */
2146
2121
  @Suppress("UNUSED_PARAMETER")
2147
- constructor(noPointer: NoPointer) {
2148
- this.pointer = null
2149
- this.cleanable = UniffiLib.CLEANER.register(this, UniffiCleanAction(pointer))
2122
+ constructor(noHandle: NoHandle) {
2123
+ this.handle = 0
2124
+ this.cleanable = null
2150
2125
  }
2151
2126
  /**
2152
2127
  * Create a new native agent handle.
2153
2128
  */
2154
2129
  constructor(`config`: InitConfig) :
2155
- this(
2130
+ this(UniffiWithHandle,
2156
2131
  uniffiRustCallWithError(NativeAgentException) { _status ->
2157
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_constructor_nativeagenthandle_new(
2132
+ UniffiLib.uniffi_native_agent_ffi_fn_constructor_nativeagenthandle_new(
2133
+
2158
2134
  FfiConverterTypeInitConfig.lower(`config`),_status)
2159
2135
  }
2160
2136
  )
2161
2137
 
2162
- protected val pointer: Pointer?
2163
- protected val cleanable: UniffiCleaner.Cleanable
2138
+ protected val handle: Long
2139
+ protected val cleanable: UniffiCleaner.Cleanable?
2164
2140
 
2165
2141
  private val wasDestroyed = AtomicBoolean(false)
2166
2142
  private val callCounter = AtomicLong(1)
@@ -2171,7 +2147,7 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2171
2147
  if (this.wasDestroyed.compareAndSet(false, true)) {
2172
2148
  // This decrement always matches the initial count of 1 given at creation time.
2173
2149
  if (this.callCounter.decrementAndGet() == 0L) {
2174
- cleanable.clean()
2150
+ cleanable?.clean()
2175
2151
  }
2176
2152
  }
2177
2153
  }
@@ -2181,7 +2157,7 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2181
2157
  this.destroy()
2182
2158
  }
2183
2159
 
2184
- internal inline fun <R> callWithPointer(block: (ptr: Pointer) -> R): R {
2160
+ internal inline fun <R> callWithHandle(block: (handle: Long) -> R): R {
2185
2161
  // Check and increment the call counter, to keep the object alive.
2186
2162
  // This needs a compare-and-set retry loop in case of concurrent updates.
2187
2163
  do {
@@ -2193,32 +2169,40 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2193
2169
  throw IllegalStateException("${this.javaClass.simpleName} call counter would overflow")
2194
2170
  }
2195
2171
  } while (! this.callCounter.compareAndSet(c, c + 1L))
2196
- // Now we can safely do the method call without the pointer being freed concurrently.
2172
+ // Now we can safely do the method call without the handle being freed concurrently.
2197
2173
  try {
2198
- return block(this.uniffiClonePointer())
2174
+ return block(this.uniffiCloneHandle())
2199
2175
  } finally {
2200
2176
  // This decrement always matches the increment we performed above.
2201
2177
  if (this.callCounter.decrementAndGet() == 0L) {
2202
- cleanable.clean()
2178
+ cleanable?.clean()
2203
2179
  }
2204
2180
  }
2205
2181
  }
2206
2182
 
2207
2183
  // Use a static inner class instead of a closure so as not to accidentally
2208
2184
  // capture `this` as part of the cleanable's action.
2209
- private class UniffiCleanAction(private val pointer: Pointer?) : Runnable {
2185
+ private class UniffiCleanAction(private val handle: Long) : Runnable {
2210
2186
  override fun run() {
2211
- pointer?.let { ptr ->
2212
- uniffiRustCall { status ->
2213
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_free_nativeagenthandle(ptr, status)
2214
- }
2187
+ if (handle == 0.toLong()) {
2188
+ // Fake object created with `NoHandle`, don't try to free.
2189
+ return;
2190
+ }
2191
+ uniffiRustCall { status ->
2192
+ UniffiLib.uniffi_native_agent_ffi_fn_free_nativeagenthandle(handle, status)
2215
2193
  }
2216
2194
  }
2217
2195
  }
2218
2196
 
2219
- fun uniffiClonePointer(): Pointer {
2197
+ /**
2198
+ * @suppress
2199
+ */
2200
+ fun uniffiCloneHandle(): Long {
2201
+ if (handle == 0.toLong()) {
2202
+ throw InternalException("uniffiCloneHandle() called on NoHandle object");
2203
+ }
2220
2204
  return uniffiRustCall() { status ->
2221
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_clone_nativeagenthandle(pointer!!, status)
2205
+ UniffiLib.uniffi_native_agent_ffi_fn_clone_nativeagenthandle(handle, status)
2222
2206
  }
2223
2207
  }
2224
2208
 
@@ -2228,10 +2212,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2228
2212
  */
2229
2213
  @Throws(NativeAgentException::class)override fun `abort`()
2230
2214
  =
2231
- callWithPointer {
2215
+ callWithHandle {
2232
2216
  uniffiRustCallWithError(NativeAgentException) { _status ->
2233
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_abort(
2234
- it, _status)
2217
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_abort(
2218
+ it,
2219
+ _status)
2235
2220
  }
2236
2221
  }
2237
2222
 
@@ -2243,10 +2228,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2243
2228
  */
2244
2229
  @Throws(NativeAgentException::class)override fun `addCronJob`(`inputJson`: kotlin.String): kotlin.String {
2245
2230
  return FfiConverterString.lift(
2246
- callWithPointer {
2231
+ callWithHandle {
2247
2232
  uniffiRustCallWithError(NativeAgentException) { _status ->
2248
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_add_cron_job(
2249
- it, FfiConverterString.lower(`inputJson`),_status)
2233
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_add_cron_job(
2234
+ it,
2235
+ FfiConverterString.lower(`inputJson`),_status)
2250
2236
  }
2251
2237
  }
2252
2238
  )
@@ -2259,10 +2245,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2259
2245
  */
2260
2246
  @Throws(NativeAgentException::class)override fun `addSkill`(`inputJson`: kotlin.String): kotlin.String {
2261
2247
  return FfiConverterString.lift(
2262
- callWithPointer {
2248
+ callWithHandle {
2263
2249
  uniffiRustCallWithError(NativeAgentException) { _status ->
2264
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_add_skill(
2265
- it, FfiConverterString.lower(`inputJson`),_status)
2250
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_add_skill(
2251
+ it,
2252
+ FfiConverterString.lower(`inputJson`),_status)
2266
2253
  }
2267
2254
  }
2268
2255
  )
@@ -2277,10 +2264,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2277
2264
  */
2278
2265
  @Throws(NativeAgentException::class)override fun `clearSession`()
2279
2266
  =
2280
- callWithPointer {
2267
+ callWithHandle {
2281
2268
  uniffiRustCallWithError(NativeAgentException) { _status ->
2282
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_clear_session(
2283
- it, _status)
2269
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_clear_session(
2270
+ it,
2271
+ _status)
2284
2272
  }
2285
2273
  }
2286
2274
 
@@ -2292,25 +2280,52 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2292
2280
  */
2293
2281
  @Throws(NativeAgentException::class)override fun `deleteAuth`(`provider`: kotlin.String)
2294
2282
  =
2295
- callWithPointer {
2283
+ callWithHandle {
2296
2284
  uniffiRustCallWithError(NativeAgentException) { _status ->
2297
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_delete_auth(
2298
- it, FfiConverterString.lower(`provider`),_status)
2285
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_delete_auth(
2286
+ it,
2287
+ FfiConverterString.lower(`provider`),_status)
2299
2288
  }
2300
2289
  }
2301
2290
 
2302
2291
 
2303
2292
 
2304
2293
 
2294
+ /**
2295
+ * Parse a canonical `wire::AgentCommand` JSON string, dispatch to the
2296
+ * matching internal method, and return the JSON-encoded
2297
+ * `wire::CommandAck`. The boundary is JSON strings only — see the
2298
+ * wire module docs for shape details.
2299
+ *
2300
+ * `ListSessions` and `ResumeSession` commands assume agent_id `"main"`
2301
+ * (aigenthive runs one agent per pod). Hosts that need a different
2302
+ * agent_id should call `list_sessions(agent_id)` / `resume_session(...)`
2303
+ * directly.
2304
+ */
2305
+ @Throws(NativeAgentException::class)override fun `dispatchAgentCommandJson`(`json`: kotlin.String): kotlin.String {
2306
+ return FfiConverterString.lift(
2307
+ callWithHandle {
2308
+ uniffiRustCallWithError(NativeAgentException) { _status ->
2309
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_dispatch_agent_command_json(
2310
+ it,
2311
+ FfiConverterString.lower(`json`),_status)
2312
+ }
2313
+ }
2314
+ )
2315
+ }
2316
+
2317
+
2318
+
2305
2319
  /**
2306
2320
  * End a skill session.
2307
2321
  */
2308
2322
  @Throws(NativeAgentException::class)override fun `endSkill`(`skillId`: kotlin.String)
2309
2323
  =
2310
- callWithPointer {
2324
+ callWithHandle {
2311
2325
  uniffiRustCallWithError(NativeAgentException) { _status ->
2312
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_end_skill(
2313
- it, FfiConverterString.lower(`skillId`),_status)
2326
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_end_skill(
2327
+ it,
2328
+ FfiConverterString.lower(`skillId`),_status)
2314
2329
  }
2315
2330
  }
2316
2331
 
@@ -2322,10 +2337,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2322
2337
  */
2323
2338
  @Throws(NativeAgentException::class)override fun `exchangeOauthCode`(`tokenUrl`: kotlin.String, `bodyJson`: kotlin.String, `contentType`: kotlin.String?): kotlin.String {
2324
2339
  return FfiConverterString.lift(
2325
- callWithPointer {
2340
+ callWithHandle {
2326
2341
  uniffiRustCallWithError(NativeAgentException) { _status ->
2327
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_exchange_oauth_code(
2328
- it, FfiConverterString.lower(`tokenUrl`),FfiConverterString.lower(`bodyJson`),FfiConverterOptionalString.lower(`contentType`),_status)
2342
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_exchange_oauth_code(
2343
+ it,
2344
+ FfiConverterString.lower(`tokenUrl`),FfiConverterString.lower(`bodyJson`),FfiConverterOptionalString.lower(`contentType`),_status)
2329
2345
  }
2330
2346
  }
2331
2347
  )
@@ -2338,10 +2354,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2338
2354
  */
2339
2355
  @Throws(NativeAgentException::class)override fun `followUp`(`prompt`: kotlin.String)
2340
2356
  =
2341
- callWithPointer {
2357
+ callWithHandle {
2342
2358
  uniffiRustCallWithError(NativeAgentException) { _status ->
2343
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_follow_up(
2344
- it, FfiConverterString.lower(`prompt`),_status)
2359
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_follow_up(
2360
+ it,
2361
+ FfiConverterString.lower(`prompt`),_status)
2345
2362
  }
2346
2363
  }
2347
2364
 
@@ -2353,10 +2370,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2353
2370
  */
2354
2371
  @Throws(NativeAgentException::class)override fun `getAuthStatus`(`provider`: kotlin.String): AuthStatusResult {
2355
2372
  return FfiConverterTypeAuthStatusResult.lift(
2356
- callWithPointer {
2373
+ callWithHandle {
2357
2374
  uniffiRustCallWithError(NativeAgentException) { _status ->
2358
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_auth_status(
2359
- it, FfiConverterString.lower(`provider`),_status)
2375
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_auth_status(
2376
+ it,
2377
+ FfiConverterString.lower(`provider`),_status)
2360
2378
  }
2361
2379
  }
2362
2380
  )
@@ -2369,10 +2387,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2369
2387
  */
2370
2388
  @Throws(NativeAgentException::class)override fun `getAuthToken`(`provider`: kotlin.String): AuthTokenResult {
2371
2389
  return FfiConverterTypeAuthTokenResult.lift(
2372
- callWithPointer {
2390
+ callWithHandle {
2373
2391
  uniffiRustCallWithError(NativeAgentException) { _status ->
2374
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_auth_token(
2375
- it, FfiConverterString.lower(`provider`),_status)
2392
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_auth_token(
2393
+ it,
2394
+ FfiConverterString.lower(`provider`),_status)
2376
2395
  }
2377
2396
  }
2378
2397
  )
@@ -2385,10 +2404,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2385
2404
  */
2386
2405
  @Throws(NativeAgentException::class)override fun `getHeartbeatConfig`(): kotlin.String {
2387
2406
  return FfiConverterString.lift(
2388
- callWithPointer {
2407
+ callWithHandle {
2389
2408
  uniffiRustCallWithError(NativeAgentException) { _status ->
2390
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_heartbeat_config(
2391
- it, _status)
2409
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_heartbeat_config(
2410
+ it,
2411
+ _status)
2392
2412
  }
2393
2413
  }
2394
2414
  )
@@ -2401,10 +2421,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2401
2421
  */
2402
2422
  @Throws(NativeAgentException::class)override fun `getModels`(`provider`: kotlin.String): kotlin.String {
2403
2423
  return FfiConverterString.lift(
2404
- callWithPointer {
2424
+ callWithHandle {
2405
2425
  uniffiRustCallWithError(NativeAgentException) { _status ->
2406
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_models(
2407
- it, FfiConverterString.lower(`provider`),_status)
2426
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_models(
2427
+ it,
2428
+ FfiConverterString.lower(`provider`),_status)
2408
2429
  }
2409
2430
  }
2410
2431
  )
@@ -2417,10 +2438,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2417
2438
  */
2418
2439
  @Throws(NativeAgentException::class)override fun `getSchedulerConfig`(): kotlin.String {
2419
2440
  return FfiConverterString.lift(
2420
- callWithPointer {
2441
+ callWithHandle {
2421
2442
  uniffiRustCallWithError(NativeAgentException) { _status ->
2422
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_scheduler_config(
2423
- it, _status)
2443
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_get_scheduler_config(
2444
+ it,
2445
+ _status)
2424
2446
  }
2425
2447
  }
2426
2448
  )
@@ -2433,10 +2455,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2433
2455
  */
2434
2456
  @Throws(NativeAgentException::class)override fun `handleWake`(`source`: kotlin.String)
2435
2457
  =
2436
- callWithPointer {
2458
+ callWithHandle {
2437
2459
  uniffiRustCallWithError(NativeAgentException) { _status ->
2438
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_handle_wake(
2439
- it, FfiConverterString.lower(`source`),_status)
2460
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_handle_wake(
2461
+ it,
2462
+ FfiConverterString.lower(`source`),_status)
2440
2463
  }
2441
2464
  }
2442
2465
 
@@ -2448,10 +2471,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2448
2471
  */
2449
2472
  @Throws(NativeAgentException::class)override fun `invokeTool`(`toolName`: kotlin.String, `argsJson`: kotlin.String): kotlin.String {
2450
2473
  return FfiConverterString.lift(
2451
- callWithPointer {
2474
+ callWithHandle {
2452
2475
  uniffiRustCallWithError(NativeAgentException) { _status ->
2453
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_invoke_tool(
2454
- it, FfiConverterString.lower(`toolName`),FfiConverterString.lower(`argsJson`),_status)
2476
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_invoke_tool(
2477
+ it,
2478
+ FfiConverterString.lower(`toolName`),FfiConverterString.lower(`argsJson`),_status)
2455
2479
  }
2456
2480
  }
2457
2481
  )
@@ -2464,10 +2488,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2464
2488
  */
2465
2489
  @Throws(NativeAgentException::class)override fun `listCronJobs`(): kotlin.String {
2466
2490
  return FfiConverterString.lift(
2467
- callWithPointer {
2491
+ callWithHandle {
2468
2492
  uniffiRustCallWithError(NativeAgentException) { _status ->
2469
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_cron_jobs(
2470
- it, _status)
2493
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_cron_jobs(
2494
+ it,
2495
+ _status)
2471
2496
  }
2472
2497
  }
2473
2498
  )
@@ -2480,10 +2505,29 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2480
2505
  */
2481
2506
  @Throws(NativeAgentException::class)override fun `listCronRuns`(`jobId`: kotlin.String?, `limit`: kotlin.Long): kotlin.String {
2482
2507
  return FfiConverterString.lift(
2483
- callWithPointer {
2508
+ callWithHandle {
2484
2509
  uniffiRustCallWithError(NativeAgentException) { _status ->
2485
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_cron_runs(
2486
- it, FfiConverterOptionalString.lower(`jobId`),FfiConverterLong.lower(`limit`),_status)
2510
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_cron_runs(
2511
+ it,
2512
+ FfiConverterOptionalString.lower(`jobId`),FfiConverterLong.lower(`limit`),_status)
2513
+ }
2514
+ }
2515
+ )
2516
+ }
2517
+
2518
+
2519
+
2520
+ /**
2521
+ * Return the embedded native tool catalog. Hosts use this to seed
2522
+ * permissions UI / tables on first run, and to check that local
2523
+ * callers stay in sync with the FFI's known tools.
2524
+ */override fun `listNativeTools`(): List<NativeToolDescriptor> {
2525
+ return FfiConverterSequenceTypeNativeToolDescriptor.lift(
2526
+ callWithHandle {
2527
+ uniffiRustCall() { _status ->
2528
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_native_tools(
2529
+ it,
2530
+ _status)
2487
2531
  }
2488
2532
  }
2489
2533
  )
@@ -2496,10 +2540,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2496
2540
  */
2497
2541
  @Throws(NativeAgentException::class)override fun `listSessions`(`agentId`: kotlin.String): kotlin.String {
2498
2542
  return FfiConverterString.lift(
2499
- callWithPointer {
2543
+ callWithHandle {
2500
2544
  uniffiRustCallWithError(NativeAgentException) { _status ->
2501
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_sessions(
2502
- it, FfiConverterString.lower(`agentId`),_status)
2545
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_sessions(
2546
+ it,
2547
+ FfiConverterString.lower(`agentId`),_status)
2503
2548
  }
2504
2549
  }
2505
2550
  )
@@ -2512,10 +2557,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2512
2557
  */
2513
2558
  @Throws(NativeAgentException::class)override fun `listSkills`(): kotlin.String {
2514
2559
  return FfiConverterString.lift(
2515
- callWithPointer {
2560
+ callWithHandle {
2516
2561
  uniffiRustCallWithError(NativeAgentException) { _status ->
2517
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_skills(
2518
- it, _status)
2562
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_skills(
2563
+ it,
2564
+ _status)
2519
2565
  }
2520
2566
  }
2521
2567
  )
@@ -2528,10 +2574,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2528
2574
  */
2529
2575
  @Throws(NativeAgentException::class)override fun `listToolPermissions`(): kotlin.String {
2530
2576
  return FfiConverterString.lift(
2531
- callWithPointer {
2577
+ callWithHandle {
2532
2578
  uniffiRustCallWithError(NativeAgentException) { _status ->
2533
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_tool_permissions(
2534
- it, _status)
2579
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_list_tool_permissions(
2580
+ it,
2581
+ _status)
2535
2582
  }
2536
2583
  }
2537
2584
  )
@@ -2544,10 +2591,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2544
2591
  */
2545
2592
  @Throws(NativeAgentException::class)override fun `loadSession`(`sessionKey`: kotlin.String): kotlin.String {
2546
2593
  return FfiConverterString.lift(
2547
- callWithPointer {
2594
+ callWithHandle {
2548
2595
  uniffiRustCallWithError(NativeAgentException) { _status ->
2549
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_load_session(
2550
- it, FfiConverterString.lower(`sessionKey`),_status)
2596
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_load_session(
2597
+ it,
2598
+ FfiConverterString.lower(`sessionKey`),_status)
2551
2599
  }
2552
2600
  }
2553
2601
  )
@@ -2560,10 +2608,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2560
2608
  */
2561
2609
  @Throws(NativeAgentException::class)override fun `loadSurfacedMessages`(`limit`: kotlin.Long): kotlin.String {
2562
2610
  return FfiConverterString.lift(
2563
- callWithPointer {
2611
+ callWithHandle {
2564
2612
  uniffiRustCallWithError(NativeAgentException) { _status ->
2565
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_load_surfaced_messages(
2566
- it, FfiConverterLong.lower(`limit`),_status)
2613
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_load_surfaced_messages(
2614
+ it,
2615
+ FfiConverterLong.lower(`limit`),_status)
2567
2616
  }
2568
2617
  }
2569
2618
  )
@@ -2573,10 +2622,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2573
2622
 
2574
2623
  @Throws(NativeAgentException::class)override fun `persistConfig`()
2575
2624
  =
2576
- callWithPointer {
2625
+ callWithHandle {
2577
2626
  uniffiRustCallWithError(NativeAgentException) { _status ->
2578
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_persist_config(
2579
- it, _status)
2627
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_persist_config(
2628
+ it,
2629
+ _status)
2580
2630
  }
2581
2631
  }
2582
2632
 
@@ -2588,10 +2638,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2588
2638
  */
2589
2639
  @Throws(NativeAgentException::class)override fun `refreshToken`(`provider`: kotlin.String): AuthTokenResult {
2590
2640
  return FfiConverterTypeAuthTokenResult.lift(
2591
- callWithPointer {
2641
+ callWithHandle {
2592
2642
  uniffiRustCallWithError(NativeAgentException) { _status ->
2593
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_refresh_token(
2594
- it, FfiConverterString.lower(`provider`),_status)
2643
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_refresh_token(
2644
+ it,
2645
+ FfiConverterString.lower(`provider`),_status)
2595
2646
  }
2596
2647
  }
2597
2648
  )
@@ -2604,10 +2655,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2604
2655
  */
2605
2656
  @Throws(NativeAgentException::class)override fun `removeCronJob`(`id`: kotlin.String)
2606
2657
  =
2607
- callWithPointer {
2658
+ callWithHandle {
2608
2659
  uniffiRustCallWithError(NativeAgentException) { _status ->
2609
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_remove_cron_job(
2610
- it, FfiConverterString.lower(`id`),_status)
2660
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_remove_cron_job(
2661
+ it,
2662
+ FfiConverterString.lower(`id`),_status)
2611
2663
  }
2612
2664
  }
2613
2665
 
@@ -2619,10 +2671,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2619
2671
  */
2620
2672
  @Throws(NativeAgentException::class)override fun `removeSkill`(`id`: kotlin.String)
2621
2673
  =
2622
- callWithPointer {
2674
+ callWithHandle {
2623
2675
  uniffiRustCallWithError(NativeAgentException) { _status ->
2624
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_remove_skill(
2625
- it, FfiConverterString.lower(`id`),_status)
2676
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_remove_skill(
2677
+ it,
2678
+ FfiConverterString.lower(`id`),_status)
2626
2679
  }
2627
2680
  }
2628
2681
 
@@ -2634,10 +2687,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2634
2687
  */
2635
2688
  @Throws(NativeAgentException::class)override fun `resetToolPermissions`()
2636
2689
  =
2637
- callWithPointer {
2690
+ callWithHandle {
2638
2691
  uniffiRustCallWithError(NativeAgentException) { _status ->
2639
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_reset_tool_permissions(
2640
- it, _status)
2692
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_reset_tool_permissions(
2693
+ it,
2694
+ _status)
2641
2695
  }
2642
2696
  }
2643
2697
 
@@ -2649,10 +2703,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2649
2703
  */
2650
2704
  @Throws(NativeAgentException::class)override fun `respondToApproval`(`toolCallId`: kotlin.String, `approved`: kotlin.Boolean, `reason`: kotlin.String?)
2651
2705
  =
2652
- callWithPointer {
2706
+ callWithHandle {
2653
2707
  uniffiRustCallWithError(NativeAgentException) { _status ->
2654
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_respond_to_approval(
2655
- it, FfiConverterString.lower(`toolCallId`),FfiConverterBoolean.lower(`approved`),FfiConverterOptionalString.lower(`reason`),_status)
2708
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_respond_to_approval(
2709
+ it,
2710
+ FfiConverterString.lower(`toolCallId`),FfiConverterBoolean.lower(`approved`),FfiConverterOptionalString.lower(`reason`),_status)
2656
2711
  }
2657
2712
  }
2658
2713
 
@@ -2664,10 +2719,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2664
2719
  */
2665
2720
  @Throws(NativeAgentException::class)override fun `respondToCronApproval`(`requestId`: kotlin.String, `approved`: kotlin.Boolean)
2666
2721
  =
2667
- callWithPointer {
2722
+ callWithHandle {
2668
2723
  uniffiRustCallWithError(NativeAgentException) { _status ->
2669
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_respond_to_cron_approval(
2670
- it, FfiConverterString.lower(`requestId`),FfiConverterBoolean.lower(`approved`),_status)
2724
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_respond_to_cron_approval(
2725
+ it,
2726
+ FfiConverterString.lower(`requestId`),FfiConverterBoolean.lower(`approved`),_status)
2671
2727
  }
2672
2728
  }
2673
2729
 
@@ -2679,10 +2735,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2679
2735
  */
2680
2736
  @Throws(NativeAgentException::class)override fun `respondToMcpTool`(`toolCallId`: kotlin.String, `resultJson`: kotlin.String, `isError`: kotlin.Boolean)
2681
2737
  =
2682
- callWithPointer {
2738
+ callWithHandle {
2683
2739
  uniffiRustCallWithError(NativeAgentException) { _status ->
2684
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_respond_to_mcp_tool(
2685
- it, FfiConverterString.lower(`toolCallId`),FfiConverterString.lower(`resultJson`),FfiConverterBoolean.lower(`isError`),_status)
2740
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_respond_to_mcp_tool(
2741
+ it,
2742
+ FfiConverterString.lower(`toolCallId`),FfiConverterString.lower(`resultJson`),FfiConverterBoolean.lower(`isError`),_status)
2686
2743
  }
2687
2744
  }
2688
2745
 
@@ -2694,10 +2751,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2694
2751
  */
2695
2752
  @Throws(NativeAgentException::class)override fun `restartMcp`(`toolsJson`: kotlin.String): kotlin.UInt {
2696
2753
  return FfiConverterUInt.lift(
2697
- callWithPointer {
2754
+ callWithHandle {
2698
2755
  uniffiRustCallWithError(NativeAgentException) { _status ->
2699
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_restart_mcp(
2700
- it, FfiConverterString.lower(`toolsJson`),_status)
2756
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_restart_mcp(
2757
+ it,
2758
+ FfiConverterString.lower(`toolsJson`),_status)
2701
2759
  }
2702
2760
  }
2703
2761
  )
@@ -2712,10 +2770,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2712
2770
  */
2713
2771
  @Throws(NativeAgentException::class)override fun `resumeSession`(`sessionKey`: kotlin.String, `agentId`: kotlin.String, `messagesJson`: kotlin.String?, `provider`: kotlin.String?, `model`: kotlin.String?): kotlin.Boolean {
2714
2772
  return FfiConverterBoolean.lift(
2715
- callWithPointer {
2773
+ callWithHandle {
2716
2774
  uniffiRustCallWithError(NativeAgentException) { _status ->
2717
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_resume_session(
2718
- it, FfiConverterString.lower(`sessionKey`),FfiConverterString.lower(`agentId`),FfiConverterOptionalString.lower(`messagesJson`),FfiConverterOptionalString.lower(`provider`),FfiConverterOptionalString.lower(`model`),_status)
2775
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_resume_session(
2776
+ it,
2777
+ FfiConverterString.lower(`sessionKey`),FfiConverterString.lower(`agentId`),FfiConverterOptionalString.lower(`messagesJson`),FfiConverterOptionalString.lower(`provider`),FfiConverterOptionalString.lower(`model`),_status)
2719
2778
  }
2720
2779
  }
2721
2780
  )
@@ -2728,10 +2787,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2728
2787
  */
2729
2788
  @Throws(NativeAgentException::class)override fun `runCronJob`(`jobId`: kotlin.String)
2730
2789
  =
2731
- callWithPointer {
2790
+ callWithHandle {
2732
2791
  uniffiRustCallWithError(NativeAgentException) { _status ->
2733
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_run_cron_job(
2734
- it, FfiConverterString.lower(`jobId`),_status)
2792
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_run_cron_job(
2793
+ it,
2794
+ FfiConverterString.lower(`jobId`),_status)
2735
2795
  }
2736
2796
  }
2737
2797
 
@@ -2743,10 +2803,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2743
2803
  */
2744
2804
  @Throws(NativeAgentException::class)override fun `seedToolPermissions`(`defaultsJson`: kotlin.String): kotlin.UInt {
2745
2805
  return FfiConverterUInt.lift(
2746
- callWithPointer {
2806
+ callWithHandle {
2747
2807
  uniffiRustCallWithError(NativeAgentException) { _status ->
2748
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_seed_tool_permissions(
2749
- it, FfiConverterString.lower(`defaultsJson`),_status)
2808
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_seed_tool_permissions(
2809
+ it,
2810
+ FfiConverterString.lower(`defaultsJson`),_status)
2750
2811
  }
2751
2812
  }
2752
2813
  )
@@ -2759,10 +2820,30 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2759
2820
  */
2760
2821
  @Throws(NativeAgentException::class)override fun `sendMessage`(`params`: SendMessageParams): kotlin.String {
2761
2822
  return FfiConverterString.lift(
2762
- callWithPointer {
2823
+ callWithHandle {
2824
+ uniffiRustCallWithError(NativeAgentException) { _status ->
2825
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_send_message(
2826
+ it,
2827
+ FfiConverterTypeSendMessageParams.lower(`params`),_status)
2828
+ }
2829
+ }
2830
+ )
2831
+ }
2832
+
2833
+
2834
+
2835
+ /**
2836
+ * Build a canonical `wire::AgentEvent` JSON envelope from the raw
2837
+ * event-type + payload pair the agent loop emits, stamping a fresh
2838
+ * `received_at`. Hosts call this to produce wire bytes for AMQP/STOMP.
2839
+ */
2840
+ @Throws(NativeAgentException::class)override fun `serializeAgentEventJson`(`eventType`: kotlin.String, `payloadJson`: kotlin.String, `sessionKey`: kotlin.String?): kotlin.String {
2841
+ return FfiConverterString.lift(
2842
+ callWithHandle {
2763
2843
  uniffiRustCallWithError(NativeAgentException) { _status ->
2764
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_send_message(
2765
- it, FfiConverterTypeSendMessageParams.lower(`params`),_status)
2844
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_serialize_agent_event_json(
2845
+ it,
2846
+ FfiConverterString.lower(`eventType`),FfiConverterString.lower(`payloadJson`),FfiConverterOptionalString.lower(`sessionKey`),_status)
2766
2847
  }
2767
2848
  }
2768
2849
  )
@@ -2775,10 +2856,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2775
2856
  */
2776
2857
  @Throws(NativeAgentException::class)override fun `setAuthKey`(`key`: kotlin.String, `provider`: kotlin.String, `authType`: kotlin.String, `refresh`: kotlin.String?, `expiresAt`: kotlin.Long?)
2777
2858
  =
2778
- callWithPointer {
2859
+ callWithHandle {
2779
2860
  uniffiRustCallWithError(NativeAgentException) { _status ->
2780
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_auth_key(
2781
- it, FfiConverterString.lower(`key`),FfiConverterString.lower(`provider`),FfiConverterString.lower(`authType`),FfiConverterOptionalString.lower(`refresh`),FfiConverterOptionalLong.lower(`expiresAt`),_status)
2861
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_auth_key(
2862
+ it,
2863
+ FfiConverterString.lower(`key`),FfiConverterString.lower(`provider`),FfiConverterString.lower(`authType`),FfiConverterOptionalString.lower(`refresh`),FfiConverterOptionalLong.lower(`expiresAt`),_status)
2782
2864
  }
2783
2865
  }
2784
2866
 
@@ -2790,10 +2872,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2790
2872
  */
2791
2873
  @Throws(NativeAgentException::class)override fun `setEventCallback`(`callback`: NativeEventCallback)
2792
2874
  =
2793
- callWithPointer {
2875
+ callWithHandle {
2794
2876
  uniffiRustCallWithError(NativeAgentException) { _status ->
2795
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_event_callback(
2796
- it, FfiConverterTypeNativeEventCallback.lower(`callback`),_status)
2877
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_event_callback(
2878
+ it,
2879
+ FfiConverterTypeNativeEventCallback.lower(`callback`),_status)
2797
2880
  }
2798
2881
  }
2799
2882
 
@@ -2806,10 +2889,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2806
2889
  */
2807
2890
  @Throws(NativeAgentException::class)override fun `setGovernanceProvider`(`provider`: GovernanceProvider)
2808
2891
  =
2809
- callWithPointer {
2892
+ callWithHandle {
2810
2893
  uniffiRustCallWithError(NativeAgentException) { _status ->
2811
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_governance_provider(
2812
- it, FfiConverterTypeGovernanceProvider.lower(`provider`),_status)
2894
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_governance_provider(
2895
+ it,
2896
+ FfiConverterTypeGovernanceProvider.lower(`provider`),_status)
2813
2897
  }
2814
2898
  }
2815
2899
 
@@ -2821,10 +2905,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2821
2905
  */
2822
2906
  @Throws(NativeAgentException::class)override fun `setHeartbeatConfig`(`configJson`: kotlin.String)
2823
2907
  =
2824
- callWithPointer {
2908
+ callWithHandle {
2825
2909
  uniffiRustCallWithError(NativeAgentException) { _status ->
2826
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_heartbeat_config(
2827
- it, FfiConverterString.lower(`configJson`),_status)
2910
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_heartbeat_config(
2911
+ it,
2912
+ FfiConverterString.lower(`configJson`),_status)
2828
2913
  }
2829
2914
  }
2830
2915
 
@@ -2833,10 +2918,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2833
2918
 
2834
2919
  @Throws(NativeAgentException::class)override fun `setMemoryProvider`(`provider`: MemoryProvider)
2835
2920
  =
2836
- callWithPointer {
2921
+ callWithHandle {
2837
2922
  uniffiRustCallWithError(NativeAgentException) { _status ->
2838
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_memory_provider(
2839
- it, FfiConverterTypeMemoryProvider.lower(`provider`),_status)
2923
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_memory_provider(
2924
+ it,
2925
+ FfiConverterTypeMemoryProvider.lower(`provider`),_status)
2840
2926
  }
2841
2927
  }
2842
2928
 
@@ -2845,10 +2931,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2845
2931
 
2846
2932
  @Throws(NativeAgentException::class)override fun `setNotifier`(`notifier`: NativeNotifier)
2847
2933
  =
2848
- callWithPointer {
2934
+ callWithHandle {
2849
2935
  uniffiRustCallWithError(NativeAgentException) { _status ->
2850
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_notifier(
2851
- it, FfiConverterTypeNativeNotifier.lower(`notifier`),_status)
2936
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_notifier(
2937
+ it,
2938
+ FfiConverterTypeNativeNotifier.lower(`notifier`),_status)
2852
2939
  }
2853
2940
  }
2854
2941
 
@@ -2860,10 +2947,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2860
2947
  */
2861
2948
  @Throws(NativeAgentException::class)override fun `setSchedulerConfig`(`configJson`: kotlin.String)
2862
2949
  =
2863
- callWithPointer {
2950
+ callWithHandle {
2864
2951
  uniffiRustCallWithError(NativeAgentException) { _status ->
2865
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_scheduler_config(
2866
- it, FfiConverterString.lower(`configJson`),_status)
2952
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_scheduler_config(
2953
+ it,
2954
+ FfiConverterString.lower(`configJson`),_status)
2867
2955
  }
2868
2956
  }
2869
2957
 
@@ -2875,10 +2963,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2875
2963
  */
2876
2964
  @Throws(NativeAgentException::class)override fun `setToolPermission`(`toolName`: kotlin.String, `permission`: kotlin.String, `enabled`: kotlin.Boolean)
2877
2965
  =
2878
- callWithPointer {
2966
+ callWithHandle {
2879
2967
  uniffiRustCallWithError(NativeAgentException) { _status ->
2880
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_tool_permission(
2881
- it, FfiConverterString.lower(`toolName`),FfiConverterString.lower(`permission`),FfiConverterBoolean.lower(`enabled`),_status)
2968
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_set_tool_permission(
2969
+ it,
2970
+ FfiConverterString.lower(`toolName`),FfiConverterString.lower(`permission`),FfiConverterBoolean.lower(`enabled`),_status)
2882
2971
  }
2883
2972
  }
2884
2973
 
@@ -2890,10 +2979,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2890
2979
  */
2891
2980
  @Throws(NativeAgentException::class)override fun `startMcp`(`toolsJson`: kotlin.String): kotlin.UInt {
2892
2981
  return FfiConverterUInt.lift(
2893
- callWithPointer {
2982
+ callWithHandle {
2894
2983
  uniffiRustCallWithError(NativeAgentException) { _status ->
2895
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_start_mcp(
2896
- it, FfiConverterString.lower(`toolsJson`),_status)
2984
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_start_mcp(
2985
+ it,
2986
+ FfiConverterString.lower(`toolsJson`),_status)
2897
2987
  }
2898
2988
  }
2899
2989
  )
@@ -2906,10 +2996,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2906
2996
  */
2907
2997
  @Throws(NativeAgentException::class)override fun `startSkill`(`skillId`: kotlin.String, `configJson`: kotlin.String, `provider`: kotlin.String?): kotlin.String {
2908
2998
  return FfiConverterString.lift(
2909
- callWithPointer {
2999
+ callWithHandle {
2910
3000
  uniffiRustCallWithError(NativeAgentException) { _status ->
2911
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_start_skill(
2912
- it, FfiConverterString.lower(`skillId`),FfiConverterString.lower(`configJson`),FfiConverterOptionalString.lower(`provider`),_status)
3001
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_start_skill(
3002
+ it,
3003
+ FfiConverterString.lower(`skillId`),FfiConverterString.lower(`configJson`),FfiConverterOptionalString.lower(`provider`),_status)
2913
3004
  }
2914
3005
  }
2915
3006
  )
@@ -2922,10 +3013,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2922
3013
  */
2923
3014
  @Throws(NativeAgentException::class)override fun `steer`(`text`: kotlin.String)
2924
3015
  =
2925
- callWithPointer {
3016
+ callWithHandle {
2926
3017
  uniffiRustCallWithError(NativeAgentException) { _status ->
2927
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_steer(
2928
- it, FfiConverterString.lower(`text`),_status)
3018
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_steer(
3019
+ it,
3020
+ FfiConverterString.lower(`text`),_status)
2929
3021
  }
2930
3022
  }
2931
3023
 
@@ -2937,10 +3029,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2937
3029
  */
2938
3030
  @Throws(NativeAgentException::class)override fun `updateCronJob`(`id`: kotlin.String, `patchJson`: kotlin.String)
2939
3031
  =
2940
- callWithPointer {
3032
+ callWithHandle {
2941
3033
  uniffiRustCallWithError(NativeAgentException) { _status ->
2942
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_update_cron_job(
2943
- it, FfiConverterString.lower(`id`),FfiConverterString.lower(`patchJson`),_status)
3034
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_update_cron_job(
3035
+ it,
3036
+ FfiConverterString.lower(`id`),FfiConverterString.lower(`patchJson`),_status)
2944
3037
  }
2945
3038
  }
2946
3039
 
@@ -2952,10 +3045,11 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2952
3045
  */
2953
3046
  @Throws(NativeAgentException::class)override fun `updateSkill`(`id`: kotlin.String, `patchJson`: kotlin.String)
2954
3047
  =
2955
- callWithPointer {
3048
+ callWithHandle {
2956
3049
  uniffiRustCallWithError(NativeAgentException) { _status ->
2957
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_method_nativeagenthandle_update_skill(
2958
- it, FfiConverterString.lower(`id`),FfiConverterString.lower(`patchJson`),_status)
3050
+ UniffiLib.uniffi_native_agent_ffi_fn_method_nativeagenthandle_update_skill(
3051
+ it,
3052
+ FfiConverterString.lower(`id`),FfiConverterString.lower(`patchJson`),_status)
2959
3053
  }
2960
3054
  }
2961
3055
 
@@ -2964,36 +3058,38 @@ open class NativeAgentHandle: Disposable, AutoCloseable, NativeAgentHandleInterf
2964
3058
 
2965
3059
 
2966
3060
 
3061
+
3062
+
3063
+
2967
3064
 
3065
+ /**
3066
+ * @suppress
3067
+ */
2968
3068
  companion object
2969
3069
 
2970
3070
  }
2971
3071
 
3072
+
2972
3073
  /**
2973
3074
  * @suppress
2974
3075
  */
2975
- public object FfiConverterTypeNativeAgentHandle: FfiConverter<NativeAgentHandle, Pointer> {
2976
-
2977
- override fun lower(value: NativeAgentHandle): Pointer {
2978
- return value.uniffiClonePointer()
3076
+ public object FfiConverterTypeNativeAgentHandle: FfiConverter<NativeAgentHandle, Long> {
3077
+ override fun lower(value: NativeAgentHandle): Long {
3078
+ return value.uniffiCloneHandle()
2979
3079
  }
2980
3080
 
2981
- override fun lift(value: Pointer): NativeAgentHandle {
2982
- return NativeAgentHandle(value)
3081
+ override fun lift(value: Long): NativeAgentHandle {
3082
+ return NativeAgentHandle(UniffiWithHandle, value)
2983
3083
  }
2984
3084
 
2985
3085
  override fun read(buf: ByteBuffer): NativeAgentHandle {
2986
- // The Rust code always writes pointers as 8 bytes, and will
2987
- // fail to compile if they don't fit.
2988
- return lift(Pointer(buf.getLong()))
3086
+ return lift(buf.getLong())
2989
3087
  }
2990
3088
 
2991
3089
  override fun allocationSize(value: NativeAgentHandle) = 8UL
2992
3090
 
2993
3091
  override fun write(value: NativeAgentHandle, buf: ByteBuffer) {
2994
- // The Rust code always expects pointers written as 8 bytes,
2995
- // and will fail to compile if they don't fit.
2996
- buf.putLong(Pointer.nativeValue(lower(value)))
3092
+ buf.putLong(lower(value))
2997
3093
  }
2998
3094
  }
2999
3095
 
@@ -3003,10 +3099,17 @@ public object FfiConverterTypeNativeAgentHandle: FfiConverter<NativeAgentHandle,
3003
3099
  * Auth status result.
3004
3100
  */
3005
3101
  data class AuthStatusResult (
3006
- var `hasKey`: kotlin.Boolean,
3007
- var `masked`: kotlin.String,
3102
+ var `hasKey`: kotlin.Boolean
3103
+ ,
3104
+ var `masked`: kotlin.String
3105
+ ,
3008
3106
  var `provider`: kotlin.String
3009
- ) {
3107
+
3108
+ ){
3109
+
3110
+
3111
+
3112
+
3010
3113
 
3011
3114
  companion object
3012
3115
  }
@@ -3042,9 +3145,15 @@ public object FfiConverterTypeAuthStatusResult: FfiConverterRustBuffer<AuthStatu
3042
3145
  * Auth token result.
3043
3146
  */
3044
3147
  data class AuthTokenResult (
3045
- var `apiKey`: kotlin.String?,
3148
+ var `apiKey`: kotlin.String?
3149
+ ,
3046
3150
  var `isOauth`: kotlin.Boolean
3047
- ) {
3151
+
3152
+ ){
3153
+
3154
+
3155
+
3156
+
3048
3157
 
3049
3158
  companion object
3050
3159
  }
@@ -3080,22 +3189,26 @@ data class InitConfig (
3080
3189
  /**
3081
3190
  * Path to the SQLite database.
3082
3191
  */
3083
- var `dbPath`: kotlin.String,
3192
+ var `dbPath`: kotlin.String
3193
+ ,
3084
3194
  /**
3085
3195
  * Path to the workspace root.
3086
3196
  */
3087
- var `workspacePath`: kotlin.String,
3197
+ var `workspacePath`: kotlin.String
3198
+ ,
3088
3199
  /**
3089
3200
  * Path to auth-profiles.json.
3090
3201
  */
3091
- var `authProfilesPath`: kotlin.String,
3202
+ var `authProfilesPath`: kotlin.String
3203
+ ,
3092
3204
  /**
3093
3205
  * Configured default LLM provider for this agent. When a per-call
3094
3206
  * `SendMessageParams.provider` is unset, the resolver falls back to
3095
3207
  * this value. `None` falls through to the hardcoded "anthropic"
3096
3208
  * safety net — which any properly-configured install should never hit.
3097
3209
  */
3098
- var `defaultProvider`: kotlin.String?,
3210
+ var `defaultProvider`: kotlin.String?
3211
+ ,
3099
3212
  /**
3100
3213
  * Configured default model. Only used when the resolver also took
3101
3214
  * `default_provider` (i.e. the caller didn't override provider) — if
@@ -3103,7 +3216,12 @@ data class InitConfig (
3103
3216
  * instead, since model strings are tied to providers.
3104
3217
  */
3105
3218
  var `defaultModel`: kotlin.String?
3106
- ) {
3219
+
3220
+ ){
3221
+
3222
+
3223
+
3224
+
3107
3225
 
3108
3226
  companion object
3109
3227
  }
@@ -3141,15 +3259,96 @@ public object FfiConverterTypeInitConfig: FfiConverterRustBuffer<InitConfig> {
3141
3259
 
3142
3260
 
3143
3261
 
3262
+ /**
3263
+ * One entry in the catalog. Field names mirror the JSON's camelCase
3264
+ * shape. Hosts use this to populate their permissions UI and to seed
3265
+ * the AgentStore's tool_permissions table on first run.
3266
+ */
3267
+ data class NativeToolDescriptor (
3268
+ var `name`: kotlin.String
3269
+ ,
3270
+ var `description`: kotlin.String
3271
+ ,
3272
+ var `source`: kotlin.String
3273
+ ,
3274
+ var `groupId`: kotlin.String
3275
+ ,
3276
+ var `groupLabel`: kotlin.String
3277
+ ,
3278
+ var `category`: kotlin.String
3279
+ ,
3280
+ var `defaultPermission`: kotlin.String
3281
+ ,
3282
+ var `defaultEnabled`: kotlin.Boolean
3283
+
3284
+ ){
3285
+
3286
+
3287
+
3288
+
3289
+
3290
+ companion object
3291
+ }
3292
+
3293
+ /**
3294
+ * @suppress
3295
+ */
3296
+ public object FfiConverterTypeNativeToolDescriptor: FfiConverterRustBuffer<NativeToolDescriptor> {
3297
+ override fun read(buf: ByteBuffer): NativeToolDescriptor {
3298
+ return NativeToolDescriptor(
3299
+ FfiConverterString.read(buf),
3300
+ FfiConverterString.read(buf),
3301
+ FfiConverterString.read(buf),
3302
+ FfiConverterString.read(buf),
3303
+ FfiConverterString.read(buf),
3304
+ FfiConverterString.read(buf),
3305
+ FfiConverterString.read(buf),
3306
+ FfiConverterBoolean.read(buf),
3307
+ )
3308
+ }
3309
+
3310
+ override fun allocationSize(value: NativeToolDescriptor) = (
3311
+ FfiConverterString.allocationSize(value.`name`) +
3312
+ FfiConverterString.allocationSize(value.`description`) +
3313
+ FfiConverterString.allocationSize(value.`source`) +
3314
+ FfiConverterString.allocationSize(value.`groupId`) +
3315
+ FfiConverterString.allocationSize(value.`groupLabel`) +
3316
+ FfiConverterString.allocationSize(value.`category`) +
3317
+ FfiConverterString.allocationSize(value.`defaultPermission`) +
3318
+ FfiConverterBoolean.allocationSize(value.`defaultEnabled`)
3319
+ )
3320
+
3321
+ override fun write(value: NativeToolDescriptor, buf: ByteBuffer) {
3322
+ FfiConverterString.write(value.`name`, buf)
3323
+ FfiConverterString.write(value.`description`, buf)
3324
+ FfiConverterString.write(value.`source`, buf)
3325
+ FfiConverterString.write(value.`groupId`, buf)
3326
+ FfiConverterString.write(value.`groupLabel`, buf)
3327
+ FfiConverterString.write(value.`category`, buf)
3328
+ FfiConverterString.write(value.`defaultPermission`, buf)
3329
+ FfiConverterBoolean.write(value.`defaultEnabled`, buf)
3330
+ }
3331
+ }
3332
+
3333
+
3334
+
3144
3335
  /**
3145
3336
  * Buffered event emitted while no foreground callback is attached.
3146
3337
  */
3147
3338
  data class PendingEvent (
3148
- var `id`: kotlin.Long,
3149
- var `eventType`: kotlin.String,
3150
- var `payloadJson`: kotlin.String,
3339
+ var `id`: kotlin.Long
3340
+ ,
3341
+ var `eventType`: kotlin.String
3342
+ ,
3343
+ var `payloadJson`: kotlin.String
3344
+ ,
3151
3345
  var `createdAt`: kotlin.Long
3152
- ) {
3346
+
3347
+ ){
3348
+
3349
+
3350
+
3351
+
3153
3352
 
3154
3353
  companion object
3155
3354
  }
@@ -3188,21 +3387,35 @@ public object FfiConverterTypePendingEvent: FfiConverterRustBuffer<PendingEvent>
3188
3387
  * Parameters for sending a message.
3189
3388
  */
3190
3389
  data class SendMessageParams (
3191
- var `prompt`: kotlin.String,
3192
- var `sessionKey`: kotlin.String,
3193
- var `model`: kotlin.String?,
3194
- var `provider`: kotlin.String?,
3195
- var `systemPrompt`: kotlin.String,
3196
- var `maxTurns`: kotlin.UInt?,
3390
+ var `prompt`: kotlin.String
3391
+ ,
3392
+ var `sessionKey`: kotlin.String
3393
+ ,
3394
+ var `model`: kotlin.String?
3395
+ ,
3396
+ var `provider`: kotlin.String?
3397
+ ,
3398
+ var `systemPrompt`: kotlin.String
3399
+ ,
3400
+ var `maxTurns`: kotlin.UInt?
3401
+ ,
3197
3402
  /**
3198
- * JSON-encoded list of allowed tool names. Empty = all tools.
3403
+ * Optional skill-mode whitelist of allowed tool names (JSON-encoded array).
3404
+ * `None` or empty = no skill restriction. The FFI also applies its own
3405
+ * per-turn permission filter from the AgentStore on top of this list.
3199
3406
  */
3200
- var `allowedToolsJson`: kotlin.String?,
3407
+ var `skillAllowedToolsJson`: kotlin.String?
3408
+ ,
3201
3409
  /**
3202
3410
  * JSON-encoded prior conversation messages for multi-turn sessions.
3203
3411
  */
3204
3412
  var `priorMessagesJson`: kotlin.String?
3205
- ) {
3413
+
3414
+ ){
3415
+
3416
+
3417
+
3418
+
3206
3419
 
3207
3420
  companion object
3208
3421
  }
@@ -3231,7 +3444,7 @@ public object FfiConverterTypeSendMessageParams: FfiConverterRustBuffer<SendMess
3231
3444
  FfiConverterOptionalString.allocationSize(value.`provider`) +
3232
3445
  FfiConverterString.allocationSize(value.`systemPrompt`) +
3233
3446
  FfiConverterOptionalUInt.allocationSize(value.`maxTurns`) +
3234
- FfiConverterOptionalString.allocationSize(value.`allowedToolsJson`) +
3447
+ FfiConverterOptionalString.allocationSize(value.`skillAllowedToolsJson`) +
3235
3448
  FfiConverterOptionalString.allocationSize(value.`priorMessagesJson`)
3236
3449
  )
3237
3450
 
@@ -3242,7 +3455,7 @@ public object FfiConverterTypeSendMessageParams: FfiConverterRustBuffer<SendMess
3242
3455
  FfiConverterOptionalString.write(value.`provider`, buf)
3243
3456
  FfiConverterString.write(value.`systemPrompt`, buf)
3244
3457
  FfiConverterOptionalUInt.write(value.`maxTurns`, buf)
3245
- FfiConverterOptionalString.write(value.`allowedToolsJson`, buf)
3458
+ FfiConverterOptionalString.write(value.`skillAllowedToolsJson`, buf)
3246
3459
  FfiConverterOptionalString.write(value.`priorMessagesJson`, buf)
3247
3460
  }
3248
3461
  }
@@ -3253,10 +3466,17 @@ public object FfiConverterTypeSendMessageParams: FfiConverterRustBuffer<SendMess
3253
3466
  * Token usage from an agent turn.
3254
3467
  */
3255
3468
  data class TokenUsage (
3256
- var `inputTokens`: kotlin.UInt,
3257
- var `outputTokens`: kotlin.UInt,
3469
+ var `inputTokens`: kotlin.UInt
3470
+ ,
3471
+ var `outputTokens`: kotlin.UInt
3472
+ ,
3258
3473
  var `totalTokens`: kotlin.UInt
3259
- ) {
3474
+
3475
+ ){
3476
+
3477
+
3478
+
3479
+
3260
3480
 
3261
3481
  companion object
3262
3482
  }
@@ -3350,6 +3570,9 @@ sealed class NativeAgentException: kotlin.Exception() {
3350
3570
  }
3351
3571
 
3352
3572
 
3573
+
3574
+
3575
+
3353
3576
  companion object ErrorHandler : UniffiRustCallStatusErrorHandler<NativeAgentException> {
3354
3577
  override fun lift(error_buf: RustBuffer.ByValue): NativeAgentException = FfiConverterTypeNativeAgentError.lift(error_buf)
3355
3578
  }
@@ -3472,6 +3695,104 @@ public object FfiConverterTypeNativeAgentError : FfiConverterRustBuffer<NativeAg
3472
3695
 
3473
3696
 
3474
3697
 
3698
+ /**
3699
+ * Callback interface implemented by hosts to store the auth-profiles
3700
+ * envelope. Methods cross the FFI as JSON strings.
3701
+ */
3702
+ public interface AuthProfileStore {
3703
+
3704
+ /**
3705
+ * Return the full auth-profiles JSON envelope. When the host has
3706
+ * nothing stored yet, return an empty default envelope:
3707
+ * `{"version":1,"profiles":{},"lastGood":{},"usageStats":{}}`.
3708
+ */
3709
+ fun `load`(): kotlin.String
3710
+
3711
+ /**
3712
+ * Persist the full auth-profiles JSON envelope. The host is
3713
+ * responsible for atomicity + permissions (e.g. file mode 0600).
3714
+ *
3715
+ * Returns an error on failure so callers like `set_auth_key` can
3716
+ * surface the problem instead of silently losing the user's auth
3717
+ * update. Use `NativeAgentError::Auth { msg }` so the variant
3718
+ * matches the rest of `auth.rs`'s error vocabulary; UniFFI bindgens
3719
+ * accept this type because `AgentStore`'s methods already do.
3720
+ */
3721
+ fun `save`(`profilesJson`: kotlin.String)
3722
+
3723
+ companion object
3724
+ }
3725
+
3726
+
3727
+
3728
+ // Put the implementation in an object so we don't pollute the top-level namespace
3729
+ internal object uniffiCallbackInterfaceAuthProfileStore {
3730
+ internal object `load`: UniffiCallbackInterfaceAuthProfileStoreMethod0 {
3731
+ override fun callback(`uniffiHandle`: Long,`uniffiOutReturn`: RustBuffer,uniffiCallStatus: UniffiRustCallStatus,) {
3732
+ val uniffiObj = FfiConverterTypeAuthProfileStore.handleMap.get(uniffiHandle)
3733
+ val makeCall = { ->
3734
+ uniffiObj.`load`(
3735
+ )
3736
+ }
3737
+ val writeReturn = { value: kotlin.String -> uniffiOutReturn.setValue(FfiConverterString.lower(value)) }
3738
+ uniffiTraitInterfaceCall(uniffiCallStatus, makeCall, writeReturn)
3739
+ }
3740
+ }
3741
+ internal object `save`: UniffiCallbackInterfaceAuthProfileStoreMethod1 {
3742
+ override fun callback(`uniffiHandle`: Long,`profilesJson`: RustBuffer.ByValue,`uniffiOutReturn`: Pointer,uniffiCallStatus: UniffiRustCallStatus,) {
3743
+ val uniffiObj = FfiConverterTypeAuthProfileStore.handleMap.get(uniffiHandle)
3744
+ val makeCall = { ->
3745
+ uniffiObj.`save`(
3746
+ FfiConverterString.lift(`profilesJson`),
3747
+ )
3748
+ }
3749
+ val writeReturn = { _: Unit -> Unit }
3750
+ uniffiTraitInterfaceCallWithError(
3751
+ uniffiCallStatus,
3752
+ makeCall,
3753
+ writeReturn,
3754
+ { e: NativeAgentException -> FfiConverterTypeNativeAgentError.lower(e) }
3755
+ )
3756
+ }
3757
+ }
3758
+
3759
+ internal object uniffiFree: UniffiCallbackInterfaceFree {
3760
+ override fun callback(handle: Long) {
3761
+ FfiConverterTypeAuthProfileStore.handleMap.remove(handle)
3762
+ }
3763
+ }
3764
+
3765
+ internal object uniffiClone: UniffiCallbackInterfaceClone {
3766
+ override fun callback(handle: Long): Long {
3767
+ return FfiConverterTypeAuthProfileStore.handleMap.clone(handle)
3768
+ }
3769
+ }
3770
+
3771
+ internal var vtable = UniffiVTableCallbackInterfaceAuthProfileStore.UniffiByValue(
3772
+ uniffiFree,
3773
+ uniffiClone,
3774
+ `load`,
3775
+ `save`,
3776
+ )
3777
+
3778
+ // Registers the foreign callback with the Rust side.
3779
+ // This method is generated for each callback interface.
3780
+ internal fun register(lib: UniffiLib) {
3781
+ lib.uniffi_native_agent_ffi_fn_init_callback_vtable_authprofilestore(vtable)
3782
+ }
3783
+ }
3784
+
3785
+ /**
3786
+ * The ffiConverter which transforms the Callbacks in to handles to pass to Rust.
3787
+ *
3788
+ * @suppress
3789
+ */
3790
+ public object FfiConverterTypeAuthProfileStore: FfiConverterCallbackInterface<AuthProfileStore>()
3791
+
3792
+
3793
+
3794
+
3795
+
3475
3796
  /**
3476
3797
  * Optional governance provider for security, audit, and loop-guard checks.
3477
3798
  * Implemented by Kotlin/Swift — typically backed by capacitor-agent-os when
@@ -3516,38 +3837,7 @@ public interface GovernanceProvider {
3516
3837
  companion object
3517
3838
  }
3518
3839
 
3519
- // Magic number for the Rust proxy to call using the same mechanism as every other method,
3520
- // to free the callback once it's dropped by Rust.
3521
- internal const val IDX_CALLBACK_FREE = 0
3522
- // Callback return codes
3523
- internal const val UNIFFI_CALLBACK_SUCCESS = 0
3524
- internal const val UNIFFI_CALLBACK_ERROR = 1
3525
- internal const val UNIFFI_CALLBACK_UNEXPECTED_ERROR = 2
3526
-
3527
- /**
3528
- * @suppress
3529
- */
3530
- public abstract class FfiConverterCallbackInterface<CallbackInterface: Any>: FfiConverter<CallbackInterface, Long> {
3531
- internal val handleMap = UniffiHandleMap<CallbackInterface>()
3532
-
3533
- internal fun drop(handle: Long) {
3534
- handleMap.remove(handle)
3535
- }
3536
-
3537
- override fun lift(value: Long): CallbackInterface {
3538
- return handleMap.get(value)
3539
- }
3540
-
3541
- override fun read(buf: ByteBuffer) = lift(buf.getLong())
3542
-
3543
- override fun lower(value: CallbackInterface) = handleMap.insert(value)
3544
-
3545
- override fun allocationSize(value: CallbackInterface) = 8UL
3546
3840
 
3547
- override fun write(value: CallbackInterface, buf: ByteBuffer) {
3548
- buf.putLong(lower(value))
3549
- }
3550
- }
3551
3841
 
3552
3842
  // Put the implementation in an object so we don't pollute the top-level namespace
3553
3843
  internal object uniffiCallbackInterfaceGovernanceProvider {
@@ -3638,14 +3928,21 @@ internal object uniffiCallbackInterfaceGovernanceProvider {
3638
3928
  }
3639
3929
  }
3640
3930
 
3931
+ internal object uniffiClone: UniffiCallbackInterfaceClone {
3932
+ override fun callback(handle: Long): Long {
3933
+ return FfiConverterTypeGovernanceProvider.handleMap.clone(handle)
3934
+ }
3935
+ }
3936
+
3641
3937
  internal var vtable = UniffiVTableCallbackInterfaceGovernanceProvider.UniffiByValue(
3938
+ uniffiFree,
3939
+ uniffiClone,
3642
3940
  `checkLoop`,
3643
3941
  `recordOutcome`,
3644
3942
  `recordAudit`,
3645
3943
  `checkSink`,
3646
3944
  `reset`,
3647
3945
  `recordUsage`,
3648
- uniffiFree,
3649
3946
  )
3650
3947
 
3651
3948
  // Registers the foreign callback with the Rust side.
@@ -3761,13 +4058,20 @@ internal object uniffiCallbackInterfaceMemoryProvider {
3761
4058
  }
3762
4059
  }
3763
4060
 
4061
+ internal object uniffiClone: UniffiCallbackInterfaceClone {
4062
+ override fun callback(handle: Long): Long {
4063
+ return FfiConverterTypeMemoryProvider.handleMap.clone(handle)
4064
+ }
4065
+ }
4066
+
3764
4067
  internal var vtable = UniffiVTableCallbackInterfaceMemoryProvider.UniffiByValue(
4068
+ uniffiFree,
4069
+ uniffiClone,
3765
4070
  `store`,
3766
4071
  `recall`,
3767
4072
  `forget`,
3768
4073
  `search`,
3769
4074
  `list`,
3770
- uniffiFree,
3771
4075
  )
3772
4076
 
3773
4077
  // Registers the foreign callback with the Rust side.
@@ -3827,9 +4131,16 @@ internal object uniffiCallbackInterfaceNativeEventCallback {
3827
4131
  }
3828
4132
  }
3829
4133
 
4134
+ internal object uniffiClone: UniffiCallbackInterfaceClone {
4135
+ override fun callback(handle: Long): Long {
4136
+ return FfiConverterTypeNativeEventCallback.handleMap.clone(handle)
4137
+ }
4138
+ }
4139
+
3830
4140
  internal var vtable = UniffiVTableCallbackInterfaceNativeEventCallback.UniffiByValue(
3831
- `onEvent`,
3832
4141
  uniffiFree,
4142
+ uniffiClone,
4143
+ `onEvent`,
3833
4144
  )
3834
4145
 
3835
4146
  // Registers the foreign callback with the Rust side.
@@ -3885,9 +4196,16 @@ internal object uniffiCallbackInterfaceNativeNotifier {
3885
4196
  }
3886
4197
  }
3887
4198
 
4199
+ internal object uniffiClone: UniffiCallbackInterfaceClone {
4200
+ override fun callback(handle: Long): Long {
4201
+ return FfiConverterTypeNativeNotifier.handleMap.clone(handle)
4202
+ }
4203
+ }
4204
+
3888
4205
  internal var vtable = UniffiVTableCallbackInterfaceNativeNotifier.UniffiByValue(
3889
- `sendNotification`,
3890
4206
  uniffiFree,
4207
+ uniffiClone,
4208
+ `sendNotification`,
3891
4209
  )
3892
4210
 
3893
4211
  // Registers the foreign callback with the Rust side.
@@ -3999,10 +4317,39 @@ public object FfiConverterOptionalString: FfiConverterRustBuffer<kotlin.String?>
3999
4317
  }
4000
4318
  }
4001
4319
  }
4320
+
4321
+
4322
+
4323
+
4324
+ /**
4325
+ * @suppress
4326
+ */
4327
+ public object FfiConverterSequenceTypeNativeToolDescriptor: FfiConverterRustBuffer<List<NativeToolDescriptor>> {
4328
+ override fun read(buf: ByteBuffer): List<NativeToolDescriptor> {
4329
+ val len = buf.getInt()
4330
+ return List<NativeToolDescriptor>(len) {
4331
+ FfiConverterTypeNativeToolDescriptor.read(buf)
4332
+ }
4333
+ }
4334
+
4335
+ override fun allocationSize(value: List<NativeToolDescriptor>): ULong {
4336
+ val sizeForLength = 4UL
4337
+ val sizeForItems = value.map { FfiConverterTypeNativeToolDescriptor.allocationSize(it) }.sum()
4338
+ return sizeForLength + sizeForItems
4339
+ }
4340
+
4341
+ override fun write(value: List<NativeToolDescriptor>, buf: ByteBuffer) {
4342
+ buf.putInt(value.size)
4343
+ value.iterator().forEach {
4344
+ FfiConverterTypeNativeToolDescriptor.write(it, buf)
4345
+ }
4346
+ }
4347
+ }
4002
4348
  @Throws(NativeAgentException::class) fun `createHandleFromPersistedConfig`(`configPath`: kotlin.String): NativeAgentHandle {
4003
4349
  return FfiConverterTypeNativeAgentHandle.lift(
4004
4350
  uniffiRustCallWithError(NativeAgentException) { _status ->
4005
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_func_create_handle_from_persisted_config(
4351
+ UniffiLib.uniffi_native_agent_ffi_fn_func_create_handle_from_persisted_config(
4352
+
4006
4353
  FfiConverterString.lower(`configPath`),_status)
4007
4354
  }
4008
4355
  )
@@ -4015,7 +4362,8 @@ public object FfiConverterOptionalString: FfiConverterRustBuffer<kotlin.String?>
4015
4362
  @Throws(NativeAgentException::class) fun `initWorkspace`(`config`: InitConfig)
4016
4363
  =
4017
4364
  uniffiRustCallWithError(NativeAgentException) { _status ->
4018
- UniffiLib.INSTANCE.uniffi_native_agent_ffi_fn_func_init_workspace(
4365
+ UniffiLib.uniffi_native_agent_ffi_fn_func_init_workspace(
4366
+
4019
4367
  FfiConverterTypeInitConfig.lower(`config`),_status)
4020
4368
  }
4021
4369