Files
orca/src/cli/plugin-authoring/plugin-grant-lines.ts
T
Neil dfbaa2fc29 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.
2026-11-01 09:32:38 -08:00

21 lines
863 B
TypeScript

/** The displayed part of `PluginApprovalGrants`; also what a host's `approval_required` data carries. */
export type PluginGrantSummary = {
execution: string
executionDescription: string
capabilities: { description: string }[]
contributions: { kind: string; name: string }[]
}
type GrantSubject = { pluginKey: string; version: string; grants: PluginGrantSummary }
/** What a plugin would be granted, as `orca plugin inspect` and the dev watch prompt print it. */
export function formatPluginGrantLines(subject: GrantSubject): string[] {
const { grants } = subject
return [
`${subject.pluginKey} ${subject.version} (${grants.execution})`,
` ${grants.executionDescription}`,
...grants.capabilities.map((capability) => ` - ${capability.description}`),
...grants.contributions.map((item) => ` adds ${item.kind}: ${item.name}`)
]
}