feat(ai): richer control context in prompts (inherited props, enums, caps) - #382
Open
dobrinyonkov wants to merge 3 commits into
Open
feat(ai): richer control context in prompts (inherited props, enums, caps)#382dobrinyonkov wants to merge 3 commits into
dobrinyonkov wants to merge 3 commits into
Conversation
Bump per-section character caps in PromptBuilder from 800/400 to 8000 (properties, bindings, aggregations, console errors) and BINDING_VALUE_CAP from 100 to 1200 (~300 tokens). Update tests that reference the old cap sizes.
Widen the Prompt Builder's property section to carry the selected control's
inherited property groups and a typed, cleaner property line for each entry.
- controlUtils: additive typeNames sibling on properties.own and each
properties.inheritedN, carrying the raw declared type string. Preserve
meta.controlName on inherited groups so the prompt heading can name the
declaring class. types dictionary and DataView consumers are unchanged.
- PromptBuilder: replace the flat {value, isDefault} property line shape
with '- <name>: <TypeName> = <value>', appending '(default)' when the
entry is marked default and omitting the type slot when typeNames[key]
is empty. Strings are JSON-quoted (so embedded quotes stay escaped);
booleans, numbers, null, undefined render literally; objects and arrays
are JSON.stringify'd and capped at 500 characters. Combined 8000-char
budget across own + all inherited groups with outer-first truncation:
deepest inherited group is dropped whole; own alone overflow is
truncated with '... [truncated]'.
Closes issue 01 of .scratch/ai-prompt-control-api-reference.
…ed properties Widen the Prompt Builder's control block with an 'Enums used:' subsection that lists the full set of valid values for each enum-typed property on the selected control. The subsection lands after all property groups and before Bindings:. - Detection per property: typeof types[key] === 'object' AND typeNames[key] is a non-empty string. Members come from Object.keys(types[key]) in insertion order (which matches the UI5 enum's declared order at runtime). - Line format: '- <enum type name>: V1 | V2 | V3 | ...'. One line per unique enum type across own + all inherited groups; dedup key is the type name. - Section capped at 2000 characters via a new module-level ENUMS_CAP constant, consistent with the existing per-section caps. Truncation appends the standard '... [truncated]' marker. - Custom-library enums (object types[key], missing typeNames[key]) are silently skipped from the subsection; the corresponding property line is unaffected. Non-enum properties (types[key] is a primitive string) never produce an entry. - Subsection omitted entirely when no property has a resolvable enum. No change to controlUtils, AssistantController, or any other consumer. Closes issue 02 of .scratch/ai-prompt-control-api-reference.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Improves the context the AI assistant sends to the model when you inspect a UI5 control. Independent of the multi-provider work — this only touches the prompt builder.
Three commits:
Why separate
This is prompt-quality work that rode along in the multi-provider branch but has nothing to do with providers. It touches only
PromptBuilder.jsandcontrolUtils.js. Splitting it out keeps the provider PRs focused and lets this land or revert on its own.Testing
npx grunt karma:CI— 610 tests pass.