Skip to content

Glirastes 0.24.2

Choose a tag to compare

@Piwo96 Piwo96 released this 25 Nov 09:06
· 26 commits to main since this release
87f5fb3

Added

  • AssistantShell: the backdrop color of the history drawer is the CSS variable --cm-history-backdrop (default rgba(17, 24, 39, 0.3), unchanged). Set it on :root or the shell element, no selector of higher specificity needed.
  • AssistantShell / AssistantWorkspace: classNames.historyBackdrop for the backdrop of the full-screen chat drawer ([data-element="history-backdrop"]). Without it the backdrop has no class, as before. The shipped backdrop color comes from a rule of specificity (0,2,0), so a single class does not override it: use .my-backdrop.my-backdrop or [data-element="history-backdrop"].my-backdrop after styles.css, or unstyled. The column and drawer states (data-drawer="true", hidden, inert, role="dialog", backdrop only while open) are now documented as stable and pinned by a test; aria-expanded on [data-action="history"] holds for the built-in toggle (with renderButton the app sets its button's attributes). Docs: after the drawer closes, focus is on the chats toggle, so a renderButton tooltip that opens on focus catches the next Escape.
  • glirastes/contracts: the mention marker grammar {{mention:type:id:label}} and its canonical profile: canonicalMentionLabel(label, { id?, maxLength? }), parseMentionMarkers(text) ({ type, id, label, canonical, span }, canonical computed on first read; the same matches as the reader before, linear also on 100,000 unterminated markers), serializeMentionMarker, isMentionMarkerType, isMentionMarkerId, MENTION_MARKER_MAX_LABEL_LENGTH (120). The React chat and the server's marker count read with it instead of two copies of one regex; what they read is unchanged.
  • MentionSerializationConfig.labels ('canonical' default, 'raw') and maxLabelLength (8-120, default 120) under mentions.serialize.
  • Contracts: the view context contract in glirastes/contracts, for the coming view context feature (nothing uses it yet). ViewContextEntry (entity: { type, id } of a declared entity type and/or selection: { type, ids }, at least one of them, so a list view needs no single record; label, facts, unsaved, route), ViewContextEntrySchema / ViewContextSchema for the shape of sanitized entries in trusted, stored data (no copy of the input promised; lists and selection.ids over 10,000 items are refused before any item is checked), and sanitizeViewContext(input, { declaredTypes, factsSchemas, policy }) for untrusted input: invalid entries and fields are dropped, never rejected, and dropped reports reason codes with counts only (field reasons only for kept entries); unknown keys are ignored without being enumerated. Characters follow the mention marker policy: labels are canonical mention labels of at most 60 code points, fact strings go through the same display cleaning, and an id or route with a hidden, control, unassigned or separator character is invalid (never cleaned). Bounds (VIEW_CONTEXT_LIMITS): 8 entries, 50 selection ids, ids exactly as sent (isEntityIdValue, no surrounding whitespace, nothing the policy removes, else dropped; a composite key as a list of 2 to 4 parts; duplicates compared by NFC); routes as a decoded path (no %, ;, query, hash, scheme, host or dot segment; non-ASCII letters allowed); facts of at most 2 KB kept only when the value as sent passes a schema of their entity type (Zod or JSON schema validator), cleaned, and validated again when cleaning changed them; 2.5 KB for all entries, where a long selection is cut to the ids that fit before an entry is dropped; every drop count stops at maxDropCount (1,000,000): it is exact up to 1,000,000 dropped and a lower bound only when more are dropped. Ids and fact strings keep delimiters as data: a renderer must write entries as JSON escaped with escapeJsonAngles (comment block) or escapeJsonForBlock (tag block). resolveViewContextPolicy resolves the coming server option viewContext (enabled default true, types, history default 'none', maxEntries, facts with false per type or for all; false turns it off) and throws on an invalid one before any input is read.

Changed

  • glirastes stt worklet lists the copied file in an existing .gitignore once (/public/audio-worklet-processor.js, or the --out path relative to the root), as glirastes init does; it never creates a .gitignore, and --no-gitignore skips the step. A ! negation of the path counts as the developer's decision and is left alone, CRLF line ends are kept, and a path gitignore would read as a pattern ([, ], *, ?, \, trailing whitespace) gets no entry. A .gitignore that cannot be read or written is a warning only; the copy still succeeds with exit 0. The --json output has a new field gitignore (added, listed, none, skipped, failed).
  • glirastes upgrade report can match upgrade notes in .css, .scss, .sass and .less files: only notes that opt in with files: ["style"] in affectedWhen/adoptedWhen, and only their patterns (an @import of glirastes/react/styles.css is no code import); every other note matches code files as before. The scan also skips storybook-static, .docusaurus and .cache.
  • Behaviour change: a picked mention is sent with its canonical label (mentions.serialize.labels: 'canonical', the default). Before, the label went raw into the marker: an entity name with }} ended the marker early, and one with a <!--context:…--> or <!--glirastes:clarification …--> comment reached the model while the bubble hid it (or made the message parse as a clarification answer); line breaks, bidi controls, zero-width, tag characters and variation selectors reached the model unseen. The label is what the chip shows, so the model now reads what the user sees there; the type and id come from the app and are not shown in the chip, as before (only hostile ones are refused). Ordinary labels, including emoji, flags, Persian, Arabic, Devanagari and Japanese names, ids and types are sent byte-identical (differential tests against the release before). The stored message text changes only in these cases: NFC (decomposed text is composed); whitespace at the start and end is trimmed; each run of control characters (also tab and line breaks) and line/paragraph separators becomes one space (NBSP, U+202F, U+3000 and runs of spaces stay); { } <! --> --!> become { } ‹! --› --!›; removed are format characters and default ignorables (bidi controls, zero-width space, word joiner, BOM, soft hyphen, U+034F, Hangul fillers, Khmer U+17B4/17B5, tag characters, variation selectors) except one ZWJ between two emoji, one ZWJ/ZWNJ between two letters of a joining script (Arabic, Syriac, Thaana, Indic, Sinhala, Khmer, Myanmar, Mongolian, Meetei Mayek, Chakma, Tai Tham, Sundanese, Newa, Limbu, Kayah Li …; the ZWJ of a legacy Malayalam chillu at word end; ZWJ/ZWNJ between Latin, Greek, Cyrillic, Han, Kana or Hangul letters is removed), the tags of the 🏴 England, Scotland and Wales flags (other tag runs are removed, the 🏴 stays), one VS15/VS16 after an emoji-capable character (after a digit, # or * only in a keycap), one IVS after a Han ideograph and one Mongolian FVS after a Mongolian letter; also removed are private use characters (icon fonts in names), noncharacters, U+2800 and lone surrogates (unassigned code points stay); a label over 120 code points is cut at a grapheme boundary to at most 119 and … (a label that would be a bare … becomes the id; never empty); only the first 4096 code points of a label (and of the label a slug is derived from) are read, before any normalisation; removal and NFC repeat until nothing changes, and a crafted label that still changes after 8 passes loses every remaining hidden character, also the joiners and selectors the rules would keep; an empty result becomes the id. A mention whose type or id carries hostile characters is sent without a marker, so the model loses the id: control characters (also tab and newline), line/paragraph separators, format characters, default ignorables, private use, unassigned or noncharacters, U+2800, lone surrogates, }, {{, <!, -->, --!> (a type also with : or over 200 UTF-16 units); the emoji, flag and joining-script exceptions apply to labels only, an id with such characters is refused, and whether a code point is unassigned depends on the engine's Unicode version (an older engine refuses an id with a code point it does not know). The token the user saw stays as typed (@acme), none of the mention's label or id enters the text, the context block does not list it, and the chat warns once per type in the console, only when NODE_ENV === 'development' (static text, no type, id or label). Spaces, single < > {, /, @, +, capitals and non-ASCII letters in ids and types, and : in ids, stay valid, as before; a type with : is refused. Such a mention can come from the legacy mentions config (search/resolve results), completion items, addActiveMention, RichMentionInput addMention/insertMention/setValue with app-built mentions, and stored drafts or queued messages. Each token occurrence is now replaced once, in one pass over the typed text: before, a label that contained a later mention's token (x @bob y) got that marker nested inside it. The context block lists the canonical label. Queued messages and restored drafts are serialized the same way when sent. mentions: { serialize: { labels: 'raw' } } restores the old format; maxLabelLength (8-120; 1-7 means 8) cuts shorter, any other value means 120. With raw nothing is validated or changed in the label, but the one-pass replacement applies too (no nested markers). Known limits: an id with : is written as before and every reader splits it at the first colon (the model gets the whole text); text stored before, written with raw, by an own client or in onBeforeSend is read as before (bubble and model copy follow in later releases); the free-text context block can still be given forged sibling entries; with constructed, very long input (a very long or often repeated mention token in a very long text) sending can take up to about a second in the user's browser, a fix follows.

Fixed

  • glirastes doctor: a literal workletUrl (voice config or adapter) pointing to a file no copy step creates (e.g. /custom/worklet.js while glirastes stt worklet writes public/audio-worklet-processor.js) was reported as a pending copy (warning, exit 0). It now fails (E-SETUP-034, remediation align-audio-worklet-url) and names both paths; the check carries them in detail (workletUrl, copyTarget) in --json. A copy step that creates the configured file but has not run yet stays a warning, as does a URL that ends in the copied path under a base path (/app/audio-worklet-processor.js with Next.js basePath or Vite base). workletUrl literals in test files (*.test.*, *.spec.*, __tests__/) are no longer checked.
  • glirastes init --dry-run listed only the file names. The preview now shows each predev/prebuild script it adds or changes (with the glirastes stt worklet && prefix) and the .gitignore entry, as init writes them (scaffold.changes in --json).
  • A message showing the loading skeleton stayed unreadable while the import of react-markdown never settled (a stalled chunk request, offline, a service worker). After a time limit it now shows its raw text, exactly as before 0.24.0 ([data-component="markdown"] with the source as text, the copy button unchanged; nothing is announced), and switches to Markdown if the import still arrives. The limit is markdown.loadingTimeoutMs (new, default 4000), counted from the start of the import (the provider's preload at mount, the first message, or an own preloadMarkdown() at app start: the clock starts at every start of the import, so the limit may have passed before the chat appears, and its messages then show the raw text directly), with one shared timer per limit that runs only while a bubble shows the skeleton, is cleared when react-markdown arrives and never runs on the server or keeps a Node process alive. A bubble that first renders after the limit has passed shows the raw text directly. false, Infinity or more than 2^31 - 1 ms: no limit (the skeleton stays until react-markdown loads or fails, as in 0.24); 0: no skeleton at all (the raw text while loading, as before 0.24.0); a negative number, NaN or a non-number: the default (a negative value is no valid duration, and 0 would silently turn the skeleton off). Each provider's bubbles use its own value. Changing the option at runtime after the limit has passed can bring a message from its raw text back to the skeleton. This is the one exception to "a bubble keeps what it showed first until Markdown renders": skeleton → raw text on timeout. A failed import shows the plain text right away, as before. For apps that set nothing: after 4 seconds without react-markdown the raw text instead of an endless skeleton.