2.5.2 #12

Merged
rune merged 23 commits from 2.5.2 into main 2026-08-17 08:37:04 +02:00
2 changed files with 21 additions and 14 deletions
Showing only changes of commit acda09942c - Show all commits
+12 -8
View File
@@ -223,28 +223,32 @@ struct StreamChunk {
// MARK: - Tool Definition
struct Tool: Codable {
// Plain data types for JSON tool-schema encoding marked `nonisolated` throughout (each nested
// type independently, since `-default-isolation=MainActor` doesn't cascade isolation-freedom from
// an outer type to its nested declarations) so they stay usable from `nonisolated` contexts like
// ExternalMCPManager's pure conversion helpers, not just from the main actor.
nonisolated struct Tool: Codable {
let type: String
let function: Function
struct Function: Codable {
nonisolated struct Function: Codable {
let name: String
let description: String
let parameters: Parameters
struct Parameters: Codable {
nonisolated struct Parameters: Codable {
let type: String
let properties: [String: Property]
let required: [String]?
struct Property: Codable {
nonisolated struct Property: Codable {
let type: String
let description: String
let `enum`: [String]?
let items: Items?
/// Item schema for `type: "array"` properties (e.g. an array of strings).
struct Items: Codable {
nonisolated struct Items: Codable {
let type: String
}
+9 -6
View File
@@ -9,12 +9,12 @@ import Foundation
/// `.http` fields are `url`/`bearerToken`/`headers`. Kept as one flat struct rather than an enum
/// with associated values simpler `Codable` and simpler settings-JSON storage, at the cost of
/// each server config carrying some always-unused fields for its transport.
enum MCPTransportKind: String, Codable, Sendable, CaseIterable {
nonisolated enum MCPTransportKind: String, Codable, Sendable, CaseIterable {
case stdio
case http
}
struct ExternalMCPServer: Codable, Identifiable, Sendable {
nonisolated struct ExternalMCPServer: Codable, Identifiable, Sendable {
var id: UUID
var name: String
var transportKind: MCPTransportKind
@@ -191,24 +191,27 @@ struct MCPToolsListResult: Decodable {
let nextCursor: String?
}
struct MCPToolDefinition: Decodable {
// Plain DTOs read from ExternalMCPManager.convertToolDefinition/convertInputSchema both
// `nonisolated static func` (for direct unit testing) so these must stay `nonisolated` too,
// same reasoning as `Tool` in AIProvider.swift.
nonisolated struct MCPToolDefinition: Decodable {
let name: String
let description: String?
let inputSchema: MCPInputSchema
}
struct MCPInputSchema: Decodable {
nonisolated struct MCPInputSchema: Decodable {
let type: String
let properties: [String: MCPPropertySchema]?
let required: [String]?
}
struct MCPPropertySchema: Decodable {
nonisolated struct MCPPropertySchema: Decodable {
let type: String?
let description: String?
let `enum`: [String]?
let items: MCPItemsSchema?
struct MCPItemsSchema: Decodable { let type: String? }
nonisolated struct MCPItemsSchema: Decodable { let type: String? }
}
struct MCPToolCallResult: Decodable {