Skip to content

Plugin panel can synthesize and play audio, but has no channel to receive data from its worker #15638

Closed

Description

@YoraiLevi

Related to #15637, but a separate and much smaller ask.

While building a TTS plugin (YoraiLevi/orca-plugin-tts)
I probed what a plugin panel can actually do with audio, inside a real build at
0f26ff4ad83e9ca736f6ad3bae6937cd0cdab7fc. The result surprised me and might interest you.

The panel is a better audio host than I expected

Measured in a real sandboxed panel, opaque origin, under the unmodified PLUGIN_PANEL_CSP
(src/shared/plugins/plugin-panel-shell.ts:20-22):

Probe Result
window.speechSynthesis works — 180 voices, start → boundary → end fires
AudioContext constructs in state running, no user gesture needed
AudioBufferSourceNode from a Float32Array plays; 4 ms scheduling drift over chained buffers
source.stop() → onended 2 ms
decodeAudioData on MP3 / Opus / AAC / WAV all decode, 8–10 ms for ~1.5 s of audio
CSP violations across the whole run zero

The reason default-src 'none' doesn't block any of this is that CSP governs resource loads. An
AudioBuffer filled from a typed array involves no URL, no fetch and no src. (For contrast:
<audio> with a data: or blob: src is blocked — media-src, MediaError.code 4 — as you'd
expect.)

AudioWorklet.addModule() is also blocked for both blob: and data: URLs, since that's a script
fetch. AudioBufferSourceNode scheduling is enough, so this isn't a problem.

The gap

There is no way to get audio to the panel.

  • The panel bridge is panel→host only; there is no host→panel push.
  • commands.invoke, storage.get, events.subscribe from a panel all return
    "action: not a panel-callable action".
  • connect-src 'none' means the panel can't fetch anything itself.

So the panel is an excellent speaker with no wire to it, and the plugin worker — which has the text
— has no audio device. My plugin currently writes a WAV to a temp file and spawns afplay /
paplay / PowerShell per chunk, which costs roughly a second of silence between sentences.

The ask

One host→panel message channel. Something like panel.postMessage(panelId, data) from the
worker, delivered to the panel's existing bridge listener.

Some measurements to size it: the panel→host direction caps at 64 KB per message and 30 messages per
10 s (plugin-panel-bridge.ts:23), which is ~1.9 MB / 10 s. 22 kHz mono Int16 PCM is 44 KB/s —
about one message per second. Bandwidth isn't the constraint; the absence of the channel is.

Why other plugin authors benefit

Any plugin whose panel needs data the worker computed is stuck the same way: live charts, log
viewers, progress UIs, previews, anything streaming. Right now a panel can only display what it can
derive on its own, which is a fairly narrow set of plugins.

For audio specifically, this one channel would replace the temp-file-and-subprocess dance with
sample-accurate scheduling and a 2 ms stop — better latency, no spawned processes, no platform-specific
player detection, and it works identically on macOS, Linux and Windows.

Happy to send a PR if you'd tell me the shape you'd accept — whether you'd want it capability-gated,
and whether the same 64 KB / rate limit should apply in this direction.

Activity

  1. YoraiLevi commented on Aug 20, 2026

    @YoraiLevi
    Author

    Update from using this in anger.

    A user running the plugin hit exactly the failure this gap causes, and it is worse than
    "panels are a bit limited". Their words:

    "this is really confusing what it is even reading right now… a way to control something and not
    feel helpless and suffer hearing random stuff."

    The plugin reads agent replies aloud. With no way to show what is playing, which session it came
    from, or what is queued, the user has no model of what the plugin is doing — and for an
    accessibility tool that is a real harm, not a cosmetic gap.

    I have opened #15643, which is a much smaller change than the push channel proposed here: make
    storage.get panel-callable. The worker writes status to plugin-private storage and the panel polls
    it. Read-only, plugin-private, already gated on the storage capability, and strictly less powerful
    than terminal.sendText — which panels may already call, and which types into a terminal.

    That would unblock live panel UI today without a new transport. This issue is still worth doing on
    its own merits — polling is not push, and audio streaming to a panel genuinely needs the channel
    (the measurements above show panel playback is excellent once data can reach it). But if only one
    of the two lands, #15643 is the one that changes what plugin authors can build.

  2. torohima commented on Aug 23, 2026

    @torohima

    Independent confirmation from a different plugin, plus what the workaround actually costs

    Hit the same wall from an unrelated direction — a status panel that renders data collected by an external process — and measured 1.4.187's bundle before finding this issue. Everything here agrees with your report, so this is a second data point rather than a second opinion.

    What the bundle says:

    • PLUGIN_PANEL_CSP is a literal constant, interpolated once into the panel shell's <meta http-equiv="Content-Security-Policy">. Nothing conditional reads it — no setting, no dev-mode flag.
    • The entire bundle contains exactly one connect-src string, that constant. There is no relaxed policy to switch to, which I think is worth stating explicitly: this is a closed door by design, not a missing config.
    • The capability vocabulary is closed and .strict()-validated, so an unknown kind is rejected rather than ignored: ["workspace:read","terminal:send","notifications:show","storage","secrets","events:subscribe","settings:own"]. No network kind.
    • A panel's entry is a contained relative file path, so pointing a panel at a local http URL is not a way around it either.
    • A panel supplying its own meta CSP cannot help: CSP only ever narrows.

    The workaround, and why it is worse than it looks. With no host→panel channel, the only writable surface is the panel's own HTML, which the host re-reads on every mount. So an external writer rewrites the generated panel file and the panel renders an embedded, timestamped snapshot. Two defects came free with that shape, and both took real debugging to attribute:

    1. The rewrite was not atomic. The file is ~38 KB; a truncate-then-write leaves a window in which a panel mount reads a partial document and renders blank or half-built. Fixed by writing a sibling temp file and os.replace.
    2. To keep the displayed age honest the writer ran on a fixed interval, and the payload carries its own clock — so an idle system produced a byte-different file six times a minute, and the panel visibly reloaded and flashed. Fixed by comparing payloads with the volatile fields stripped and writing only on a real change, with a slower heartbeat so a quiet system still cannot be mistaken for a dead writer.

    Neither is Orca's bug. They are the cost of emulating a data channel with a file, and every plugin that needs the same thing will pay them again — differently, and probably later.

    On the two proposals. They solve different halves and I would take either, in this order:

    Happy to test either against a real panel and report back.

  3. added
    bug
    on Sep 19, 2026
  4. added theissue type on Sep 19, 2026
  5. harepus commented on Sep 29, 2026

    @harepus

    @AmethystLiang Another data point: we want a multi-agent launcher and live dashboard (batch-launch agents into one grid, see who needs you, jump to the pane). Honestly we'd rather see that native in Orca, maybe as an extension of the experimental Agent Dashboard, than as a plugin. The plugin is a stopgap, and it runs into this issue: we ended up with the same rewrite-the-panel-HTML hack described above.

    #12229 (plugin.command.invoke, bound to the panel's own plugin) would cover both halves for us: panel actions with args, and polling worker state. Is that a shape you'd accept, or are you leaning toward push or storage.get?

  6. ZephyrDeng commented on Sep 29, 2026

    @ZephyrDeng

    Additional reproduction from a live task-board plugin on Orca 1.4.215 (build commit 3eb1adec20ff90503196ebfd1fe6dbaaefaad736). This is the same missing worker-to-panel data channel, beyond the audio use case.

    1. A plugin worker collects a task/message/ledger snapshot and embeds it in its panel HTML.
    2. Open the panel, expand an item and scroll within it.
    3. Change real source data. The worker must currently rewrite the HTML to deliver the updated snapshot.
    4. The host re-reads the panel entry; when the HTML differs, it increments documentRevision. The iframe key includes that revision and its srcDoc changes, so the document is recreated rather than receiving an incremental data update.

    We fixed spurious writes by comparing snapshots canonically and ignoring collection timestamps. An unchanged-data live check passed across multiple polling intervals, but real data changes still recreate the iframe. Deduplication therefore only removes unnecessary refreshes; it does not solve live updates. We have temporarily disabled the board pending a supported channel.

    The installed host API marks storage.get / storage.keys as panel: false; the bridge validates requests against the panel-callable action set. A worker-to-existing-panel push channel, or panel access to its own plugin-private snapshot, would let us update the existing DOM without rewriting the document. Invoking the panel's own worker command could also provide a pull path.

    Tracking the related proposals: #15643, #13220 (private storage reads), and #12229 (own-worker command invocation). Merge/issue status alone will not establish availability in an installed build.

    Acceptance for restoring the board: real task, message and ledger changes arrive without reloading the document; the iframe and unchanged DOM nodes retain identity; expanded state, focus and scroll position survive. We will still need to implement and test incremental DOM updates after the transport exists.

    This report deliberately uses no real task contents, local paths or embedded snapshots.

  7. psoto commented on Sep 30, 2026

    @psoto

    Adding a concrete use case for a worker → panel data channel.

    Our team keeps two repo-versioned plugins that are monitoring dashboards: a deploy-pipeline view and a shared dev-box monitor (instance state, per-user sessions and agents, CPU/RAM/disk). Both collect data in the worker by shelling out to CLIs with the user's own auth, and both would naturally live in a right-sidebar panel with an icon. Today they render a temp HTML file and open it in Orca's browser instead, because:

    • PLUGIN_PANEL_CSP blocks every load the panel could use (connect-src 'none', img-src data:).
    • The only panel-callable actions are workspace.readContext, terminal.sendText and notifications.show, so the panel cannot read anything the worker produces.
    • Rewriting the panel entry file on disk as a workaround trips the dev-plugin watcher (full re-discovery, worker restart) and the file must exist before the plugin loads.

    The smallest change that would unblock this pattern: make a read-only storage.get (plugin-private scope) panel-callable. The worker writes a JSON snapshot with storage.set and the panel polls storage.get over the existing bridge, well inside the 30 messages per 10 s budget. A push variant (a worker → panel message, or a storage.changed event delivered to the panel) would avoid polling, but read-only access alone is enough. This overlaps with item 2 of #19020.

  8. marioser commented on Oct 4, 2026

    @marioser

    Another use case for a worker→panel channel, independent of audio.

    I'm building a plugin that tracks the prompt-cache lifetime of every agent session (Claude
    Code, Codex, OpenCode, Pi) by reading each agent's own session logs from the worker, and
    warns before the cache expires. The natural UI is a panel with one row per session and a
    live countdown. Today the plugin can only fall back to notifications.show plus a palette
    command, because:

    • the panel bridge is panel→host only, with workspace.readContext, terminal.sendText
      and notifications.show as the only panel-callable actions;
    • the panel cannot call worker commands or read storage;
    • connect-src 'none' rules out any side channel.

    Either shape from this issue would unblock it:

    1. a panel-callable action that invokes one of the plugin's own worker commands and returns
      its result (pull, polled every few seconds), or
    2. a host→panel push the worker can send (e.g. panel.post({ panelId, data })).

    For this case (1) is enough and keeps the bridge request/response only. A small bounded
    payload (a few KB of JSON) every ~5 s would cover it.

    Two related gaps I hit while designing it, in case they belong elsewhere:

    • there is no host method to list worktrees with their paths — only the focused one via
      workspace.readContext, which carries no path;
    • agent.status.changed carries no agent type or session id, so a plugin cannot tie a
      status change to a specific agent session without guessing.
  9. mmarabel commented on Oct 30, 2026

    @mmarabel
    Contributor

    Another use case for this channel: a fleet-monitoring plugin that shows CPU and memory for connected machines in a sidebar panel. The worker would collect the readings; the panel needs a supported way to receive them and refresh its display. A same-plugin request/response API such as #25256 would be enough for periodic updates; GPU readings could be added where available.

  10. nwparker commented on Nov 7, 2026

    @nwparker
    Contributor

    Thanks for the detailed measurements, they were really useful. #37013 (merged) adds the host-to-panel channel you asked for: the worker calls orca.panels.post(event, payload, { panel? }) and the panel listens with plugin.on(event, fn) (window.orca.plugin in HTML panels). Posts can be up to 256 KiB, at most 200 per 10 s per plugin, which is plenty for 22 kHz PCM chunks. The panel can also call the worker with plugin.request(name, input) / orca.panels.handle(name). Docs: plugin-authoring.md and plugin-host-api.md; example: examples/plugins/hello-worker-panel. Closing as fixed. If something is missing for the TTS plugin, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions