HostActionContext
interfaceThe context an interceptor runs in, not the one a handler runs in. It is deliberately narrower than ContextBase. An interceptor sits in the middle of an action that is already running, so state arrives as a StateSnapshot read at this instant rather than a live handle, and there is no `on`, no `emit`, and no writable state. Reach for the members here to decide whether the action should proceed.
Import
import { HostActionContext } from '@modular/sdk';Members12
- actionoptional
HostActionEnvelope<HostActionId>The full envelope, present whenever an action is actually in flight.
- actions
HostActionRunnerDispatch another action, for example to repair state before continuing.
- actor
HostActorWho caused the action being intercepted.
- ai
AiRuntimeApiText answers, agents, models, and sessions.
- clipboard
HostClipboardCapabilitiesClipboard writes.
- commands
CommandsViewApiRun a command by id.
- events
HostEventCapabilitiesObserve commits made while this interceptor is alive.
- scope
HostScopeWhere it applies.
- signal
HostActionAbortSignalCancellation for the run you are sitting inside.
- source
HostActionSourceHow it was triggered.
- trace
HostTraceContextThe trace this interceptor's work is recorded under.
- state
<TValue>(declaration: StateDeclaration<TValue>) => StateSnapshot<TValue> | <TName extends 'editor.selection' | 'host.scope' | 'workbench.colorTheme' | 'workbench.layout' | 'workbench.windowState' | 'workspace.focusedEditorGroupTab'>(name: TName) => StateSnapshot<BuiltInStateValue<TName>>Reads state as of now. Snapshots do not update, unlike handles.
Notes
- category
- Context