You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement the shell.annotations.onChanged({ target, namespace, handle }) API per foundation §419. Apps subscribe to annotation changes by target+namespace and receive callbacks when matching events flow through the Event Bus.
Background
Sprint that closed sdk#15 landed set / get / clear for shell.annotations, but onChanged was deferred because os-sdk has only a producer-side Event Bus interface (UnixEventEmitter). Subscribing requires a consumer-side counterpart.
Scope
os-sdk Event Bus consumer — new module sdk/os-sdk/src/event_consumer.rs:
EventConsumer trait + UnixEventConsumer impl
Connects to the consumer socket (/run/lunaris/event-bus-consumer.sock), registers with a stable consumer id derived from app_id, subscribes to event-type prefixes
Returns an async-stream-ish or callback-based interface
Mirror MockEventEmitter with MockEventConsumer for tests
Annotations::on_changed in os-sdk:
Spawns a consumer subscription filtered to app.annotation.set and app.annotation.cleared
Filters by target + namespace client-side (cheap; the daemon broadcasts all matching apps' events)
Returns a handle that drops the subscription when dropped (RAII)
tauri-plugin-shell: shell_annotation_subscribe Tauri command that wires onChanged callback through Tauri events (lunaris://annotation-changed)
TS surface: shell.annotations.onChanged({ target, namespace }, handle) returns an unsubscribe function
Out of scope
Cross-namespace subscription rate-limiting (defer to capability-token Phase 3.2-full)
onChanged for non-annotation event types (presence/timeline) — those have no defined onChanged in foundation
Acceptance
App calls shell.annotations.onChanged; another app calls shell.annotations.set with matching target+namespace; first app's handler fires within ~100ms
Drop / unsubscribe correctly tears down the subscription (no event leak in tests)
Tests cover: matching event fires, non-matching event ignored, drop unsubscribes
Phase
Phase 6 follow-up. Discovered during sdk#15 sprint as deferred scope.
Goal
Implement the
shell.annotations.onChanged({ target, namespace, handle })API per foundation §419. Apps subscribe to annotation changes by target+namespace and receive callbacks when matching events flow through the Event Bus.Background
Sprint that closed sdk#15 landed set / get / clear for shell.annotations, but
onChangedwas deferred because os-sdk has only a producer-side Event Bus interface (UnixEventEmitter). Subscribing requires a consumer-side counterpart.Scope
os-sdk Event Bus consumer — new module
sdk/os-sdk/src/event_consumer.rs:EventConsumertrait +UnixEventConsumerimpl/run/lunaris/event-bus-consumer.sock), registers with a stable consumer id derived from app_id, subscribes to event-type prefixesasync-stream-ish or callback-based interfaceAnnotations::on_changed in os-sdk:
app.annotation.setandapp.annotation.clearedtauri-plugin-shell:
shell_annotation_subscribeTauri command that wires onChanged callback through Tauri events (lunaris://annotation-changed)TS surface:
shell.annotations.onChanged({ target, namespace }, handle)returns an unsubscribe functionOut of scope
Acceptance
shell.annotations.onChanged; another app callsshell.annotations.setwith matching target+namespace; first app's handler fires within ~100msPhase
Phase 6 follow-up. Discovered during sdk#15 sprint as deferred scope.