Skip to content

Port generation to OpenUI Cloud - #10

Open
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1787984241-openui-cloud
Open

Port generation to OpenUI Cloud#10
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1787984241-openui-cloud

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Aug 29, 2026

Copy link
Copy Markdown

Summary

AppLess no longer talks to Cerebras directly. Screens are generated through OpenUI Cloud (https://api.thesys.dev/v1/embed/chat/completions) with the app's own native component library handed over as a managed chatLibrary config block, so the Cloud generates the system prompt (generateSystemPrompt from @openuidev/thesys-server) and validates the streamed openui-lang against that same library, while routing the model call to Cerebras only. No behaviour beyond the provider swap changes: same contract, same renderer, same local tool loop, no new src modules and no test changes.

Request shape:

POST https://api.thesys.dev/v1/embed/chat/completions   // Authorization: Bearer <thesys key>
{
  model: "google/gemma-4-31b-it",
  messages: [{ role: "system", content: SYSTEM_PROMPT /* ]]>openui:config {…} + tools/date prose */ }, ],
  stream: true,
  provider: { only: ["cerebras"], allow_fallbacks: false },
  metadata: { thesys: '{"c1_openrouter_provider":{"only":["cerebras"],"allow_fallbacks":false}}' },
}

Routing travels twice on purpose: with a managed config block the Cloud builds its metadata from the config and honours the request-level provider field, while metadata.thesys is the documented form for plain embed requests — both agree, so either path routes Cerebras-only.

@openuidev/thesys-server is Node-only, so prompt generation stays a build step: scripts/generate-prompt.mjs replaces scripts/embed-prompt.mjs (which required a sibling checkout of the web repo to copy a prompt from). It bundles the native contract with esbuild, serialises it to a chatLibrary (library.toJSONSchema() + per-component descriptions + componentGroups), passes the AppLess-specific prose from the old prompt as systemPromptOptions, and embeds the result:

]]>openui:config
{"chatLibrary":{"schema":…,"root":"Card","componentGroups":…,"id":"appless-native-0.1.0"},"systemPromptOptions":{"preamble":…,"additionalRules":…,"examples":…}}

src/genos/ui/contract.tsx is now the single source for both the renderer and the wire library, so npm run generate:prompt is the only step when components change.

Responses arrive wrapped in the Cloud's inline section markers, so cleanLang() strips them before parsing (stripInlineMarkers() in src/genos/store.ts) — including a marker split across chunk boundaries, since a trailing ]]>openui… fragment is never valid openui-lang:

]]>openui:content?thesys=true
```openui-lang
root = Card([…])

]]>openui:end


The local tool loop is untouched: the Cloud passes `tools`/`tool_calls` turns through unwrapped, so `web_search` still runs on-device.

BYOK is unchanged in shape, only the provider: `EXPO_PUBLIC_THESYS_API_KEY` / device-stored Thesys key (`genos.thesys-key`) instead of the Cerebras key, and the first-launch gate points at the Thesys console.

## Verification

- `npm run typecheck`, `npm test` (existing 22 tests, unchanged).
- Replayed the generated config block through muse's gateway parser and validator: config parses with zero `validateChatLibrary` issues, the trailing prose survives as instructions, and muse's `buildChatLibrarySystemPrompt` renders a 27k-char prompt containing the AppLess preamble, rules and examples.
- A live request to the endpoint returned `ERR_BILLING_THRESHOLD_EXCEEDED` (org billing suspended), so end-to-end streaming against production is still unverified.


Link to Devin session: https://app.devin.ai/sessions/35baf7b209b041ab83ae2917408cbb33
Open in Devin Desktop: https://app.devin.ai/desktop/session/35baf7b209b041ab83ae2917408cbb33?variant=devin

Screens are now generated through api.thesys.dev/v1/embed with AppLess' own
component library sent as a managed chatLibrary config block, so the Cloud
owns prompt generation (generateSystemPrompt from @openuidev/thesys-server)
and openui-lang validation while routing the model call to Cerebras.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Keeps the port to a provider swap: no new src modules or tests - the
AppLess prompt prose lives in scripts/generate-prompt.mjs (which replaces
scripts/embed-prompt.mjs) next to the chatLibrary serialisation.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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