pub enum Event {
Inbound {
destination: String,
sub_type: String,
value: Value,
},
CliCommand {
destination: String,
value: Value,
},
ApiCall {
destination: String,
sub_type: ApiCallSubType,
value: Value,
},
}Expand description
Every event the viewer emits to the JS side. Serde-tagged on
type so the JS bridge can pattern-match and decide how to
repackage each variant for the destination iframe.
destination is "objectiveai" for built-in events, or the
plugin’s repository name otherwise. For CliCommand it’s the
repository name of whichever iframe invoked the CLI — the bridge
derives it from MessageEvent.source, the plugin author never
sets it.
Variants§
Inbound
Host → iframe. Carries data into the plugin (the existing
path). sub_type is the snake_case discriminator the plugin
listens on (built-ins: agent_completions /
functions_executions / functions_inventions_recursive /
laboratories_executions; plugins: whatever they declared in
their manifest’s viewer_routes[i].type).
CliCommand
Host → iframe. One JSON line of cli output emitted by an
in-process objectiveai_cli::run() invocation started by
this iframe via invokeCli. value is the cli’s Output<T>
envelope. No sub_type — a single invocation produces a single
stream of lines.
ApiCall
Host → iframe. One value in the response stream of an
in-process upstream API call started by the iframe via
api-call-invoke. sub_type identifies which endpoint the
stream belongs to (lets the iframe demux multiple concurrent
calls to different endpoints). value is an
ApiCallEnvelope JSON object: one
begin, then one or more chunks (or error), then exactly
one end.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Event
impl JsonSchema for Event
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnsafeUnpin for Event
impl UnwindSafe for Event
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more