Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="pi-plugin-chrome" content="v2" />
<title>Hello Plugin</title>
<style>
:root {
color-scheme: dark;
--bg: #181818;
--surface: #212121;
--surface-hover: color-mix(in oklab, #ffffff 6%, transparent);
--fg: #ffffff;
--secondary: color-mix(in oklab, #ffffff 70%, transparent);
--muted: color-mix(in oklab, #ffffff 52%, transparent);
--border: color-mix(in oklab, #ffffff 10%, transparent);
--accent: #ffffff;
}
:root[data-base="light"] {
color-scheme: light;
--bg: #ffffff;
--surface: #f9f9f9;
--surface-hover: color-mix(in oklab, #1a1c1f 5%, transparent);
--fg: #1a1c1f;
--secondary: color-mix(in oklab, #1a1c1f 74%, transparent);
--muted: #5d5d5d;
--border: color-mix(in oklab, #1a1c1f 10%, transparent);
--accent: #1a1c1f;
}
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100vh;
padding: var(--pi-plugin-titlebar-height, 0px) 16px 16px;
overflow: auto;
background: var(--bg);
color: var(--fg);
font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
/*
* PI-Desktop reserves exactly a transparent 46px drag band and overlays
* only the host-owned three-button capsule. Normal-flow content is
* offset automatically; do not add another 46px top padding. Development
* panels show a reminder that the band is not clickable outside the
* capsule. Fixed/sticky top UI should use:
* top: var(--pi-plugin-titlebar-height, 46px);
*/
.card {
border: 1px solid var(--border);
border-radius: 12px;
padding: 16px;
background: var(--surface);
}
h2 {
margin: 0 0 4px;
font-size: 16px;
font-weight: 560;
letter-spacing: -0.02em;
}
p {
margin: 0;
color: var(--muted);
}
button {
margin-top: 12px;
border: 1px solid var(--border);
border-radius: 8px;
padding: 8px 12px;
background: var(--accent);
color: var(--bg);
cursor: pointer;
font: inherit;
transition: opacity 150ms ease, transform 150ms ease;
}
button:hover { opacity: 0.82; }
button:active { transform: translateY(1px); }
button:focus-visible {
outline: 2px solid color-mix(in oklab, var(--accent) 58%, transparent);
outline-offset: 2px;
}
</style>
</head>
<body>
<div class="card">
<h2>Hello Plugin</h2>
<p>Sample plugin panel for PI-Desktop extensions.</p>
<button id="ping">Toast Ping</button>
</div>
<script>
const applyAppearance = (appearance) => {
const base = appearance?.base;
document.documentElement.dataset.base = base === "light" || base === "dark"
? base
: window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
};
window.pluginBridge?.on("appearance:changed", applyAppearance);
window.pluginBridge?.invoke("app.getAppearance").then(applyAppearance).catch(() => applyAppearance(null));
document.getElementById("ping").addEventListener("click", async () => {
if (window.pluginBridge?.invoke) {
await window.pluginBridge.invoke("ui.showToast", { message: "Hello panel bridge" });
} else {
alert("pluginBridge not available in sample preview");
}
});
</script>
</body>
</html>