ForgeComm
Swift ForgeComm library product.
Swift ForgeComm library product.
Package contract
| Field | Value |
|---|---|
| Language | swift |
| Source version | Swift package source snapshot |
| Manifest | forge-swift/Package.swift |
| Source files | 6 |
| Evidence | Source reference; registry publication and runtime conformance are separate checks |
Import boundary
import ForgeCommUse 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.
AgentMessage.swift
Read declaration text · 13 declaration entries
public struct AgentCommMessage: Codable, Sendable, Equatable
public let id: String
/// Correlation ID for linking related messages (request/response pairs).
///
/// When a message is a reply, `correlationId` matches the original
/// message's `id`. This enables reliable request/response pairing
/// across async transports.
public let correlationId: String?
/// The message ID this message is a reply to.
///
/// Used in conjunction with `correlationId` for explicit reply chains.
public let replyTo: String?
/// The sender agent's DID.
public let sender: String
/// The recipient agent's DID.
public let recipient: String
/// The communication protocol identifier.
///
/// Examples: `"forge.delegation.v1"`, `"forge.heartbeat.v1"`,
/// `"forge.task.v1"`.
public let `protocol`: String
public let correlationId: String?
/// The message ID this message is a reply to.
///
/// Used in conjunction with `correlationId` for explicit reply chains.
public let replyTo: String?
/// The sender agent's DID.
public let sender: String
/// The recipient agent's DID.
public let recipient: String
/// The communication protocol identifier.
///
/// Examples: `"forge.delegation.v1"`, `"forge.heartbeat.v1"`,
/// `"forge.task.v1"`.
public let `protocol`: String
/// The message type within the protocol.
///
/// Examples: `"request"`, `"response"`, `"notification"`,
/// `"task_assign"`, `"task_result"`.
public let messageType: String
/// The message payload.
public let replyTo: String?
/// The sender agent's DID.
public let sender: String
/// The recipient agent's DID.
public let recipient: String
/// The communication protocol identifier.
///
/// Examples: `"forge.delegation.v1"`, `"forge.heartbeat.v1"`,
/// `"forge.task.v1"`.
public let `protocol`: String
/// The message type within the protocol.
///
/// Examples: `"request"`, `"response"`, `"notification"`,
/// `"task_assign"`, `"task_result"`.
public let messageType: String
/// The message payload.
public let payload: JSONValue
/// Optional Ed25519 signature over the message content.
///
/// When present, the signature covers the canonical JSON serialization
public let sender: String
/// The recipient agent's DID.
public let recipient: String
/// The communication protocol identifier.
///
/// Examples: `"forge.delegation.v1"`, `"forge.heartbeat.v1"`,
/// `"forge.task.v1"`.
public let `protocol`: String
/// The message type within the protocol.
///
/// Examples: `"request"`, `"response"`, `"notification"`,
/// `"task_assign"`, `"task_result"`.
public let messageType: String
/// The message payload.
public let payload: JSONValue
/// Optional Ed25519 signature over the message content.
///
/// When present, the signature covers the canonical JSON serialization
/// of (id, correlationId, sender, recipient, protocol, messageType, payload).
/// Verification uses the sender's public key from their OAS DID document.
public let signature: String?
public let recipient: String
/// The communication protocol identifier.
///
/// Examples: `"forge.delegation.v1"`, `"forge.heartbeat.v1"`,
/// `"forge.task.v1"`.
public let `protocol`: String
/// The message type within the protocol.
///
/// Examples: `"request"`, `"response"`, `"notification"`,
/// `"task_assign"`, `"task_result"`.
public let messageType: String
/// The message payload.
public let payload: JSONValue
/// Optional Ed25519 signature over the message content.
///
/// When present, the signature covers the canonical JSON serialization
/// of (id, correlationId, sender, recipient, protocol, messageType, payload).
/// Verification uses the sender's public key from their OAS DID document.
public let signature: String?
/// When the message was created.
public let timestamp: Timestamp
public let `protocol`: String
/// The message type within the protocol.
///
/// Examples: `"request"`, `"response"`, `"notification"`,
/// `"task_assign"`, `"task_result"`.
public let messageType: String
/// The message payload.
public let payload: JSONValue
/// Optional Ed25519 signature over the message content.
///
/// When present, the signature covers the canonical JSON serialization
/// of (id, correlationId, sender, recipient, protocol, messageType, payload).
/// Verification uses the sender's public key from their OAS DID document.
public let signature: String?
/// When the message was created.
public let timestamp: Timestamp
/// Creates a new agent communication message.
///
/// - Parameters:
/// - id: Unique message identifier. Defaults to a new UUID.
/// - correlationId: Optional correlation ID for request/response pairing.
public let messageType: String
/// The message payload.
public let payload: JSONValue
/// Optional Ed25519 signature over the message content.
///
/// When present, the signature covers the canonical JSON serialization
/// of (id, correlationId, sender, recipient, protocol, messageType, payload).
/// Verification uses the sender's public key from their OAS DID document.
public let signature: String?
/// When the message was created.
public let timestamp: Timestamp
/// Creates a new agent communication message.
///
/// - Parameters:
/// - id: Unique message identifier. Defaults to a new UUID.
/// - correlationId: Optional correlation ID for request/response pairing.
/// - replyTo: Optional message ID this message replies to.
/// - sender: The sender agent's DID.
/// - recipient: The recipient agent's DID.
/// - protocol: The communication protocol identifier.
/// - messageType: The message type within the protocol.
/// - payload: The message payload.
public let payload: JSONValue
/// Optional Ed25519 signature over the message content.
///
/// When present, the signature covers the canonical JSON serialization
/// of (id, correlationId, sender, recipient, protocol, messageType, payload).
/// Verification uses the sender's public key from their OAS DID document.
public let signature: String?
/// When the message was created.
public let timestamp: Timestamp
/// Creates a new agent communication message.
///
/// - Parameters:
/// - id: Unique message identifier. Defaults to a new UUID.
/// - correlationId: Optional correlation ID for request/response pairing.
/// - replyTo: Optional message ID this message replies to.
/// - sender: The sender agent's DID.
/// - recipient: The recipient agent's DID.
/// - protocol: The communication protocol identifier.
/// - messageType: The message type within the protocol.
/// - payload: The message payload.
/// - signature: Optional Ed25519 signature.
/// - timestamp: Message creation time. Defaults to now.
public init(
public let signature: String?
/// When the message was created.
public let timestamp: Timestamp
/// Creates a new agent communication message.
///
/// - Parameters:
/// - id: Unique message identifier. Defaults to a new UUID.
/// - correlationId: Optional correlation ID for request/response pairing.
/// - replyTo: Optional message ID this message replies to.
/// - sender: The sender agent's DID.
/// - recipient: The recipient agent's DID.
/// - protocol: The communication protocol identifier.
/// - messageType: The message type within the protocol.
/// - payload: The message payload.
/// - signature: Optional Ed25519 signature.
/// - timestamp: Message creation time. Defaults to now.
public init(
id: String;
public let timestamp: Timestamp
/// Creates a new agent communication message.
///
/// - Parameters:
/// - id: Unique message identifier. Defaults to a new UUID.
/// - correlationId: Optional correlation ID for request/response pairing.
/// - replyTo: Optional message ID this message replies to.
/// - sender: The sender agent's DID.
/// - recipient: The recipient agent's DID.
/// - protocol: The communication protocol identifier.
/// - messageType: The message type within the protocol.
/// - payload: The message payload.
/// - signature: Optional Ed25519 signature.
/// - timestamp: Message creation time. Defaults to now.
public init(
id: String;
public init(
id: String;
public func reply(
messageType: String,
payload: JSONValue,
signature: String?;ChannelTransport.swift
Read declaration text · 5 declaration entries
public func createChannelPair() -> (ChannelTransport, ChannelTransport)
public final class ChannelTransport: MessageTransport, @unchecked Sendable
public func send(_ message: AgentCommMessage) async throws
public func receive() async throws -> AgentCommMessage?
public func close() asyncCommError.swift
Read declaration text · 2 declaration entries
public enum CommError: Error, Sendable, Equatable
public var errorDescription: String?MessageTransport.swift
Read declaration text · 1 declaration entries
public protocol MessageTransport: SendableNoopTransport.swift
Read declaration text · 5 declaration entries
public final class NoopTransport: MessageTransport, @unchecked Sendable
public init()
public func send(_ message: AgentCommMessage) async throws
public func receive() async throws -> AgentCommMessage?
public func close() asyncProtocolNegotiation.swift
Read declaration text · 11 declaration entries
public struct ProtocolOffer: Codable, Sendable, Equatable
public let offererDid: String
/// The list of supported protocol identifiers, in preference order.
public let protocols: [String]
/// When the offer was created.
public let timestamp: Timestamp
/// Creates a new protocol offer.
///
/// - Parameters:
/// - offererDid: The offering agent's DID.
/// - protocols: Supported protocol identifiers in preference order.
/// - timestamp: Offer creation time. Defaults to now.
public init(
offererDid: String,
protocols: [String],
timestamp: Timestamp;
public let protocols: [String]
/// When the offer was created.
public let timestamp: Timestamp
/// Creates a new protocol offer.
///
/// - Parameters:
/// - offererDid: The offering agent's DID.
/// - protocols: Supported protocol identifiers in preference order.
/// - timestamp: Offer creation time. Defaults to now.
public init(
offererDid: String,
protocols: [String],
timestamp: Timestamp;
public let timestamp: Timestamp
/// Creates a new protocol offer.
///
/// - Parameters:
/// - offererDid: The offering agent's DID.
/// - protocols: Supported protocol identifiers in preference order.
/// - timestamp: Offer creation time. Defaults to now.
public init(
offererDid: String,
protocols: [String],
timestamp: Timestamp;
public init(
offererDid: String,
protocols: [String],
timestamp: Timestamp;
public struct ProtocolAccept: Codable, Sendable, Equatable
public let accepterDid: String
/// The selected protocol identifier.
public let selectedProtocol: String
/// When the acceptance was created.
public let timestamp: Timestamp
/// Creates a new protocol acceptance.
///
/// - Parameters:
/// - accepterDid: The accepting agent's DID.
/// - selectedProtocol: The selected protocol identifier.
/// - timestamp: Acceptance creation time. Defaults to now.
public init(
accepterDid: String,
selectedProtocol: String,
timestamp: Timestamp;
public let selectedProtocol: String
/// When the acceptance was created.
public let timestamp: Timestamp
/// Creates a new protocol acceptance.
///
/// - Parameters:
/// - accepterDid: The accepting agent's DID.
/// - selectedProtocol: The selected protocol identifier.
/// - timestamp: Acceptance creation time. Defaults to now.
public init(
accepterDid: String,
selectedProtocol: String,
timestamp: Timestamp;
public let timestamp: Timestamp
/// Creates a new protocol acceptance.
///
/// - Parameters:
/// - accepterDid: The accepting agent's DID.
/// - selectedProtocol: The selected protocol identifier.
/// - timestamp: Acceptance creation time. Defaults to now.
public init(
accepterDid: String,
selectedProtocol: String,
timestamp: Timestamp;
public init(
accepterDid: String,
selectedProtocol: String,
timestamp: Timestamp;
public func negotiateProtocol(
offer: ProtocolOffer,
supportedProtocols: [String],
responderDid: String
) throws -> ProtocolAccept