mirror of
https://github.com/wu736139669/hapi.git
synced 2026-10-08 19:19:42 +00:00
APIClient (final class, Sendable) with typed endpoints for the M2/M3 REST
surface behind an HTTPPerforming seam; actor AuthManager with single-flight
JWT refresh (POST /api/auth), proactive refresh 10 min before exp, terminal
authFailed state, and 401 -> refresh -> retry-once wiring per
docs/api/client-contract/auth.md; Keychain credential store (per-hub records
under run.hapi.companion) with CredentialStoring seam + in-memory double;
HubRegistry (ordered hubs + active hub in injectable UserDefaults, origin
normalization); payload-only JWT decoding; APIError {status, code, body}
parsing per errors.md; minimal multipart builder for M4c dictation; 256 MB
URLCache session for generated images.
Request/response wire models (SendMessageRequest, PermissionApproveRequest,
SpawnRequest/SpawnResponse, MessagesQuery, envelopes, RPC-wrapped shapes)
join HapiProtocol/Models mirroring shared/src/apiTypes.ts.
swift-testing coverage: JWT decode (padding/garbage/hostile exp), auth
single-flight (8 concurrent callers -> one exchange), 401 retry-once and
terminal paths, APIError body parsing, endpoint request construction
byte-checks (cursor queries, deliveryMode body, answers formats, explicit
null model reset) via a recording performer, hub URL normalization,
multipart bytes.
16 lines
565 B
Swift
16 lines
565 B
Swift
import Foundation
|
|
import HapiProtocol
|
|
|
|
/// Version anchor for the transport layer.
|
|
///
|
|
/// As of M1b the target carries `APIClient` + typed endpoints, `AuthManager`
|
|
/// (single-flight JWT refresh), the Keychain credential store, `HubRegistry`,
|
|
/// and the multipart builder; SSEClient and the stores arrive in M1c+.
|
|
public enum HapiClientVersion {
|
|
/// Version of the HapiKit client scaffold.
|
|
public static let current = "0.1.0"
|
|
|
|
/// Highest hub protocol generation this client speaks.
|
|
public static let protocolVersion = ProtocolVersion.supported
|
|
}
|