dexploarer/plugin-electrobun-dev/electrobun-rpc

Claude Code and agent skill by dexploarer/plugin-electrobun-dev

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

This skill should be used when the user asks about "electrobun RPC", "defineElectrobunRPC", "Electroview.defineRPC", "ElectrobunRPCSchema", bun-to-renderer communication, or renderer-to-bun communication. Activates automatically when RPC code is present.

Install

npx vskill@latest install dexploarer/plugin-electrobun-dev/electrobun-rpc

SKILL.md

The same SKILL.md was published earlier as dexploarer/plugin-electrobun-dev/electrobun-rpc.

Electrobun RPC System

Type-safe bidirectional communication between the Bun process and webview renderers. Uses WebSockets for transport with AES-GCM encryption. Two call types: requests (expects a response) and messages (fire-and-forget).

Schema Definition (shared type)

Define the schema in a shared file both sides import:

typescript
// src/shared/rpc-schema.ts
import type { ElectrobunRPCSchema, RPCSchema } from "electrobun/view";
// bun: what the BUN process handles (requests from renderer, messages from renderer)
// webview: what the WEBVIEW handles (requests from bun, messages from bun)
export type AppRPC = {
bun: RPCSchema<{
requests: {
getNotes: { args: {}; response: Note[] };
saveNote: { args: { id: string; title: string; content: string }; response: { success: boolean } };
deleteNote: { args: { id: string }; response: void };
};
messages: {
userIdleDetected: {};
};
}>;
webview: RPCSchema<{
requests: {
getSelectedText: { args: {}; response: string };
};
messages: {
menuAction: { action: string; role?: string };
noteUpdatedExternally: { id: string };
};
}>;
} & ElectrobunRPCSchema;

Bun Side — BrowserView.defineRPC

typescript
import { BrowserView } from "electrobun/bun";
import type { AppRPC } from "../shared/rpc-schema";
const appRPC = BrowserView.defineRPC<AppRPC>({
maxRequestTime: 10000, // ms — set higher for file dialogs, heavy DB ops
handlers: {
requests: {
getNotes: async () => {
return await db.getAllNotes();
},
saveNote: async ({ id, title, content }) => {
await db.saveNote({ id, title, content });
return { success: true };
},
deleteNote: async ({ id }) => {
await db.deleteNote(id);
},
},
messages: {
userIdleDetected: () => {
console.log("User idle, saving state...");
},
},
},
});
// Pass rpc to BrowserView
const view = new BrowserView({ url: "...", rpc: appRPC });
// Send a message to renderer
view.rpc.send.menuAction({ action: "file-new" });
// Make a request to renderer
const selectedText = await view.rpc.request.getSelectedText({});

Renderer Side — Electroview.defineRPC

typescript
// src/mainview/index.ts
import { Electroview } from "electrobun/view";
import type { AppRPC } from "../shared/rpc-schema";
const rpc = Electroview.defineRPC<AppRPC>({
maxRequestTime: 10000,
handlers: {
requests: {
getSelectedText: () => {
return window.getSelection()?.toString() ?? "";
},
},
messages: {
menuAction: ({ action, role }) => {
handleMenuAction(action ?? role ?? "unknown");
},
noteUpdatedExternally: ({ id }) => {
reloadNote(id);
},
},
},
});
// Make a request to bun
const notes = await rpc.request.getNotes({});
// Send a message to bun
rpc.send.userIdleDetected({});

Key Rules

  • `requests`: bidirectional, async, returns a value. Use for: data fetching, file I/O, native dialogs.
  • `messages`: fire-and-forget, no return value. Use for: notifications, state updates, events.
  • `maxRequestTime`: always set explicitly. Default may be too low for:
  • File save dialogs: set ≥ 30000
  • Database operations: set ≥ 10000
  • Quick in-memory ops: 5000 is fine
  • Type safety: the schema type is shared — import it on both sides. Never duplicate the type definition.
  • Encryption: RPC uses AES-GCM. Keys are auto-generated per session. Don't bypass this.

Common Gotchas

  1. RPC not available yet: Wait for dom-ready event before calling view.rpc.request.*.
  2. maxRequestTime timeout: Error message is generic. If you see "RPC timeout", increase maxRequestTime.
  3. sandbox: true: Disables RPC entirely. Don't set sandbox on windows that need RPC.
  4. Schema mismatch: If bun and renderer import different schema types, calls silently fail. Use a single shared type file.
  5. Renderer not initialized: Electroview.defineRPC must be called before any rpc.request.* calls.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
5
Repository forks
1
7-day trend score
9

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/dexploarer/plugin-electrobun-dev/electrobun-rpc/badge)](https://verified-skill.com/skills/dexploarer/plugin-electrobun-dev/electrobun-rpc)

Something wrong with this skill or its page? Tell us.