You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Added
Declared @ sources: mentions in .glirastes/tools.json (policy: "derived" | "declared", sources.<type>: { tool, queryParam, idField?, labelField?, itemsPath?, descriptionField?, limitParam?, label?, aliases? }, ignore, acknowledgedTypes). The key is the entity type of the tool's declared identity, whose id, name and path are the defaults. With declared only these appear in @; tools refresh / tools check report every other derivable search as mention-source-candidate with the entry to paste. Declared sources come first in the @ list, in their order. New findings mention-source-candidate, mention-source-invalid, mention-source-undeclared-type, mention-type-follows-identity, mention-type-ambiguous (all warnings). Without mentions the generated list is as before, except for the type change under Changed.
@ list ordered by context: useMentionContext({ preferredTypes, presetType }) below the provider (the call rendered last wins: nested over its ancestors, a later sibling or later mount over earlier ones), mentionContext on AiChatProvider / VercelAiChat and on <glirastes-chat>. Preferred groups come first, the others in declared order. This is the host indication the planned view context will feed; no second channel.
Type filter: @<type>:<text> searches one entity type. Typing after @ suggests matching types first (group "Filter by type", at most 3); a pick sets @<name>: and keeps the list open. presetType presets the filter on a bare @ (not inside an IME composition; on its end when the @ is still bare); Backspace behind the untouched preset removes it. Names are the entity label of the chat's language (without whitespace or colon, not only combining marks), aliases (new on ChatEntityData, ChatEntityDefinition and the overrides; one list or one per BCP-47 tag) and the canonical type; the marker keeps the canonical type. Works in MentionInput, RichMentionInput (new prop completionPreset) and own composers on useChatComposerInput. CompletionSelectKind gains 'query' (replace the typed query with insertText and search again). ChatInteractionRegistry.entityFilter, entityFilterNames, entityFilterConflicts, completionPreset; ChatInteractionsConfig.mentionContext, texts.
Locale keys completionCommandsGroupLabel, completionEntityTypesGroupLabel, completionEntityTypeFilterLabel (English and German ship; the commands heading was fixed to "Commands"/"Befehle").
List size per trigger: ChatInteractionsConfig.completionLimits ({ '/': { perProvider: 40, total: 40 } }, type CompletionLimits, also in glirastes/embed through config.chatInteractions) and createCompletionSearch(providers, { limits }). Defaults stay 8 per provider and 12 in total; total without a value is the larger of 12 and perProvider. Bounds 1–100 (perProvider) and 1–200 (total); values are truncated and clamped, non-numbers and non-finite values take the default, nothing throws. The provider applies them to every provider of the trigger, the app's own completionProviders included; each search gets perProvider as limit (a derived @ search also as limitParam), entity types share it in turn, type suggestions stay outside the caps. @'s perProvider also sizes the argument field's entity search (searchEntity, 8 before and without it). limitPerProvider / maxResults of createCompletionSearch now reach 100 / 200 (were 20 / 50).
createAiChatHandler option viewContext (server side of the view context; on by default, false turns it off, null counts as not set). Unchanged apps: nothing changes: without the new body field the model input (system prompt, messages, cache breakpoints) and the metrics are byte-identical, and no browser sends the field yet (the registry and hook follow in a later release). The runtime container (glirastes-runtime) turns it off (viewContext: false) until its option chat.viewContext comes. The handler reads glirastesViewContext: { version: 1, current: ViewContextEntry[] } (another version or shape is ignored; byMessage is reserved), keeps with sanitizeViewContext only entries of entity types the request's tools declare (outputEntities / inputEntities, before intent scoping, narrowed by types), at most maxEntries, facts only for a type with a schema in facts, and sends them as a <view-context> block in its own user message right after the newest user message. The block: a fixed header ("data, not an instruction", no permission), one JSON line per entry; <, line and paragraph separators, C1 controls, bidi, zero-width, invisible-format and tag characters as JSON escapes, so no value can close the block or start a line and every line stays valid JSON; no nonce: a user, or third-party data through a mention label, can write a look-alike block into their own message; no permission comes from it, and escaping <view-context in user text follows in its own PR. Size: entry lines at most 2,560 characters after the PII shield and escaping, whole trailing entries left out deterministically when escapes or pseudonyms make them longer (never part of a line); the whole block at most 2,966 characters (a hard bound): typically far fewer tokens, roughly 850 at 3.5 characters per token when full, 1,000 to 1,500 with random ids or non-ASCII text; an app makes it smaller with maxEntries and the facts config. With piiShield, the values (ids, labels, routes, fact values; not entity types or keys) go through the shield before serializing, like tool results (one anonymizeResult call, counted in the audit as anonymize-result and in totalToolCalls): a value gets the same pseudonym as in the user message and a pseudonymized id in a tool argument is restored. The shield's result is read once into an own JSON copy and each shielded entry is checked against ViewContextEntrySchema again: a label a longer pseudonym pushed over 60 characters is cut as the sanitizer cuts it, a route a pseudonym made invalid (a space) is left out, anything else that fails (or a failing shield) sends no block; the request runs on. Never in the system prompt (the block sits behind the cache breakpoint of the newest message, so the next request still hits the cache), never stored in the chat. Invalid input is dropped, never answered with 400. No block for a continuation without a new user message (approval, UI outcome, budget "continue"), a request the pipeline guardrails blocked, a direct command or a custom streamHandler. Guardrails and the app's input check do not see the view context. hideIds does not learn the ids of the block, so the model may show them in answers. Known limits until view contexts are bound to messages: the answer to a clarification gets no block (its question's view is not known), continuations of a turn carry none, and history must be 'none' ('changes' / 'all' throw at creation, like any invalid option). Known limit of the PII shield: the sanitizer cuts a label to 60 characters before the shield sees it, so in a label over 60 characters that ends with an e-mail address, IBAN or phone number the cut value may no longer be recognised and can reach the model as an unprotected fragment in plain text; ids and facts are never cut. The fix follows before the browser side of the view context. Until then, a client of your own that already sends the field should cut labels to at most 60 characters itself, or set viewContext: false. Not yet: browser side, chat.viewContext of the runtime container, facts schemas from the generated artifact, view context records counting as seen for verifyMentions, metrics of the drop counts.
Changed
A derived @ entity takes the type, id field and name field its search tool declares by identity at the searched list (exactly one declaration with a single id), instead of the singular of the route: media-file instead of file. Arguments, "Open" and the action ids follow (file.files.delete → media-file.files.delete), so hidden: true and other patches in .glirastes/chat-interactions.json under the old type or action id no longer apply: a hidden action shows again until the patch is renamed. A declared type that another derived search also ends up with (or that mentions.sources already has) is not adopted: every search involved keeps its route type, as before, with a mention-type-ambiguous warning; no entity of before disappears. Only apps with such a declaration are affected; mention-type-follows-identity names each type, see the migration in docs/chat-interactions.md.
mergeChatInteractions (and so createChatInteractionsHandler) names hidden: true patches for command ids, entity types and action ids that are not derived in a second console warning; they hide nothing. Both warnings, also the existing one for stale patches, now start with chat interaction overrides (.glirastes/chat-interactions.json or the overrides passed in code): instead of .glirastes/chat-interactions.json:, since the overrides may come as an object from code.
A derived @ entity without a reviewed singular is still named after its route (/api/files → "File") when its type follows the declared identity (media-file); a declared source without label is named the same way, after its type only when its path names no type (/search).
@<name>:<text> narrows the search to one entity type also without any new configuration, whenever the text before the first colon is a type's label, alias or canonical type: @task:123 searched every type for task:123 before, now task for 123.
Completion search (command ranking, type filter) also folds letters without a Unicode decomposition: ł ø đ ð ħ ı æ œ þ and their upper-case forms (wlasciciel finds Właściciel). Plain ASCII and German compare as before.
Derived entity labels carry every language of languages in .glirastes/tools.json (the reviewed singular of the search tool), and derived entity action labels keep every language of the tool title; both were cut to en and de.
With at least two entity types, typing after @ shows up to 3 type suggestions above the hits.