Skip to content

docs: Plugin system plan — trusted runtime, npm distribution (desktop + mobile) - #5738

Closed
gsxdsm wants to merge 1 commit into
stablyai:mainfrom
gsxdsm:gsxdsm/plugin-system-plan
Closed

gsxdsm wants to merge 1 commit into
stablyai:mainfrom
gsxdsm:gsxdsm/plugin-system-plan

Conversation

@gsxdsm

@gsxdsm gsxdsm commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Planning / discussion PR — no code. This is a design plan for review. The plan document lives under docs/, which is gitignored in this repo, so the full plan is inline below rather than committed as a file. This PR is intentionally an empty commit carrying the plan in its description.

Produced via ce-plan + two rounds of ce-doc-review (7 personas each).


feat: Plugin system — trusted runtime, right-sidebar UI, npm distribution (desktop + mobile)

Summary

Introduce a plugin system for Orca modeled on the VS Code extension architecture. A plugin is an npm package with a backend module (main) and a single-file webview UI. The backend runs as a trusted Node child process with full runtime access — it can require packages, spawn processes, and shell out freely — while the UI renders in a sandboxed webview (<webview> desktop, react-native-webview mobile) used only for fault isolation, not privilege containment. Plugins contribute a right-sidebar panel and an optional settings page, manage their own persisted settings, and respond to lifecycle events. Trust is established at install time (npm provenance + explicit "runs with full access" consent), not enforced at runtime.

To keep risk proportional to (currently unvalidated) demand, delivery is phased behind a developer-preview flag — see Delivery Phasing. v1a ships the trusted runtime + desktop sidebar + settings + local/private-registry install + one example; v1b opens public-npm distribution + git/tarball sources + publishing; v1c adds mobile/relay rendering and remote-SSH provisioning. The host runs the plugin's privileged backend where the workspace lives: Electron main on desktop, and the relay host (local or remote over SSH) for mobile.

Decided by the user across rounds: webview single UI for both platforms; external installable npm bundles; plugins are trusted (full Node/shell, webview = fault-isolation only, trust at install); child process per plugin; install sources public npm + private/scoped registry + git/tarball + local; plugins present their own settings page; the plan enumerates lifecycle events + API; and (this round) integrate the full review — phased delivery, the technical/security/design fixes, and the strategic framing below.

Honest scope note. This is a VS-Code-extension-host-class platform — a large, permanent surface — committed before a single real plugin proves demand. The phasing exists precisely so the cheap, demand-validating slice (v1a) ships and is dog-fooded before the expensive, hard-to-reverse surfaces (public ecosystem, mobile, remote per-arch provisioning) are built and frozen.


Product Premise & Audience

No upstream brainstorm validated demand; stated explicitly.

  • v1a audience — power users & internal teams: served entirely by local-folder + private/scoped-registry install behind a developer-preview flag. This audience never needs the public registry, so v1a does not take on the external-ecosystem responsibility.
  • v1b audience — external developers (deliberate bet): opening the public npm registry is an explicit decision to become a platform that runs strangers' code on users' machines. It carries discoverability expectations, a curation/trust responsibility for code Orca didn't write, and a support/reputation burden ("a plugin broke my machine" becomes an Orca event). v1b is gated behind evidence that real plugins exist — see Trust & Support Posture.
  • Why trusted runtime: the user requires plugins to "run whatever in their runtime." A capability jail defeats that; the honest model is trusted plugins (like any npm dependency / VS Code extension) with informed install-time consent.
  • Concrete first plugins: a custom CI/status panel shelling out to a provider CLI; a "scratch notes" panel with plugin-owned settings; an on-demand formatter/linter panel. Each needs Node access + the UI/settings/bridge surface, and each is buildable in v1a.

Problem Frame

The right sidebar is a closed set of tabs hardcoded in four places that must stay in sync — the RightSidebarTab union (src/shared/types.ts ~2954–2964), the activityItems catalog + visibility filter (right-sidebar/index.tsx, right-sidebar-activity-visibility.ts), the lazy panel switch (right-sidebar-panel-content.tsx), and the two route validators (right-sidebar-route.ts over ActiveRightSidebarTab, and pruneRightSidebarTabByWorktree in worktrees.ts ~1074, which drops unknown literals).

There is no runtime code-loading or child-process-plugin mechanism; the idiom is closed unions + build-time satisfies maps. The existing child-process runtimes (computer sidecar src/main/computer/sidecar-client.ts, the daemon) fork Electron's own binary with ELECTRON_RUN_AS_NODE=1 and resolve entries from app.asar.unpacked — a packaged app does not assume a system node. Mobile is a separate React Native app with no Node; it reaches the host only over the relay — a daemon deployed to remote hosts over SSH (src/relay/relay.ts), which is electron-free (esbuild platform: node; src/relay/plugin-overlay.ts documents that it "deliberately does not reuse" electron-importing services), discovers a remote node via ssh-remote-node-resolution.ts, and whose single native dep (node-pty) already makes a missing C/C++ toolchain "the dominant first-connect failure on Linux relays (#1693)" per ssh-relay-build-toolchain.ts.

We need: (1) open the four desktop seams to a registry; (2) a trusted Node plugin-host runtime (child process per plugin) that loads a backend, fires lifecycle events, and exposes a host API while letting the plugin use Node freely; (3) npm-based distribution (publish + install from registry/git/tarball/local) with the install-time code-execution surface handled; (4) a settings extension point (app page to add/remove plugins, and plugin-contributed settings pages); (5) cross-platform delivery where the backend runs on the host (including remote SSH) and the device renders only UI.


Requirements

  • R1 — Manifest & package contract. A plugin is an npm package whose manifest declares: id, name, version, hostApiVersion, main, contributes (sidebar: { title, icon, ui }, optional settings: { ui }), capabilities (declared intent for consent), and optional settingsSchema. UI entries are single self-contained HTML files. Invalid manifests are rejected with actionable errors.
  • R2 — Trusted runtime. Each active plugin's main runs in a dedicated Node child process (forked from Electron's binary via ELECTRON_RUN_AS_NODE, not a system node) with full runtime. On desktop the host spawns it; on mobile/remote the relay host runs it. Crash/teardown of one plugin never affects others or the app.
  • R3 — Lifecycle & async API surface. The host invokes activate(context) / deactivate() and delivers subscribed events. context exposes a documented, enumerated API (workspace, commands, settings, events, UI messaging, logging). Every host-backed accessor is async (Promise-returning) because each crosses a process boundary (and an SSH hop on mobile). Plugins may also bypass the API and use raw Node. See Plugin API & Lifecycle.
  • R4 — npm distribution (phased). Users install from a private/scoped registry or a local folder (v1a), the public npm registry, git URL, or tarball (v1b); dependencies resolve via a vendored in-process installer with lifecycle scripts disabled by default; versions are pinned with a lockfile + integrity digest. A documented publishing path ships in v1b.
  • R5 — UI rendering. An active plugin renders its sidebar panel in a fault-isolated webview on desktop (v1a) and mobile (v1c), with defined loading/error/crashed/empty states. The UI talks to its backend via a host-bound bridge (identity never caller-supplied).
  • R6 — Mobile/remote (v1c). The same single-file UI renders on mobile via react-native-webview fed { html }; its backend runs on the relay host. v1c remote support is scoped to pure-JS plugins (no native deps / no host-side compile); native-dep plugins on remote are explicitly out of scope. The device never runs Node.
  • R7 — Plugin settings. Plugins manage plugin-owned, per-plugin-isolated, persisted settings via context.settings and may present their own settings page (a contributed settings webview) inside Settings → Plugins.
  • R8 — Management surface. A Settings → Plugins page (preview-gated) lists installed plugins (source, version, capabilities, state), and supports add (allowed sources per phase), remove, activate/deactivate, update, per-plugin settings, and View Output.
  • R9 — Trust, consent & supply chain. Install shows an explicit "runs with full access to your computer" consent (capabilities framed as declared intentions, not limits; remote host named when applicable); dependency install disables lifecycle scripts by default; sources are integrity-checked (HTTPS-only, SHA-256 / pinned commit SHA); private-registry tokens are stored via safeStorage, never plaintext.
  • R10 — Lifecycle safety & cross-platform. (De)registration (process spawn/kill, partitions, asset scope) is idempotent and authority stays in the host; the capability gate is one shared electron-free module used by both main and relay (conformance-tested for parity); Windows ACLs apply to plugin state; shortcuts are platform-correct; remote-SSH honored; provider-neutral naming.

Out of scope for v1 (see Scope Boundaries): marketplace/discovery, auto-update, multi-file UI + full asset protocol, per-workspace activation, contribution points beyond sidebar + settings, host-pushed streaming beyond enumerated events, native-dep plugins on remote hosts, a real runtime sandbox tier, and shipping production plugins (one example only).


Trust Model (read this first)

v1 plugins are trusted code, equivalent to any npm dependency or VS Code extension. Concretely:

  • A plugin's backend runs with the full privileges of the user — files, processes, network, shell. There is no runtime sandbox on the backend, by design.
  • Trust is established at install, not at runtime: explicit "full access" consent, the install source shown, integrity verified (HTTPS-only + SHA-256 digest / pinned commit SHA; npm provenance preferred), and version pinning + lockfile.
  • Install itself is a code-execution event. npm-style installs run dependency lifecycle scripts (postinstall, …). The installer therefore runs with lifecycle scripts disabled by default (--ignore-scripts equivalent); the full dependency graph is resolved and shown before any code runs. A plugin that genuinely needs build-time scripts (native modules) triggers a second explicit consent naming that step.
  • Declared capabilities are informed-consent metadata, not a jail. A plugin can ignore them and call Node directly; the consent UI says so in required copy. Their value is transparency + a future-compat seam.
  • The webview UI sandbox is for fault-isolation and architecture, not privilege containment. Tests assert fault isolation and clean teardown, not "the UI can't escape" (it doesn't need to — the backend is already trusted).

This reframing is the basis for every security-flavored decision below: with backends trusted, all real security lives at install and in the supply chain, not at runtime.


Trust & Support Posture

  • v1a is preview-gated. The Settings → Plugins surface and the mobile Plugins entry appear only when a developer-preview flag is enabled (a settings toggle / experimental feature). This keeps the blast radius to users who understand the trust model and prevents one-click install of full-access code by incidental users.
  • Public-npm (v1b) is the external-ecosystem bet. It is gated behind evidence that real plugins exist. When it ships, Orca explicitly owns: the reputation/support consequence of third-party code harming a user, a stated curation stance (none in v1b — discovery is deliberately absent so users seek plugins out deliberately), and docs that set expectations.
  • Contract is pre-stable. Until the example plus at least one real internal plugin exercise the API, hostApiVersion is 0.x with no additive-only guarantee (see Versioning). This avoids freezing a first-attempt API — notably the sync-vs-async and host-action-allowlist shapes — before it has met a real workload.

Key Technical Decisions

  • KTD1 — VS Code-style split: trusted Node backend + fault-isolated webview UI. Matches paperclip fix: restore PDF preview rendering #258's "plugins use Node APIs directly" while keeping a robust UI boundary. (see reference: paperclip fix: restore PDF preview rendering #258)
  • KTD2 — Plugin host = child process per plugin, forked from Electron's binary. Desktop: main forks process.execPath with ELECTRON_RUN_AS_NODE=1, entry resolved from app.asar.unpacked (mirroring src/main/computer/sidecar-client.ts) — not a system node. Mobile/remote: the relay runs the backend on the host (local or remote SSH). One process per plugin → crash isolation + clean kill. Authors are told their child runs under Electron's node (asar-require + process.versions.electron implications documented).
  • KTD3 — One shared electron-free capability gate; per-environment host services. The capability gate (method→capability map, host-action allowlist enforcement, WorkspaceSnapshot field projection, open-external-url scheme validation) lives in one electron-free module in src/shared/plugin/ that both main and relay import — not just shared types. A conformance test runs the same cases against both the main and relay service impls so a gate change can't land on desktop but drift on the remote path. Only the I/O-bound service backends differ per environment.
  • KTD4 — Registry-driven sidebar; the literal allowlists are the real seam. Add a `plugin:${string}` variant to RightSidebarTab, and extend both runtime validators (right-sidebar-route.ts and pruneRightSidebarTabByWorktree) to accept the plugin: prefix.
  • KTD5 — Single-file UI; orca-plugin:// origin (desktop), { html } (mobile). UI entries are single self-contained HTML. Desktop serves via a path-scoped orca-plugin://<id>/ protocol (registered privileged before app.whenReady()); mobile fetches the one HTML over the relay and feeds react-native-webview { html }. No on-device HTTP server, no relative-asset resolution.
  • KTD6 — Vendored in-process installer; lifecycle scripts off by default. Dependency resolution uses a vendored in-process installer (e.g. @npmcli/arborist + pacote) rather than assuming a system npm/pnpm on the user's machine or remote host. Installs run with lifecycle scripts disabled, resolving the full graph for display before any execution. This single choice backs both desktop (U12a) and remote-relay (U7b) install paths and makes the lockfile/integrity model the installer's, not a shelled-out CLI's.
  • KTD7 — pluginId bound by the host, never the caller. Derived from the sending webContents (desktop), the owning child process (host), or the paired relay client (mobile).
  • KTD8 — Authority in the host; idempotent process lifecycle. Per docs/terminal-main-owned-state.md + docs/ssh-handler-reregistration-port-forwards.md: the Plugin Manager owns install/activation truth; activation spawns the backend + registers UI partition/asset scope; deactivation kills + deregisters — idempotently.

Versioning & Compatibility

  • Pre-stable v1. hostApiVersion is 0.x through v1a/v1b; the contract (manifest, the async context API, lifecycle events, message shapes, WorkspaceSnapshot, host-action allowlist, settings schema) is provisional and may take breaking changes until the example + at least one real internal plugin validate it. This is the honest stance given zero shipped consumers and known-open shapes (sync-vs-async resolved to async; two-entry host-action allowlist likely to grow).
  • At 1.0 (declared only after validation), the host commits to no breaking changes within major 1 (additive only). Newer-major plugin → "requires a newer version of Orca"; older-major (once majors exist) → host supports its own major + N-1.
  • No plugin auto-update in v1; the management UI surfaces Update available (re-runs install, re-consents on capability change) and Incompatible (requires newer Orca; shown inactive with no Update button) instead of failing silently.

Plugin API & Lifecycle

The enumerated v1 surface. Backend code may additionally use any Node API directly (trusted). All host-backed accessors are async — they cross a process boundary (and an SSH hop on mobile).

Entry points (backend main)

  • activate(context): void | Promise<void> — register panels, commands, settings, and event subscriptions.
  • deactivate(): void | Promise<void> — dispose resources; the host force-kills the process after a grace period.

context API

  • context.workspace.getSnapshot(): Promise<WorkspaceSnapshot> — bounded { workspaceName, currentBranch, isDirty, openFileCount }; no paths/credentials in the typed snapshot (a plugin wanting more uses Node directly, which consent covers).
  • context.workspace.onDidChange(cb): Disposable — workspace/branch/dirty changes.
  • context.commands.register(id, handler): Disposable and context.commands.invokeHost(name, params): Promise<Result> — register plugin commands; invoke an allowlisted host command (v1: open-external-url (scheme-validated + confirmed), copy-to-clipboard).
  • context.settings.get(key): Promise<T> / set(key, value): Promise<void> / onDidChange(cb): Disposable — plugin-owned, per-plugin-isolated, schema-validated settings.
  • context.ui.postMessage(msg) / context.ui.onMessage(cb): Disposable — talk to this plugin's sidebar/settings webview(s).
  • context.events — subscribe to host lifecycle events: onWorkspaceChanged, onBranchChanged, onSettingsChanged, onPanelVisible(panelId), onDeactivate. (Object-level onDidChange and the context.events.* names are the same notifications surfaced two ways; the SDK docs in U8 state when to use each.)
  • context.log — namespaced logger surfaced in the plugin output channel (View Output, U6).
  • context.subscriptions: Disposable[] — disposed by the host on deactivate.

Lifecycle events

activate → (onPanelVisible on open) → workspace/branch/settings change events while active → onDeactivate → deactivate. The host attempts deactivate before process kill.

Capabilities (declared intent, consent-only)

workspace:read, commands, settings, process:spawn, network, fs. Shown at install with a required disclaimer that they are intentions, not enforced limits.


Delivery Phasing

Each unit is tagged with the phase it ships in. Phases are sequential gates, not hard release boundaries.

  • v1a — Preview MVP (desktop, internal): U1, U2, U3, U10, U11, U13, U4, U5, U6 (local + private-registry install only), U12a, U8 (example + authoring/security docs). Behind the developer-preview flag.
  • v1b — Public distribution: U12b (public registry by arbitrary name, git URL, tarball, integrity, publishing docs) + U6 enabling those sources. Gated on demand evidence + the external-ecosystem posture.
  • v1c — Mobile/remote: U7a (local-relay-hosted backend + mobile UI/settings), then U7b (remote-SSH provisioning, pure-JS plugins only).

High-Level Technical Design

Directional guidance for reviewers — not implementation specification.

Component map

flowchart TB
  subgraph HostDesktop["Electron main (desktop host authority)"]
    PM["PluginManager: install/activation state, process supervision"]
    GATE["Shared electron-free capability gate"]
    SVC1["Host services (main impl): workspace / commands / settings store"]
    PROC1["fork(process.execPath, ELECTRON_RUN_AS_NODE) — 1 per plugin"]
  end
  subgraph Relay["Relay host (mobile authority; LOCAL or REMOTE/SSH; electron-free)"]
    GATE2["Same shared gate module"]
    SVC2["Host services (relay impl)"]
    PROC2["plugin-host process(es) on the host (pure-JS on remote)"]
  end
  subgraph PluginBackend["Plugin backend main (TRUSTED Node)"]
    API["activate(context) · require · child_process · shell"]
  end
  subgraph DesktopUI["Desktop renderer"]
    PANEL["PluginPanel <webview> (fault-isolated)"]
    SET["Settings → Plugins (preview-gated) + plugin settings webview + View Output"]
  end
  subgraph MobileUI["Mobile (React Native, no Node)"]
    MWV["react-native-webview ({ html })"]
  end

  PM --> PROC1 --> API
  API <-->|async child IPC| GATE --> SVC1
  PANEL -- "guest postMessage → renderer → window.api.plugins" --> GATE
  SET --> GATE
  MWV -- "RN postMessage → RpcClient → relay" --> GATE2 --> SVC2 --> PROC2 --> API
  GATE === GATE2
Loading

Install sequence (lifecycle-script safe)

sequenceDiagram
  participant U as User
  participant R as Installer (vendored, in-process)
  participant C as Consent UI
  U->>R: add plugin (source)
  R->>R: resolve manifest + full dep graph (NO code run)
  R->>C: show source, version, deps, capabilities + "full access" + integrity
  C-->>U: review
  U->>C: Accept
  C->>R: install with lifecycle scripts DISABLED
  alt native build required
    R->>C: second explicit consent (run build scripts?)
  end
  R-->>U: installed (Inactive)
Loading

Activation sequence

sequenceDiagram
  participant PM as PluginManager (host)
  participant PH as plugin-host child (fork: execPath+RUN_AS_NODE)
  participant B as Plugin backend main
  PM->>PH: fork child (cwd = plugin dir)
  PH->>B: load main, call activate(context)
  B->>PH: register panel/commands/settings/events
  PM-->>PM: tab appears; UI lazy-loads on open
  note over PM,PH: deactivate → deactivate() → kill after grace; crash → Errored + bounded restart
Loading

Output Structure

src/shared/plugin/
  manifest.ts / manifest-validate.ts   # npm-package manifest, contributes, capabilities, settingsSchema
  api-contract.ts                       # ASYNC context API protocol, WorkspaceSnapshot, host-command allowlist, events
  capability-gate.ts                    # ELECTRON-FREE shared gate: allowlist + snapshot projection + scheme validation
  capability-consent.ts                 # capability → consent copy + required "not a limit" disclaimer constant
src/main/plugin/
  plugin-manager.ts                     # install/activation state, process supervision, partition/asset scope
  plugin-host-process.ts                # fork(process.execPath, ELECTRON_RUN_AS_NODE); asar.unpacked entry; crash/restart
  plugin-host-entry.ts                  # child entry: require plugin main, call activate(context)
  plugin-asset-protocol.ts              # orca-plugin:// (pre-app-ready), path-scoped single-file serve
  host-services.ts                      # workspace/commands/settings service impls (desktop)
  context-bridge.ts                     # deliver async context API over child IPC; route UI↔backend messages
  plugin-settings-store.ts              # per-plugin settings file (settings.json under plugin dir), schema-validated, ACL
  install/                              # vendored installer (arborist/pacote), resolver, sources, lockfile+integrity
src/main/bootstrap (edit)               # registerSchemesAsPrivileged before app.whenReady
src/main/window/createMainWindow.ts (edit) # allow plugin partition + orca-plugin:// src; nav lock
src/main/ipc/plugins.ts                 # IPC: list/install/remove/activate/update/output + sender-bound bridge
src/relay/plugin-host.ts                # run plugin-host on relay host (local/remote); provision (pure-JS) plugin
src/relay/host-services.ts              # relay impls of workspace/commands/settings (electron-free)
src/relay/dispatcher.ts (edit)          # plugin.* methods (client-bound pluginId)
src/preload/ (edit)                     # window.api.plugins.* (bridge takes NO pluginId arg)
src/renderer/src/components/right-sidebar/ (edit + plugin-panel.tsx)
src/renderer/src/components/plugins/     # Settings → Plugins (preview-gated): add dialog, consent, settings host, output panel
src/renderer/src/store/slices/plugins.ts
mobile/src/components/plugins/           # MobilePluginPanel ({ html }) + MobilePluginSettings + nav entry
examples/hello-sidebar-plugin/           # npm package: backend main + single-file UI + settings + vendored sdk
docs/plugins/authoring.md, publishing.md, security.md

Implementation Units

U9 was dissolved earlier (hardening folded into owning units); the gap is intentional. U-IDs are stable; U7/U12 split into a/b during this review.

Phase A — Contract & host authority (v1a)

U1. Manifest, package contract & async API protocol

  • Goal: Define the npm-package manifest, contributions, capabilities, and the shared async context API protocol.
  • Requirements: R1, R3, R7 (settingsSchema).
  • Dependencies: none.
  • Files: src/shared/plugin/manifest.ts, manifest-validate.ts, api-contract.ts, capability-consent.ts, __tests__/manifest-validate.test.ts, __tests__/api-contract.test.ts
  • Approach: Manifest = { id, name, version, hostApiVersion, main, contributes: { sidebar: { title, icon (Lucide name), ui }, settings?: { ui } }, capabilities, settingsSchema? } from plugin.json or package.json#orca. ui entries must be single HTML files. api-contract.ts defines the envelope, the Promise-returning accessor signatures, WorkspaceSnapshot, the host-command allowlist union, and lifecycle/event names. capability-consent.ts maps capabilities to consent copy and exports a required disclaimer constant ("declared intentions, not enforced limits — plugins run with full access").
  • Test scenarios: valid manifest (±settings) → ok; missing main/id/version/hostApiVersion → named errors; multi-file ui → rejected; unknown capability → rejected; every host-backed accessor type is Promise<...> (compile/contract assertion); api-contract round-trips an envelope and rejects unknown methods/events.

U2. Plugin Manager, lifecycle & asset protocol

  • Goal: Authority for install/activation state, asset protocol, partition lifecycle, and local-folder install.
  • Requirements: R8 (state), R5 (asset isolation), R10.
  • Dependencies: U1.
  • Files: src/main/plugin/plugin-manager.ts, plugin-asset-protocol.ts, src/main/bootstrap (edit), __tests__/plugin-manager.test.ts, __tests__/plugin-asset-protocol.test.ts
  • Approach: persisted registry; activation triggers process spawn (U10) + partition/asset registration; deactivation tears down idempotently. orca-plugin:// declared privileged before app.whenReady(); per-plugin handler resolves within the active plugin dir, serves the single HTML, rejects traversal/inactive/unknown. Local-folder install copies + validates. Windows ACLs on state.
  • Execution note: characterization tests for activation-persistence + idempotent (de)registration first.
  • Patterns: ssh-handler-reregistration-port-forwards.md, terminal-main-owned-state.md, windows-secure-file-acl-hardening.md.
  • Test scenarios: install/activate/deactivate/remove round-trip + persistence; double-activate no-op; asset traversal/inactive/unknown denied; remove deactivates first; Windows ACL synchronous.

U3. Shared capability gate + desktop host services

  • Goal: Implement the electron-free shared gate and the desktop service backends.
  • Requirements: R3, R9 (bounded snapshot), R10 (gate parity).
  • Dependencies: U1.
  • Files: src/shared/plugin/capability-gate.ts (electron-free), src/main/plugin/host-services.ts, src/shared/plugin/__tests__/capability-gate.test.ts, src/main/plugin/__tests__/host-services.test.ts
  • Approach: capability-gate.ts (no electron/userData imports) enforces method→capability, the host-command allowlist, WorkspaceSnapshot field projection, and open-external-url scheme validation — pure decisions, reused by U7's relay impl. Desktop host-services.ts provides the I/O backends (read workspace state, run allowlisted commands, emit events). All accessors async.
  • Test scenarios: gate grants declared / denies undeclared / rejects unknown method; snapshot projection drops path/credential fields; non-http(s) open-external-url rejected; unknown host command rejected; workspace-change event delivered to a subscriber. (Parity vs relay asserted in U7's conformance test.)

Phase B — Trusted plugin runtime (v1a)

U10. Plugin host child process & supervision

  • Goal: Spawn each backend as a trusted Node child (Electron binary), load main, manage crash/teardown/output.
  • Requirements: R2, R8 (output), R10.
  • Dependencies: U1, U2.
  • Files: src/main/plugin/plugin-host-process.ts, plugin-host-entry.ts, __tests__/plugin-host-process.test.ts, __tests__/plugin-host-process.integration.test.ts
  • Approach: fork process.execPath with env.ELECTRON_RUN_AS_NODE='1', entry resolved from app.asar.unpacked (mirror src/main/computer/sidecar-client.ts); the entry requires plugin main and calls activate(context). Child↔main is structured IPC carrying the async api-contract envelope. Full Node, no lockdown (trusted). Supervision: stdout/stderr → a bounded ring buffer exposed via IPC for View Output (U6); on crash → Errored + bounded restart w/ backoff then manual re-activate; on deactivate → deactivate() then kill after grace. One process per plugin.
  • Execution note: crash-isolation + trusted-spawn run as integration tests against a real forked child, not mocks.
  • Test scenarios (unit): supervisor bookkeeping (Errored marking, restart backoff, output buffering). (integration): real child forked under ELECTRON_RUN_AS_NODE; backend require('child_process').spawn succeeds (trusted proven); killing one child leaves a second child's process untouched (real crash isolation); deactivate calls deactivate() then kills.

U11. Async context API wiring, lifecycle events & UI↔backend bridge

  • Goal: Deliver the enumerated async context API + events to the backend; route UI↔backend messages.
  • Requirements: R3, R5 (bridge identity), R7 (settings surface).
  • Dependencies: U3, U10, U4 (UI bridge entry). U13 advisory: context.settings is stubbed (clearly-marked "not yet wired" rejection) until U13 lands, so workspace/commands/events/UI bridge are not blocked by settings.
  • Files: src/main/plugin/context-bridge.ts, __tests__/context-bridge.test.ts
  • Approach: implement context.{workspace,commands,settings,ui,events,log,subscriptions} over async child IPC, backed by host-services (U3) and plugin-settings-store (U13). UI messages (via U4) route to the owning plugin's backend; backend→UI flows back. pluginId host-derived end-to-end. context.subscriptions disposed on deactivate.
  • Test scenarios: each accessor round-trips as a Promise; onBranchChanged fires; UI↔backend messages route only to the correct plugin (no cross-plugin leakage); subscriptions disposed on deactivate; forged pluginId impossible; context.settings returns the stub error before U13.

U13. Per-plugin settings store & contributed settings page

  • Goal: Persist isolated plugin settings and let a plugin present its own settings UI.
  • Requirements: R7, R9 (isolation).
  • Dependencies: U1, U2.
  • Files: src/main/plugin/plugin-settings-store.ts, src/renderer/src/components/plugins/plugin-settings-host.tsx, __tests__/plugin-settings-store.test.ts, __tests__/plugin-settings-host.test.tsx
  • Approach: each plugin's settings live in its own userData/plugins/<id>/settings.json (not a shared namespaced file), schema-validated against settingsSchema when present, ACL'd per the secure-file pattern. Exposed to the backend as async context.settings and to the plugin's settings webview (contributes.settings.ui, single-file) via the bridge, scoped to that plugin. Composition (design): the settings webview is a full-panel takeover — the plugin owns its save/cancel chrome (VS Code webview model); the app provides none. settingsSchema is used only to validate writes, it does not auto-generate a UI; a plugin may ship both (schema validates, webview renders). onDidChange notifies the backend. (Cross-plugin read of another plugin's settings file is possible by design — plugins are trusted; documented in security.md, so users don't store cross-sensitive secrets there.)
  • Test scenarios: set/get round-trips + persists; schema-invalid rejected; onDidChange notifies backend; settings webview reads/writes only its own namespace; when both schema + ui present, webview renders and schema validates writes; Windows ACL applied; the per-plugin file path isolates A from B (A's store path never resolves into B's).

Phase C — Desktop rendering & management (v1a)

U4. Preload + sender-bound IPC bridge

  • Goal: Expose plugin management + a sender-bound UI bridge through the audited contextBridge.
  • Requirements: R5, R8.
  • Dependencies: U2, U10.
  • Files: src/main/ipc/plugins.ts, register-core-handlers.ts (edit), src/preload/index.ts, api-types.ts, __tests__/plugins.test.ts
  • Approach: window.api.plugins = { list, install, update, activate, deactivate, remove, getOutput, onChanged } + bridge bridge(msg) / onMessage taking no pluginId arg (main resolves from sending webContents → forwards to that plugin's backend). Single audited contextBridge.
  • Test scenarios: management methods round-trip; bridge attribution by sender; forged-id impossible; onChanged fires on transitions; getOutput returns the ring buffer.

U5. Right-sidebar registry, sandboxed UI & panel states

  • Goal: Registry-driven tabs, fault-isolated UI webview with states, locked-down attach/navigation.
  • Requirements: R5, R10.
  • Dependencies: U4.
  • Files: src/shared/types.ts (add plugin:${string}), right-sidebar/index.tsx, right-sidebar-activity-visibility.ts, right-sidebar-panel-content.tsx, right-sidebar/plugin-panel.tsx (new), store/slices/plugins.ts, store/right-sidebar-route.ts + store/slices/worktrees.ts (accept plugin:), createMainWindow.ts (edit), __tests__/plugin-panel.test.tsx, __tests__/plugin-tab-routing.test.ts, src/main/window/__tests__/plugin-webview-policy.test.ts
  • Approach: plugins slice hydrates from list()/onChanged; active plugins augment activityItems; inactive plugins live only in Settings → Plugins. Extend both literal validators for plugin:<id>. PluginPanel defines loading/error/crashed/empty states (lifecycle Errored/crash → error+Retry). Deactivate-while-open → default tab + toast. Webview: nodeIntegration off, dedicated partition, CSP orca-plugin://<id>/; two-hop bridge (guest→renderer→window.api.plugins, attached webviews have no preload). Extend will-attach-webview to allow the plugin partition + verify orca-plugin://<id>/* src; attach a will-navigate lock. Framing: UI fault-isolation, not privilege.
  • Test scenarios: activate adds / deactivate removes + clears route; inactive never in activity bar; both validators accept active plugin:<id>, fall back otherwise; loading→ready, error+Retry; deactivate-while-visible switches; webview-policy (allowed partition+src; denied otherwise; nav to evil.com denied); a plugin UI crash shows error state without killing the app.

U6. Settings → Plugins management page (preview-gated)

  • Goal: Discoverable, preview-gated page to add/remove/activate/update, with consent, settings, and output.
  • Requirements: R8, R9, R4 (install entry), R7.
  • Dependencies: U4, U12a (install sources), U13 (settings host). (U12b enables more sources in v1b.)
  • Files: plugins-manager.tsx, plugin-list-item.tsx, add-plugin-dialog.tsx, capability-consent-dialog.tsx, plugin-output-panel.tsx, settings route wiring, __tests__/plugins-manager.test.tsx
  • Approach: Settings → Plugins sub-page, shown only when the developer-preview flag is on. Add dialog (design): a single text input with heuristic source detection (bare name → registry; git+/.git → git; .tgz/.tar.gz → tarball) plus a Browse… button for local folder; detected type shown inline before submit. In v1a only local-folder + the configured private/scoped registry are accepted; public-by-arbitrary-name, git, tarball unlock in v1b (U12b). Flow states (design): idle → resolving (manifest+dep graph, may be slow) → consent → installing (non-dismissible progress + Cancel that aborts + cleans partial dir) → success/error. Consent (design + security): leads with "This plugin runs with full access to your computer — files, network, processes."; capabilities listed under a required disclaimer ("the author's declared intentions, not enforced limits"); shows resolved source + version + integrity (digest/commit SHA) + remote host name when the active workspace is a remote SSH session ("will run on "). List items: source/version/capabilities, activate toggle, Update available (re-runs install; re-consents if capabilities changed) / Incompatible (inactive, "Requires a newer Orca", no Update), a Settings affordance (U13; hidden when the plugin has no settings UI/schema), View Output (opens plugin-output-panel), destructive Remove (AlertDialog, destructive tokens). Errors inline.
  • Test scenarios: preview flag gates the whole surface; heuristic detection labels each source kind; v1a rejects public-by-name/git/tarball with a "available in a later release" message; resolving→consent→installing→success path; Cancel aborts + cleans; consent shows full-access lead + disclaimer + integrity + remote host; Update re-consents only on capability change; Incompatible renders inactive without Update; Remove confirms; View Output shows buffered logs; Settings hidden when absent.

Phase D — Distribution

U12a. Vendored installer, local + private-registry sources, lockfile (v1a)

  • Goal: Resolve/install from local folder + a configured private/scoped registry with a vendored installer, lifecycle scripts off, pinned + integrity-checked.
  • Requirements: R4, R9.
  • Dependencies: U2.
  • Files: src/main/plugin/install/installer.ts (vendored arborist/pacote), resolver.ts, registry-source.ts, local-source.ts, dependency-install.ts, lockfile.ts, __tests__/install-resolver.test.ts, __tests__/install-integrity.test.ts, __tests__/install-scripts.test.ts
  • Approach: A vendored in-process installer (no reliance on a system npm/pnpm) resolves the manifest + full dependency graph without executing anything, then installs into userData/plugins/<id>/ with lifecycle scripts disabled (ignoreScripts), writing an exact-version lockfile + integrity digests. registry-source targets a configured private/scoped registry (public-by-arbitrary-name is gated to U12b); registry auth tokens stored via safeStorage and passed to the installer only in-memory, never written to a plaintext .npmrc. A plugin needing native build scripts surfaces a second explicit consent before scripts run. Reinstall verifies bytes against the lockfile.
  • Test scenarios: local + private-registry resolve to a validated dir; dep with a postinstall does NOT execute under default install (asserted); native-build path requires the second consent before scripts run; version pinned + lockfile + digest written; reinstall with a mismatched digest rejected; private-registry token never appears on disk in plaintext; invalid manifest → nothing installed.

U12b. Public registry, git & tarball sources, integrity & publishing (v1b)

  • Goal: Open public-registry-by-name, git, and tarball install with integrity, and document publishing.
  • Requirements: R4, R9.
  • Dependencies: U12a.
  • Files: src/main/plugin/install/git-source.ts, tarball-source.ts, public-registry enablement in registry-source.ts, __tests__/install-sources.test.ts, docs/plugins/publishing.md
  • Approach: Enable arbitrary public-registry names (preferring npm provenance). git-source resolves the ref to a full commit SHA at install time, records it, and the consent shows the SHA (not a mutable ref). tarball-source is HTTPS-only (reject http://), computes a SHA-256 before extraction (zip-slip hardened), stores the digest. Reinstall verifies digest/SHA. publishing.md documents the manifest convention, the orca-plugin keyword/naming, single-file UI build, and npm publish. Unlocks the corresponding sources in U6's add dialog under the v1b posture.
  • Test scenarios: public name resolves (provenance recorded when present); git ref resolves to a pinned commit SHA shown in consent; http:// tarball rejected; tarball SHA-256 computed + verified; traversing tarball entry rejected; reinstall verifies digest/SHA; invalid manifest from any source → nothing installed.

Phase E — Mobile / remote (v1c)

U7a. Local-relay-hosted backend + mobile UI/settings

  • Goal: Run the trusted backend on a local relay host and render UI + settings on the device.
  • Requirements: R6, R2, R3, R10 (gate parity).
  • Dependencies: U1, U10, U3, U11, U13.
  • Files: src/relay/plugin-host.ts, src/relay/host-services.ts, src/relay/dispatcher.ts (edit), src/shared/plugin/__tests__/gate-conformance.test.ts, mobile/src/components/plugins/MobilePluginPanel.tsx, MobilePluginSettings.tsx, plugin-bridge.ts, mobile nav entry, mobile/src/transport/types.ts, src/relay/__tests__/plugin-host.test.ts, mobile/.../__tests__/MobilePluginPanel.test.tsx
  • Approach: the relay runs the plugin-host child on the local relay host and registers plugin.* MethodHandlers binding pluginId to the paired client. Relay host-services.ts is electron-free and uses the same capability-gate.ts as desktop; a conformance test runs identical cases against the main and relay service impls so gate decisions can't diverge. Mobile fetches the single UI HTML over the relay (plugin.getEntry, ≤16MB) → { html }; bridge uses window.ReactNativeWebView.postMessage → RpcClient. Mobile nav (design): a Plugins entry → screen listing active plugins → tap → plugin detail (full-screen panel webview) with a Settings button swapping to the full-screen settings webview (mirrors desktop at the nav level). Loading/error states for relay-fetch failures.
  • Test scenarios: local relay spawns backend + activate runs; async bridge call routes RN→relay→backend and resolves; gate-conformance: main and relay return identical decisions for the shared case suite; client cannot impersonate another plugin; UI HTML fetched + rendered; settings webview reachable via the mobile nav path; relay-fetch failure shows error.

U7b. Remote-SSH provisioning (pure-JS plugins) (v1c)

  • Goal: Provision + run a backend on a remote SSH relay host, scoped to pure-JS plugins.
  • Requirements: R6, R9 (remote consent), R10.
  • Dependencies: U7a, U12a (installer).
  • Files: src/relay/plugin-provision.ts, __tests__/plugin-provision.test.ts (containerized/loopback-SSH integration), docs note in security.md
  • Approach: reuse ssh-remote-node-resolution.ts to locate the remote node and ssh-relay-build-toolchain.ts semantics for actionable errors. v1c remote is scoped to pure-JS plugins: dependencies are pre-resolved on the desktop and synced to the remote (arch-independent because no native build), and the remote install runs with no compile step and no host package manager required. A plugin with native deps is refused on remote with a clear message ("native-dependency plugins are not supported on remote hosts yet") rather than an opaque node-gyp failure. The remote consent (U6) names the host. Provisioning is supervised like local (crash/Errored).
  • Test scenarios (integration, real loopback/containerized SSH): pure-JS plugin synced + spawned on the remote; missing remote node → actionable error (reusing the resolver); native-dep plugin → refused with the scoped message before any compile; remote consent names the host; remote crash → Errored without affecting desktop plugins.

Phase F — SDK, example, docs (v1a)

U8. Plugin SDK (backend + UI), example & docs

  • Goal: Typed SDK for the async backend context and the substrate-detecting UI client, a working example using Node + settings, and authoring/security docs.
  • Requirements: R3, R7, R9 (docs), R10.
  • Dependencies: U1, U3, U11, U13.
  • Files: examples/hello-sidebar-plugin/ (npm package: src/main.ts, ui/index.html, ui/settings.html, plugin.json, vendored sdk.ts, __tests__/), docs/plugins/authoring.md, docs/plugins/security.md (publishing.md in U12b)
  • Approach: vendored SDK (no separate package.json in v1): backend context typings re-exported from api-contract.ts (all async); a UI client that detects the host substrate (window.ReactNativeWebView vs standard postMessage) exposing one typed UI↔backend surface. The example is a real plugin: backend shells out to a tool (proves trusted runtime), renders results in the panel, and ships a settings page writing per-plugin settings. authoring.md covers package layout, single-file UI build, the async API, lifecycle, and when to use object-level vs events subscriptions. security.md documents the trusted-runtime model, install-time code execution + --ignore-scripts, integrity, safeStorage tokens, cross-plugin settings readability, and remote execution. The example serves as the end-to-end integration gate for Phases A–B.
  • Test scenarios: backend SDK context types compile (all Promise-returning); UI client works against both a desktop-postMessage and a mocked react-native-webview substrate; example manifest validates (U1); example ui/*.html are single self-contained files; example activate registers a panel, a command, and a settings page; example backend successfully spawns a subprocess in an integration test.

Scope Boundaries

In scope (v1, phased)

v1a: trusted per-plugin child-process runtime (Electron-binary fork) with enumerated async API + lifecycle; right-sidebar panel + per-plugin settings page; preview-gated Settings → Plugins with full-access consent + output; vendored installer (local + private registry, lifecycle scripts off, lockfile+integrity); shared electron-free gate; SDK + one example; authoring/security docs. v1b: public registry + git + tarball + integrity + publishing. v1c: mobile/relay rendering (local), then remote-SSH provisioning (pure-JS plugins).

Deferred to Follow-Up Work

  • Marketplace/discovery and auto-update. (Adding discovery later raises the trust burden — noted, not free.)
  • Multi-file plugin UIs + full asset protocol. (Cleanly additive.)
  • Per-workspace activation.
  • Contribution points beyond sidebar + settings.
  • Native-dependency plugins on remote hosts (v1c is pure-JS remote).
  • A real runtime sandbox/permission tier. (Hard to retrofit: existing trusted plugins assume free Node, so a jail would be a breaking trust change — flagged, not "free later".)

Outside this product's identity

  • Shipping production third-party plugins (only the reference example ships).

Risks & Dependencies

  • Trusted runtime = full machine access (high, accepted). Mitigation is non-runtime: consent, source transparency, integrity, pinning, preview gating, docs. No runtime containment by design.
  • Install-time code execution / supply chain (high). npm lifecycle scripts run arbitrary code at install. Mitigation: lifecycle scripts disabled by default (vendored installer), full dep graph shown before any execution, second consent for native builds, HTTPS-only + SHA-256/commit-SHA integrity, lockfile verification, provenance preference, private-registry support, safeStorage tokens. Typosquatting/transitive-primary-code risk remains (accepted, VS Code-class).
  • Packaged-app runtime assumptions (high → resolved in plan). No system node/npm assumed: child = Electron-binary fork (KTD2); deps = vendored in-process installer (KTD6). Misimplementing either reintroduces a hard failure on clean machines.
  • Remote provisioning (high, scoped down). node + toolchain on remote SSH hosts is the Linux support #1 connect failure. Mitigation: v1c remote = pure-JS only, deps pre-resolved/synced from desktop, native-dep plugins refused with an actionable message; reuse ssh-remote-node-resolution.ts + toolchain probe.
  • Two service impls drift (medium → mitigated). Main + relay services. Mitigation: one shared electron-free gate holds all security decisions; conformance test fails CI on divergence (U7a).
  • Async contract correctness (medium). All accessors are Promise-returning so the same signature works across local IPC and SSH; authors are given a latency envelope (U8).
  • Platform identity / support burden (medium, owned). Public-npm makes "a plugin broke my machine" an Orca event. Mitigation: preview gating, no discovery in v1b, explicit posture, demand gate before v1b.
  • Seam drift (medium). Two literal validators must accept plugin: (KTD4); U5 tests both.
  • Per-plugin process supervision (medium). Bounded restart → Errored, grace-kill, output ring buffer (U10).

Alternatives Considered

  • Untrusted sandboxed bundles (earlier draft). Rejected by user choice — plugins must run arbitrary Node/shell. Replaced by trusted-at-install.
  • Tiered trust (UI-only vs Node). Declined for v1; revisitable as the deferred sandbox tier (now a breaking change to retrofit).
  • Shared single extension-host process. Rejected for child-process-per-plugin isolation.
  • Shelling out to a system npm/pnpm. Rejected — not present on clean user machines or remote hosts; vendored in-process installer instead (KTD6).
  • Spawning a system node. Rejected — packaged apps fork Electron's binary with ELECTRON_RUN_AS_NODE (KTD2).
  • Sync context API. Rejected — every call crosses a process boundary / SSH hop; async-only (R3).
  • Single big-bang v1. Rejected this round — phased v1a/v1b/v1c gates the expensive, hard-to-reverse surfaces behind demand validation.

Sources & Research

  • paperclip fix: restore PDF preview rendering #258 — plugins ship a UI bundle + use Node APIs directly; multisite distribution. Shaped KTD1, the trusted-runtime direction.
  • Codebase research — right-sidebar seams + the two literal validators; sidecar-client.ts (Electron-binary fork + asar.unpacked); relay as electron-free remote-SSH daemon (relay.ts, plugin-overlay.ts, ssh-remote-node-resolution.ts, ssh-relay-build-toolchain.ts / SSH relay: pre-bundle node-pty per platform (VS Code-style) to eliminate npm install on remote #1693); createMainWindow.ts webview hardening; single audited contextBridge; no existing custom-protocol or child-process-plugin runtime. Anchored KTD2/KTD3/KTD6, U10, U7a/U7b.
  • Institutional learnings — ssh-handler-reregistration-port-forwards.md, terminal-main-owned-state.md, windows-secure-file-acl-hardening.md. Shaped KTD8, R10, U2/U10/U13.
  • Document review (2 rounds, 2026-06-18) — 7 personas each round. Round 1 corrected the remote-relay model, mobile asset serving, sender-bound pluginId, webview hardening, install hardening, capability/snapshot shapes. Round 2 (this round) added: Electron-binary fork (not system node), vendored in-process installer (not system npm), --ignore-scripts before consent-bypassing postinstall, async context API, shared electron-free gate + conformance test, remote pure-JS scoping + toolchain reuse, safeStorage tokens, per-plugin settings isolation, git/tarball integrity, the design states (add-dialog detection, install progress, consent contradiction, settings composition, output UI, update/incompatible, mobile nav), and the phased v1a/v1b/v1c delivery behind a developer-preview gate with the external-ecosystem/support posture and pre-stable (0.x) contract.
  • User scope additions (2026-06-18) — trusted runtime, child-process-per-plugin, npm/git/tarball/private + local install, plugin settings pages, enumerated lifecycle/API; and "integrate the full review, then PR."
  • Prior art — VS Code extension host (trusted Node extension + sandboxed webview UI + message passing).

No docs/solutions/ knowledge base exists yet — run /ce-compound after this lands to capture the (greenfield) plugin-system learnings.


🤖 Generated with Claude Code


Open in Stage

ELI5

This is a design plan (not code yet) for a plugin system: trusted plugins with a right-sidebar UI, installable via npm, for both desktop and mobile. Reviewers can comment on the design before implementation.

…ution, desktop + mobile)

Planning/discussion PR. The plan lives under docs/ (gitignored), so the
full plan is in the PR description. Empty commit carries the PR.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
gsxdsm added a commit to gsxdsm/orca-stably that referenced this pull request Jun 19, 2026
…ate (U2 core)

Second v1a increment (plan PR stablyai#5738; builds on the shared contract). Host-side
authority for the plugin lifecycle, electron-free and fully injectable
(pluginsDir + stateFilePath) so it unit-tests against temp dirs:

- plugin-store: persisted install/activation state; idempotent setActive;
  reinstall preserves the active flag; corrupt-state resets to empty.
- plugin-discovery: scan a plugins dir, read plugin.json or package.json#orca,
  validate via the shared contract; separates valid vs invalid with errors.
- plugin-install: local-folder install that validates BEFORE copying (nothing
  written for an invalid bundle); folder copy runs no lifecycle scripts.
- plugin-manager: composes the above — list/get/discover/installLocal/activate/
  deactivate/remove, idempotent, deactivate-before-remove, state persisted.

21 new tests (53 total in the plugin tree), lint + typecheck clean. The
Electron-coupled orca-plugin:// asset protocol + webview-partition lifecycle and
the trusted child-process runtime are deferred to later increments per the plan,
so nothing here is half-wired.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
gsxdsm added a commit to gsxdsm/orca-stably that referenced this pull request Jun 19, 2026
…r (U13 core)

Third v1a increment (plan PR stablyai#5738). Plugin-owned settings persistence,
electron-free and injectable so it unit-tests against temp dirs:

- settings-schema (shared): minimal JSON-Schema-subset validator (type,
  properties, required, items, enum, additionalProperties) so main and the
  relay validate writes identically without a heavy dependency.
- plugin-settings-store: each plugin's settings live in their OWN file
  (<pluginsDir>/<id>/settings.json) — never a shared blob — with id path-safety
  so one plugin's path can't resolve into another's. Writes validate against the
  manifest settingsSchema when present; invalid writes leave the file untouched.

14 new tests (67 total in the plugin tree), lint + typecheck clean. The
renderer settings-host webview and the context.settings IPC wiring are deferred
to later increments per the plan.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
gsxdsm added a commit to gsxdsm/orca-stably that referenced this pull request Jun 19, 2026
…U10 core)

Fourth v1a increment (plan PR stablyai#5738). The pure, unit-testable half of the
trusted child-process runtime (the real child_process fork + crash-isolation
are wired and integration-tested separately, per the plan):

- plugin-output-buffer: bounded ring buffer for backend stdout/stderr (drops
  oldest past capacity) so the management UI's View Output stays memory-safe.
- plugin-supervision: deterministic restart policy — clean exit -> inactive;
  crash -> restart with backoff until maxRestarts, then Errored; fresh
  activation resets the crash counter; per-plugin isolated state.

12 new tests (79 total in the plugin tree), lint + typecheck clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@AmethystLiang
AmethystLiang requested a review from Jinwoo-H June 23, 2026 16:50
@mondaychen

mondaychen commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Very supportive of this direction — I have a concrete use case that I think validates the demand this plan asks about, plus one roadmap question.

Use case: a rich .docx editor/viewer as a plugin. I have a web-based docx editor built on SuperDoc (React frontend + a small Node backend for file access). I want to use it inside Orca so that specs and Word docs in a worktree can be viewed, edited, and — importantly — redlined by agents: an agent running in an Orca terminal drives the editor through a small tool API (search, insert tracked change, add comment, accept/reject), and edits save back to the .docx on disk. The editor component is using a different license, so it can never be compiled into Orca itself — a user-installed plugin is exactly the right distribution boundary.

What I do today without the plugin system: run my app as a localhost sidecar and open it in an Orca browser tab via orca tab create --url http://127.0.0.1:.../?file=.... It works, but I manage the process lifecycle, port, and auth token myself; there's no file-type association (clicking a .docx still shows "Binary file — cannot display"); and remote/SSH worktrees can't work at all, since the sidecar only reads the local disk. This proposal's architecture addresses all of that: the trusted backend replaces my sidecar (with supervision), the webview replaces my browser tab, and running the backend "where the workspace lives" via relay provisioning would solve the remote-worktree gap — something a localhost sidecar architecturally never can.

Roadmap question: the v1 UI surface is a right-sidebar panel. Would a file-type viewer / custom-editor contribution point fit as a follow-up — i.e., a manifest field like viewers: [{ extensions: [".docx"] }] so matching files open the plugin's webview as an editor tab, with file bytes and save routed through the capability bridge (roughly VS Code's CustomEditor analog)? That's the piece that would make document plugins first-class rather than panel-shaped.

Happy to build this docx viewer plugin against the v1a SDK behind the developer-preview flag as a real-world exercise of the API, and to report back on the SDK's ergonomics from a third-party author's perspective.

@electro56435

electro56435 commented Jul 5, 2026 •

Copy link
Copy Markdown

I want Kickbacks.ai to run inside Orca, and this PR is the only path I can see to it. So commenting to (a) make sure that use case is on the radar when v1a scope gets locked, and (b) get a yes/no on whether the existing bundled-install mechanism opens to third parties in v1a.

Concrete demand: Kickbacks (github.com/andrewmccalip/kickbacks.ai) patches ~/.claude/settings.json for Claude Code's spinner today; their PR https://github.com/andrewmccalip/kickbacks.ai/pull/73 already factors out a vscode-free host emitting the same lifecycle hooks Orca's bundled extensions consume. It would drop into ~/.pi/agent / ~/.omp/agent the same way if the install surface existed.
Question: is opening the bundled-install API for ~/.pi/agent / ~/.omp/agent to third-party tools an explicit v1a deliverable, or is v1a strictly the new npm-distributed runtime?

@AmethystLiang AmethystLiang assigned OrcaWin and unassigned Jinwoo-H Jul 20, 2026
@AmethystLiang
AmethystLiang requested review from OrcaWin and removed request for Jinwoo-H July 20, 2026 18:44
@nwparker nwparker added the enhancement New feature or request label Jul 27, 2026
@AmethystLiang

Copy link
Copy Markdown
Contributor

Thanks for the contribution — the underlying change is already implemented in main, so we’re closing this PR as superseded.

@gsxdsm
gsxdsm deleted the gsxdsm/plugin-system-plan branch October 31, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants