Objects
IsolateGlobals and SmartApp
The names a smart app sets on globalThis, and the typed view of them.
IsolateGlobals
Definition
interface IsolateGlobals {
definition: SmartAppDefinition;
preferences: SmartAppPreferences;
installed?: () => void | Promise<void>;
updated?: () => void | Promise<void>;
uninstalled?: () => void | Promise<void>;
// Operator-invoked "run now" / test-fire. Fired by
// SmartAppManager.runSmartAppInstance — wired to the Run button in
// the admin UI. Subscriptions and the runner's running state are
// left alone; this is purely a synchronous one-shot dispatch of
// whatever the smart app considers a manual run (e.g. SimpleRule
// fires every configured action). Distinct from pause/resume, which
// own the RUNNING/PAUSED lifecycle.
run?: () => void | Promise<void>;
// Mutable per-instance state. Injected from the runner before each handler
// runs and copied back out + persisted after the handler returns (see
// `SmartAppEngine.runHandler`). Survives restarts. Each smart app narrows
// this via the second `SmartApp<Inputs, State>` type parameter.
state: Record<string, unknown>;
}Members
| Name | Type | Optional | Description |
|---|---|---|---|
definition | SmartAppDefinition | no | — |
preferences | SmartAppPreferences | no | — |
installed | () => void | Promise<void> | yes | — |
updated | () => void | Promise<void> | yes | — |
uninstalled | () => void | Promise<void> | yes | — |
run | () => void | Promise<void> | yes | Operator-invoked "run now" / test-fire. Fired by SmartAppManager.runSmartAppInstance — wired to the Run button in the admin UI. Subscriptions and the runner's running state are left alone; this is purely a synchronous one-shot dispatch of whatever the smart app considers a manual run (e.g. SimpleRule fires every configured action). Distinct from pause/resume, which own the RUNNING/PAUSED lifecycle. |
state | Record<string, unknown> | no | Mutable per-instance state. Injected from the runner before each handler runs and copied back out + persisted after the handler returns (see SmartAppEngine.runHandler). Survives restarts. Each smart app narrows this via the second SmartApp<Inputs, State> type parameter. |
apps/edge-runtime/src/core/smartapp/builtin/ambient.d.ts:387
SmartApp
Typed globalThis view for a smart app: platform exports + the per-app input names the bootstrap hydrates, plus the per-app state shape. Use as
const $g = globalThis as unknown as SmartApp< { motionSensor: Entity | undefined; light: Entity | undefined; delaySec: number | undefined; }, { motionCount?: number; lastMotionAt?: string; } >;
Inputs is required to be passed explicitly (no {} default) so an author who forgets to declare inputs gets a "missing type argument" error instead of silently typing input access as unknown. State defaults to an open record for apps that don't persist anything.
Definition
type SmartApp<Inputs, State extends Record<string, unknown> = Record<string, unknown>> =
Omit<IsolateGlobals, 'state'> & { state: State } & Inputs;apps/edge-runtime/src/core/smartapp/builtin/ambient.d.ts:427
Generated from docs-bundle v0.1.0, novon-platform 9ce3486c (2026-10-09).