Class EventScriptReplyRenderer
- All Implemented Interfaces:
ReplyRenderer
value must be exactly one JSON object:
{ "script": "...", "config": { ... }, "enabled": true }
Every member is optional and an omitted member changes nothing, but the object is otherwise
strict: a payload that is not a JSON object, carries an unrecognized or mistyped member, proposes
nothing, or proposes something this tab cannot accept — enabled on a pinned checkbox,
config with no TriggerConfigSupport or failing its schema — renders with the full
problem list and no Apply button. A suggestion is applied whole or not at all; there is
no partial apply of the members that happened to be valid.
payloadInstructions(EventScriptTabState) is the agent-facing side of the same contract: it describes only
the members the tab carries, off the same EventScriptTabState fields EventScriptPromptComposer reads, so a prompt block and its payload description move together.
One renderer is held per assist session; both render methods run on the EDT and read the tab snapshot fresh on each reply, because the popup is non-modal and the panel may have changed since the last submit.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceWrite-backs to the live tab, each invoked on the EDT when the user clicks Apply. -
Constructor Summary
ConstructorsConstructorDescriptionEventScriptReplyRenderer(Supplier<EventScriptTabState> snapshot, EventScriptReplyRenderer.ApplyActions actions, Runnable applied) -
Method Summary
Modifier and TypeMethodDescription@Nullable StringgetSuggestionFailure(String value) Check an apply-able payload before anything renders it.static StringThe "Suggestion payload" contract handed to the assist agent, describing the envelope members this tab accepts:scriptalways,enabledwhen the snapshot carries an enabled state,configwhen it carries aTriggerConfigSupport.renderStatement(String description) Render an informational reply with no apply-able actions.renderSuggestion(String description, String value) Render an apply-able suggestion.
-
Constructor Details
-
EventScriptReplyRenderer
public EventScriptReplyRenderer(Supplier<EventScriptTabState> snapshot, EventScriptReplyRenderer.ApplyActions actions, Runnable applied) - Parameters:
snapshot- returns the tab's live state; read fresh on every reply, so it must snapshot inside the supplier.actions- the write-backs an accepted suggestion applies.applied- invoked once after every write-back in an accepted suggestion succeeded.
-
-
Method Details
-
payloadInstructions
The "Suggestion payload" contract handed to the assist agent, describing the envelope members this tab accepts:scriptalways,enabledwhen the snapshot carries an enabled state,configwhen it carries aTriggerConfigSupport.- Parameters:
state- the tab state captured when the assist popup opened.- Returns:
- the payload contract as prompt prose.
-
renderStatement
Description copied from interface:ReplyRendererRender an informational reply with no apply-able actions. The returnedReplyViewis expected to carry an empty actions list — the panel will read it as aSTATEMENTcard.- Specified by:
renderStatementin interfaceReplyRenderer- Parameters:
description- prose explanation from the model, supporting markdown.
-
getSuggestionFailure
Description copied from interface:ReplyRendererCheck an apply-able payload before anything renders it. A renderer that rejects a payload here gets the model asked again while the turn is still open, instead of the user reading a rejection card for a reply nothing tried to fix.Unlike the render methods this runs on the sending thread, not the EDT, so an implementation must inspect only
value— no Swing state, no editor snapshot.- Specified by:
getSuggestionFailurein interfaceReplyRenderer- Parameters:
value- the payloadReplyRenderer.renderSuggestion(String, String)would receive.- Returns:
nullwhen the payload is usable. Otherwise what to tell the model, phrased for it to act on: what was wrong and what to send instead.
-
renderSuggestion
Description copied from interface:ReplyRendererRender an apply-able suggestion. Thevalueis the literal content the user can write back to the host editor;descriptionis the prose framing. The returned view typically carries one or more apply buttons (Insert, Replace, …).- Specified by:
renderSuggestionin interfaceReplyRenderer- Parameters:
description- prose explanation from the model, supporting markdown.value- the literal content the apply buttons hand back to the host editor.
-