Plugin shots wait for the worker and restore after --act; terminal approval prompt (#37066)

* feat(plugins): dev watch asks for first-load approval in a terminal; acronym-aware names

- In an interactive terminal without --json, a first dev watch load that needs approval shows
  the grants (as plugin inspect prints them) and asks Approve and load? [y/N]; yes reloads with
  the host's fingerprint and keeps watching. --json and non-TTY runs keep the exit-3 flow.
- create keeps known acronyms uppercase when it derives a name from the id (pr-queue → PR Queue).

* fix(plugins): a declined dev watch approval prints only the re-run command

The person just read the grants in the prompt, so the exit-3 error no longer repeats them:
Not approved. To approve later, run: <command>.

* feat(plugins): shots wait for the worker; --act restores the panel; Table and Tree acts

- A shot settles once the panel has no plugin.request or host call in flight and no new tree for
  a quiet spell (capped at 3 s), so a cold worker's skeleton is not captured; pendingRequests
  reports what was still pending.
- After --act and the capture, the guest restores every plugin-written atom it had before (new
  ui.snapshot/ui.restore; persisted atoms re-persist) and Orca remounts its drawn controls;
  restored: true|false. Worker-side effects are not rolled back.
- --act gains the kit's slide, sort, selectRows, activateRow, loadMore, expand, collapse,
  selectItem and activateItem.
- Docs: the dev watch first-load prompt; shot settle, restore and the new verbs.

* fix(plugins): a shot waits for the theme repaint and retries a bare capture

Linux CI captured a dark --theme shot as a bare background (2 colors). The renderer now waits
until the document shows the asked color scheme and paints, adds a frame after a --width
resize, and main recaptures a panel image that is still a background and a border (two colors
or fewer) up to 8 times, 150 ms apart, before returning it. Html panels keep their guest
composite.

* fix(plugins): capture the main window with stayHidden

webContents.capturePage(rect, { stayHidden: true }) keeps a hidden window rendering for the
capture, as the components gallery screenshots do. The repaint wait stays, and the bare-capture
retry stays as a fallback.
This commit is contained in:
Neil
2026-11-01 09:32:38 -08:00
committed by GitHub
parent 64829c264d
commit dfbaa2fc29
52 changed files with 2081 additions and 412 deletions
@@ -6,6 +6,7 @@ import type {
PluginDevWatchStatus
} from './plugin-dev-watch-events'
import { PluginLogFollower } from './plugin-log-follower'
import { devLoadWithApproval, type PluginDevWatchConfirm } from './plugin-dev-watch-approval'
import { PluginFrameLogDedupe, type PluginDevWatchLogLine } from './plugin-frame-log-dedupe'
import {
createPluginDevWatchCheckQueue,
@@ -20,7 +21,8 @@ import {
/** What the loop asks of the Orca host; the handler binds it to RPC for one folder. */
export type PluginDevWatchHost = {
refreshTypes(): Promise<string[]>
devLoad(): Promise<DevLoadResult>
/** `approvalFingerprint` overrides `--approve` once the person approved at the prompt. */
devLoad(approvalFingerprint?: string): Promise<DevLoadResult>
list(): Promise<PluginHostListEntry[]>
logs(pluginKey: string, after: string | undefined): Promise<LogsResult>
/** Re-checks the folder's approval; null when it needs none. */
@@ -41,6 +43,8 @@ export type PluginDevWatchDeps = {
onInterrupt(listener: () => void): () => void
exitNow(code: number): void
isConnectionLost(error: unknown): boolean
/** Only for a person at a terminal without `--json`: asks to approve a first load that needs it. */
confirm?: PluginDevWatchConfirm
}
// Why these rates: logs feel live at 500 ms, and the plugin list (a projection of every plugin) is
@@ -131,11 +135,12 @@ async function startShooter(
}
/** Loads the folder, then streams its logs and reload status until interrupted. Returns the exit
* code. A failed first load throws (approval_required exits 3 like `orca plugin dev load`). */
* code. A failed first load throws (approval_required exits 3 like `orca plugin dev load`) unless
* the person approves it at the `confirm` prompt. */
export async function runPluginDevWatch(deps: PluginDevWatchDeps): Promise<number> {
const { host, emit } = deps
const typeFiles = await host.refreshTypes()
const loaded = await host.devLoad()
const loaded = await devLoadWithApproval((fingerprint) => host.devLoad(fingerprint), deps.confirm)
const { pluginKey } = loaded
let snapshot = snapshotOf(loaded.plugin)
emit({