com um clique
add-method
// Adds a new ACP protocol method to the SDK with proper typing, documentation, and tests.
// Adds a new ACP protocol method to the SDK with proper typing, documentation, and tests.
Synchronizes Swift types with the ACP protocol schema. Use when updating SDK types to match the latest protocol specification.
Tests the ACP Swift SDK against multiple ACP agents (qwen, gemini, claude-code-acp) to verify compatibility.
Updates golden test files from the Python SDK for cross-SDK compatibility verification.
| name | add-method |
| description | Adds a new ACP protocol method to the SDK with proper typing, documentation, and tests. |
Adds a new ACP protocol method to the SDK.
User says: "/add-method " (e.g., "/add-method session/fork")
Look up method in schema (schema.json or schema.unstable.json) for:
Create Method enum in appropriate file:
Client/Methods/SessionMethods.swiftClient/Methods/Initialize.swiftAdd deprecation warning if unstable:
@available(*, deprecated, message: "Unstable ACP API - may change without notice")
Add convenience method to Client (if appropriate):
extension Client {
public func forkSession(sessionID: String) async throws -> SessionFork.Result {
try await send(SessionFork.request(
id: .sequential(from: &nextRequestID),
SessionFork.Parameters(sessionID: sessionID)
))
}
}
Add golden test if available
Run tests to verify:
swift test
// MARK: - method/name
/// Description of what this method does.
public enum MethodName: Method {
public static let name = "method/name"
public struct Parameters: Codable, Hashable, Sendable {
/// Description of parameter.
public var param: String
private enum CodingKeys: String, CodingKey {
case param = "paramName"
}
public init(param: String) {
self.param = param
}
}
public struct Result: Codable, Hashable, Sendable {
/// Description of result.
public var result: String
public init(result: String) {
self.result = result
}
}
}
PascalCase (e.g., SessionNew, SessionPrompt)"session/new", "session/prompt")camelCase with CodingKeys for snake_case JSONID suffix (e.g., sessionID, toolCallID)swift test passes