Skip to content

lang-core: @ToAssistant context as any value - #1298

Open
Aditya-thesys wants to merge 2 commits into
mainfrom
feat/lang-core-to-assistant-context
Open

Aditya-thesys wants to merge 2 commits into
mainfrom
feat/lang-core-to-assistant-context

Conversation

@Aditya-thesys

@Aditya-thesys Aditya-thesys commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

@ToAssistant(message, context) now passes context through as any value instead of turning it into a string.

Button("Details", @ToAssistant("Show details", {orderId: 42}))
// onAction params.context: { orderId: 42 }   (before: "[object Object]")
  • Any value is kept: object, array, number, string, and falsy values (0, false, ""). Missing or null means no context.
  • react-lang, vue-lang and angular-lang forward it as params.context.
  • The system prompt now teaches the context argument (real-model check: models used it 0/6 times before, 6/6 after).
  • react-ui chat stores it as the third element of the hidden context: ["User clicked: msg", formState, context] ({} in the form slot when there is no form). Messages without a context are byte-identical. muse reads this JSON as text, so no backend change is needed.
  • Card blocks merge the clicked item into an object context as selectedItem.

Single-step actions moved out of this PR to a later actions PR.

Open question for review: keep the array format, or switch to an object like {"form": {...}, "context": {...}}.

@vercel

vercel Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openui-docs Ready Ready Preview Oct 5, 2026 3:32pm UTC

Request Review

…ext through as any value

The context argument of @ToAssistant(message, context) is no longer
coerced to a string. Any value (object, array, number, string) is kept,
including falsy ones; null or a missing argument means no context. The
renderers forward it in params.context whenever it is set.
The stored user turn for a continue_conversation action becomes
["User clicked: msg", formState, context] when a context is set, with {}
holding the form slot when there is no form. Without a context the
message is unchanged. Card item context merges into an object context as
selectedItem and stays a text suffix for other contexts.
@Aditya-thesys
Aditya-thesys force-pushed the feat/lang-core-to-assistant-context branch from 58dc2cc to d8e7541 Compare October 5, 2026 15:28
@Aditya-thesys Aditya-thesys changed the title lang-core: @ToAssistant context as any value, single-step actions lang-core: @ToAssistant context as any value Oct 5, 2026

This branch was successfully deployed

1 active deployment
Preview — d8e7541b Deployed Oct 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant