{
"title": "viewer.Event",
"description": "Every event the viewer emits to the JS side. Serde-tagged on\n`type` so the JS bridge can pattern-match and decide how to\nrepackage each variant for the destination iframe.\n\n`destination` is `\"objectiveai\"` for built-in events, or the\nplugin's repository name otherwise. For `CliCommand` it's the\nrepository name of whichever iframe invoked the CLI — the bridge\nderives it from `MessageEvent.source`, the plugin author never\nsets it.",
"anyOf": [
{
"title": "Inbound",
"description": "Host → iframe. Carries data into the plugin (the existing\npath). `sub_type` is the snake_case discriminator the plugin\nlistens on (built-ins: `agent_completions` /\n`functions_executions` / `functions_inventions_recursive` /\n`laboratories_executions`; plugins: whatever they declared in\ntheir manifest's `viewer_routes[i].type`).",
"type": "object",
"properties": {
"destination": {
"type": "string"
},
"sub_type": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"inbound"
]
},
"value": {}
}
},
{
"title": "CliCommand",
"description": "Host → iframe. One JSON line of cli output emitted by an\nin-process `objectiveai_cli::run()` invocation started by\nthis iframe via `invokeCli`. `value` is the cli's `Output<T>`\nenvelope. No sub_type — a single invocation produces a single\nstream of lines.",
"type": "object",
"properties": {
"destination": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"cli_command"
]
},
"value": {}
}
},
{
"title": "ApiCall",
"description": "Host → iframe. One value in the response stream of an\nin-process upstream API call started by the iframe via\n`api-call-invoke`. `sub_type` identifies which endpoint the\nstream belongs to (lets the iframe demux multiple concurrent\ncalls to *different* endpoints). `value` is an\n[`ApiCallEnvelope`](super::ApiCallEnvelope) JSON object: one\n`begin`, then one or more `chunk`s (or `error`), then exactly\none `end`.",
"type": "object",
"properties": {
"destination": {
"type": "string"
},
"sub_type": {
"$ref": "viewer.ApiCallSubType"
},
"type": {
"type": "string",
"enum": [
"api_call"
]
},
"value": {}
}
}
]
}