Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

Merge remote-tracking branch 'origin/main' into feat/plugin-panel-widget-surface

vastsa49cf4ab18656
diff --cc docs/adr/0275-plugin-panel-floating-widget.md
index 8c8080579,000000000..52d7dc376
mode 100644,000000..100644
--- a/docs/adr/0275-plugin-panel-floating-widget.md
+++ b/docs/adr/0275-plugin-panel-floating-widget.md
@@@ -1,76 -1,0 +1,76 @@@
- # ADR 0273: A floating widget placement for plugin panels
++# ADR 0275: A floating widget placement for plugin panels
+
+- Status: Accepted for implementation
+- Date: 2026-09-17
+- Deciders: PI-Desktop core
+- Related: [ADR 0081](0081-host-owned-plugin-panel-chrome.md) ·
+ [ADR 0092](0092-plugin-owned-panel-surface.md) ·
+ [ADR 0093](0093-plugin-panel-strict-drag-band.md) ·
+ [ADR 0110](0110-plugin-panel-chrome-spacing-contract.md) ·
+ [07-plugins/03-plugin-api](../spec/07-plugins/03-plugin-api.md)
+
+## Context
+
+Every plugin panel is a frameless `BrowserWindow` that reserves a 46px host drag
+band and carries one three-control capsule in its top-right corner (ADR 0092,
+ADR 0093, ADR 0110). That grammar suits a panel that shows content, and does not
+suit a plugin whose whole interface is a small round companion — a voice orb, a
+timer, a status light.
+
+Such a plugin cannot exist today. The host paints an opaque background, forces a
+360×280 minimum, and draws the capsule over the top of the page. What an author
+gets is a rectangle with a toolbar strip, not a floating sphere; the transparent
+strip that makes the panel chrome work reads as a seam around a shape that is not
+a rectangle at all. Electron can already host a transparent window, and the
+plugin surface itself — preload bridge, session partition, permission gate, egress
+policy — needs no change to allow it.
+
+## Decision
+
+1. A manifest may declare `"ui": { "shape": "widget" }`. `"panel"` stays the
+ default; an absent or `"panel"` value keeps today's behavior unchanged.
+2. A widget window is `transparent: true` with a fully transparent
+ `backgroundColor`, `hasShadow: false`, `frame: false`, `maximizable: false`,
+ `fullscreenable: false`, and `skipTaskbar: true`. The plugin draws its own
+ silhouette, shadow, and glow.
+3. A widget has no 46px band and no capsule. The preload publishes
+ `--pi-plugin-titlebar-height: 0px`, never applies the legacy additive offset,
+ and instead installs a drag map over the whole window: empty space drags,
+ while standard controls and every element marked `data-pi-plugin-no-drag`
+ stay clickable. The mechanics are the paint-through segment map of ADR 0093,
+ applied to the full rectangle.
+4. The capsule is the panel's only close affordance (ADR 0093 §4), so the host
+ owns an equivalent menu behind the widget surface's own context menu: close,
+ minimize, and an always-on-top toggle. It travels on the existing
+ sender-validated window-control channel as one new `contextMenu` action, so
+ `window.pluginBridge` still gains no window primitive.
+5. `ui.width` / `ui.height` are honoured down to 120×120 for a widget (a panel's
+ minimum stays 360×280). `ui.alwaysOnTop` defaults to `false`; `ui.resizable`
+ defaults to `false` for a widget and `true` for a panel.
+6. The preload publishes the placement as
+ `document.documentElement.dataset.piPluginPanelShape` (`panel` | `widget` |
+ `view`) before page scripts run, so one HTML entry can serve every placement
+ without a bridge round trip.
+7. The plugin surface is otherwise unchanged: same preload, same
+ `pluginBridge` channels, same permission gate, same per-plugin session
+ partition, same egress policy, same localization rules. A widget needs no new
+ permission.
+8. `manifest.ui.shape`, `ui.alwaysOnTop`, and `ui.resizable` are validated at
+ install by the Plugin SDK, carried in the shared manifest type, and parsed by
+ host-core's `PluginUiMeta`, so the Rust catalog and the TypeScript host agree
+ on the contract.
+
+## Consequences
+
+- A plugin can be a floating orb: transparent, small, always-on-top when it asks
+ for it, draggable from its empty space, and closable from a host menu even when
+ the plugin never drew a close button.
+- The 46px band, the capsule, and the v2 spacing contract stay exactly as they
+ are for panels and docked views; existing plugins and installed packages are
+ unaffected.
+- Placement is a per-plugin manifest choice, not a per-page one: the same HTML
+ entry may serve a panel, a widget, and a docked view by reading the published
+ placement and the titlebar variable.
+- A widget surface has one more pointer rule to document: an element that must
+ receive clicks is either a standard control or carries
+ `data-pi-plugin-no-drag`; everything else drags the window.
diff --cc docs/adr/README.md
index b59a68209,7e5b15477..7b9042175
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@@ -299,4 -299,5 +299,6 @@@ Each ADR includes
| 0269 | [Move capability documents between the global and project levels](0269-capability-level-transfer.md) | Accepted for implementation (amends ADR 0112) |
| 0268 | Remove quotes, annotations, and side chats | Accepted (supersedes message-quotes-and-side-chats / response-annotations / floating-annotation-index) |
| 0272 | [Judge a public-network address on the route the request will dial](0272-connection-time-public-network-route.md) | Accepted for implementation (amends ADR 0243; issue #419 / PR #473) |
- | 0273 | [A floating widget placement for plugin panels](0273-plugin-panel-floating-widget.md) | Accepted for implementation (amends ADR 0093 §4; ADR 0092 / ADR 0110) |
+ | 0273 | [Git checkout as a Create project source](0273-git-checkout-create-project-source.md) | Accepted for implementation (amends ADR 0233; ADR 0247) |
+ | 0274 | [A development plugin is reviewed before it is loaded](0274-development-plugin-permission-review.md) | Accepted for implementation (amends ADR 0005) |
++| 0275 | [A floating widget placement for plugin panels](0275-plugin-panel-floating-widget.md) | Accepted for implementation (amends ADR 0093 §4; ADR 0092 / ADR 0110) |
diff --cc packages/shared/src/types/plugins.ts
index 3cda7f4a7,8792292df..354920beb
--- a/packages/shared/src/types/plugins.ts
+++ b/packages/shared/src/types/plugins.ts
@@@ -70,19 -70,33 +70,44 @@@ export type PluginUiMeta =
width?: number;
height?: number;
title?: string | PluginLocalizedString;
+ /**
+ * Panel placement. `"panel"` (default) keeps the host-owned 46px drag band
+ * and its three-control capsule. `"widget"` is a transparent, frameless
+ * floating surface with neither, sized from the inside: the page owns its
+ * whole rectangle and drags the window through a host-provided drag map.
+ */
+ shape?: "panel" | "widget";
+ /** Floating widget placement only: keep the surface above other windows. */
+ alwaysOnTop?: boolean;
+ /** Overrides the per-shape default: panels are resizable, widgets are not. */
+ resizable?: boolean;
};
+
+ /**
+ * A development plugin waiting for its permission review.
+ *
+ * Choosing a folder is a request, not consent: the host answers with what the
+ * folder declares and loads nothing until the user accepts it. `kind` is
+ * `"load"` for a folder or scaffold that is not registered yet, and `"reload"`
+ * for a plugin already loaded whose manifest now asks for more than the
+ * approval it is running under.
+ */
+ export type PluginPermissionReview = {
+ kind: "load" | "reload";
+ /** Absolute path of the plugin folder being reviewed. */
+ path: string;
+ id: string;
+ name: string;
+ version?: string;
+ /** Every permission the manifest declares. */
+ permissions: string[];
+ /**
+ * What is beyond the current approval: new permission names, and widened file
+ * scopes rendered as `fs.<mode>…` entries. Empty for a first load.
+ */
+ addedPermissions: string[];
+ };
/**
* One plugin-contributed work panel view, resolved for the current window.
*