Package com.inductiveautomation.eventstream.designer.ai


@NullMarked package com.inductiveautomation.eventstream.designer.ai

AI Designer embed wiring for the Event Stream script-editing surfaces — the filter, the transform, the error handler, and the handler editors.

Each of those surfaces edits a single Jython extension-function body, and each needs the same two things before an agent is useful on it:

  • caller context — a framing string describing what the body receives and what it must return;
  • tools — a way for the agent to fetch a real captured event when that description is not enough.

The cost boundary

The two are separate because of one constraint: the embed framework assembles an agent's caller context synchronously on the Event Dispatch Thread when the user submits a prompt, and forbids that assembly from blocking. So the grounding is split in two, and that split is the organizing idea of the package.

  • The shape is cheap — which source, which encoder — read straight off the live configuration and rendered into prose by EventStreamCallerContext. It embeds inline for free.
  • The sample is expensive — a real captured event costs a blocking Gateway RPC, so it cannot be gathered during context assembly. It rides an on-demand tool instead, invoked from the agent's tool loop on a background thread, which also makes it lazy and always current.

The expensive half is a package of its own, tools. Read its package docs for how a sample is decided, fetched, and worded.

Entry points

EventStreamAiGrounding produces both halves, keyed by EventStreamSurface so that "what does the transform surface see" is answered by passing one constant to two methods rather than by finding the two methods named after that surface. The stream editor's own surfaces — filter, transform, error — are handed their halves directly at construction.

EventStreamScriptAssistMounter mounts the result: given a surface's extension-function panel (ExtensionFunctionPanel) and both halves, it adds an "Ask AI" button to that panel's toolbar and hands the button back, so a surface whose editor sits behind an "enable" checkbox can bind the button's enabled state alongside it. It is a no-op when the AI module is absent or unconfigured, so hosts may call it unconditionally. It is not intended for third-party use, though nothing enforces that today.

Boundaries

  • The input port is a Supplier<EventStreamConfig> handed to EventStreamAiGrounding — one EDT-only read of the configuration as currently edited, supplied by the stream editor's configuration manager, yielding null when it cannot be read. Everything the grounding knows about the pipeline it derives from that single value, so the branching it drives in the tools package is testable by passing a plain configuration.
  • The output port is EventStreamAiContext, the narrow view handed to handler editors, which are created lazily from the registry and may belong to another module. A handler editor asks for one by implementing EventStreamAiHandler. Handlers own their overall framing, so the view gives them the raw late-stage event shape rather than an assembled caller context, and the sample tool for the same stage the error handler sees.