Skip to Content
Packages@attuneui/core

@attuneui/core

The framework-free part of Attune: the adaptive loop and everything it decides. No DOM, no React, no network. It runs in a browser, on a server, and in tests.

npm install @attuneui/core

The store

ExportWhat it does
createAdaptiveStore(config)The adaptive loop in a small store of its own: getState, setState, subscribe, and the actions.
createAdaptiveEngine(config, host)The same loop on a host’s get and set, for example a zustand store’s initializer.
AdaptiveSpecYour app’s types in one place: extend it and narrow panel, goal, action, kind, and others.
AdaptiveHooksThe hooks where an app’s own features join the loop. See Extend the loop.

The state holds the event log, the plan on screen and the one before it (for undo), the last answer, a history of rounds, the status (idle, thinking, offline, error), the settings, the pins, the bigger and docked panels, the focused panel, the anchor, the pointer, the column count, the goal, the mode, and the last command’s outcome.

The actions:

ActionWhat it does
track(input)Log a user signal. It may ask the model, after a short pause.
runCommand(text)Send command bar text, judged with the current activity in one request.
chooseCommandOption(panel)Apply the panel the user picked for an unclear command.
pin, unpin, maximize, restore, dismiss, openThe user’s manual edits. Each applies at once.
acceptSuggestion, dismissSuggestionTake or turn down a suggestion that is still offered.
setSettings, setWeightsChange the settings or the priority blend.
undo(to?)Put the previous layout back.
reset()Clear the events and return to the starting layout. Pins and settings stay.
adaptNow()Ask the model now.
setPointer, setCanvasHold, setColumns, setFocusedWhat the canvas reports. useStoreCanvas calls them for you.
dispose()Stop every timer and the request in flight.

The catalog and the vocabulary

ExportWhat it does
defineCatalog, CatalogYour panels, goals, actions, and goal-to-panel affinity, checked once.
UNCLEAR_GOAL, NO_ACTION, PANEL_UNCLEARThe fixed no-match ids.
LAYOUT_MODES, LAYOUT_MODE_DEFSThe three layouts and their descriptions for the model.
CORE_SIGNAL_TYPES, signalProfile, SignalProfileThe core signal types, and how your own types count.

The snapshot and recent use

ExportWhat it does
buildSnapshot, InteractionSnapshotThe activity in words for the model.
describeCoreEvent, deriveObservationsOne event’s sentence, and the behavior facts code measured.
panelUsage, eventWeight, CORE_USAGE_WEIGHTSRecent use per panel, with the core weights.
AdaptSchedulerWhen to ask: debounce, a longest wait, one request in flight, commands first.

The policy and the plan

ExportWhat it does
createPolicyThe whole policy round, bound to your catalog: computePlan, defaultPlan, traditionalPlan, and the plan edits.
scorePanels, pickMode, pickDensity, helpLevelThe general rules the policy uses.
LayoutPlan, PanelPlacement, AnchorRef, PanelRelation, DecisionThe plan and its parts.
basicSuggestions, basicRelationSuggestions and link tags for an app with nothing of its own.
neutralJudgmentsThe calm fallback answer: every panel supporting, no goal, no next step.
quietPanels, shownQuietThe quiet rule.
CoreJudgments, CoreCommandJudgments, ChoiceJudgment, ScoreJudgmentThe typed answers the layout code reads.

The grid and the motion

ExportWhat it does
placePlanThe place step: explicit cells with the anchor held still, the pointer’s card kept, the rounds counted.
packGrid, lockedPanels, summarizeChangesThe anchored packer and what a round changed.
CELL_SPANS, spanOf, GRID_BREAKPOINTS, columnsForWidthCard spans per size, and 1, 2, or 4 columns by width.
roundCues, cueFor, STAGE_GROW, STAGE_EXIT, STAGE_MOVE, STAGE_ENTERWhich card plays which stage of a round, and when.
noteText, linkAnnouncementThe sentences for the anchor note and screen readers.
fitRowFits a row of chips on one line: full, compact, or “+N”.
Last updated on