Core
Every export of the package root: engine, levels, strategies, presence, sessions, gate, deferral, demand, metrics, and compatibility.
Every export of @kumbatio/energy-system, generated from the declarations of the installed package (v2.1.1).
import { DEFERRAL_PRESET_IDS, ENERGY_LEVEL_VALUES, ENERGY_PRESENCE_VALUES } from '@kumbatio/energy-system'46 value exports and 53 type exports.
Functions
createDeferralPresets
export declare function createDeferralPresets(options?: DeferralPresetOptions): readonly DeferralPreset[];Build the standard deferral presets. Times are computed in local time - "tomorrow morning" means the user's morning.
createEnergyEngine
export declare function createEnergyEngine(options?: EnergyEngineOptions): EnergyEngine;createEnergyOrigin
export declare function createEnergyOrigin(): string;Create a unique producer identity for deterministic cross-context ordering.
createEnergyState
export declare function createEnergyState(level: EnergyLevel, source?: EnergySource, timestamp?: number, revision?: number, origin?: string): EnergyState;Create an EnergyState for the current moment
createExternalLevelCompatibility
export declare function createExternalLevelCompatibility<TExternal extends number>(options: ExternalLevelCompatibilityOptions<TExternal>): ExternalLevelCompatibility<TExternal>;Build a compatibility bridge for systems that use non-native level values.
This is useful during migrations (e.g. legacy 4-level models) while keeping the package's native fixed 5-level model unchanged.
createFocusSessionController
export declare function createFocusSessionController(options?: FocusSessionControllerOptions): FocusSessionController;createNotificationGate
export declare function createNotificationGate(engine: EnergyEngine, options: NotificationGateOptions): NotificationGate;Create a notification gate bound to an engine. The gate re-resolves its config on every energy change and releases deferred notifications the moment the new level's config (or lifted suppression) admits them.
createPresenceStrategy
export declare function createPresenceStrategy(name: string, presence: EnergyPresenceMap): AdaptationStrategy<EnergyPresence>;Lift a presence map into an AdaptationStrategy so it can be resolved through the engine like any built-in strategy:
const aiChat = createPresenceStrategy('ai-chat', presenceAtOrAbove(75))
engine.resolve(aiChat) // 'visible' | 'muted' | 'hidden'cycleDiscreteLevel
export declare function cycleDiscreteLevel<TLevel extends number>(current: number, levels: readonly TLevel[], fallback: TLevel): TLevel;Cycle through any discrete numeric level list.
cycleEnergyLevel
export declare function cycleEnergyLevel(current: EnergyLevel): EnergyLevel;Cycle to the next energy level: 100 -> 75 -> 50 -> 25 -> 0 -> 100
defineEnergyPresence
export declare function defineEnergyPresence(spec?: EnergyPresenceSpec): EnergyPresenceMap;Build a complete, frozen presence map from a partial spec.
// Hide the AI chat at 50 and below, keep it muted at 75:
const aiChatPresence = defineEnergyPresence({
default: 'visible',
75: 'muted',
50: 'hidden',
25: 'hidden',
0: 'hidden',
})getEnergyLevel
export declare function getEnergyLevel(level: EnergyLevel): Readonly<EnergyLevelDefinition>;Get definition for a specific energy level
getEnergyLevels
export declare function getEnergyLevels(): ReadonlyArray<Readonly<EnergyLevelDefinition>>;Get all energy level definitions, ordered highest to lowest
getEnergyMetrics
export declare function getEnergyMetrics(state: EnergyState, now?: number): EnergyMetrics;Derive app-agnostic energy metrics from the current state.
isEnergyLevel
export declare function isEnergyLevel(value: unknown): value is EnergyLevel;Validate that an unknown value is a valid EnergyLevel
isEnergyPresence
export declare function isEnergyPresence(value: unknown): value is EnergyPresence;Validate that an unknown value is a valid EnergyPresence
isEnergySource
export declare function isEnergySource(value: unknown): value is EnergySource;Validate that an unknown value is a valid EnergySource
isHigherEnergy
export declare function isHigherEnergy(a: EnergyLevel, b: EnergyLevel): boolean;Returns true if level a represents higher energy than level b
isNotificationPriority
export declare function isNotificationPriority(value: unknown): value is NotificationPriority;Validate that an unknown value is a valid NotificationPriority
isOriginatorTier
export declare function isOriginatorTier(value: unknown): value is OriginatorTier;Validate that an unknown value is a valid OriginatorTier
isPreferredEnergyState
export declare function isPreferredEnergyState(candidate: EnergyState, current: EnergyState): boolean;Should candidate replace current?
The comparison walks four keys in order, stopping at the first that differs:
timestamp- later wins. The ordinary case, and the only one most states ever reach.revision- higher wins. Two writes inside one clock tick are not simultaneous; the producer numbers them so they still order.source-manual>scheduled>inferred. SeesourcePriority.origin- higher string wins. Not meaningful, and deliberately so: when two producers write the same instant, the same revision, and the same kind of source, there is no principled winner, and an arbitrary rule every context computes identically beats a coin flip each context tosses separately. Convergence is the property that matters.
A final level comparison exists below the four keys as a backstop for
producers that reuse one identity for different state, which is a contract
violation but should still converge rather than oscillate.
Equal on every key means equal: false, so an identical state never counts
as a change and never fires a notification.
isPresenceVisible
export declare function isPresenceVisible(presence: EnergyPresence): boolean;True unless the presence is 'hidden'
isSessionExpired
export declare function isSessionExpired(session: FocusSession, now?: number): boolean;True once a session has reached its end time
isUnproducedState
export declare function isUnproducedState(state: Pick<EnergyState, 'timestamp' | 'origin'>): boolean;True for the untouched default state - its age and identity are not meaningful.
mapToNearestDiscreteLevel
export declare function mapToNearestDiscreteLevel<TLevel extends number>(value: number, levels: readonly TLevel[], fallback: TLevel): TLevel;Map an arbitrary number to the nearest available discrete level.
mapToNearestEnergyLevel
export declare function mapToNearestEnergyLevel(value: number): EnergyLevel;Map any number to the closest native package energy level.
presenceAtOrAbove
export declare function presenceAtOrAbove(min: EnergyLevel, below?: EnergyPresence): EnergyPresenceMap;Presence map for elements that need at least min energy.
Below min the element is below ('hidden' by default).
const composerToolbar = presenceAtOrAbove(50) // hidden at 25 and 0
const aiSidebar = presenceAtOrAbove(75, 'muted') // muted below 75presenceAtOrBelow
export declare function presenceAtOrBelow(max: EnergyLevel, above?: EnergyPresence): EnergyPresenceMap;Presence map for elements that only belong at low energy - recovery hints,
"one thing at a time" affordances. Above max the element is above
('hidden' by default).
resolveDeferral
export declare function resolveDeferral(presets: readonly DeferralPreset[], presetId: string, now?: Date): number | null;Resolve a preset id to a resurface timestamp (epoch ms). Returns null for an unknown id - callers decide whether that is an error.
resolveDemandOutcome
export declare function resolveDemandOutcome(config: DemandAdmissionConfig, autonomy: AutonomyConfig, demand: DemandInput): DemandOutcome;The pure gating decision, extracted so apps can unit-test their demand
policy without wiring any effects - the counterpart of
resolveNotificationOutcome.
Both configs are required because the two questions are genuinely separate:
admission says what the app's policy wants done, autonomy says how much
of it may happen without the user watching.
resolveEnergyPresence
export declare function resolveEnergyPresence(presence: EnergyPresenceMap, level: EnergyLevel): EnergyPresence;Resolve the presence of an element for a given energy level
resolveNotificationOutcome
export declare function resolveNotificationOutcome(config: NotificationConfig, priority: NotificationPriority, suppressed: boolean): PublishOutcome;Pure gating decision: given the active config, an intent priority, and the suppression flag, decide the outcome. Extracted so apps can unit-test their notification policy without constructing a gate.
sessionRemainingMs
export declare function sessionRemainingMs(session: FocusSession, now?: number): number;Milliseconds left in a session (0 when expired)
Constants
autonomyStrategy
export declare const autonomyStrategy: AdaptationStrategy<AutonomyConfig>;DEFERRAL_PRESET_IDS
export declare const DEFERRAL_PRESET_IDS: Readonly<{
readonly inOneHour: 'in-1-hour';
readonly thisEvening: 'this-evening';
readonly tomorrowMorning: 'tomorrow-morning';
readonly nextWorkday: 'next-workday';
readonly nextMonday: 'next-monday';
}>;Stable preset ids, exported so configs/strategies can reference them
deferralStrategy
export declare const deferralStrategy: AdaptationStrategy<DeferralConfig>;demandAdmissionStrategy
export declare const demandAdmissionStrategy: AdaptationStrategy<DemandAdmissionConfig>;ENERGY_LEVEL_VALUES
export declare const ENERGY_LEVEL_VALUES: ReadonlySet<number>;Valid energy level values for runtime validation
ENERGY_PRESENCE_VALUES
export declare const ENERGY_PRESENCE_VALUES: ReadonlySet<EnergyPresence>;Valid energy presence values for runtime validation
ENERGY_SOURCE_VALUES
export declare const ENERGY_SOURCE_VALUES: ReadonlySet<EnergySource>;Valid energy source values for runtime validation
interactionForgivenessStrategy
export declare const interactionForgivenessStrategy: AdaptationStrategy<InteractionForgivenessConfig>;notificationStrategy
export declare const notificationStrategy: AdaptationStrategy<NotificationConfig>;taskComplexityStrategy
export declare const taskComplexityStrategy: AdaptationStrategy<TaskComplexityConfig>;uiVisibilityStrategy
export declare const uiVisibilityStrategy: AdaptationStrategy<UIVisibilityConfig>;UNPRODUCED_ORIGIN
export declare const UNPRODUCED_ORIGIN = "0-initial";UNPRODUCED_TIMESTAMP
export declare const UNPRODUCED_TIMESTAMP = 0;Interfaces
AdaptationStrategy
export interface AdaptationStrategy<TConfig> {
/** Unique name for this strategy */
name: string;
/** Human-readable description of what this strategy does at a given level */
describe(level: EnergyLevel): string;
/** Compute the configuration for a given energy level */
resolve(level: EnergyLevel): TConfig;
}Maps energy levels to application behavior. Pure function - given a level, produce a configuration.
Prop
Type
AutonomyConfig
export interface AutonomyConfig {
/**
* Minimum confidence (0–1) an automated decision needs before acting
* unattended. `1` admits only certainty, which in practice means rule-based
* actions and never a judgment call.
*/
readonly confidenceThreshold: number;
/** Whether automation may compose novel wording, or only fill fixed templates. */
readonly allowGeneratedContent: boolean;
/** How many automated steps may chain before control returns to the user. */
readonly maxUnattendedSteps: number;
}How much latitude automation has to act for the user without asking.
The mirror of interactionForgivenessStrategy: forgiveness protects against
the user's mistakes at low energy, autonomy against the agent's. The
system acts on the user's behalf precisely when they are least able to
supervise it, so the worst day is the wrong day for it to improvise.
What narrows as energy falls is discretion, not action. At rest the automation may still take a single, certain, template-only step - an out-of-office reply is exactly that shape - but it may not chain steps, compose novel wording, or act on a judgment call.
Prop
Type
CognitiveProfile
export interface CognitiveProfile {
readonly decisionCapacity: DecisionCapacity;
readonly focusDuration: FocusDuration;
readonly taskComplexity: TaskComplexity;
readonly interruptionTolerance: InterruptionTolerance;
}What the brain can handle at a given energy level
Prop
Type
DeferralConfig
export interface DeferralConfig {
/** Preset ids in suggestion order for this level (first = most prominent) */
readonly orderedPresetIds: readonly string[];
/** The preset a one-tap "defer" action should use at this level */
readonly defaultPresetId: string;
}Prop
Type
DeferralPreset
export interface DeferralPreset {
readonly id: string;
readonly label: string;
/** Compute the resurface time from a reference moment */
compute(now: Date): Date;
}A named deferral option
Prop
Type
DeferralPresetOptions
export interface DeferralPresetOptions {
/** Hour (0-23) mornings resolve to. Default 9. */
morningHour?: number;
/** Hour (0-23) evenings resolve to. Default 18. */
eveningHour?: number;
}Prop
Type
DemandAcknowledgment
export interface DemandAcknowledgment {
readonly detail: AcknowledgmentDetail;
/** Whether the wording may be composed, or must come from a fixed template. */
readonly allowGeneratedContent: boolean;
}What the acknowledgment is permitted to be. The two axes are independent: how much it may say comes from the level's admission config, whether the wording may be composed at all comes from autonomy.
Prop
Type
DemandAdmissionConfig
export interface DemandAdmissionConfig {
/**
* Lowest originator tier admitted live. Mirrors the notification gate's
* `priorityThreshold`: `all` admits everyone, `none` admits no one.
*/
readonly originatorThreshold: 'all' | 'known' | 'exempt' | 'none';
/** Whether demand held back from the user is acknowledged to its originator. */
readonly acknowledge: boolean;
/** Ceiling on acknowledgment detail at this level. */
readonly acknowledgmentDetail: AcknowledgmentDetail;
}Prop
Type
DemandInput
export interface DemandInput {
readonly originatorTier: OriginatorTier;
/**
* Whether this demand asks something of the user. Informational mail - a
* receipt, a newsletter, a build notification - is not this policy's
* business and passes through untouched.
*/
readonly bearsObligation: boolean;
/**
* Confidence (0–1) that the two classifications above are right. A
* deterministic rule reports `1`; an LLM classifier reports what it reports.
* Below the level's autonomy threshold, the demand is captured silently
* rather than risking a wrong automated action on the user's worst day.
* Defaults to `1`, so a caller with no classifier gets rule-based behavior.
*/
readonly confidence?: number;
}The properties of one piece of demand that the policy reads
Prop
Type
DemandOutcome
export interface DemandOutcome {
readonly admission: DemandAdmission;
/** The acknowledgment to send. Null unless `admission` is `acknowledge`. */
readonly acknowledgment: DemandAcknowledgment | null;
readonly reason: DemandOutcomeReason;
}The policy decision for one piece of demand
Prop
Type
EnergyClock
export interface EnergyClock {
now(): number;
}Time source contract for deterministic environments (tests, simulations)
Prop
Type
EnergyEngine
export interface EnergyEngine {
/**
* Begin hydration and cross-context observation. Idempotent, and a no-op on
* a disposed engine. Only needed when the engine was created with
* `autoStart: false`.
*/
start(): void;
/** Get current energy state */
getState(): EnergyState;
/** Set energy level with optional source */
setLevel(level: EnergyLevel, source?: EnergySource): void;
/** Cycle to next energy level */
cycleLevel(): void;
/** Subscribe to state changes. Returns unsubscribe function. */
subscribe(listener: EnergyChangeListener): () => void;
/** Resolve a strategy against current energy state */
resolve<T>(strategy: AdaptationStrategy<T>): T;
/** Load persisted state (called automatically, but can be called manually) */
hydrate(): Promise<void>;
/**
* Wait until the current state version is durably persisted.
* Rejects if the engine is disposed or an unchanged initial state cannot be
* reconciled because its persistence hydration read failed.
*/
flush(): Promise<void>;
/** Release engine-owned subscriptions/resources */
dispose(): void;
}Prop
Type
EnergyEngineOptions
export interface EnergyEngineOptions {
initialLevel?: EnergyLevel;
persistence?: EnergyPersistence;
onChange?: EnergyChangeListener;
/** Called when a persistence attempt fails before the engine schedules a retry. */
onPersistenceError?: (error: unknown, state: EnergyState) => void;
/** Deterministic time source for tests/simulations */
clock?: EnergyClock | (() => number);
/** Stable producer identity for deterministic reconciliation. Primarily useful in tests. */
originId?: string;
/**
* Maximum tolerated future clock skew (ms) for externally supplied state
* (hydration and cross-context observation). States stamped further ahead of
* the local clock are rejected so one bad clock cannot win reconciliation
* until its timestamp passes. Pass Number.POSITIVE_INFINITY to accept any
* finite timestamp. Default: 5 minutes.
*/
maxFutureSkewMs?: number;
/**
* Whether construction immediately hydrates from persistence and subscribes
* to cross-context updates. Default: true.
*
* Pass false when the engine is constructed somewhere that may never be
* committed - a React render, most notably - and call `start()` from a
* lifecycle that only runs for trees React kept. Without this, a discarded
* render leaves an engine nobody will ever dispose, holding a live
* cross-context observer (a `storage` listener, for the localStorage
* adapter) for the lifetime of the page.
*/
autoStart?: boolean;
}Prop
Type
EnergyLevelDefinition
export interface EnergyLevelDefinition {
readonly value: EnergyLevel;
readonly key: string;
readonly label: string;
readonly description: string;
readonly cognitiveProfile: CognitiveProfile;
}Complete metadata for a single energy level
Prop
Type
EnergyMetrics
export interface EnergyMetrics {
/** Milliseconds since this state was set */
readonly stateAgeMs: number;
/** Rounded minutes since this state was set */
readonly stateAgeMinutes: number;
/** Suggested focused-work window length */
readonly expectedProductivityWindowMinutes: number;
/** Suggested break cadence for the current level. 0 means no breaks are suggested (rest is already a break). */
readonly suggestedBreakIntervalMinutes: number;
/** Recommended task complexity based on cognitive profile */
readonly recommendedTaskComplexity: TaskComplexity;
/**
* Heuristic signal for maintainability of this state.
* True only for mid-range levels (25/50/75): peak (100) is a burst state
* that depletes rather than holds, and rest (0) is recovery, not a working
* state to maintain. Both extremes report false.
*/
readonly sustainable: boolean;
/** Optional guidance for recovery horizon */
readonly recoveryHintMinutes?: number;
}Computed, app-agnostic metrics from an energy state snapshot.
Prop
Type
EnergyNotification
export interface EnergyNotification {
readonly priority: NotificationPriority;
readonly payload: unknown;
/** When the intent was published (epoch ms, gate clock) */
readonly createdAt: number;
}A single notification intent held or delivered by the gate
Prop
Type
EnergyPersistence
export interface EnergyPersistence {
load(): Promise<EnergyState | null>;
save(state: EnergyState): Promise<void>;
/**
* Optional observer for externally persisted state updates (cross-tab, worker, etc.)
*/
observe?(onState: (state: EnergyState) => void): () => void;
}Storage contract - implement per platform
Prop
Type
EnergyState
export interface EnergyState {
/** Current cognitive capacity */
readonly level: EnergyLevel;
/** When this state was set (epoch ms) */
readonly timestamp: number;
/** How this state was determined */
readonly source: EnergySource;
/** Logical sequence for writes sharing the same timestamp */
readonly revision: number;
/** Stable identity of the engine/context that produced this state */
readonly origin: string;
}A point-in-time snapshot of cognitive capacity
Prop
Type
ExternalLevelCompatibility
export interface ExternalLevelCompatibility<TExternal extends number> {
levels: readonly TExternal[];
fallbackLevel: TExternal;
fallbackEnergyLevel: EnergyLevel;
toEnergyLevel: (externalLevel: TExternal | number) => EnergyLevel;
fromEnergyLevel: (level: EnergyLevel) => TExternal;
cycleExternalLevel: (current: TExternal | number) => TExternal;
cycleMappedEnergyLevel: (current: TExternal | number) => EnergyLevel;
}Prop
Type
ExternalLevelCompatibilityOptions
export interface ExternalLevelCompatibilityOptions<TExternal extends number> {
/**
* External level cycle order (e.g. [100, 66, 33, 0]).
*/
levels: readonly TExternal[];
/**
* Mapping from external level values to native package levels.
*/
toEnergyLevel: Readonly<Record<TExternal, EnergyLevel>>;
/**
* Fallback external level when input is unknown.
*/
fallbackLevel: TExternal;
/**
* Fallback native level when mapping is invalid or missing.
* Defaults to the mapped value of fallbackLevel.
*/
fallbackEnergyLevel?: EnergyLevel;
}Prop
Type
FocusSession
export interface FocusSession {
/** When the session started (epoch ms) */
readonly startedAt: number;
/** When the session ends (epoch ms). Sessions are always bounded. */
readonly endsAt: number;
/** Break nudge cadence in ms. 0 = no break nudges. */
readonly breakIntervalMs: number;
}An active focus session snapshot
Prop
Type
FocusSessionController
export interface FocusSessionController {
/** Start a session (replacing any active one, which is stopped first). */
start(options?: StartFocusSessionOptions): FocusSession;
/** End the active session early. No-op when idle. */
stop(): void;
getSession(): FocusSession | null;
/** Milliseconds left in the active session (0 when idle) */
remainingMs(): number;
/** Subscribe to session lifecycle events. Returns unsubscribe function. */
subscribe(listener: FocusSessionListener): () => void;
/** Stop any active session and release resources */
dispose(): void;
}Prop
Type
FocusSessionControllerOptions
export interface FocusSessionControllerOptions {
/**
* Engine used for energy-aware defaults: session length from the level's
* expected productivity window, break cadence from the task-complexity
* strategy. Optional - without it, defaults are 25 minutes / no breaks.
*/
engine?: EnergyEngine;
/**
* Suppression target (typically a NotificationGate). Suppressed on start,
* released on stop/end/dispose - the controller owns the flag for the
* session's lifetime, so it can never be left stuck on.
*/
gate?: FocusSuppressible;
/** Deterministic time source for tests/simulations */
clock?: EnergyEngineOptions['clock'];
/** Deterministic timer source for tests/simulations */
scheduler?: GateScheduler;
}Prop
Type
FocusSuppressible
export interface FocusSuppressible {
setSuppressed(suppressed: boolean): void;
}Anything that can be suppressed for the lifetime of a session
Prop
Type
GateScheduler
export interface GateScheduler {
setTimeout(callback: () => void, ms: number): unknown;
clearTimeout(handle: unknown): void;
}Timer contract so tests can drive batch windows deterministically
Prop
Type
InteractionForgivenessConfig
export interface InteractionForgivenessConfig {
/** How long an undo affordance stays available after an action */
readonly undoWindowMs: number;
/** Whether destructive actions (delete, discard, overwrite) ask first */
readonly confirmDestructive: boolean;
/** Suggested autosave cadence for in-progress work */
readonly autosaveIntervalMs: number;
}How much room the interface gives the user to notice and reverse mistakes. Lower energy means slower error detection, so forgiveness scales inversely with capacity: longer undo windows, confirmation on destructive actions, more frequent autosave.
Prop
Type
NotificationChannels
export interface NotificationChannels {
readonly visual: boolean;
readonly sound: boolean;
readonly vibration: boolean;
}Output channels permitted by the config active at delivery time
Prop
Type
NotificationConfig
export interface NotificationConfig {
/** Allow visual notifications (badges, toasts) */
readonly allowVisual: boolean;
/** Allow audio notifications */
readonly allowSound: boolean;
/** Allow haptic feedback */
readonly allowVibration: boolean;
/** Minimum ms between batched notifications (0 = immediate) */
readonly batchInterval: number;
/** Minimum priority to show */
readonly priorityThreshold: 'all' | 'high' | 'critical' | 'none';
}Prop
Type
NotificationDelivery
export interface NotificationDelivery {
readonly notifications: readonly EnergyNotification[];
readonly reason: NotificationDeliveryReason;
readonly channels: NotificationChannels;
readonly level: EnergyLevel;
}One call to onDeliver: one or more notifications plus delivery context
Prop
Type
NotificationGate
export interface NotificationGate {
/** Publish a notification intent. Returns what the gate did with it. */
publish(input: {
priority?: NotificationPriority;
payload?: unknown;
}): PublishOutcome;
/**
* Hard-suppress delivery (e.g. during a focus session). While suppressed,
* every publish defers; lifting suppression releases the deferred queue.
*/
setSuppressed(suppressed: boolean): void;
isSuppressed(): boolean;
/** Counts of undelivered notifications currently held by the gate */
pendingCount(): {
batched: number;
deferred: number;
};
/** Deliver the open batch now and release any deferred items that qualify */
flush(): void;
/**
* Release resources. Pending notifications are delivered as a final
* 'released' delivery first - a disposed gate never swallows intents.
*/
dispose(): void;
}Prop
Type
NotificationGateOptions
export interface NotificationGateOptions {
/** Delivery sink. Called with everything the gate decides to surface. */
onDeliver(delivery: NotificationDelivery): void;
/** Strategy resolving level -> NotificationConfig. Default: `notificationStrategy`. */
strategy?: AdaptationStrategy<NotificationConfig>;
/** Deterministic time source for tests/simulations */
clock?: EnergyEngineOptions['clock'];
/** Deterministic timer source for tests/simulations */
scheduler?: GateScheduler;
}Prop
Type
StartFocusSessionOptions
export interface StartFocusSessionOptions {
/** Session length. Default: engine's expected productivity window, else 25. */
durationMinutes?: number;
/** Break nudge cadence. 0 disables. Default: engine's task-complexity guidance. */
breakEveryMinutes?: number;
}Prop
Type
TaskComplexityConfig
export interface TaskComplexityConfig {
/** Maximum task complexity to surface */
readonly maxComplexity: TaskComplexity;
/** Whether to proactively suggest breaks */
readonly suggestBreaks: boolean;
/** Minutes between break suggestions (when enabled) */
readonly breakIntervalMinutes: number;
}Prop
Type
UIVisibilityConfig
export interface UIVisibilityConfig {
readonly sidebar: boolean;
readonly tabBar: boolean;
readonly statusBar: boolean;
readonly toolbar: boolean;
readonly chromeOpacity: number;
readonly chromeOpacityHover: number;
readonly contentMaxWidth: string;
readonly contentFontScale: number;
readonly readOnlyCursor: boolean;
}Prop
Type
Type aliases
AcknowledgmentDetail
export type AcknowledgmentDetail = 'full' | 'brief' | 'minimal';How much an acknowledgment may say
DecisionCapacity
export type DecisionCapacity = 'high' | 'moderate' | 'low' | 'minimal' | 'none';DemandAdmission
export type DemandAdmission = 'live' | 'acknowledge' | 'silent';What happens to a piece of inbound demand.
live: reaches the user now, untouched by this policy.acknowledge: the originator is acknowledged and the obligation is captured for later. The two are one act - an acknowledgment without a capture is a promise nobody kept, a capture without an acknowledgment leaves the originator in silence.silent: captured for later with no acknowledgment.
DemandOutcomeReason
export type DemandOutcomeReason = 'exempt-originator' | 'tier-admitted' | 'no-obligation' | 'acknowledgment-disabled' | 'below-confidence' | 'acknowledged';Why the policy reached its decision - for audit trails and explanatory UI
EnergyChangeListener
export type EnergyChangeListener = (state: EnergyState, prev: EnergyState) => void;Callback for energy state changes
EnergyLevel
export type EnergyLevel = 0 | 25 | 50 | 75 | 100;Discrete cognitive capacity values
EnergyPresence
export type EnergyPresence = 'visible' | 'muted' | 'hidden';How a UI element participates at a given energy level.
visible: rendered normallymuted: rendered but de-emphasized (reduced opacity, secondary styling)hidden: not rendered at all
EnergyPresenceMap
export type EnergyPresenceMap = Readonly<Record<EnergyLevel, EnergyPresence>>;A complete presence declaration: one presence value per energy level. This is the annotation apps attach to components/views to state which energy levels they belong to (e.g. "hide the AI chat at 50 and below").
EnergyPresenceSpec
export type EnergyPresenceSpec = Partial<Record<EnergyLevel, EnergyPresence>> & {
default?: EnergyPresence;
};Per-level presence spec. Unlisted levels fall back to default
('visible' when omitted).
EnergySource
export type EnergySource = 'manual' | 'scheduled' | 'inferred';How the energy level was set
FocusDuration
export type FocusDuration = 'extended' | 'moderate' | 'short' | 'minimal' | 'none';FocusSessionEvent
export type FocusSessionEvent = 'start' | 'break' | 'end' | 'stop';Session lifecycle events:
start: a session beganbreak: a break nudge is due (recurring while the session runs)end: the session reachedendsAtand auto-expiredstop: the session was ended manually beforeendsAt
FocusSessionListener
export type FocusSessionListener = (event: FocusSessionEvent, session: FocusSession) => void;InterruptionTolerance
export type InterruptionTolerance = 'high' | 'moderate' | 'low' | 'minimal' | 'none';NotificationDeliveryReason
export type NotificationDeliveryReason = 'immediate' | 'batch' | 'released';Why a delivery is happening
NotificationPriority
export type NotificationPriority = 'normal' | 'high' | 'critical';Priority of a single notification intent
OriginatorTier
export type OriginatorTier = 'exempt' | 'known' | 'unknown';Standing of the originator relative to the user.
exempt: the inner circle. Never sees an energy acknowledgment.known: an established correspondent.unknown: no established relationship.
Tier assignment is the app's job - a Screener approval, a contacts list, an org chart. The policy only consumes the tier.
PublishOutcome
export type PublishOutcome = 'delivered' | 'batched' | 'deferred';What happened to a published notification
TaskComplexity
export type TaskComplexity = 'complex' | 'moderate' | 'routine' | 'simple' | 'consumption';