Enforce restricted action slots (follow-up to #1298) the parser keeps `@OpenUrl` and the prompt still teaches it
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript
- Ambito
- backend-api-design, frontend, security
Direzione di ricerca
Start with the restricted action slot refs and parser checks in lang-core, then inspect actionSection() and builtinSteps() for prompt generation and runChatAction in react-ui for runtime handling. Reproduce with the supplied createParser example and review related issues #1298, #663, and #633. Done means disallowed steps are reported and dropped, the prompt lists only allowed steps, and apps can veto URL opening.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
#1298 (shipped in 1.0 via #1348) added restricted action slots for the prompt and schema and left enforcement as a follow-up. I couldn't find an issue tracking it, so here is one with a repro.
lang-core exports steps.OpenUrl.ref / steps.ToAssistant.ref for restricted action slots, and the generated prompt says "Props typed like @OpenUrl | @ToAssistant accept only the steps listed." With action: z.union([steps.ToAssistant.ref]).optional():
- Parser:
@OpenUrl(...)in that slot, bare or insideAction([...]), parses withmeta.errors == []and stays in the action plan. An unknown step (@Frobnicate) does getunknown-function, so steps are checked, but not against the slot's union. - Prompt:
actionSection()still lists@OpenUrlunder "Available steps", uses it in the intro (Action([@OpenUrl(...), @ToAssistant(...)])) and the "simple nav" example, and the signatures line says(@ToAssistant, @OpenUrl), though no slot accepts it.builtinSteps()filters only Run/Set/Reset. - Runtime:
react-ui'srunChatActionhandlesopen_urlitself (window.open(url, "_blank")) and forwards only other events toonAction, so anAgentInterfaceapp can't veto it.
To Reproduce
// Button.action = z.union([steps.ToAssistant.ref]).optional()
createParser(spec.schema, spec.root)
.parse('root = Card([b])\nb = Button("Go", @OpenUrl("https://x"))')
.meta.errors; // []
Expected behavior
A step outside the slot's union is reported (e.g. code: "step-not-allowed") and dropped from the plan; the prompt advertises only steps some slot accepts.
Actual behavior
The step is kept silently, taught to the model, and a click opens the URL.
Desktop (the parser part reproduces in Node, no browser)
Versions: @openuidev/lang-core 1.0.1, @openuidev/react-lang 1.0.1, @openuidev/react-ui 0.18.1
Additional context
Possible fixes:
- Parser: check step membership against the slot's union, next to the existing
unknown-functioncheck. - Prompt: derive the step list from the library's slots and omit the
@OpenUrlintro/example when no slot accepts it (or aPromptOptions.stepsoverride). - Runtime: pass
open_urlthroughonAction(or let it override the default) so apps can veto navigation.
Apps that must never open model-written URLs (strict CSP, a screen that rejects URLs) currently wrap each action-bearing component to filter steps themselves.
Related: #663 (custom action steps), #633 (prompt allow-list for components).
- Lingua principale
- TypeScript
- Stelle
- 10k
- Fork
- 698
- Merge medio
- 1g 6h
- PR unite (30g)
- 158
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di thesysdev/openui
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
thesysdev/openui#1445 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Add dataInvention flag to PromptOptions to disable the 'generate realistic/plausible data' ruleAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
thesysdev/openui#959 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di thesysdev/openui
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
area/admin/user area/internationalization automated-triage issue/auto-triaged type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
grafana/grafana#137281 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
accessibility bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
Luen/crag-stats#429 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Missing assertions to legacy Cafe Menu block testsForse già presa @mariamanbar l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
freeCodeCamp/freeCodeCamp#71624 ·
I maintainer di solito rispondono entro 1 giorno