Files
luma/Luma/InstrumentSessionKey.swift
Ole André Vadla Ravnås 26d687cecd Wire widgets through agent, UI, and collab
Engine owns the widget state cache, applies inbound updates from
the agent, persists session-scoped widgets, and broadcasts to
collaborating peers (action invocations route to the host).
Renderers in both UIs read the cache and the unified update
stream, with a Clear button that propagates to peers.

Agent SDK adds ctx.widget(id) with push/upsertItem/removeItem/
clear, plus a typed onAction handler. create() now takes a
restored snapshot seeded from persisted state and the join
snapshot.

Per-def .d.ts narrows the widget map, restored shape, and action
union to the exact ids declared in the editor.
2026-05-10 21:02:42 +02:00

23 lines
645 B
Swift

import LumaCore
import SwiftUI
private struct InstrumentSessionKey: EnvironmentKey {
static let defaultValue: LumaCore.ProcessSession? = nil
}
private struct InstrumentInstanceKey: EnvironmentKey {
static let defaultValue: LumaCore.InstrumentInstance? = nil
}
extension EnvironmentValues {
var instrumentSession: LumaCore.ProcessSession? {
get { self[InstrumentSessionKey.self] }
set { self[InstrumentSessionKey.self] = newValue }
}
var instrumentInstance: LumaCore.InstrumentInstance? {
get { self[InstrumentInstanceKey.self] }
set { self[InstrumentInstanceKey.self] = newValue }
}
}