This package is organized into layered SwiftPM targets so core concerns remain isolated while exposing a simple top-level facade. The GitHub Pages documentation site publishes the same SDK-first view through Swift-DocC; this page is the compact in-repo companion for contributors and integrators.
-
OpenClawProtocol- Transport models (
RequestFrame,ResponseFrame,EventFrame,GatewayFrame) - Protocol version and error code constants
- Synced from the pinned upstream OpenClaw generated Swift snapshot via
Scripts/protocol-gen-swift.mjsand the local.codex/openclawcheckout
- Transport models (
-
OpenClawCore- Cross-platform shims (crypto/network/security/process/fs)
- Config and session persistence
- CredentialStore abstractions (
KeychainCredentialStore+FileCredentialStore) - Cron, hooks, security runtime state, and security audit reporting (
SecurityAuditRunner) - Diagnostics and usage aggregation (
RuntimeDiagnosticsPipeline)
-
OpenClawGateway- Actor-safe transport client
- Socket abstraction (
GatewaySocket) - Reconnect/watchdog and pending-request lifecycle
-
OpenClawAgents- Tool registry and runtime lifecycle events
- Timeout-aware run execution and orchestration
- Streaming run execution (
runStream) for progressive output consumers - Structured runtime diagnostics emission (
run.*,model.call.*)
-
OpenClawPlugins- Static plugin API (Swift protocols, no runtime JS loading)
- Hook dispatch, custom gateway methods, service lifecycle
-
OpenClawChannels- Channel adapters and outbound routing
- Auto-reply engine integrating sessions + runtime execution
- Delivery health snapshots, retry/backoff policy, throttling controls, and command handlers
- Typing heartbeat lifecycle for long-running Discord/Telegram reply flows
-
OpenClawMemoryandOpenClawMedia- Memory indexing/search primitives
- Media normalization, MIME classification, and limits
-
OpenClawKit- Facade API (
OpenClawSDK) exposing primary integration points - Re-exports lower-level modules for advanced use
- Facade API (
- Mutable runtime state is actor-isolated.
- Public model types are
Sendable. - Cross-task callbacks are
@Sendable. - Networking safety is validated by
Scripts/check-networking-concurrency.sh.
AutoReplyEngine and EmbeddedAgentRuntime emit RuntimeDiagnosticEvent payloads
into an injected RuntimeDiagnosticSink. Host apps can plug a
RuntimeDiagnosticsPipeline sink to:
- retain recent event timelines (
recentEvents(limit:)) - inspect aggregate usage (
usageSnapshot()) - power app-level diagnostics surfaces (for example, the expanded iOS sample tabs)
OpenClawSDK.runSecurityAudit(...) can also publish structured security subsystem
events (audit.completed, audit.finding) into the same pipeline.
When adding new features:
- add protocol surface in
OpenClawProtocolfirst (if needed) - add core/runtime capability in the appropriate module target
- wire facade entry points in
OpenClawSDKonly after lower layers are tested - add unit + E2E coverage with Swift Testing
- prefer user-facing conceptual docs in the DocC catalog, and keep this file focused on stable architecture notes