Release v1.0.0

github-actions[bot] committed Sep 13, 2026 at 16:29 UTC 0fcd9d17e7737e833bcc1c0175692be1bb055ce3
2 files changed +275 -214
Package.swift
+2 -2
@@ -8,9 +8,9 @@ let localFrameworkAbsolutePath = packageRoot.appendingPathComponent(localFramewo
8
9 // Updated automatically by onde-ed's release-sdk-swift workflow.
10 let releaseFrameworkURL =
11 - "https://github.com/ondeinference/onde-ed/releases/download/0.1.0/EdFramework.xcframework.zip"
11 + "https://github.com/ondeinference/ed/releases/download/v1.0.0/EdFramework.xcframework.zip"
12 let releaseFrameworkChecksum =
13 - "0000000000000000000000000000000000000000000000000000000000000000"
13 + "b8b8d3934a69a692c3208c3f3d8f0b92ff285af39fb2e20ee7158bbb7c87587b"
14
15 let edFrameworkTarget: Target
16 if FileManager.default.fileExists(atPath: localFrameworkAbsolutePath) {
Sources/Ed/ed_agent_ffi.swift
+273 -212
@@ -352,7 +352,7 @@ private func uniffiTraitInterfaceCallWithError<T, E>(
352 callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error))
353 }
354 }
355 -// Initial value and increment amount for handles.
355 +// Initial value and increment amount for handles.
356 // These ensure that SWIFT handles always have the lowest bit set
357 fileprivate let UNIFFI_HANDLEMAP_INITIAL: UInt64 = 1
358 fileprivate let UNIFFI_HANDLEMAP_DELTA: UInt64 = 2
@@ -555,37 +555,37 @@ fileprivate struct FfiConverterString: FfiConverter {
555
556
557 public protocol FfiEdAgentProtocol: AnyObject, Sendable {
558 -
559 - func cancel()
560 -
558 +
559 + func cancel()
560 +
561 func clearHistory() async -> UInt64
562 -
562 +
563 func history() async -> [FfiChatMessage]
564 -
564 +
565 func info() async -> FfiEngineInfo
566 -
566 +
567 func isLoaded() async -> Bool
568 -
568 +
569 func loadAssignedModel(environment: FfiEnvironment, appId: String, appSecret: String, systemPrompt: String?, sampling: FfiSamplingConfig?) async throws -> Double
570 -
570 +
571 func loadDefaultAgentModel(systemPrompt: String?) async throws -> Double
572 -
572 +
573 func loadGgufModel(config: FfiGgufModelConfig, systemPrompt: String?, sampling: FfiSamplingConfig?) async throws -> Double
574 -
574 +
575 func loadUqffModel(config: FfiUqffModelConfig, systemPrompt: String?, sampling: FfiSamplingConfig?) async throws -> Double
576 -
577 - func registerTool(tool: FfiToolDefinition) async throws
578 -
579 - func removeAllTools() async
580 -
576 +
577 + func registerTool(tool: FfiToolDefinition) async throws
578 +
579 + func removeAllTools() async
580 +
581 func run(message: String) async throws -> FfiAgentReply
582 -
582 +
583 func send(message: String) async throws -> FfiReply
584 -
584 +
585 func unload() async -> String?
586 -
586 +
587 func unregisterTool(name: String) async -> Bool
588 -
588 +
589 }
590 open class FfiEdAgent: FfiEdAgentProtocol, @unchecked Sendable {
591 fileprivate let handle: UInt64
@@ -648,23 +648,23 @@ public convenience init(executor: FfiToolExecutor, approvals: FfiApprovalHandler
648 try! rustCall { uniffi_ed_agent_ffi_fn_free_ffiedagent(handle, $0) }
649 }
650
651 +
652
652 -
653 -
653 +
654 open func cancel() {try! rustCall() {
655 uniffi_ed_agent_ffi_fn_method_ffiedagent_cancel(
656 self.uniffiCloneHandle(),$0
657 )
658 }
659 }
660 -
660 +
661 open func clearHistory()async -> UInt64 {
662 return
663 try! await uniffiRustCallAsync(
664 rustFutureFunc: {
665 uniffi_ed_agent_ffi_fn_method_ffiedagent_clear_history(
666 self.uniffiCloneHandle()
667 -
667 +
668 )
669 },
670 pollFunc: ffi_ed_agent_ffi_rust_future_poll_u64,
@@ -672,17 +672,17 @@ open func clearHistory()async -> UInt64 {
672 freeFunc: ffi_ed_agent_ffi_rust_future_free_u64,
673 liftFunc: FfiConverterUInt64.lift,
674 errorHandler: nil
675 -
675 +
676 )
677 }
678 -
678 +
679 open func history()async -> [FfiChatMessage] {
680 return
681 try! await uniffiRustCallAsync(
682 rustFutureFunc: {
683 uniffi_ed_agent_ffi_fn_method_ffiedagent_history(
684 self.uniffiCloneHandle()
685 -
685 +
686 )
687 },
688 pollFunc: ffi_ed_agent_ffi_rust_future_poll_rust_buffer,
@@ -690,17 +690,17 @@ open func history()async -> [FfiChatMessage] {
690 freeFunc: ffi_ed_agent_ffi_rust_future_free_rust_buffer,
691 liftFunc: FfiConverterSequenceTypeFfiChatMessage.lift,
692 errorHandler: nil
693 -
693 +
694 )
695 }
696 -
696 +
697 open func info()async -> FfiEngineInfo {
698 return
699 try! await uniffiRustCallAsync(
700 rustFutureFunc: {
701 uniffi_ed_agent_ffi_fn_method_ffiedagent_info(
702 self.uniffiCloneHandle()
703 -
703 +
704 )
705 },
706 pollFunc: ffi_ed_agent_ffi_rust_future_poll_rust_buffer,
@@ -708,17 +708,17 @@ open func info()async -> FfiEngineInfo {
708 freeFunc: ffi_ed_agent_ffi_rust_future_free_rust_buffer,
709 liftFunc: FfiConverterTypeFfiEngineInfo_lift,
710 errorHandler: nil
711 -
711 +
712 )
713 }
714 -
714 +
715 open func isLoaded()async -> Bool {
716 return
717 try! await uniffiRustCallAsync(
718 rustFutureFunc: {
719 uniffi_ed_agent_ffi_fn_method_ffiedagent_is_loaded(
720 self.uniffiCloneHandle()
721 -
721 +
722 )
723 },
724 pollFunc: ffi_ed_agent_ffi_rust_future_poll_i8,
@@ -726,10 +726,10 @@ open func isLoaded()async -> Bool {
726 freeFunc: ffi_ed_agent_ffi_rust_future_free_i8,
727 liftFunc: FfiConverterBool.lift,
728 errorHandler: nil
729 -
729 +
730 )
731 }
732 -
732 +
733 open func loadAssignedModel(environment: FfiEnvironment, appId: String, appSecret: String, systemPrompt: String?, sampling: FfiSamplingConfig?)async throws -> Double {
734 return
735 try await uniffiRustCallAsync(
@@ -746,7 +746,7 @@ open func loadAssignedModel(environment: FfiEnvironment, appId: String, appSecre
746 errorHandler: FfiConverterTypeFfiEdError_lift
747 )
748 }
749 -
749 +
750 open func loadDefaultAgentModel(systemPrompt: String?)async throws -> Double {
751 return
752 try await uniffiRustCallAsync(
@@ -763,7 +763,7 @@ open func loadDefaultAgentModel(systemPrompt: String?)async throws -> Double {
763 errorHandler: FfiConverterTypeFfiEdError_lift
764 )
765 }
766 -
766 +
767 open func loadGgufModel(config: FfiGgufModelConfig, systemPrompt: String?, sampling: FfiSamplingConfig?)async throws -> Double {
768 return
769 try await uniffiRustCallAsync(
@@ -780,7 +780,7 @@ open func loadGgufModel(config: FfiGgufModelConfig, systemPrompt: String?, sampl
780 errorHandler: FfiConverterTypeFfiEdError_lift
781 )
782 }
783 -
783 +
784 open func loadUqffModel(config: FfiUqffModelConfig, systemPrompt: String?, sampling: FfiSamplingConfig?)async throws -> Double {
785 return
786 try await uniffiRustCallAsync(
@@ -797,7 +797,7 @@ open func loadUqffModel(config: FfiUqffModelConfig, systemPrompt: String?, sampl
797 errorHandler: FfiConverterTypeFfiEdError_lift
798 )
799 }
800 -
800 +
801 open func registerTool(tool: FfiToolDefinition)async throws {
802 return
803 try await uniffiRustCallAsync(
@@ -814,14 +814,14 @@ open func registerTool(tool: FfiToolDefinition)async throws {
814 errorHandler: FfiConverterTypeFfiEdError_lift
815 )
816 }
817 -
817 +
818 open func removeAllTools()async {
819 return
820 try! await uniffiRustCallAsync(
821 rustFutureFunc: {
822 uniffi_ed_agent_ffi_fn_method_ffiedagent_remove_all_tools(
823 self.uniffiCloneHandle()
824 -
824 +
825 )
826 },
827 pollFunc: ffi_ed_agent_ffi_rust_future_poll_void,
@@ -829,10 +829,10 @@ open func removeAllTools()async {
829 freeFunc: ffi_ed_agent_ffi_rust_future_free_void,
830 liftFunc: { $0 },
831 errorHandler: nil
832 -
832 +
833 )
834 }
835 -
835 +
836 open func run(message: String)async throws -> FfiAgentReply {
837 return
838 try await uniffiRustCallAsync(
@@ -849,7 +849,7 @@ open func run(message: String)async throws -> FfiAgentReply {
849 errorHandler: FfiConverterTypeFfiEdError_lift
850 )
851 }
852 -
852 +
853 open func send(message: String)async throws -> FfiReply {
854 return
855 try await uniffiRustCallAsync(
@@ -866,14 +866,14 @@ open func send(message: String)async throws -> FfiReply {
866 errorHandler: FfiConverterTypeFfiEdError_lift
867 )
868 }
869 -
869 +
870 open func unload()async -> String? {
871 return
872 try! await uniffiRustCallAsync(
873 rustFutureFunc: {
874 uniffi_ed_agent_ffi_fn_method_ffiedagent_unload(
875 self.uniffiCloneHandle()
876 -
876 +
877 )
878 },
879 pollFunc: ffi_ed_agent_ffi_rust_future_poll_rust_buffer,
@@ -881,10 +881,10 @@ open func unload()async -> String? {
881 freeFunc: ffi_ed_agent_ffi_rust_future_free_rust_buffer,
882 liftFunc: FfiConverterOptionString.lift,
883 errorHandler: nil
884 -
884 +
885 )
886 }
887 -
887 +
888 open func unregisterTool(name: String)async -> Bool {
889 return
890 try! await uniffiRustCallAsync(
@@ -899,12 +899,12 @@ open func unregisterTool(name: String)async -> Bool {
899 freeFunc: ffi_ed_agent_ffi_rust_future_free_i8,
900 liftFunc: FfiConverterBool.lift,
901 errorHandler: nil
902 -
902 +
903 )
904 }
905 +
906
906 -
907 -
907 +
908 }
909
910
@@ -962,9 +962,9 @@ public struct FfiAgentConfig: Equatable, Hashable {
962 self.maxToolOutputChars = maxToolOutputChars
963 }
964
965 +
966
966 -
967 -
967 +
968 }
969
970 #if compiler(>=6)
@@ -978,7 +978,7 @@ public struct FfiConverterTypeFfiAgentConfig: FfiConverterRustBuffer {
978 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiAgentConfig {
979 return
980 try FfiAgentConfig(
981 - maxToolRounds: FfiConverterUInt8.read(from: &buf),
981 + maxToolRounds: FfiConverterUInt8.read(from: &buf),
982 maxToolOutputChars: FfiConverterUInt64.read(from: &buf)
983 )
984 }
@@ -1020,9 +1020,9 @@ public struct FfiAgentReply: Equatable, Hashable {
1020 self.toolRounds = toolRounds
1021 }
1022
1023 +
1024
1024 -
1025 -
1025 +
1026 }
1027
1028 #if compiler(>=6)
@@ -1036,9 +1036,9 @@ public struct FfiConverterTypeFfiAgentReply: FfiConverterRustBuffer {
1036 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiAgentReply {
1037 return
1038 try FfiAgentReply(
1039 - text: FfiConverterString.read(from: &buf),
1040 - durationSeconds: FfiConverterDouble.read(from: &buf),
1041 - duration: FfiConverterString.read(from: &buf),
1039 + text: FfiConverterString.read(from: &buf),
1040 + durationSeconds: FfiConverterDouble.read(from: &buf),
1041 + duration: FfiConverterString.read(from: &buf),
1042 toolRounds: FfiConverterUInt8.read(from: &buf)
1043 )
1044 }
@@ -1067,6 +1067,67 @@ public func FfiConverterTypeFfiAgentReply_lower(_ value: FfiAgentReply) -> RustB
1067 }
1068
1069
1070 +/**
1071 + * A tool call waiting on the user, with the risk that made it wait.
1072 + *
1073 + * The risk travels with the call because it is the reason an approval sheet
1074 + * is on screen at all: a host that only received the call would have to look
1075 + * the tool up again to tell the user whether it is about to change anything.
1076 + */
1077 +public struct FfiApprovalRequest: Equatable, Hashable {
1078 + public var call: FfiToolCall
1079 + public var risk: FfiToolRisk
1080 +
1081 + // Default memberwise initializers are never public by default, so we
1082 + // declare one manually.
1083 + public init(call: FfiToolCall, risk: FfiToolRisk) {
1084 + self.call = call
1085 + self.risk = risk
1086 + }
1087 +
1088 +
1089 +
1090 +
1091 +}
1092 +
1093 +#if compiler(>=6)
1094 +extension FfiApprovalRequest: Sendable {}
1095 +#endif
1096 +
1097 +#if swift(>=5.8)
1098 +@_documentation(visibility: private)
1099 +#endif
1100 +public struct FfiConverterTypeFfiApprovalRequest: FfiConverterRustBuffer {
1101 + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiApprovalRequest {
1102 + return
1103 + try FfiApprovalRequest(
1104 + call: FfiConverterTypeFfiToolCall.read(from: &buf),
1105 + risk: FfiConverterTypeFfiToolRisk.read(from: &buf)
1106 + )
1107 + }
1108 +
1109 + public static func write(_ value: FfiApprovalRequest, into buf: inout [UInt8]) {
1110 + FfiConverterTypeFfiToolCall.write(value.call, into: &buf)
1111 + FfiConverterTypeFfiToolRisk.write(value.risk, into: &buf)
1112 + }
1113 +}
1114 +
1115 +
1116 +#if swift(>=5.8)
1117 +@_documentation(visibility: private)
1118 +#endif
1119 +public func FfiConverterTypeFfiApprovalRequest_lift(_ buf: RustBuffer) throws -> FfiApprovalRequest {
1120 + return try FfiConverterTypeFfiApprovalRequest.lift(buf)
1121 +}
1122 +
1123 +#if swift(>=5.8)
1124 +@_documentation(visibility: private)
1125 +#endif
1126 +public func FfiConverterTypeFfiApprovalRequest_lower(_ value: FfiApprovalRequest) -> RustBuffer {
1127 + return FfiConverterTypeFfiApprovalRequest.lower(value)
1128 +}
1129 +
1130 +
1131 public struct FfiChatMessage: Equatable, Hashable {
1132 public var role: FfiChatRole
1133 public var content: String
@@ -1078,9 +1139,9 @@ public struct FfiChatMessage: Equatable, Hashable {
1139 self.content = content
1140 }
1141
1142 +
1143
1082 -
1083 -
1144 +
1145 }
1146
1147 #if compiler(>=6)
@@ -1094,7 +1155,7 @@ public struct FfiConverterTypeFfiChatMessage: FfiConverterRustBuffer {
1155 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiChatMessage {
1156 return
1157 try FfiChatMessage(
1097 - role: FfiConverterTypeFfiChatRole.read(from: &buf),
1158 + role: FfiConverterTypeFfiChatRole.read(from: &buf),
1159 content: FfiConverterString.read(from: &buf)
1160 )
1161 }
@@ -1136,9 +1197,9 @@ public struct FfiEngineInfo: Equatable, Hashable {
1197 self.historyLength = historyLength
1198 }
1199
1200 +
1201
1140 -
1141 -
1202 +
1203 }
1204
1205 #if compiler(>=6)
@@ -1152,9 +1213,9 @@ public struct FfiConverterTypeFfiEngineInfo: FfiConverterRustBuffer {
1213 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiEngineInfo {
1214 return
1215 try FfiEngineInfo(
1155 - status: FfiConverterTypeFfiEngineStatus.read(from: &buf),
1156 - modelName: FfiConverterOptionString.read(from: &buf),
1157 - approxMemory: FfiConverterOptionString.read(from: &buf),
1216 + status: FfiConverterTypeFfiEngineStatus.read(from: &buf),
1217 + modelName: FfiConverterOptionString.read(from: &buf),
1218 + approxMemory: FfiConverterOptionString.read(from: &buf),
1219 historyLength: FfiConverterUInt64.read(from: &buf)
1220 )
1221 }
@@ -1202,9 +1263,9 @@ public struct FfiGgufModelConfig: Equatable, Hashable {
1263 self.chatTemplate = chatTemplate
1264 }
1265
1266 +
1267
1206 -
1207 -
1268 +
1269 }
1270
1271 #if compiler(>=6)
@@ -1218,11 +1279,11 @@ public struct FfiConverterTypeFfiGgufModelConfig: FfiConverterRustBuffer {
1279 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiGgufModelConfig {
1280 return
1281 try FfiGgufModelConfig(
1221 - modelId: FfiConverterString.read(from: &buf),
1222 - files: FfiConverterSequenceString.read(from: &buf),
1223 - tokModelId: FfiConverterOptionString.read(from: &buf),
1224 - displayName: FfiConverterString.read(from: &buf),
1225 - approxMemory: FfiConverterString.read(from: &buf),
1282 + modelId: FfiConverterString.read(from: &buf),
1283 + files: FfiConverterSequenceString.read(from: &buf),
1284 + tokModelId: FfiConverterOptionString.read(from: &buf),
1285 + displayName: FfiConverterString.read(from: &buf),
1286 + approxMemory: FfiConverterString.read(from: &buf),
1287 chatTemplate: FfiConverterOptionString.read(from: &buf)
1288 )
1289 }
@@ -1264,9 +1325,9 @@ public struct FfiReply: Equatable, Hashable {
1325 self.duration = duration
1326 }
1327
1328 +
1329
1268 -
1269 -
1330 +
1331 }
1332
1333 #if compiler(>=6)
@@ -1280,7 +1341,7 @@ public struct FfiConverterTypeFfiReply: FfiConverterRustBuffer {
1341 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiReply {
1342 return
1343 try FfiReply(
1283 - text: FfiConverterString.read(from: &buf),
1344 + text: FfiConverterString.read(from: &buf),
1345 duration: FfiConverterString.read(from: &buf)
1346 )
1347 }
@@ -1328,9 +1389,9 @@ public struct FfiSamplingConfig: Equatable, Hashable {
1389 self.presencePenalty = presencePenalty
1390 }
1391
1392 +
1393
1332 -
1333 -
1394 +
1395 }
1396
1397 #if compiler(>=6)
@@ -1344,12 +1405,12 @@ public struct FfiConverterTypeFfiSamplingConfig: FfiConverterRustBuffer {
1405 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiSamplingConfig {
1406 return
1407 try FfiSamplingConfig(
1347 - temperature: FfiConverterOptionDouble.read(from: &buf),
1348 - topP: FfiConverterOptionDouble.read(from: &buf),
1349 - topK: FfiConverterOptionUInt64.read(from: &buf),
1350 - minP: FfiConverterOptionDouble.read(from: &buf),
1351 - maxTokens: FfiConverterOptionUInt64.read(from: &buf),
1352 - frequencyPenalty: FfiConverterOptionFloat.read(from: &buf),
1408 + temperature: FfiConverterOptionDouble.read(from: &buf),
1409 + topP: FfiConverterOptionDouble.read(from: &buf),
1410 + topK: FfiConverterOptionUInt64.read(from: &buf),
1411 + minP: FfiConverterOptionDouble.read(from: &buf),
1412 + maxTokens: FfiConverterOptionUInt64.read(from: &buf),
1413 + frequencyPenalty: FfiConverterOptionFloat.read(from: &buf),
1414 presencePenalty: FfiConverterOptionFloat.read(from: &buf)
1415 )
1416 }
@@ -1394,9 +1455,9 @@ public struct FfiStatusUpdate: Equatable, Hashable {
1455 self.error = error
1456 }
1457
1458 +
1459
1398 -
1399 -
1460 +
1461 }
1462
1463 #if compiler(>=6)
@@ -1410,8 +1471,8 @@ public struct FfiConverterTypeFfiStatusUpdate: FfiConverterRustBuffer {
1471 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiStatusUpdate {
1472 return
1473 try FfiStatusUpdate(
1413 - status: FfiConverterTypeFfiEngineStatus.read(from: &buf),
1414 - modelName: FfiConverterOptionString.read(from: &buf),
1474 + status: FfiConverterTypeFfiEngineStatus.read(from: &buf),
1475 + modelName: FfiConverterOptionString.read(from: &buf),
1476 error: FfiConverterOptionString.read(from: &buf)
1477 )
1478 }
@@ -1452,9 +1513,9 @@ public struct FfiToolCall: Equatable, Hashable {
1513 self.arguments = arguments
1514 }
1515
1516 +
1517
1456 -
1457 -
1518 +
1519 }
1520
1521 #if compiler(>=6)
@@ -1468,8 +1529,8 @@ public struct FfiConverterTypeFfiToolCall: FfiConverterRustBuffer {
1529 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiToolCall {
1530 return
1531 try FfiToolCall(
1471 - id: FfiConverterString.read(from: &buf),
1472 - name: FfiConverterString.read(from: &buf),
1532 + id: FfiConverterString.read(from: &buf),
1533 + name: FfiConverterString.read(from: &buf),
1534 arguments: FfiConverterString.read(from: &buf)
1535 )
1536 }
@@ -1512,9 +1573,9 @@ public struct FfiToolDefinition: Equatable, Hashable {
1573 self.risk = risk
1574 }
1575
1576 +
1577
1516 -
1517 -
1578 +
1579 }
1580
1581 #if compiler(>=6)
@@ -1528,9 +1589,9 @@ public struct FfiConverterTypeFfiToolDefinition: FfiConverterRustBuffer {
1589 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiToolDefinition {
1590 return
1591 try FfiToolDefinition(
1531 - name: FfiConverterString.read(from: &buf),
1532 - description: FfiConverterString.read(from: &buf),
1533 - parametersSchema: FfiConverterString.read(from: &buf),
1592 + name: FfiConverterString.read(from: &buf),
1593 + description: FfiConverterString.read(from: &buf),
1594 + parametersSchema: FfiConverterString.read(from: &buf),
1595 risk: FfiConverterTypeFfiToolRisk.read(from: &buf)
1596 )
1597 }
@@ -1570,9 +1631,9 @@ public struct FfiToolOutput: Equatable, Hashable {
1631 self.error = error
1632 }
1633
1634 +
1635
1574 -
1575 -
1636 +
1637 }
1638
1639 #if compiler(>=6)
@@ -1586,7 +1647,7 @@ public struct FfiConverterTypeFfiToolOutput: FfiConverterRustBuffer {
1647 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiToolOutput {
1648 return
1649 try FfiToolOutput(
1589 - content: FfiConverterString.read(from: &buf),
1650 + content: FfiConverterString.read(from: &buf),
1651 error: FfiConverterOptionString.read(from: &buf)
1652 )
1653 }
@@ -1630,9 +1691,9 @@ public struct FfiUqffModelConfig: Equatable, Hashable {
1691 self.chatTemplate = chatTemplate
1692 }
1693
1694 +
1695
1634 -
1635 -
1696 +
1697 }
1698
1699 #if compiler(>=6)
@@ -1646,10 +1707,10 @@ public struct FfiConverterTypeFfiUqffModelConfig: FfiConverterRustBuffer {
1707 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiUqffModelConfig {
1708 return
1709 try FfiUqffModelConfig(
1649 - modelId: FfiConverterString.read(from: &buf),
1650 - files: FfiConverterSequenceString.read(from: &buf),
1651 - displayName: FfiConverterString.read(from: &buf),
1652 - approxMemory: FfiConverterString.read(from: &buf),
1710 + modelId: FfiConverterString.read(from: &buf),
1711 + files: FfiConverterSequenceString.read(from: &buf),
1712 + displayName: FfiConverterString.read(from: &buf),
1713 + approxMemory: FfiConverterString.read(from: &buf),
1714 chatTemplate: FfiConverterOptionString.read(from: &buf)
1715 )
1716 }
@@ -1682,7 +1743,7 @@ public func FfiConverterTypeFfiUqffModelConfig_lower(_ value: FfiUqffModelConfig
1743 // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
1744
1745 public enum FfiApprovalDecision: Equatable, Hashable {
1685 -
1746 +
1747 case allowOnce
1748 case allowForSession
1749 case deny
@@ -1706,32 +1767,32 @@ public struct FfiConverterTypeFfiApprovalDecision: FfiConverterRustBuffer {
1767 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiApprovalDecision {
1768 let variant: Int32 = try readInt(&buf)
1769 switch variant {
1709 -
1770 +
1771 case 1: return .allowOnce
1711 -
1772 +
1773 case 2: return .allowForSession
1713 -
1774 +
1775 case 3: return .deny
1715 -
1776 +
1777 default: throw UniffiInternalError.unexpectedEnumCase
1778 }
1779 }
1780
1781 public static func write(_ value: FfiApprovalDecision, into buf: inout [UInt8]) {
1782 switch value {
1722 -
1723 -
1783 +
1784 +
1785 case .allowOnce:
1786 writeInt(&buf, Int32(1))
1726 -
1727 -
1787 +
1788 +
1789 case .allowForSession:
1790 writeInt(&buf, Int32(2))
1730 -
1731 -
1791 +
1792 +
1793 case .deny:
1794 writeInt(&buf, Int32(3))
1734 -
1795 +
1796 }
1797 }
1798 }
@@ -1756,7 +1817,7 @@ public func FfiConverterTypeFfiApprovalDecision_lower(_ value: FfiApprovalDecisi
1817 // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
1818
1819 public enum FfiChatRole: Equatable, Hashable {
1759 -
1820 +
1821 case system
1822 case user
1823 case assistant
@@ -1780,32 +1841,32 @@ public struct FfiConverterTypeFfiChatRole: FfiConverterRustBuffer {
1841 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiChatRole {
1842 let variant: Int32 = try readInt(&buf)
1843 switch variant {
1783 -
1844 +
1845 case 1: return .system
1785 -
1846 +
1847 case 2: return .user
1787 -
1848 +
1849 case 3: return .assistant
1789 -
1850 +
1851 default: throw UniffiInternalError.unexpectedEnumCase
1852 }
1853 }
1854
1855 public static func write(_ value: FfiChatRole, into buf: inout [UInt8]) {
1856 switch value {
1796 -
1797 -
1857 +
1858 +
1859 case .system:
1860 writeInt(&buf, Int32(1))
1800 -
1801 -
1861 +
1862 +
1863 case .user:
1864 writeInt(&buf, Int32(2))
1804 -
1805 -
1865 +
1866 +
1867 case .assistant:
1868 writeInt(&buf, Int32(3))
1808 -
1869 +
1870 }
1871 }
1872 }
@@ -1829,20 +1890,20 @@ public func FfiConverterTypeFfiChatRole_lower(_ value: FfiChatRole) -> RustBuffe
1890
1891 public enum FfiEdError: Swift.Error, Equatable, Hashable, Foundation.LocalizedError {
1892
1832 -
1833 -
1893 +
1894 +
1895 case Failure(reason: String
1896 )
1897
1898 +
1899
1900 +
1901
1839 -
1840 -
1841 -
1902 +
1903 public var errorDescription: String? {
1904 String(reflecting: self)
1905 }
1845 -
1906 +
1907 }
1908
1909 #if compiler(>=6)
@@ -1859,9 +1920,9 @@ public struct FfiConverterTypeFfiEdError: FfiConverterRustBuffer {
1920 let variant: Int32 = try readInt(&buf)
1921 switch variant {
1922
1923 +
1924
1863 -
1864 -
1925 +
1926 case 1: return .Failure(
1927 reason: try FfiConverterString.read(from: &buf)
1928 )
@@ -1873,14 +1934,14 @@ public struct FfiConverterTypeFfiEdError: FfiConverterRustBuffer {
1934 public static func write(_ value: FfiEdError, into buf: inout [UInt8]) {
1935 switch value {
1936
1937 +
1938
1877 -
1878 -
1879 -
1939 +
1940 +
1941 case let .Failure(reason):
1942 writeInt(&buf, Int32(1))
1943 FfiConverterString.write(reason, into: &buf)
1883 -
1944 +
1945 }
1946 }
1947 }
@@ -1904,7 +1965,7 @@ public func FfiConverterTypeFfiEdError_lower(_ value: FfiEdError) -> RustBuffer
1965 // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
1966
1967 public enum FfiEngineStatus: Equatable, Hashable {
1907 -
1968 +
1969 case unloaded
1970 case loading
1971 case ready
@@ -1930,44 +1991,44 @@ public struct FfiConverterTypeFfiEngineStatus: FfiConverterRustBuffer {
1991 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiEngineStatus {
1992 let variant: Int32 = try readInt(&buf)
1993 switch variant {
1933 -
1994 +
1995 case 1: return .unloaded
1935 -
1996 +
1997 case 2: return .loading
1937 -
1998 +
1999 case 3: return .ready
1939 -
2000 +
2001 case 4: return .generating
1941 -
2002 +
2003 case 5: return .error
1943 -
2004 +
2005 default: throw UniffiInternalError.unexpectedEnumCase
2006 }
2007 }
2008
2009 public static func write(_ value: FfiEngineStatus, into buf: inout [UInt8]) {
2010 switch value {
1950 -
1951 -
2011 +
2012 +
2013 case .unloaded:
2014 writeInt(&buf, Int32(1))
1954 -
1955 -
2015 +
2016 +
2017 case .loading:
2018 writeInt(&buf, Int32(2))
1958 -
1959 -
2019 +
2020 +
2021 case .ready:
2022 writeInt(&buf, Int32(3))
1962 -
1963 -
2023 +
2024 +
2025 case .generating:
2026 writeInt(&buf, Int32(4))
1966 -
1967 -
2027 +
2028 +
2029 case .error:
2030 writeInt(&buf, Int32(5))
1970 -
2031 +
2032 }
2033 }
2034 }
@@ -1992,7 +2053,7 @@ public func FfiConverterTypeFfiEngineStatus_lower(_ value: FfiEngineStatus) -> R
2053 // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
2054
2055 public enum FfiEnvironment: Equatable, Hashable {
1995 -
2056 +
2057 case development
2058 case production
2059
@@ -2015,26 +2076,26 @@ public struct FfiConverterTypeFfiEnvironment: FfiConverterRustBuffer {
2076 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiEnvironment {
2077 let variant: Int32 = try readInt(&buf)
2078 switch variant {
2018 -
2079 +
2080 case 1: return .development
2020 -
2081 +
2082 case 2: return .production
2022 -
2083 +
2084 default: throw UniffiInternalError.unexpectedEnumCase
2085 }
2086 }
2087
2088 public static func write(_ value: FfiEnvironment, into buf: inout [UInt8]) {
2089 switch value {
2029 -
2030 -
2090 +
2091 +
2092 case .development:
2093 writeInt(&buf, Int32(1))
2033 -
2034 -
2094 +
2095 +
2096 case .production:
2097 writeInt(&buf, Int32(2))
2037 -
2098 +
2099 }
2100 }
2101 }
@@ -2059,7 +2120,7 @@ public func FfiConverterTypeFfiEnvironment_lower(_ value: FfiEnvironment) -> Rus
2120 // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
2121
2122 public enum FfiToolRisk: Equatable, Hashable {
2062 -
2123 +
2124 case readOnly
2125 case mutating
2126
@@ -2082,26 +2143,26 @@ public struct FfiConverterTypeFfiToolRisk: FfiConverterRustBuffer {
2143 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FfiToolRisk {
2144 let variant: Int32 = try readInt(&buf)
2145 switch variant {
2085 -
2146 +
2147 case 1: return .readOnly
2087 -
2148 +
2149 case 2: return .mutating
2089 -
2150 +
2151 default: throw UniffiInternalError.unexpectedEnumCase
2152 }
2153 }
2154
2155 public static func write(_ value: FfiToolRisk, into buf: inout [UInt8]) {
2156 switch value {
2096 -
2097 -
2157 +
2158 +
2159 case .readOnly:
2160 writeInt(&buf, Int32(1))
2100 -
2101 -
2161 +
2162 +
2163 case .mutating:
2164 writeInt(&buf, Int32(2))
2104 -
2165 +
2166 }
2167 }
2168 }
@@ -2126,9 +2187,9 @@ public func FfiConverterTypeFfiToolRisk_lower(_ value: FfiToolRisk) -> RustBuffe
2187
2188
2189 public protocol FfiApprovalHandler: AnyObject, Sendable {
2129 -
2130 - func approve(call: FfiToolCall) async -> FfiApprovalDecision
2131 -
2190 +
2191 + func approve(request: FfiApprovalRequest) async -> FfiApprovalDecision
2192 +
2193 }
2194
2195
@@ -2157,7 +2218,7 @@ fileprivate struct UniffiCallbackInterfaceFfiApprovalHandler {
2218 },
2219 approve: { (
2220 uniffiHandle: UInt64,
2160 - call: RustBuffer,
2221 + request: RustBuffer,
2222 uniffiFutureCallback: @escaping UniffiForeignFutureCompleteRustBuffer,
2223 uniffiCallbackData: UInt64,
2224 uniffiOutDroppedCallback: UnsafeMutablePointer<UniffiForeignFutureDroppedCallbackStruct>
@@ -2168,7 +2229,7 @@ fileprivate struct UniffiCallbackInterfaceFfiApprovalHandler {
2229 throw UniffiInternalError.unexpectedStaleHandle
2230 }
2231 return await uniffiObj.approve(
2171 - call: try FfiConverterTypeFfiToolCall_lift(call)
2232 + request: try FfiConverterTypeFfiApprovalRequest_lift(request)
2233 )
2234 }
2235
@@ -2268,21 +2329,21 @@ public func FfiConverterCallbackInterfaceFfiApprovalHandler_lower(_ v: FfiApprov
2329
2330
2331 public protocol FfiEventListener: AnyObject, Sendable {
2271 -
2272 - func statusChanged(update: FfiStatusUpdate)
2273 -
2274 - func toolRequested(call: FfiToolCall)
2275 -
2276 - func approvalRequested(call: FfiToolCall)
2277 -
2278 - func toolStarted(call: FfiToolCall)
2279 -
2280 - func toolFinished(toolCallId: String, content: String, isError: Bool)
2281 -
2282 - func agentReplied(reply: FfiAgentReply)
2283 -
2284 - func warning(message: String)
2285 -
2332 +
2333 + func statusChanged(update: FfiStatusUpdate)
2334 +
2335 + func toolRequested(call: FfiToolCall)
2336 +
2337 + func approvalRequested(request: FfiApprovalRequest)
2338 +
2339 + func toolStarted(call: FfiToolCall)
2340 +
2341 + func toolFinished(toolCallId: String, content: String, isError: Bool)
2342 +
2343 + func agentReplied(reply: FfiAgentReply)
2344 +
2345 + func warning(message: String)
2346 +
2347 }
2348
2349
@@ -2325,7 +2386,7 @@ fileprivate struct UniffiCallbackInterfaceFfiEventListener {
2386 )
2387 }
2388
2328 -
2389 +
2390 let writeReturn = { () }
2391 uniffiTraitInterfaceCall(
2392 callStatus: uniffiCallStatus,
@@ -2349,7 +2410,7 @@ fileprivate struct UniffiCallbackInterfaceFfiEventListener {
2410 )
2411 }
2412
2352 -
2413 +
2414 let writeReturn = { () }
2415 uniffiTraitInterfaceCall(
2416 callStatus: uniffiCallStatus,
@@ -2359,7 +2420,7 @@ fileprivate struct UniffiCallbackInterfaceFfiEventListener {
2420 },
2421 approvalRequested: { (
2422 uniffiHandle: UInt64,
2362 - call: RustBuffer,
2423 + request: RustBuffer,
2424 uniffiOutReturn: UnsafeMutableRawPointer,
2425 uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
2426 ) in
@@ -2369,11 +2430,11 @@ fileprivate struct UniffiCallbackInterfaceFfiEventListener {
2430 throw UniffiInternalError.unexpectedStaleHandle
2431 }
2432 return uniffiObj.approvalRequested(
2372 - call: try FfiConverterTypeFfiToolCall_lift(call)
2433 + request: try FfiConverterTypeFfiApprovalRequest_lift(request)
2434 )
2435 }
2436
2376 -
2437 +
2438 let writeReturn = { () }
2439 uniffiTraitInterfaceCall(
2440 callStatus: uniffiCallStatus,
@@ -2397,7 +2458,7 @@ fileprivate struct UniffiCallbackInterfaceFfiEventListener {
2458 )
2459 }
2460
2400 -
2461 +
2462 let writeReturn = { () }
2463 uniffiTraitInterfaceCall(
2464 callStatus: uniffiCallStatus,
@@ -2425,7 +2486,7 @@ fileprivate struct UniffiCallbackInterfaceFfiEventListener {
2486 )
2487 }
2488
2428 -
2489 +
2490 let writeReturn = { () }
2491 uniffiTraitInterfaceCall(
2492 callStatus: uniffiCallStatus,
@@ -2449,7 +2510,7 @@ fileprivate struct UniffiCallbackInterfaceFfiEventListener {
2510 )
2511 }
2512
2452 -
2513 +
2514 let writeReturn = { () }
2515 uniffiTraitInterfaceCall(
2516 callStatus: uniffiCallStatus,
@@ -2473,7 +2534,7 @@ fileprivate struct UniffiCallbackInterfaceFfiEventListener {
2534 )
2535 }
2536
2476 -
2537 +
2538 let writeReturn = { () }
2539 uniffiTraitInterfaceCall(
2540 callStatus: uniffiCallStatus,
@@ -2552,9 +2613,9 @@ public func FfiConverterCallbackInterfaceFfiEventListener_lower(_ v: FfiEventLis
2613
2614
2615 public protocol FfiToolExecutor: AnyObject, Sendable {
2555 -
2616 +
2617 func execute(toolName: String, arguments: String) async -> FfiToolOutput
2557 -
2618 +
2619 }
2620
2621
@@ -3105,7 +3166,7 @@ private let initializationResult: InitializationResult = {
3166 if (uniffi_ed_agent_ffi_checksum_constructor_ffiedagent_new() != 19584) {
3167 return InitializationResult.apiChecksumMismatch
3168 }
3108 - if (uniffi_ed_agent_ffi_checksum_method_ffiapprovalhandler_approve() != 12591) {
3169 + if (uniffi_ed_agent_ffi_checksum_method_ffiapprovalhandler_approve() != 9982) {
3170 return InitializationResult.apiChecksumMismatch
3171 }
3172 if (uniffi_ed_agent_ffi_checksum_method_ffieventlistener_status_changed() != 50680) {
@@ -3114,7 +3175,7 @@ private let initializationResult: InitializationResult = {
3175 if (uniffi_ed_agent_ffi_checksum_method_ffieventlistener_tool_requested() != 58928) {
3176 return InitializationResult.apiChecksumMismatch
3177 }
3117 - if (uniffi_ed_agent_ffi_checksum_method_ffieventlistener_approval_requested() != 54477) {
3178 + if (uniffi_ed_agent_ffi_checksum_method_ffieventlistener_approval_requested() != 13081) {
3179 return InitializationResult.apiChecksumMismatch
3180 }
3181 if (uniffi_ed_agent_ffi_checksum_method_ffieventlistener_tool_started() != 23754) {