Skip to content

Sola AIR v2.0.0 Ambient Intent Runtime 37 Components

Your UI shouldn't wait to be asked.

Add a companion panel to an app you already have. Sola Sentinel notices when someone hesitates on a form, and the companion mounts in its own closed Shadow DOM, so your styles and ours stay apart. No rewrite of the host page.

Sentinel · observing

Watches a form with no per-field wiring

Type into a field, then stop for a moment. The observation and the gate are the real Sentinel from @sola-air-ui/sentinel, watching this form the same way observe() would watch any of yours — no per-field wiring below. The suggestion itself is resolved locally so this page needs no API key.

Suggestion
Nothing yet — the form has not been touched.
Observer buffer flow 99.8
  • · idle
$ npm i @sola-air-ui/core @sola-air-ui/sentinel

Companions are written in .sola and compiled once, with the Vite plugin or the sola compile command. The host page then needs only a bundler import or two script tags. Details

Add it to a page you already have

companion.js typescript
import { observe } from '@sola-air-ui/sentinel';
import { mountShell } from '@sola-air-ui/core';
import Companion from './Companion.sola';
 
// Mount once, in a closed shadow root.
const shell = mountShell(Companion, {}, { id: 'companion' });
 
// Watch a form that is already on the page. No per-field wiring.
observe(document.querySelector('#target-form'), {
onSuggest(prompt) {
// Send the prompt to your endpoint, then show the answer.
console.log(prompt);
}
});

Compiler X-Ray: the source, what the compiler emits, and the result

0 signal writes

This is what a companion is made of: a component compiles to plain DOM updates, with no virtual DOM to diff, so there is little code to add to the page. The whole core runtime is 7.8 kB gzipped.

1. Source ClusterCardDemo.sola
<script>
  // The homepage's Compiler X-Ray shows this file and the compiler's real output
  // for it, generated at build time. Keep the bindings direct ({updates}, {budget})
  // so what the X-Ray shows is a text-node update, not a child re-mount.
  let updates = $state(1420);
  let budget = $derived(Math.min(100, Math.round(updates / 20)));

  $on('sola:compiler-updates', (e) => {
    if (e && typeof e.updates === 'number') updates = e.updates;
  });
</script>

<div class="signal-card">
  <span class="label">Reactive DOM Writes</span>
  <span class="value">{updates} ops/s</span>
  <span class="trend">{budget}% frame budget</span>
  <div class="track" aria-hidden="true">
    <div class="fill" style="width: {budget}%"></div>
  </div>
</div>

<style>
  .signal-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: ui-sans-serif, system-ui, sans-serif;
  }
  .label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sola-text-secondary, #475569);
  }
  .value {
    font-size: 28px;
    font-weight: 800;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--sola-text-primary, #0f172a);
  }
  .trend {
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--sola-text-secondary, #475569);
  }
  .track {
    height: 10px;
    margin-top: 6px;
    border-radius: 999px;
    background: var(--sola-surface-2, #e2e8f0);
    overflow: hidden;
  }
  .fill {
    height: 100%;
    border-radius: 999px;
    background: var(--sola-accent, #1d4ed8);
    transition: width 220ms cubic-bezier(0.16, 1, 0.3, 1);
  }
</style>
2. Compiler output compiler v1.7.6
  2  import { createSignal, createDerived, createEffect, createIntent, createData, createPersistentSignal, onMount, onDestroy, pushContext, popContext, __flush_mounts, __flush_destroys, __untrack, bus as __solaBus } from '@sola-air-ui/core'; 64  const [updates, set_updates] = createSignal(1420); 65  const budget = createDerived(() => Math.min(100, Math.round(updates() / 20))); 89  createEffect(() => { __e4.textContent = String((updates()) ?? ''); }); 98  createEffect(() => { __e7.textContent = String((budget()) ?? ''); });109  createEffect(() => { __n10.setAttribute('style', String("width: " + (budget()) + "%")); });

The 6 reactive lines of 121. Each createEffect rewrites one text node or attribute when the signals it reads change.

3. Mounted 7.8 kB gzipped core

The slider sends sola:compiler-updates on the event bus; the component's $on handler sets updates.