Files
Neil 459745d9a4 fix(plugins): workspace.changed replays the current context on subscribe (#37044)
A panel that loaded before Orca focused a workspace showed nothing until the next change, and a
subscription made before the panel's push channel opened was never told at all. Now each new
subscriber gets the current context first: the panel bridge replays it once the channel is
open (or right away), and a worker's events.on('workspace.changed') reads it through
workspace.readContext. Unit tests for both, and the agents e2e checks the first event arrives
with no change happening.
2026-11-01 07:46:18 -08:00

2.3 KiB

Events

Worker events

List each in contributes.events ({ "on": "<event>" }), with main, the trusted-worker profile and the capability shown; then orca.events.on(event, handler) in activate(orca) returns { dispose() }. Payloads:

  • workspace.created (capability workspace:read; since 1.4.245): A worktree workspace was created. { workspaceId: string; kind: "worktree" | "folder"; path: string; branch: string }
  • workspace.removed (capability workspace:read; since 1.4.245): A worktree workspace was removed. { workspaceId: string; kind: "worktree" | "folder"; path: string }
  • agent.status.changed (capability agent:read; since 1.4.160): An agent in a terminal pane changed status; workspaceId is null when Orca cannot tie the pane to a workspace, and terminalId names its terminal when Orca lists it. { workspaceId: string | null; paneKey: string; terminalId?: string; title?: string; state: "working" | "blocked" | "waiting" | "done"; receivedAt: number; mainAgent?: { state: "working" | "blocked" | "waiting" | "done"; outcome?: "success" | "failure" | "cancellation" | "superseded" | "interruption" | "unconfirmed"; stateStartedAt: number } }
  • workspace.changed (capability workspace:read; since 1.4.246): The focused workspace changed, or its terminals were opened, closed or renamed; context is what workspace.readContext now answers. Each new subscriber first gets the current context. { context: { branch: string; displayName: string; terminals: { id: string; title?: string }[] } | null }

Frame events (orca.on(event, handler) in HTML panels and custom editors)

  • theme: FrameTheme: The --orca-* variables and the light/dark class on <html> already changed.
  • 'editor.document': EditorDocument: Custom editors: a new document; orca.document.onDidChange is the usual way to listen.
  • 'editor.flush': undefined: Custom editors: post pending edits before a save; Orca waits for a returned promise.

Components panel events (on(event, handler) from orca)

  • theme: { colorScheme: 'light' | 'dark' }
  • Every worker event above, with the same payload and capability; a panel needs no contributes.events entry, it subscribes while it is open. HTML panels get them on orca.on too.