شعار Generative Ui

Generative Ui

مؤسسةشائع
GetStream
generative-ui

How an agent's interactive UI (OpenUI, A2UI) travels from the model to the apps - the agent.yaml `ui:` key and the prompt it compiles, the router's streaming splitter, the `ui_delta`/`ui_completed` socket frames, what is kept in Stream Chat, and LiveUI in the client SDKs. Read before changing any of them or debugging a card that is missing, stuck or jumps.

نظرة عامة

الناشرGetStream
المستودعAgents
اسم المهارةgenerative-ui
النجوم
8.2K
التفريعات
709
الملفات المرفقة
تعليمات فقط
الترخيصApache-2.0
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • مكتفية بذاتها

    كل ما يحتاجه النموذج موجود في التعليمات — لا ملفات إضافية لمزامنتها.

  • مفتوحة المصدر

    نشرها GetStream على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Generative Ui في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/GetStream/Agents/tree/main/.claude/skills/generative-ui
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/GetStream/Agents.git /tmp/Agents
mkdir -p .claude/skills
cp -r /tmp/Agents/.claude/skills/generative-ui .claude/skills/generative-ui
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Generative Ui في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Generative Ui تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Generative Ui بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

Generative UI

An agent can answer with a card instead of text: a restaurant with its tables, a trip with a map. The model writes the card as a program in a fenced block, the router splits it off its words as it streams, and the apps render it with their own renderer (stream-chat-react's AIUIHost, stream_chat_flutter_ai, StreamChatAI). The router knows no UI format beyond OpenUI patches; it carries the program as text.

model tokens
  -> agent: ui_stream.go splits UI from prose (before stage directions and TTS)
       -> prose: spoken on a call, written in chat
       -> UIDelta / UICompleted events
            -> session socket: ui_delta / ui_completed frames (no buffering)
            -> conversation: Stream Chat message custom.ai_ui (partial updates, then settled)
            -> chatlog: custom.ai_ui on a call's transcript message
  -> agent history keeps the UI block, so the model can patch it next turn

The agent.yaml ui: key

ui: tells the model what it may draw. The SDK that loads the folder compiles it into a ## Interactive UI Generation section and syncs it as the config's ui_instructions, apart from instructions.md, so the router sees only text. The output is deterministic, so the prompt prefix stays cacheable across turns. The prompt is mixed mode: the model answers in prose and adds a card only when it helps.

The router tells the model ui_instructions after the instructions (session.Spec.prompt), unless the session was opened with ui: false, which a device may send. The router then omits ui_instructions, so an app that shows no UI leaves the catalog out of every turn and can expect prose; this does not prevent the model from producing UI blocks, which are still split off the reply. The session row keeps the choice (agent_sessions.no_ui), so a reopened or forked conversation is not told them either. Go and JavaScript write ui_instructions. A renderer's own prompt pasted into instructions.md (stream-chat-react's openUIInstructions is OpenUI's, 53 KB, and says the entire reply must be openui-lang) can't be turned off either and contradicts prose plus one block: use ui: instead.

yaml
# agents/concierge/agent.yaml
name: concierge
llm: llm-fast
ui:
  format: openui            # the default, or a2ui
  keep: [CardHeader, Form, Chips, FollowUpBlock]   # built-ins to offer; their children come along
  components: ui/components.json   # default path; read when the file exists
  blueprints: ui/blueprints.yaml   # default path; read when the file exists
  patch_mode: true          # teach openui-patch for refining the previous card
  voice_ui: true            # a card on calls too, after one spoken sentence
  rules:
    - Always pair RestaurantCard with AvailabilityGauge when the wait is known.
KeyWhat it does
formatopenui, the default, or a2ui. Anything else is refused.
keepOpenUI: restricts the built-in catalog (uiBuiltins in sdks/go/agents/ui.go) to these names plus their required children (Form brings FormControl, Buttons, Button); Card is always in. A2UI: names the basic catalog's components and functions to offer, and nothing else comes along, as stream-chat-swift's own prompt generator does. Empty offers all of them. A name that is neither built in nor a custom component is refused.
componentsThe app's own components in the portable format every app reads (UIComponents.json): name (snake_case), description, parameters (JSON schema with x-order, the positional order), events, optional slots. Each becomes a PascalCase signature: restaurant_card -> RestaurantCard(name: string, ...).
blueprintsA YAML list of name, when, order, rules, example. Each is a line telling the model which components, in which order, for which kind of ask. An example is a program in the format, checked at load so it renders as written: OpenUI for unknown components, too many arguments and undefined or orphan references, with the line of the problem; A2UI as stream-chat-swift's A2UIProgram checks it, for messages it can't read, components and properties the catalog doesn't have, missing required properties, children never defined, components nothing holds, cycles and nesting past 50.
patch_modeOpenUI only: adds the rule to answer a refinement of the previous card with an openui-patch block of only the changed statements. Refused with a2ui, since only OpenUI patches are merged and an A2UI reply writes a new surface.
voice_uiChanges the opening rule from "no UI block on a voice call" to "one spoken sentence, then the card".
rulesAppended as ### Brand & Design Rules.

Paths are relative to the agent directory and may not leave it (symlinks included); each file is capped at 512 KiB.

Loaded by: Go (sdks/go/agents/ui.go, from Load, into Folder.UIInstructions) and JavaScript (sdks/js/src/ui-catalog.ts, from loadFolder in folder.ts). Python, .NET, Ruby, Rust and PHP don't read ui: yet (see the note at the end of the sdk skill), and the getstream CLI refuses it as an unknown key (cli/internal/agentrc/agentrc.go, KnownFields), so getstream agents sync fails on it. The two compilers must produce the same bytes for the same folder: sdks/testdata/ui/concierge/ is compiled by a Go test and a JavaScript test, both held to sdks/testdata/ui/concierge.instructions.txt, which Go writes: what the model is told, the instructions and the UI joined by a blank line, as the router joins them. An SDK that adds ui: checks itself against the same pair. a2ui is compiled by Go (sdks/go/agents/ui_a2ui.go) and JavaScript (sdks/js/src/ui-a2ui.ts), both held to sdks/testdata/ui/concierge-a2ui/ and concierge-a2ui.instructions.txt. JavaScript parses this YAML by hand; it still differs from yaml.v3 on escapes inside quoted strings ('it''s'), empty list items, and ui: written as a flow mapping.

How the model writes UI

The compiled prompt asks for one short sentence, then the card in a ```openui-lang block, root = Card([...]) first so the shell streams at once. With format: a2ui the card is A2UI 1.0 messages in a ```ui:a2ui@1.0 block, one JSON object per line: a createSurface naming the catalog getstream.io:app-catalog, the id the apps' A2UI renderers give the basic catalog with their own components, then updateComponents, root first. The prompt is the one stream-chat-swift's renderer writes for itself (A2UIInstructions): its protocol and guidelines, then the catalog as JSON Schema, the basic catalog's components and functions that keep names beside the app's own, each app component as the renderer has it (PortableComponent: its parameters as properties, its events joining its description). sdks/go/agents/a2ui/ holds the basic catalog and the protocol as the renderer has them, which a2ui/generate.sh writes again from a stream-chat-swift checkout; a Go test holds the catalog to the one in swift_assistant/a2ui/instructions.md, which the renderer wrote, so regenerate both together. JavaScript carries the same three files as a module, sdks/js/src/generated/a2ui.ts, which npm run a2ui in sdks/js writes from Go's copies; run it after generate.sh, or a JavaScript test fails. The router's splitter (acceleration/internal/agent/ui_stream.go) reads:

  • ```openui-lang and ```openui-patch (OpenUI, replace or patch)
  • ```ui:<format>[@<version>][+patch], such as ui:a2ui@1.0

A block opens only on a fence at the start of a line. The splitter runs on every agent's reply, UI or not, so prose that mentions UI (wrap the list in a <ui> element) stays prose. Only the first UI block of a reply is its UI. A fence split across tokens is held back until it is known, never shown as prose for a moment.

A patch is statements that replace those with the same identifier, add new ones at the end, or remove one with name = null (a $variable set to null stays). MergeOpenUIStatements (conversation/ui.go) and its copies in sdks/js/src/conversation.ts and sdks/dart/.../core/conversation.dart do the merge.

In the router

  • agent.go runs every chunk through uiStream.Add before stage directions and the TTS chunker, so [header, map] isn't stripped as a direction and a call never reads UI code aloud. It sends UIDelta as UI arrives and UICompleted when the block closes, and keeps the block in the assistant's history (HistoryBlock) so the model can patch it.

  • api/sessionws.go writes them to the session socket with no timer:

    • {"type":"ui_delta","turn_id","format","version"?,"mode"?,"delta"}
    • {"type":"ui_completed","turn_id","format","version"?,"mode"?,"content"}

    mode is left out for replace. A delta is the next piece of the raw block; a patch's delta is the patch, not the merged program.

  • conversation/conversation.go folds them into the reply's custom.ai_ui ({v, format, version?, status: "streaming"|"complete", content}), merging a patch onto the last completed UI of the conversation (seeded from history when it reopens). Stream Chat gets partial updates every answerEvery (150ms) while the reply is written and the settled UI when it finishes. conversation_updated broadcasts for text deltas are coalesced to the same 150ms; one held back is sent from the live loop's tick (publishHeld), so the last words before a pause reach watchers without waiting for the next event.

  • A UI that would take the message's custom data over 48 KiB is left out of that write (fitUI): the reply keeps its words and has no card.

  • chatlog/chatlog.go keeps custom.ai_ui on a call's transcript message, so a card drawn on a call is in the chat afterwards.

In the client SDKs

  • Turn.ui (JavaScript, Dart, Swift and Kotlin TurnUI) is the turn's UI from the socket: format, version, status (Swift's and Kotlin's isStreaming), content, with patches merged onto the transcript's previous card. A patch with no card before it in this transcript, as after a reload, sets no ui: Stream Chat's copy, which the router merged, is the one to show. Kotlin and Dart take a patch's base close to the router's: the latest earlier card that was completed and not interrupted, in any format (../sdk/notes/2026-11-23-ui-patch-base.md lists where they still differ). A patch whose base isn't OpenUI shows no ui, and LiveUI drops the preview it had merged. Swift and JavaScript still merge onto the latest OpenUI card.
  • LiveUI lays the socket's UI over the Stream Chat reply while it is written, so the card draws at socket speed instead of at Chat's 150ms. JavaScript's AgentChat applies it to every message it hands out; in Dart, the app calls liveUI.observe and liveUI.overlay itself (flutter_assistant/lib/agent_chat.dart), and in Swift too (swift_assistant's AgentChat.swift, which publishes each change inside an animation) and Kotlin (android_assistant's AgentTransport.kt, which redraws the conversation when observe says what shows changed). Swift's, JavaScript's, Kotlin's and Dart's TurnUI.content also hold back the OpenUI statement no newline has ended yet while it streams, so a card grows a part at a time rather than reflowing with every delta, and LiveUI leaves a reply its text until one statement is finished. The rules, which keep a card from jumping:
    • A reply that names its turn (support_runtime.turn_id) shows only that turn's UI.
    • Before its turn id is in Chat, the newest generating reply shows latest(): the newest turn's UI, only when that turn is the agent's. The person's question (said) and a new responding turn clear it, so a new reply never shows the card before it.
    • Once Chat says the reply is written (generating false) or its ai_ui is complete, what Chat stored shows.

Debugging

  • Card never shows: is it in the reply's custom.ai_ui in Stream Chat? If not, did the model write a fence the splitter reads (router logs, or the ui_delta frames on the socket)? Was it over 48 KiB?
  • Card shows UI code as text, or a call reads it aloud: the block didn't open as UI, usually a fence info string the splitter doesn't know.
  • Card blanks or jumps between turns: check the LiveUI rules above against the message's support_runtime.turn_id, generating and ai_ui.status.
  • A component the model places but the app can't render: compare the agent's ui/components.json and keep with what the app's renderer registers. Flutter's OpenUIRenderer doesn't render every built-in yet.

Known gaps

  • The agent, the conversation and the chatlog each keep their own "previous UI" for patches; a patch after a tool round can be merged onto a different base in each.
  • An interrupted call reply can leave a half-written ai_ui with status: "streaming" in the transcript, and a refused one is saved with its UI.
  • The UI block is in the assistant's history Content, which lastAssistantSaid, the echo filter and the flow controller read as speech.
  • ui_delta and ui_completed aren't declared in internal/api/handwritten.go yet.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Generative Ui؟

How an agent's interactive UI (OpenUI, A2UI) travels from the model to the apps - the agent.yaml `ui:` key and the prompt it compiles, the router's streaming splitter, the `ui_delta`/`ui_completed` socket frames, what is kept in Stream Chat, and LiveUI in the client SDKs. Read before changing any of them or debugging a card that is missing, stuck or jumps.

لماذا تستخدم Generative Ui على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Generative Ui عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Generative Ui في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/GetStream/Agents/tree/main/.claude/skills/generative-ui. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Generative Ui؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Generative Ui؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Generative Ui معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Generative Ui مجانية؟

نعم. نشرها GetStream على GitHub بموجب ترخيص Apache-2.0. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇