Repository navigation
feat(client): provide() — the serve side of the Command primitive (bidirectional commands) - #1664
Merged
Merged
Conversation
…directional commands)
This was referenced Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The serve side of the Command primitive — the third of the four SDK facade verbs (
execute+subscribeshipped in #1663; this isprovide;emitfollows once the substrate'sEventPublishAdapterlands). A client can now provide (serve) a command, not just call one — for client-provided commands the core can't run:interface/screenshot, capture, sensors (the SDK's display / renderer / hardware). OpenCV-style adapter polymorphism: one command identity, N platform handlers (web = DOM/canvas, AR/VR = renderer capture).How (the serve side on the Transport trait — M5's design call)
continuum-clientTransport trait gainsprovide(command, Arc<dyn ServeHandler>)+revoke(command)(+ theServeHandlertrait). Symmetric withrequest— one trait owns the Command primitive both ways.AircIpcTransportreal serve loop: the client-side twin ofpersona/command_inbound_pump.rs— a second broadcast subscribe, decode inboundAircCommandRequest(reply-to/correlation from theairc.*headers), dispatch to the registered handler, replyAircCommandResponseviaairc.reply. Same protocol types asrequest→ zero wire drift. Dispatch is spawned per request so a slow handler (a screenshot) doesn't stall the loop; the loop starts once on firstprovide.MockTransportserve registry +dispatch_provided(command, params)to exercise the serve path without a live daemon.Connectiongainsprovide/revoke+ a manualClone(shares the oneArc<T>; derivedClonewould wrongly demandT: Clone).continuum-client-ffi):provide(command, Arc<dyn CommandHandler>) -> Registration(drop = revoke, the serve twin ofSubscription).CommandHandler { handle(params_json) -> Result<String, FfiError> }is the foreign callback (mirror ofEventCallback); the adapter runs it onspawn_blockingso a heavy handler stays off the async worker (off-main-thread).Validation
cargo fmt+cargo clippy -D warnings+cargo test— continuum-client 18 tests, facade 7 tests (4 prior + 3 new: provided-handler-answers, handler-error→Refused, revoke-stops-serving). Serve path validated end-to-end viaMockTransport(register → dispatch → handler → result), no live daemon.Also: a one-line dep (
airc-protocolworkspace dep — the crate the substrate'scommand_handlerreads the correlation/reply-to header keys from, zero drift) and two trivial pre-existing clippy nits in continuum-client's existing tests, fixed in passing.Next
emit(the publish verb) once the substrate-sideEventPublishAdapter(the receive-door twin ofEventSubscribeAdapter) lands — then the uniffi.udlbinds all four verbs in one pass → native swift/kotlin SDKs (Android here, xcframework on macOS CI). Env-targeting (airc://peer:env/path) composes as an internal filter once #1662'sCommandUrilands —provide's signature is env-agnostic.🤖 Generated with Claude Code