Forge documentation
Library referenceSwift

ForgeCore

Swift ForgeCore library product.

Swift ForgeCore library product.

Package contract

FieldValue
Languageswift
Source versionSwift package source snapshot
Manifestforge-swift/Package.swift
Source files15
EvidenceSource reference; registry publication and runtime conformance are separate checks

Import boundary

import ForgeCore

Use a source checkout or your verified private registry. Manifest coordinates identify the package; they do not establish that a public registry release exists.

Source reference

Download package reference JSON. Each original source file and generated declaration artifact has its own SHA-256 digest. Function bodies and constant values are omitted from downloads. These are source declaration inventories, not compiler-resolved rustdoc, TypeDoc, DocC, or Dokka output. Private modules can contain public declarations that are not reachable through the package boundary; consult the entry point before importing.

Brew.swift

Read declaration text · 51 declaration entries

public struct BrewId: Codable, Sendable, Hashable, Comparable

public init(_ id: String)

public var asStr: String

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

public static func < (lhs: BrewId, rhs: BrewId) -> Bool

public var description: String

public struct NodeId: Codable, Sendable, Hashable, Comparable

public init(_ id: String)

public var asStr: String

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

public static func < (lhs: NodeId, rhs: NodeId) -> Bool

public var description: String

public struct BrewVersion: Codable, Sendable, Hashable, Comparable

public init(_ version: String)

public var asStr: String

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

public static func < (lhs: BrewVersion, rhs: BrewVersion) -> Bool

public var description: String

public enum JoinMode: Codable, Sendable, Hashable

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

public enum BrewNodeKind: Codable, Sendable

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

public enum BrewEdgeKind: String, Codable, Sendable, Hashable, Comparable, CaseIterable

public static func < (lhs: BrewEdgeKind, rhs: BrewEdgeKind) -> Bool

public struct BrewNode: Codable, Sendable

public let id: NodeId
/// The node's execution semantics.
public let kind: BrewNodeKind
/// Arbitrary key-value metadata for tooling and visualization.
public var metadata: [String: String]

public init(id: NodeId, kind: BrewNodeKind, metadata: [String: String];

public let kind: BrewNodeKind
/// Arbitrary key-value metadata for tooling and visualization.
public var metadata: [String: String]

public init(id: NodeId, kind: BrewNodeKind, metadata: [String: String];

public var metadata: [String: String]

public init(id: NodeId, kind: BrewNodeKind, metadata: [String: String];

public init(id: NodeId, kind: BrewNodeKind, metadata: [String: String];

public struct BrewEdge: Codable, Sendable, Hashable, Comparable

public let from: NodeId
/// Target node.
public let to: NodeId
/// Edge semantics.
public let kind: BrewEdgeKind

public init(from: NodeId, to: NodeId, kind: BrewEdgeKind)

public let to: NodeId
/// Edge semantics.
public let kind: BrewEdgeKind

public init(from: NodeId, to: NodeId, kind: BrewEdgeKind)

public let kind: BrewEdgeKind

public init(from: NodeId, to: NodeId, kind: BrewEdgeKind)

public init(from: NodeId, to: NodeId, kind: BrewEdgeKind)

public static func < (lhs: BrewEdge, rhs: BrewEdge) -> Bool

public struct Brew: Codable, Sendable

public let id: BrewId
/// Semantic version of this brew definition.
public let version: BrewVersion
/// The graph's nodes, keyed by stable node ID.
public var nodes: [NodeId: BrewNode]
/// The graph's edges.
public var edges: Set<BrewEdge>
/// Designated entry nodes. Execution begins at these nodes.
public var entryNodes: [NodeId]
/// Designated exit nodes. When all exit nodes complete, the brew is complete.
public var exitNodes: [NodeId]
/// Optional model topology for this brew.
public var topology: ModelTopology?

public init(
id: BrewId,
version: BrewVersion,
nodes: [NodeId: BrewNode];

public let version: BrewVersion
/// The graph's nodes, keyed by stable node ID.
public var nodes: [NodeId: BrewNode]
/// The graph's edges.
public var edges: Set<BrewEdge>
/// Designated entry nodes. Execution begins at these nodes.
public var entryNodes: [NodeId]
/// Designated exit nodes. When all exit nodes complete, the brew is complete.
public var exitNodes: [NodeId]
/// Optional model topology for this brew.
public var topology: ModelTopology?

public init(
id: BrewId,
version: BrewVersion,
nodes: [NodeId: BrewNode];

public var nodes: [NodeId: BrewNode]
/// The graph's edges.
public var edges: Set<BrewEdge>
/// Designated entry nodes. Execution begins at these nodes.
public var entryNodes: [NodeId]
/// Designated exit nodes. When all exit nodes complete, the brew is complete.
public var exitNodes: [NodeId]
/// Optional model topology for this brew.
public var topology: ModelTopology?

public init(
id: BrewId,
version: BrewVersion,
nodes: [NodeId: BrewNode];

public var edges: Set<BrewEdge>
/// Designated entry nodes. Execution begins at these nodes.
public var entryNodes: [NodeId]
/// Designated exit nodes. When all exit nodes complete, the brew is complete.
public var exitNodes: [NodeId]
/// Optional model topology for this brew.
public var topology: ModelTopology?

public init(
id: BrewId,
version: BrewVersion,
nodes: [NodeId: BrewNode];

public var entryNodes: [NodeId]
/// Designated exit nodes. When all exit nodes complete, the brew is complete.
public var exitNodes: [NodeId]
/// Optional model topology for this brew.
public var topology: ModelTopology?

public init(
id: BrewId,
version: BrewVersion,
nodes: [NodeId: BrewNode];

public var exitNodes: [NodeId]
/// Optional model topology for this brew.
public var topology: ModelTopology?

public init(
id: BrewId,
version: BrewVersion,
nodes: [NodeId: BrewNode];

public var topology: ModelTopology?

public init(
id: BrewId,
version: BrewVersion,
nodes: [NodeId: BrewNode];

public init(
id: BrewId,
version: BrewVersion,
nodes: [NodeId: BrewNode];

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

BrewBuilder.swift

Read declaration text · 10 declaration entries

public final class BrewBuilder: @unchecked Sendable

public init(_ id: String, _ version: String)

public func addNode(_ nodeId: String, _ kind: BrewNodeKind) -> BrewBuilder

public func addEdge(_ from: String, _ to: String, _ kind: BrewEdgeKind) -> BrewBuilder

public func setEntry(_ nodeId: String) -> BrewBuilder

public func setExit(_ nodeId: String) -> BrewBuilder

public func withTopology(_ topology: ModelTopology) -> BrewBuilder

public func withMetadata(_ nodeId: String, key: String, value: String) -> BrewBuilder

public func build() throws -> Brew

public func topologicalSort(nodes: [NodeId: BrewNode], edges: Set<BrewEdge>) throws -> [NodeId]

BrewResolver.swift

Read declaration text · 36 declaration entries

public struct BrewEnvironment: Codable, Sendable

public var providers: [String: ProviderRef]
/// Registered tool names available in this environment.
public var tools: Set<String>
/// Connected MCP server identifiers (URIs or aliases).
public var mcpServers: Set<String>
/// Web capabilities available in this environment.
public var webCapabilities: Set<String>

public init(
providers: [String: ProviderRef];

public var tools: Set<String>
/// Connected MCP server identifiers (URIs or aliases).
public var mcpServers: Set<String>
/// Web capabilities available in this environment.
public var webCapabilities: Set<String>

public init(
providers: [String: ProviderRef];

public var mcpServers: Set<String>
/// Web capabilities available in this environment.
public var webCapabilities: Set<String>

public init(
providers: [String: ProviderRef];

public var webCapabilities: Set<String>

public init(
providers: [String: ProviderRef];

public init(
providers: [String: ProviderRef];

public enum BrewResolutionErrorKind: String, Codable, Sendable, Hashable

public struct BrewResolutionError: Error, Codable, Sendable, Hashable

public let nodeId: NodeId
/// What went wrong.
public let errorKind: BrewResolutionErrorKind

public init(nodeId: NodeId, errorKind: BrewResolutionErrorKind)

public let errorKind: BrewResolutionErrorKind

public init(nodeId: NodeId, errorKind: BrewResolutionErrorKind)

public init(nodeId: NodeId, errorKind: BrewResolutionErrorKind)

public var errorDescription: String?

public enum ResolvedNodeKind: Codable, Sendable

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

public struct ResolvedNode: Codable, Sendable

public let id: NodeId
/// The resolved (verified) node kind.
public let kind: ResolvedNodeKind

public init(id: NodeId, kind: ResolvedNodeKind)

public let kind: ResolvedNodeKind

public init(id: NodeId, kind: ResolvedNodeKind)

public init(id: NodeId, kind: ResolvedNodeKind)

public struct ResolvedBrewPlan: Codable, Sendable

public let planId: String
/// The source brew's identifier.
public let brewId: BrewId
/// The source brew's version.
public let brewVersion: BrewVersion
/// ISO 8601 timestamp of when resolution occurred.
public let resolvedAt: String
/// SHA-256 hash of the serialized `BrewEnvironment`.
public let environmentHash: String
/// Resolved nodes keyed by node ID.
public let nodes: [NodeId: ResolvedNode]
/// Edges from the original brew.
public let edges: Set<BrewEdge>
/// Topologically sorted execution order.
public let executionOrder: [NodeId]
/// Entry nodes from the original brew.
public let entryNodes: [NodeId]
/// Exit nodes from the original brew.
public let exitNodes: [NodeId]

private enum CodingKeys: String, CodingKey

public let brewId: BrewId
/// The source brew's version.
public let brewVersion: BrewVersion
/// ISO 8601 timestamp of when resolution occurred.
public let resolvedAt: String
/// SHA-256 hash of the serialized `BrewEnvironment`.
public let environmentHash: String
/// Resolved nodes keyed by node ID.
public let nodes: [NodeId: ResolvedNode]
/// Edges from the original brew.
public let edges: Set<BrewEdge>
/// Topologically sorted execution order.
public let executionOrder: [NodeId]
/// Entry nodes from the original brew.
public let entryNodes: [NodeId]
/// Exit nodes from the original brew.
public let exitNodes: [NodeId]

private enum CodingKeys: String, CodingKey

public let brewVersion: BrewVersion
/// ISO 8601 timestamp of when resolution occurred.
public let resolvedAt: String
/// SHA-256 hash of the serialized `BrewEnvironment`.
public let environmentHash: String
/// Resolved nodes keyed by node ID.
public let nodes: [NodeId: ResolvedNode]
/// Edges from the original brew.
public let edges: Set<BrewEdge>
/// Topologically sorted execution order.
public let executionOrder: [NodeId]
/// Entry nodes from the original brew.
public let entryNodes: [NodeId]
/// Exit nodes from the original brew.
public let exitNodes: [NodeId]

private enum CodingKeys: String, CodingKey

public let resolvedAt: String
/// SHA-256 hash of the serialized `BrewEnvironment`.
public let environmentHash: String
/// Resolved nodes keyed by node ID.
public let nodes: [NodeId: ResolvedNode]
/// Edges from the original brew.
public let edges: Set<BrewEdge>
/// Topologically sorted execution order.
public let executionOrder: [NodeId]
/// Entry nodes from the original brew.
public let entryNodes: [NodeId]
/// Exit nodes from the original brew.
public let exitNodes: [NodeId]

private enum CodingKeys: String, CodingKey

public let environmentHash: String
/// Resolved nodes keyed by node ID.
public let nodes: [NodeId: ResolvedNode]
/// Edges from the original brew.
public let edges: Set<BrewEdge>
/// Topologically sorted execution order.
public let executionOrder: [NodeId]
/// Entry nodes from the original brew.
public let entryNodes: [NodeId]
/// Exit nodes from the original brew.
public let exitNodes: [NodeId]

private enum CodingKeys: String, CodingKey

public let nodes: [NodeId: ResolvedNode]
/// Edges from the original brew.
public let edges: Set<BrewEdge>
/// Topologically sorted execution order.
public let executionOrder: [NodeId]
/// Entry nodes from the original brew.
public let entryNodes: [NodeId]
/// Exit nodes from the original brew.
public let exitNodes: [NodeId]

private enum CodingKeys: String, CodingKey

public let edges: Set<BrewEdge>
/// Topologically sorted execution order.
public let executionOrder: [NodeId]
/// Entry nodes from the original brew.
public let entryNodes: [NodeId]
/// Exit nodes from the original brew.
public let exitNodes: [NodeId]

private enum CodingKeys: String, CodingKey

public let executionOrder: [NodeId]
/// Entry nodes from the original brew.
public let entryNodes: [NodeId]
/// Exit nodes from the original brew.
public let exitNodes: [NodeId]

private enum CodingKeys: String, CodingKey

public let entryNodes: [NodeId]
/// Exit nodes from the original brew.
public let exitNodes: [NodeId]

private enum CodingKeys: String, CodingKey

public let exitNodes: [NodeId]

private enum CodingKeys: String, CodingKey

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

public func resolveBrew(_ brew: Brew, environment: BrewEnvironment) throws -> ResolvedBrewPlan

public struct BrewResolutionErrors: Error, Sendable

public let errors: [BrewResolutionError]
}

extension BrewResolutionErrors: LocalizedError

public var errorDescription: String?

Config.swift

Read declaration text · 24 declaration entries

public struct GenerateOptions: Codable, Sendable, Equatable

public var temperature: Double?
/// Maximum tokens to generate.
public var maxTokens: Int?
/// Top-p (nucleus) sampling threshold.
public var topP: Double?
/// Stop sequences -- generation stops when any of these are produced.
public var stopSequences: [String]?
/// Frequency penalty (-2.0 to 2.0).
public var frequencyPenalty: Double?
/// Presence penalty (-2.0 to 2.0).
public var presencePenalty: Double?
/// Seed for deterministic generation (if supported by provider).
public var seed: Int?
/// JSON schema for structured output enforcement.
public var outputSchema: JsonSchema?

/// Creates default generate options with all fields nil.
public init(
temperature: Double?;

public var maxTokens: Int?
/// Top-p (nucleus) sampling threshold.
public var topP: Double?
/// Stop sequences -- generation stops when any of these are produced.
public var stopSequences: [String]?
/// Frequency penalty (-2.0 to 2.0).
public var frequencyPenalty: Double?
/// Presence penalty (-2.0 to 2.0).
public var presencePenalty: Double?
/// Seed for deterministic generation (if supported by provider).
public var seed: Int?
/// JSON schema for structured output enforcement.
public var outputSchema: JsonSchema?

/// Creates default generate options with all fields nil.
public init(
temperature: Double?;

public var topP: Double?
/// Stop sequences -- generation stops when any of these are produced.
public var stopSequences: [String]?
/// Frequency penalty (-2.0 to 2.0).
public var frequencyPenalty: Double?
/// Presence penalty (-2.0 to 2.0).
public var presencePenalty: Double?
/// Seed for deterministic generation (if supported by provider).
public var seed: Int?
/// JSON schema for structured output enforcement.
public var outputSchema: JsonSchema?

/// Creates default generate options with all fields nil.
public init(
temperature: Double?;

public var stopSequences: [String]?
/// Frequency penalty (-2.0 to 2.0).
public var frequencyPenalty: Double?
/// Presence penalty (-2.0 to 2.0).
public var presencePenalty: Double?
/// Seed for deterministic generation (if supported by provider).
public var seed: Int?
/// JSON schema for structured output enforcement.
public var outputSchema: JsonSchema?

/// Creates default generate options with all fields nil.
public init(
temperature: Double?;

public var frequencyPenalty: Double?
/// Presence penalty (-2.0 to 2.0).
public var presencePenalty: Double?
/// Seed for deterministic generation (if supported by provider).
public var seed: Int?
/// JSON schema for structured output enforcement.
public var outputSchema: JsonSchema?

/// Creates default generate options with all fields nil.
public init(
temperature: Double?;

public var presencePenalty: Double?
/// Seed for deterministic generation (if supported by provider).
public var seed: Int?
/// JSON schema for structured output enforcement.
public var outputSchema: JsonSchema?

/// Creates default generate options with all fields nil.
public init(
temperature: Double?;

public var seed: Int?
/// JSON schema for structured output enforcement.
public var outputSchema: JsonSchema?

/// Creates default generate options with all fields nil.
public init(
temperature: Double?;

public var outputSchema: JsonSchema?

/// Creates default generate options with all fields nil.
public init(
temperature: Double?;

public init(
temperature: Double?;

public func withTemperature(_ temperature: Double) -> GenerateOptions

public func withMaxTokens(_ maxTokens: Int) -> GenerateOptions

public func withTopP(_ topP: Double) -> GenerateOptions

public func withStopSequences(_ sequences: [String]) -> GenerateOptions

public func withFrequencyPenalty(_ penalty: Double) -> GenerateOptions

public func withPresencePenalty(_ penalty: Double) -> GenerateOptions

public func withSeed(_ seed: Int) -> GenerateOptions

public func withOutputSchema(_ schema: JsonSchema) -> GenerateOptions

public struct EmbedOptions: Codable, Sendable, Equatable

public var model: String?
/// Dimensionality of the output embeddings (if configurable).
public var dimensions: Int?

/// Creates default embed options.
public init(model: String?;

public var dimensions: Int?

/// Creates default embed options.
public init(model: String?;

public init(model: String?;

public func withModel(_ model: String) -> EmbedOptions

public func withDimensions(_ dimensions: Int) -> EmbedOptions

Error.swift

Read declaration text · 2 declaration entries

public enum ForgeError: Error, Sendable, Equatable

public var errorDescription: String?

Message.swift

Read declaration text · 15 declaration entries

public enum Role: String, Codable, Sendable, Hashable, CaseIterable

public var description: String

public enum MessagePart: Sendable, Equatable

public var isToolCall: Bool

public var isToolResult: Bool

public var asText: String?

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

public struct ModelMessage: Codable, Sendable, Equatable

public let role: Role
/// One or more content parts.
public var parts: [MessagePart]

/// Creates a new message with the given role and content parts.
///
/// - Parameters:
///   - role: The message participant role.
///   - parts: One or more content parts.
public init(role: Role, parts: [MessagePart])

public var parts: [MessagePart]

/// Creates a new message with the given role and content parts.
///
/// - Parameters:
///   - role: The message participant role.
///   - parts: One or more content parts.
public init(role: Role, parts: [MessagePart])

public init(role: Role, parts: [MessagePart])

public static func text(_ role: Role, _ text: String) -> ModelMessage

public func toolCalls() -> [MessagePart]

public func textContent() -> String

Model.swift

Read declaration text · 5 declaration entries

public protocol LanguageModel: Sendable

public var supportsToolCalling: Bool

public var supportsStructuredOutput: Bool

public var supportsImageInput: Bool

public var supportsStreaming: Bool

Output.swift

Read declaration text · 25 declaration entries

public enum FinishReason: String, Codable, Sendable, Hashable, CaseIterable

public var isComplete: Bool

public var isToolCall: Bool

public var description: String

public struct Usage: Codable, Sendable, Equatable

public let promptTokens: Int
/// Tokens generated in the response.
public let completionTokens: Int
/// Total tokens (prompt + completion).
public let totalTokens: Int

public init(promptTokens: Int, completionTokens: Int, totalTokens: Int)

public let completionTokens: Int
/// Total tokens (prompt + completion).
public let totalTokens: Int

public init(promptTokens: Int, completionTokens: Int, totalTokens: Int)

public let totalTokens: Int

public init(promptTokens: Int, completionTokens: Int, totalTokens: Int)

public init(promptTokens: Int, completionTokens: Int, totalTokens: Int)

public static func zero() -> Usage

public func adding(_ other: Usage) -> Usage

public struct GenerateResult: Sendable

public let message: ModelMessage
/// Why generation stopped.
public let finishReason: FinishReason
/// Token usage statistics.
public let usage: Usage

public init(message: ModelMessage, finishReason: FinishReason, usage: Usage)

public let finishReason: FinishReason
/// Token usage statistics.
public let usage: Usage

public init(message: ModelMessage, finishReason: FinishReason, usage: Usage)

public let usage: Usage

public init(message: ModelMessage, finishReason: FinishReason, usage: Usage)

public init(message: ModelMessage, finishReason: FinishReason, usage: Usage)

public var text: String

public var hasToolCalls: Bool

public enum StreamChunk: Sendable, Equatable

public static func text(_ text: String) -> StreamChunk

public var isTextDelta: Bool

public var isDone: Bool

public var asText: String?

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

Provider.swift

Read declaration text · 103 declaration entries

public struct ProviderRef: Codable, Sendable, Hashable, Equatable

public let namespace: String
/// The model name (e.g., "gpt-4o").
public let model: String
/// The full reference string (e.g., "openai:gpt-4o").
public let full: String

/// Parses a provider reference string.
///
/// - Parameter input: A string in `namespace:model` format.
/// - Returns: The parsed `ProviderRef`.
/// - Throws: `ForgeError.invalidProviderRef` if the input does not contain
///   exactly one colon separator, or if either part is empty.
public static func parse(_ input: String) throws -> ProviderRef

public let model: String
/// The full reference string (e.g., "openai:gpt-4o").
public let full: String

/// Parses a provider reference string.
///
/// - Parameter input: A string in `namespace:model` format.
/// - Returns: The parsed `ProviderRef`.
/// - Throws: `ForgeError.invalidProviderRef` if the input does not contain
///   exactly one colon separator, or if either part is empty.
public static func parse(_ input: String) throws -> ProviderRef

public let full: String

/// Parses a provider reference string.
///
/// - Parameter input: A string in `namespace:model` format.
/// - Returns: The parsed `ProviderRef`.
/// - Throws: `ForgeError.invalidProviderRef` if the input does not contain
///   exactly one colon separator, or if either part is empty.
public static func parse(_ input: String) throws -> ProviderRef

public static func parse(_ input: String) throws -> ProviderRef

public var description: String

public struct ProviderMetadata: Codable, Sendable

public let name: String
/// Provider namespace (e.g., "openai").
public let namespace: String
/// Whether the provider supports tool calling.
public let supportsToolCalling: Bool
/// Whether the provider supports structured output.
public let supportsStructuredOutput: Bool
/// Whether the provider supports streaming.
public let supportsStreaming: Bool
/// Whether the provider supports image input.
public let supportsImageInput: Bool
/// Provider-session runtime capabilities for coding-style integrations.
public let runtimeCapabilities: ProviderRuntimeCapabilities

public init(
name: String,
namespace: String,
supportsToolCalling: Bool,
supportsStructuredOutput: Bool,
supportsStreaming: Bool,
supportsImageInput: Bool,
runtimeCapabilities: ProviderRuntimeCapabilities;

public let namespace: String
/// Whether the provider supports tool calling.
public let supportsToolCalling: Bool
/// Whether the provider supports structured output.
public let supportsStructuredOutput: Bool
/// Whether the provider supports streaming.
public let supportsStreaming: Bool
/// Whether the provider supports image input.
public let supportsImageInput: Bool
/// Provider-session runtime capabilities for coding-style integrations.
public let runtimeCapabilities: ProviderRuntimeCapabilities

public init(
name: String,
namespace: String,
supportsToolCalling: Bool,
supportsStructuredOutput: Bool,
supportsStreaming: Bool,
supportsImageInput: Bool,
runtimeCapabilities: ProviderRuntimeCapabilities;

public let supportsToolCalling: Bool
/// Whether the provider supports structured output.
public let supportsStructuredOutput: Bool
/// Whether the provider supports streaming.
public let supportsStreaming: Bool
/// Whether the provider supports image input.
public let supportsImageInput: Bool
/// Provider-session runtime capabilities for coding-style integrations.
public let runtimeCapabilities: ProviderRuntimeCapabilities

public init(
name: String,
namespace: String,
supportsToolCalling: Bool,
supportsStructuredOutput: Bool,
supportsStreaming: Bool,
supportsImageInput: Bool,
runtimeCapabilities: ProviderRuntimeCapabilities;

public let supportsStructuredOutput: Bool
/// Whether the provider supports streaming.
public let supportsStreaming: Bool
/// Whether the provider supports image input.
public let supportsImageInput: Bool
/// Provider-session runtime capabilities for coding-style integrations.
public let runtimeCapabilities: ProviderRuntimeCapabilities

public init(
name: String,
namespace: String,
supportsToolCalling: Bool,
supportsStructuredOutput: Bool,
supportsStreaming: Bool,
supportsImageInput: Bool,
runtimeCapabilities: ProviderRuntimeCapabilities;

public let supportsStreaming: Bool
/// Whether the provider supports image input.
public let supportsImageInput: Bool
/// Provider-session runtime capabilities for coding-style integrations.
public let runtimeCapabilities: ProviderRuntimeCapabilities

public init(
name: String,
namespace: String,
supportsToolCalling: Bool,
supportsStructuredOutput: Bool,
supportsStreaming: Bool,
supportsImageInput: Bool,
runtimeCapabilities: ProviderRuntimeCapabilities;

public let supportsImageInput: Bool
/// Provider-session runtime capabilities for coding-style integrations.
public let runtimeCapabilities: ProviderRuntimeCapabilities

public init(
name: String,
namespace: String,
supportsToolCalling: Bool,
supportsStructuredOutput: Bool,
supportsStreaming: Bool,
supportsImageInput: Bool,
runtimeCapabilities: ProviderRuntimeCapabilities;

public let runtimeCapabilities: ProviderRuntimeCapabilities

public init(
name: String,
namespace: String,
supportsToolCalling: Bool,
supportsStructuredOutput: Bool,
supportsStreaming: Bool,
supportsImageInput: Bool,
runtimeCapabilities: ProviderRuntimeCapabilities;

public init(
name: String,
namespace: String,
supportsToolCalling: Bool,
supportsStructuredOutput: Bool,
supportsStreaming: Bool,
supportsImageInput: Bool,
runtimeCapabilities: ProviderRuntimeCapabilities;

public enum RuntimeCapability: String, Codable, Sendable, Hashable, CaseIterable

public struct ProviderRuntimeCapabilities: Codable, Sendable, Equatable

public let baselineContract: Bool
public let capabilities: Set<RuntimeCapability>

public init(
baselineContract: Bool;

public let capabilities: Set<RuntimeCapability>

public init(
baselineContract: Bool;

public init(
baselineContract: Bool;

public static func baseline() -> ProviderRuntimeCapabilities

public func withCapability(_ capability: RuntimeCapability) -> ProviderRuntimeCapabilities

public func supports(_ capability: RuntimeCapability) -> Bool

public struct ProviderNegotiationRequest: Codable, Sendable, Equatable

public let providerRef: String
public let requireBaselineContract: Bool
public let requiredCapabilities: [RuntimeCapability]

public init(
providerRef: String,
requireBaselineContract: Bool,
requiredCapabilities: [RuntimeCapability]
)

public let requireBaselineContract: Bool
public let requiredCapabilities: [RuntimeCapability]

public init(
providerRef: String,
requireBaselineContract: Bool,
requiredCapabilities: [RuntimeCapability]
)

public let requiredCapabilities: [RuntimeCapability]

public init(
providerRef: String,
requireBaselineContract: Bool,
requiredCapabilities: [RuntimeCapability]
)

public init(
providerRef: String,
requireBaselineContract: Bool,
requiredCapabilities: [RuntimeCapability]
)

public struct ProviderNegotiationResult: Codable, Sendable, Equatable

public let providerRef: String
public let baselineContract: Bool
public let negotiatedCapabilities: [RuntimeCapability]
}

public enum ProviderSessionState: String, Codable, Sendable, Hashable, CaseIterable

public let baselineContract: Bool
public let negotiatedCapabilities: [RuntimeCapability]
}

public enum ProviderSessionState: String, Codable, Sendable, Hashable, CaseIterable

public let negotiatedCapabilities: [RuntimeCapability]
}

public enum ProviderSessionState: String, Codable, Sendable, Hashable, CaseIterable

public enum ProviderSessionState: String, Codable, Sendable, Hashable, CaseIterable

public struct ProviderUsageSummary: Codable, Sendable, Equatable

public let inputTokens: UInt64
public let outputTokens: UInt64
public let totalTokens: UInt64

public init(inputTokens: UInt64;

public let outputTokens: UInt64
public let totalTokens: UInt64

public init(inputTokens: UInt64;

public let totalTokens: UInt64

public init(inputTokens: UInt64;

public init(inputTokens: UInt64;

public struct ProviderSessionEvent: Codable, Sendable, Equatable

public let sessionId: String
public let state: ProviderSessionState
public let message: String?
public let usage: ProviderUsageSummary?

public init(
sessionId: String,
state: ProviderSessionState,
message: String?;

public let state: ProviderSessionState
public let message: String?
public let usage: ProviderUsageSummary?

public init(
sessionId: String,
state: ProviderSessionState,
message: String?;

public let message: String?
public let usage: ProviderUsageSummary?

public init(
sessionId: String,
state: ProviderSessionState,
message: String?;

public let usage: ProviderUsageSummary?

public init(
sessionId: String,
state: ProviderSessionState,
message: String?;

public init(
sessionId: String,
state: ProviderSessionState,
message: String?;

public final class ProviderRegistry: @unchecked Sendable

public init()

public func register(_ providerRef: String, model: any LanguageModel) throws

public func registerWithRuntime(
_ providerRef: String,
model: any LanguageModel,
runtimeCapabilities: ProviderRuntimeCapabilities
) throws

public func get(_ providerRef: String) -> (any LanguageModel)?

public func require(_ providerRef: String) throws -> any LanguageModel

public func getMetadata(_ providerRef: String) -> ProviderMetadata?

public func list() -> [String]

public var count: Int

public var isEmpty: Bool

public func negotiate(
_ request: ProviderNegotiationRequest
) throws -> ProviderNegotiationResult

public enum ProviderFamily: String, Codable, Sendable, Hashable, CaseIterable

public enum AuthStrategy: String, Codable, Sendable, Hashable, CaseIterable

public struct ProviderPreset: Codable, Sendable, Equatable

public let namespace: String
public let family: ProviderFamily
public let authStrategy: AuthStrategy

public init(namespace: String, family: ProviderFamily, authStrategy: AuthStrategy)

public let family: ProviderFamily
public let authStrategy: AuthStrategy

public init(namespace: String, family: ProviderFamily, authStrategy: AuthStrategy)

public let authStrategy: AuthStrategy

public init(namespace: String, family: ProviderFamily, authStrategy: AuthStrategy)

public init(namespace: String, family: ProviderFamily, authStrategy: AuthStrategy)

public typealias ProviderEnvironment;

public typealias ProviderGenerateHandler;

public typealias ProviderStreamHandler;

public struct ProviderExecutionRequest: Sendable

public let providerRef: String
public let namespace: String
public let modelId: String
public let family: ProviderFamily
public let authStrategy: AuthStrategy
public let credential: String
public let baseURL: String?
public let messages: [ModelMessage]
public let tools: [ToolDefinition]
public let options: GenerateOptions

public init(
providerRef: String,
namespace: String,
modelId: String,
family: ProviderFamily,
authStrategy: AuthStrategy,
credential: String,
baseURL: String?,
messages: [ModelMessage],
tools: [ToolDefinition],
options: GenerateOptions
)

public let namespace: String
public let modelId: String
public let family: ProviderFamily
public let authStrategy: AuthStrategy
public let credential: String
public let baseURL: String?
public let messages: [ModelMessage]
public let tools: [ToolDefinition]
public let options: GenerateOptions

public init(
providerRef: String,
namespace: String,
modelId: String,
family: ProviderFamily,
authStrategy: AuthStrategy,
credential: String,
baseURL: String?,
messages: [ModelMessage],
tools: [ToolDefinition],
options: GenerateOptions
)

public let modelId: String
public let family: ProviderFamily
public let authStrategy: AuthStrategy
public let credential: String
public let baseURL: String?
public let messages: [ModelMessage]
public let tools: [ToolDefinition]
public let options: GenerateOptions

public init(
providerRef: String,
namespace: String,
modelId: String,
family: ProviderFamily,
authStrategy: AuthStrategy,
credential: String,
baseURL: String?,
messages: [ModelMessage],
tools: [ToolDefinition],
options: GenerateOptions
)

public let family: ProviderFamily
public let authStrategy: AuthStrategy
public let credential: String
public let baseURL: String?
public let messages: [ModelMessage]
public let tools: [ToolDefinition]
public let options: GenerateOptions

public init(
providerRef: String,
namespace: String,
modelId: String,
family: ProviderFamily,
authStrategy: AuthStrategy,
credential: String,
baseURL: String?,
messages: [ModelMessage],
tools: [ToolDefinition],
options: GenerateOptions
)

public let authStrategy: AuthStrategy
public let credential: String
public let baseURL: String?
public let messages: [ModelMessage]
public let tools: [ToolDefinition]
public let options: GenerateOptions

public init(
providerRef: String,
namespace: String,
modelId: String,
family: ProviderFamily,
authStrategy: AuthStrategy,
credential: String,
baseURL: String?,
messages: [ModelMessage],
tools: [ToolDefinition],
options: GenerateOptions
)

public let credential: String
public let baseURL: String?
public let messages: [ModelMessage]
public let tools: [ToolDefinition]
public let options: GenerateOptions

public init(
providerRef: String,
namespace: String,
modelId: String,
family: ProviderFamily,
authStrategy: AuthStrategy,
credential: String,
baseURL: String?,
messages: [ModelMessage],
tools: [ToolDefinition],
options: GenerateOptions
)

public let baseURL: String?
public let messages: [ModelMessage]
public let tools: [ToolDefinition]
public let options: GenerateOptions

public init(
providerRef: String,
namespace: String,
modelId: String,
family: ProviderFamily,
authStrategy: AuthStrategy,
credential: String,
baseURL: String?,
messages: [ModelMessage],
tools: [ToolDefinition],
options: GenerateOptions
)

public let messages: [ModelMessage]
public let tools: [ToolDefinition]
public let options: GenerateOptions

public init(
providerRef: String,
namespace: String,
modelId: String,
family: ProviderFamily,
authStrategy: AuthStrategy,
credential: String,
baseURL: String?,
messages: [ModelMessage],
tools: [ToolDefinition],
options: GenerateOptions
)

public let tools: [ToolDefinition]
public let options: GenerateOptions

public init(
providerRef: String,
namespace: String,
modelId: String,
family: ProviderFamily,
authStrategy: AuthStrategy,
credential: String,
baseURL: String?,
messages: [ModelMessage],
tools: [ToolDefinition],
options: GenerateOptions
)

public let options: GenerateOptions

public init(
providerRef: String,
namespace: String,
modelId: String,
family: ProviderFamily,
authStrategy: AuthStrategy,
credential: String,
baseURL: String?,
messages: [ModelMessage],
tools: [ToolDefinition],
options: GenerateOptions
)

public init(
providerRef: String,
namespace: String,
modelId: String,
family: ProviderFamily,
authStrategy: AuthStrategy,
credential: String,
baseURL: String?,
messages: [ModelMessage],
tools: [ToolDefinition],
options: GenerateOptions
)

public struct ProviderInstallOptions: Sendable

public let environment: ProviderEnvironment?
public let generate: ProviderGenerateHandler?
public let stream: ProviderStreamHandler?

public init(
environment: ProviderEnvironment?;

public let generate: ProviderGenerateHandler?
public let stream: ProviderStreamHandler?

public init(
environment: ProviderEnvironment?;

public let stream: ProviderStreamHandler?

public init(
environment: ProviderEnvironment?;

public init(
environment: ProviderEnvironment?;

public func approvedCodingProviderPresets() -> [ProviderPreset]

public func approvedDirectProviderPresets() -> [ProviderPreset]

public func approvedGatewayProviderPresets() -> [ProviderPreset]

public func registerOfficialCodingProviders(
_ registry: ProviderRegistry,
options: ProviderInstallOptions;

public func registerDefaultCoreDirectProviders(
_ registry: ProviderRegistry,
options: ProviderInstallOptions;

public func registerOpenAiModel(
_ registry: ProviderRegistry,
modelId: String,
options: ProviderInstallOptions;

public func registerAnthropicModel(
_ registry: ProviderRegistry,
modelId: String,
options: ProviderInstallOptions;

public func registerGoogleModel(
_ registry: ProviderRegistry,
modelId: String,
options: ProviderInstallOptions;

public func registerXaiModel(_ registry: ProviderRegistry, modelId: String, options: ProviderInstallOptions;

public func registerDeepSeekModel(_ registry: ProviderRegistry, modelId: String, options: ProviderInstallOptions;

public func registerMistralModel(_ registry: ProviderRegistry, modelId: String, options: ProviderInstallOptions;

public func registerCohereModel(_ registry: ProviderRegistry, modelId: String, options: ProviderInstallOptions;

public func registerGroqModel(_ registry: ProviderRegistry, modelId: String, options: ProviderInstallOptions;

public func registerMoonshotModel(_ registry: ProviderRegistry, modelId: String, options: ProviderInstallOptions;

public func registerZaiModel(_ registry: ProviderRegistry, modelId: String, options: ProviderInstallOptions;

public func registerMiniMaxModel(_ registry: ProviderRegistry, modelId: String, options: ProviderInstallOptions;

public func registerOpenRouterModel(_ registry: ProviderRegistry, modelId: String, options: ProviderInstallOptions;

public func registerBedrockModel(_ registry: ProviderRegistry, modelId: String, options: ProviderInstallOptions;

public func registerVertexAiModel(_ registry: ProviderRegistry, modelId: String, options: ProviderInstallOptions;

public func registerMicrosoftFoundryModel(_ registry: ProviderRegistry, modelId: String, options: ProviderInstallOptions;

public func registerFoundryModel(_ registry: ProviderRegistry, modelId: String, options: ProviderInstallOptions;

Routing.swift

Read declaration text · 31 declaration entries

public enum TaskMode: String, Codable, Sendable, Hashable, CaseIterable

public var roleName: String

public enum ExecutionTopology: String, Codable, Sendable, Hashable, CaseIterable

public struct RoutingContext: Codable, Sendable

public var domain: String?

/// The task mode for this call.
public var taskMode: TaskMode?

/// The execution topology for this call.
public var executionTopology: ExecutionTopology?

/// Tool capabilities required for the model selected by this route.
public var toolRequirements: [String]

/// Explicit role override. When set, the router returns the slot with
/// this role name without applying strategy logic.
public var roleOverride: String?

public init(
domain: String?;

public var taskMode: TaskMode?

/// The execution topology for this call.
public var executionTopology: ExecutionTopology?

/// Tool capabilities required for the model selected by this route.
public var toolRequirements: [String]

/// Explicit role override. When set, the router returns the slot with
/// this role name without applying strategy logic.
public var roleOverride: String?

public init(
domain: String?;

public var executionTopology: ExecutionTopology?

/// Tool capabilities required for the model selected by this route.
public var toolRequirements: [String]

/// Explicit role override. When set, the router returns the slot with
/// this role name without applying strategy logic.
public var roleOverride: String?

public init(
domain: String?;

public var toolRequirements: [String]

/// Explicit role override. When set, the router returns the slot with
/// this role name without applying strategy logic.
public var roleOverride: String?

public init(
domain: String?;

public var roleOverride: String?

public init(
domain: String?;

public init(
domain: String?;

public struct ModelCapabilities: Codable, Sendable

public var textGeneration: Bool
/// Whether the model supports structured output (JSON mode).
public var structuredOutput: Bool
/// Whether the model supports tool calling.
public var toolCalling: Bool
/// Whether the model supports vision (image input).
public var vision: Bool
/// Whether the model supports audio input/output.
public var audio: Bool
/// Whether the model supports embedding generation.
public var embedding: Bool
/// Maximum number of tokens in the context window.
public var maxContextTokens: UInt32
/// Maximum number of tokens the model can generate in a single response.
public var maxOutputTokens: UInt32

public init(
textGeneration: Bool;

public var structuredOutput: Bool
/// Whether the model supports tool calling.
public var toolCalling: Bool
/// Whether the model supports vision (image input).
public var vision: Bool
/// Whether the model supports audio input/output.
public var audio: Bool
/// Whether the model supports embedding generation.
public var embedding: Bool
/// Maximum number of tokens in the context window.
public var maxContextTokens: UInt32
/// Maximum number of tokens the model can generate in a single response.
public var maxOutputTokens: UInt32

public init(
textGeneration: Bool;

public var toolCalling: Bool
/// Whether the model supports vision (image input).
public var vision: Bool
/// Whether the model supports audio input/output.
public var audio: Bool
/// Whether the model supports embedding generation.
public var embedding: Bool
/// Maximum number of tokens in the context window.
public var maxContextTokens: UInt32
/// Maximum number of tokens the model can generate in a single response.
public var maxOutputTokens: UInt32

public init(
textGeneration: Bool;

public var vision: Bool
/// Whether the model supports audio input/output.
public var audio: Bool
/// Whether the model supports embedding generation.
public var embedding: Bool
/// Maximum number of tokens in the context window.
public var maxContextTokens: UInt32
/// Maximum number of tokens the model can generate in a single response.
public var maxOutputTokens: UInt32

public init(
textGeneration: Bool;

public var audio: Bool
/// Whether the model supports embedding generation.
public var embedding: Bool
/// Maximum number of tokens in the context window.
public var maxContextTokens: UInt32
/// Maximum number of tokens the model can generate in a single response.
public var maxOutputTokens: UInt32

public init(
textGeneration: Bool;

public var embedding: Bool
/// Maximum number of tokens in the context window.
public var maxContextTokens: UInt32
/// Maximum number of tokens the model can generate in a single response.
public var maxOutputTokens: UInt32

public init(
textGeneration: Bool;

public var maxContextTokens: UInt32
/// Maximum number of tokens the model can generate in a single response.
public var maxOutputTokens: UInt32

public init(
textGeneration: Bool;

public var maxOutputTokens: UInt32

public init(
textGeneration: Bool;

public init(
textGeneration: Bool;

public struct ResolvedRoute: Codable, Sendable

public let slotRole: String

/// The specific `ProviderRef` to use (primary or one of the fallbacks).
public let provider: ProviderRef

/// The model capabilities of the selected provider.
public let modelCapabilities: ModelCapabilities

/// Whether a fallback model was selected instead of the primary.
public let fallbackUsed: Bool

public init(
slotRole: String,
provider: ProviderRef,
modelCapabilities: ModelCapabilities;

public let provider: ProviderRef

/// The model capabilities of the selected provider.
public let modelCapabilities: ModelCapabilities

/// Whether a fallback model was selected instead of the primary.
public let fallbackUsed: Bool

public init(
slotRole: String,
provider: ProviderRef,
modelCapabilities: ModelCapabilities;

public let modelCapabilities: ModelCapabilities

/// Whether a fallback model was selected instead of the primary.
public let fallbackUsed: Bool

public init(
slotRole: String,
provider: ProviderRef,
modelCapabilities: ModelCapabilities;

public let fallbackUsed: Bool

public init(
slotRole: String,
provider: ProviderRef,
modelCapabilities: ModelCapabilities;

public init(
slotRole: String,
provider: ProviderRef,
modelCapabilities: ModelCapabilities;

public protocol ModelRouter: Sendable

public struct DefaultModelRouter: ModelRouter, Sendable

public let name: String;

public init()

public func route(context: RoutingContext, topology: ModelTopology) throws -> ResolvedRoute

Schema.swift

Read declaration text · 37 declaration entries

public enum SchemaType: String, Codable, Sendable, Hashable

public struct JsonSchema: Codable, Sendable, Equatable

public var schemaType: SchemaType

/// Human-readable description of this schema element.
public var schemaDescription: String?

/// Properties (for object type).
public var properties: [String: JsonSchema]?

/// Required property names (for object type).
public var requiredFields: [String]?

/// Whether additional properties are allowed (for object type).
public var additionalProperties: Bool?

/// Items schema (for array type).
public var items: Box<JsonSchema>?

/// Allowed values.
public var enumValues: [JSONValue]?

/// Minimum numeric value.
public var minimum: Double?

/// Maximum numeric value.
public var maximum: Double?


public var schemaDescription: String?

/// Properties (for object type).
public var properties: [String: JsonSchema]?

/// Required property names (for object type).
public var requiredFields: [String]?

/// Whether additional properties are allowed (for object type).
public var additionalProperties: Bool?

/// Items schema (for array type).
public var items: Box<JsonSchema>?

/// Allowed values.
public var enumValues: [JSONValue]?

/// Minimum numeric value.
public var minimum: Double?

/// Maximum numeric value.
public var maximum: Double?

/// Minimum string length.
public var minLength: UInt64?


public var properties: [String: JsonSchema]?

/// Required property names (for object type).
public var requiredFields: [String]?

/// Whether additional properties are allowed (for object type).
public var additionalProperties: Bool?

/// Items schema (for array type).
public var items: Box<JsonSchema>?

/// Allowed values.
public var enumValues: [JSONValue]?

/// Minimum numeric value.
public var minimum: Double?

/// Maximum numeric value.
public var maximum: Double?

/// Minimum string length.
public var minLength: UInt64?

/// Maximum string length.
public var maxLength: UInt64?


public var requiredFields: [String]?

/// Whether additional properties are allowed (for object type).
public var additionalProperties: Bool?

/// Items schema (for array type).
public var items: Box<JsonSchema>?

/// Allowed values.
public var enumValues: [JSONValue]?

/// Minimum numeric value.
public var minimum: Double?

/// Maximum numeric value.
public var maximum: Double?

/// Minimum string length.
public var minLength: UInt64?

/// Maximum string length.
public var maxLength: UInt64?

// MARK: - CodingKeys

private enum CodingKeys: String, CodingKey

public var additionalProperties: Bool?

/// Items schema (for array type).
public var items: Box<JsonSchema>?

/// Allowed values.
public var enumValues: [JSONValue]?

/// Minimum numeric value.
public var minimum: Double?

/// Maximum numeric value.
public var maximum: Double?

/// Minimum string length.
public var minLength: UInt64?

/// Maximum string length.
public var maxLength: UInt64?

// MARK: - CodingKeys

private enum CodingKeys: String, CodingKey

public var items: Box<JsonSchema>?

/// Allowed values.
public var enumValues: [JSONValue]?

/// Minimum numeric value.
public var minimum: Double?

/// Maximum numeric value.
public var maximum: Double?

/// Minimum string length.
public var minLength: UInt64?

/// Maximum string length.
public var maxLength: UInt64?

// MARK: - CodingKeys

private enum CodingKeys: String, CodingKey

public var enumValues: [JSONValue]?

/// Minimum numeric value.
public var minimum: Double?

/// Maximum numeric value.
public var maximum: Double?

/// Minimum string length.
public var minLength: UInt64?

/// Maximum string length.
public var maxLength: UInt64?

// MARK: - CodingKeys

private enum CodingKeys: String, CodingKey

public var minimum: Double?

/// Maximum numeric value.
public var maximum: Double?

/// Minimum string length.
public var minLength: UInt64?

/// Maximum string length.
public var maxLength: UInt64?

// MARK: - CodingKeys

private enum CodingKeys: String, CodingKey

public var maximum: Double?

/// Minimum string length.
public var minLength: UInt64?

/// Maximum string length.
public var maxLength: UInt64?

// MARK: - CodingKeys

private enum CodingKeys: String, CodingKey

public var minLength: UInt64?

/// Maximum string length.
public var maxLength: UInt64?

// MARK: - CodingKeys

private enum CodingKeys: String, CodingKey

public var maxLength: UInt64?

// MARK: - CodingKeys

private enum CodingKeys: String, CodingKey

public static func string() -> JsonSchema

public static func number() -> JsonSchema

public static func integer() -> JsonSchema

public static func boolean() -> JsonSchema

public static func array() -> JsonSchema

public static func object() -> JsonSchema

public static func null() -> JsonSchema

public func description(_ desc: String) -> JsonSchema

public func property(_ name: String, _ schema: JsonSchema) -> JsonSchema

public func required(_ name: String) -> JsonSchema

public func itemsSchema(_ schema: JsonSchema) -> JsonSchema

public func enumValues(_ values: [JSONValue]) -> JsonSchema

public func minimum(_ min: Double) -> JsonSchema

public func maximum(_ max: Double) -> JsonSchema

public func minLength(_ len: UInt64) -> JsonSchema

public func maxLength(_ len: UInt64) -> JsonSchema

public func additionalProperties(_ allowed: Bool) -> JsonSchema

public func validate(_ value: JSONValue) throws

public final class Box<T: Codable & Sendable & Equatable>: Codable, Sendable, Equatable

public let value: T

public init(_ value: T)

public init(_ value: T)

public static func == (lhs: Box<T>, rhs: Box<T>) -> Bool

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

Telemetry.swift

Read declaration text · 40 declaration entries

public enum SpanAttribute: Codable, Sendable, Equatable

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

public init(stringLiteral value: String)

public init(integerLiteral value: Int64)

public init(floatLiteral value: Double)

public init(booleanLiteral value: Bool)

public enum SpanStatus: Codable, Sendable, Equatable

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

public struct ForgeSpan: Codable, Sendable

public var name: String
/// Span start time.
public var startTime: Timestamp
/// Span end time (set when span completes).
public var endTime: Timestamp?
/// Key-value attributes.
public var attributes: [String: SpanAttribute]
/// Span status.
public var status: SpanStatus
/// Parent span ID for distributed tracing.
public var parentId: String?
/// This span's unique ID.
public var spanId: String

/// Creates a new span with the given name. Start time is set to now.
///
/// - Parameter name: The span name (use dotted notation: "forge.agent.generate").
public init(name: String)

public var startTime: Timestamp
/// Span end time (set when span completes).
public var endTime: Timestamp?
/// Key-value attributes.
public var attributes: [String: SpanAttribute]
/// Span status.
public var status: SpanStatus
/// Parent span ID for distributed tracing.
public var parentId: String?
/// This span's unique ID.
public var spanId: String

/// Creates a new span with the given name. Start time is set to now.
///
/// - Parameter name: The span name (use dotted notation: "forge.agent.generate").
public init(name: String)

public var endTime: Timestamp?
/// Key-value attributes.
public var attributes: [String: SpanAttribute]
/// Span status.
public var status: SpanStatus
/// Parent span ID for distributed tracing.
public var parentId: String?
/// This span's unique ID.
public var spanId: String

/// Creates a new span with the given name. Start time is set to now.
///
/// - Parameter name: The span name (use dotted notation: "forge.agent.generate").
public init(name: String)

public var attributes: [String: SpanAttribute]
/// Span status.
public var status: SpanStatus
/// Parent span ID for distributed tracing.
public var parentId: String?
/// This span's unique ID.
public var spanId: String

/// Creates a new span with the given name. Start time is set to now.
///
/// - Parameter name: The span name (use dotted notation: "forge.agent.generate").
public init(name: String)

public var status: SpanStatus
/// Parent span ID for distributed tracing.
public var parentId: String?
/// This span's unique ID.
public var spanId: String

/// Creates a new span with the given name. Start time is set to now.
///
/// - Parameter name: The span name (use dotted notation: "forge.agent.generate").
public init(name: String)

public var parentId: String?
/// This span's unique ID.
public var spanId: String

/// Creates a new span with the given name. Start time is set to now.
///
/// - Parameter name: The span name (use dotted notation: "forge.agent.generate").
public init(name: String)

public var spanId: String

/// Creates a new span with the given name. Start time is set to now.
///
/// - Parameter name: The span name (use dotted notation: "forge.agent.generate").
public init(name: String)

public init(name: String)

public mutating func setAttribute(_ key: String, _ value: SpanAttribute)

public mutating func end()

public mutating func endWithError(_ message: String)

public func withParent(_ parentId: String) -> ForgeSpan

public struct ForgeEvent: Codable, Sendable

public var name: String
/// When the event occurred.
public var timestamp: Timestamp
/// Key-value attributes.
public var attributes: [String: SpanAttribute]

/// Creates a new event with the given name. Timestamp is set to now.
///
/// - Parameter name: The event name.
public init(name: String)

public var timestamp: Timestamp
/// Key-value attributes.
public var attributes: [String: SpanAttribute]

/// Creates a new event with the given name. Timestamp is set to now.
///
/// - Parameter name: The event name.
public init(name: String)

public var attributes: [String: SpanAttribute]

/// Creates a new event with the given name. Timestamp is set to now.
///
/// - Parameter name: The event name.
public init(name: String)

public init(name: String)

public mutating func setAttribute(_ key: String, _ value: SpanAttribute)

public protocol TelemetryEmitter: Sendable

public struct NoopEmitter: TelemetryEmitter, Sendable

public init()

public func emitSpan(_ span: ForgeSpan)

public func emitEvent(_ event: ForgeEvent)

public final class RecordingEmitter: TelemetryEmitter, @unchecked Sendable

public init()

public func emitSpan(_ span: ForgeSpan)

public func emitEvent(_ event: ForgeEvent)

public var spans: [ForgeSpan]

public var events: [ForgeEvent]

Tool.swift

Read declaration text · 28 declaration entries

public enum ToolTier: String, Codable, Sendable, Hashable, CaseIterable

public var requiresAuthorization: Bool

public var description: String

public struct ToolDefinition: Codable, Sendable, Equatable

public let name: String
/// Human-readable description shown to the model.
public let toolDescription: String
/// JSON Schema defining the tool's parameters.
public let parameters: JsonSchema
/// Tier classification (Platform/External/Embedded).
public let tier: ToolTier

private enum CodingKeys: String, CodingKey

public let toolDescription: String
/// JSON Schema defining the tool's parameters.
public let parameters: JsonSchema
/// Tier classification (Platform/External/Embedded).
public let tier: ToolTier

private enum CodingKeys: String, CodingKey

public let parameters: JsonSchema
/// Tier classification (Platform/External/Embedded).
public let tier: ToolTier

private enum CodingKeys: String, CodingKey

public let tier: ToolTier

private enum CodingKeys: String, CodingKey

public static func builder(_ name: String) -> ToolDefinitionBuilder

public struct ToolDefinitionBuilder: Sendable

public func description(_ desc: String) -> ToolDefinitionBuilder

public func parameters(_ schema: JsonSchema) -> ToolDefinitionBuilder

public func tier(_ tier: ToolTier) -> ToolDefinitionBuilder

public func build() -> ToolDefinition

public struct ToolCall: Codable, Sendable, Equatable

public let id: String
/// The tool name being invoked.
public let name: String
/// JSON arguments for the tool.
public let arguments: JSONValue

public init(id: String, name: String, arguments: JSONValue)

public let name: String
/// JSON arguments for the tool.
public let arguments: JSONValue

public init(id: String, name: String, arguments: JSONValue)

public let arguments: JSONValue

public init(id: String, name: String, arguments: JSONValue)

public init(id: String, name: String, arguments: JSONValue)

public struct ToolResult: Codable, Sendable, Equatable

public let toolCallId: String
/// The tool name.
public let name: String
/// The result content (stringified).
public let content: String
/// Whether the tool execution resulted in an error.
public let isError: Bool

public init(toolCallId: String, name: String, content: String, isError: Bool)

public let name: String
/// The result content (stringified).
public let content: String
/// Whether the tool execution resulted in an error.
public let isError: Bool

public init(toolCallId: String, name: String, content: String, isError: Bool)

public let content: String
/// Whether the tool execution resulted in an error.
public let isError: Bool

public init(toolCallId: String, name: String, content: String, isError: Bool)

public let isError: Bool

public init(toolCallId: String, name: String, content: String, isError: Bool)

public init(toolCallId: String, name: String, content: String, isError: Bool)

public enum ToolApproval: Sendable, Equatable

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

Topology.swift

Read declaration text · 32 declaration entries

public let defaultRole: String;

public enum CostPreference: String, Codable, Sendable, Hashable, CaseIterable

public enum LatencyPreference: String, Codable, Sendable, Hashable, CaseIterable

public struct ModelSlot: Codable, Sendable

public let role: String

/// Primary model for this slot.
public let primary: ProviderRef

/// Ordered fallback models. Tried in sequence when the primary is
/// unavailable or fails negotiation.
public var fallbacks: [ProviderRef]

/// Runtime capabilities required for this slot.
public var requiredCapabilities: [RuntimeCapability]

/// Optional cost preference for the router.
public var costPreference: CostPreference?

/// Optional latency preference for the router.
public var latencyPreference: LatencyPreference?

/// Optional Arsenal scope narrowing applied when this slot is selected.
public var arsenalScopeNarrowing: [String]?

public init(
role: String,
primary: ProviderRef,
fallbacks: [ProviderRef];

public let primary: ProviderRef

/// Ordered fallback models. Tried in sequence when the primary is
/// unavailable or fails negotiation.
public var fallbacks: [ProviderRef]

/// Runtime capabilities required for this slot.
public var requiredCapabilities: [RuntimeCapability]

/// Optional cost preference for the router.
public var costPreference: CostPreference?

/// Optional latency preference for the router.
public var latencyPreference: LatencyPreference?

/// Optional Arsenal scope narrowing applied when this slot is selected.
public var arsenalScopeNarrowing: [String]?

public init(
role: String,
primary: ProviderRef,
fallbacks: [ProviderRef];

public var fallbacks: [ProviderRef]

/// Runtime capabilities required for this slot.
public var requiredCapabilities: [RuntimeCapability]

/// Optional cost preference for the router.
public var costPreference: CostPreference?

/// Optional latency preference for the router.
public var latencyPreference: LatencyPreference?

/// Optional Arsenal scope narrowing applied when this slot is selected.
public var arsenalScopeNarrowing: [String]?

public init(
role: String,
primary: ProviderRef,
fallbacks: [ProviderRef];

public var requiredCapabilities: [RuntimeCapability]

/// Optional cost preference for the router.
public var costPreference: CostPreference?

/// Optional latency preference for the router.
public var latencyPreference: LatencyPreference?

/// Optional Arsenal scope narrowing applied when this slot is selected.
public var arsenalScopeNarrowing: [String]?

public init(
role: String,
primary: ProviderRef,
fallbacks: [ProviderRef];

public var costPreference: CostPreference?

/// Optional latency preference for the router.
public var latencyPreference: LatencyPreference?

/// Optional Arsenal scope narrowing applied when this slot is selected.
public var arsenalScopeNarrowing: [String]?

public init(
role: String,
primary: ProviderRef,
fallbacks: [ProviderRef];

public var latencyPreference: LatencyPreference?

/// Optional Arsenal scope narrowing applied when this slot is selected.
public var arsenalScopeNarrowing: [String]?

public init(
role: String,
primary: ProviderRef,
fallbacks: [ProviderRef];

public var arsenalScopeNarrowing: [String]?

public init(
role: String,
primary: ProviderRef,
fallbacks: [ProviderRef];

public init(
role: String,
primary: ProviderRef,
fallbacks: [ProviderRef];

public struct ModelTopology: Codable, Sendable

public var name: String

public var defaultRoleName: String

public var slots: [String: ModelSlot]

public var slotCount: Int

public func hasRole(_ role: String) -> Bool

public var defaultSlot: ModelSlot

public func slotForRole(_ role: String) -> ModelSlot

public func allProviderRefs() -> [ProviderRef]

public static func single(_ providerRef: ProviderRef) -> ModelTopology

public static func builder() -> TopologyBuilder

public final class TopologyBuilder: @unchecked Sendable

public func name(_ name: String) -> TopologyBuilder

public func slot(_ role: String, _ primary: ProviderRef) -> TopologyBuilder

public func withFallback(_ role: String, _ fallback: ProviderRef) -> TopologyBuilder

public func withRequiredCapability(_ role: String, _ capability: RuntimeCapability) -> TopologyBuilder

public func withCostPreference(_ role: String, _ pref: CostPreference) -> TopologyBuilder

public func withLatencyPreference(_ role: String, _ pref: LatencyPreference) -> TopologyBuilder

public func withScopeNarrowing(_ role: String, _ scopes: [String]) -> TopologyBuilder

public func build() throws -> ModelTopology

Types.swift

Read declaration text · 28 declaration entries

public enum JSONValue: Sendable, Equatable, Hashable

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

public init(stringLiteral value: String)

public init(integerLiteral value: Int)

public init(floatLiteral value: Double)

public init(booleanLiteral value: Bool)

public init(nilLiteral: ())

public init(arrayLiteral elements: JSONValue...)

public init(dictionaryLiteral elements: (String, JSONValue)...)

public var description: String

public struct AgentDid: Codable, Sendable, Hashable, Equatable

public init?(_ did: String)

public static func fromTrusted(_ trustedDid: String) -> AgentDid

public var asString: String

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

public var description: String

public struct Timestamp: Codable, Sendable, Equatable, Comparable

public let date: Date

/// Creates a `Timestamp` for the current UTC time.
public static func now() -> Timestamp

public static func now() -> Timestamp

public init(date: Date)

public init?(iso8601 string: String)

public func toISO8601() -> String

public static func < (lhs: Timestamp, rhs: Timestamp) -> Bool

public init(from decoder: Decoder) throws

public func encode(to encoder: Encoder) throws

public var description: String

Continue

On this page