Class EventStreamAiGrounding
Provides AI groundings for the Scripting surfaces for following stages:
- Filter
- Transform
- Error Handler
- Handler Editors
The Filter, Transform, and Error sections use callerContextFor(EventStreamSurface) with sampleToolFor(EventStreamSurface) to get
their grounds.
Handlers own their overall framing, using EventStreamAiContext.handlerEventDataShape() and
EventStreamAiContext.lateStageSampleTool()
The grounding comes is split into 2 main tasks:
-
The type-level description of the event a body receives, embedded straight into the caller context.
- It is resolved from the current configuration shown in the editor: which source encoder,
which transform encoder, whether the Transform is enabled. All read through
liveConfigon every prompt, with the source's display name resolved throughsourceRegistry. Whatever cannot be read is leftnull, and the framing degrades to generic prose for that part alone.
- It is resolved from the current configuration shown in the editor: which source encoder,
which transform encoder, whether the Transform is enabled. All read through
-
An on-demand tool the agent calls when it wants a real sample of the last captured event. That is a blocking Gateway round-trip, so it rides a tool rather than being embedded.
- The whole of that half lives in the
tools subpackage, behind
SampleTools. This class supplies what only the Designer knows — the RPC, the resource's coordinates, andliveConfig— and hands out the resulting tool perEventStreamSurface; how a sample is decided, fetched, and worded is not its business. - The Filter matters because the Transform and the late stages only ever see events an
enabled Filter forwarded, so a Filter that rejects everything means there is no sample —
not a different one. An agent may pass
applyFilter=falseto bypass it for a single fetch, but only when the user asks.
- The whole of that half lives in the
tools subpackage, behind
-
Constructor Summary
ConstructorsConstructorDescriptionEventStreamAiGrounding(EventStreamRpc rpc, String projectName, String resourceFolderPath, @Nullable DesignerAiContext aiContext, Supplier<@Nullable EventStreamConfig> liveConfig, SourceRegistry sourceRegistry) -
Method Summary
Modifier and TypeMethodDescriptioncallerContextFor(EventStreamSurface surface) The finished framing string forsurface, grounded in the event shape read from the live configuration.The sample tool for the handlers, which receive the same late-stage event the error handler does.sampleToolFor(EventStreamSurface surface) The on-demand sample toolsurfaceshould contribute, deferred to prompt-submit time so it is only built once the AI assist is actuallyready().
-
Constructor Details
-
EventStreamAiGrounding
public EventStreamAiGrounding(EventStreamRpc rpc, String projectName, String resourceFolderPath, @Nullable DesignerAiContext aiContext, Supplier<@Nullable EventStreamConfig> liveConfig, SourceRegistry sourceRegistry) - Parameters:
rpc- the gateway RPC used to encode the stream's last captured events.projectName- the project the stream belongs to.resourceFolderPath- the stream resource's folder path.aiContext- the Designer AI context, ornullwhen the AI module is absent — in which case this grounding is inert and never builds a sample tool.liveConfig- the Event Stream configuration as currently edited, ornullwhen it cannot be read.sourceRegistry- provide additional info on the Source from, such as name
-
-
Method Details
-
callerContextFor
The finished framing string for
surface, grounded in the event shape read from the live configuration. Sections take the assembled framing rather than a shape they would have to pair withEventStreamCallerContext.forSurface(EventStreamSurface, EventStreamCallerContext.EventShapeInfo)themselves, so a section and its framing cannot drift apart.One entry point keyed by
EventStreamSurfacerather than one method per surface, so a caller cannot pair a surface with another surface's framing. The returned supplier defers the read to prompt-submit time; invoke it on the EDT. -
lateStageSampleTool
The sample tool for the handlers, which receive the same late-stage event the error handler does. Reached by handler editors (built-in or third-party) throughEventStreamAiContext. -
sampleToolFor
The on-demand sample toolsurfaceshould contribute, deferred to prompt-submit time so it is only built once the AI assist is actuallyready(). -
createAiContext
-