Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
/*
Shared primitives — panel cards, form fields, button variants, badges, and
the overlay/dialog base used by every floating surface.
*/
/* Surfaces and fields carry tone, not strokes (D297): a card is a soft tile,
a field is a filled well that lifts and gains an accent ring only while
focused. Both themes share the formula through the tile tokens. */
.ui-tooltip {
position: fixed;
z-index: 1000;
max-width: calc(100vw - 16px);
transform: translate(-50%, -100%);
border: 1px solid var(--ds-border-default);
border-radius: var(--radius-sm);
background: var(--ds-bg-elevated-opaque);
box-shadow: var(--ds-raised-shadow);
padding: 3px 7px;
color: var(--ds-text-secondary);
font-size: var(--text-2xs);
line-height: var(--leading-compact);
white-space: nowrap;
pointer-events: none;
}
.ui-tooltip-path {
width: max-content;
max-width: min(420px, calc(100vw - 16px));
overflow-wrap: anywhere;
white-space: normal;
}
/* A help tooltip carries a sentence, not a label, so it wraps instead of
running off its anchor. */
.ui-tooltip-help {
width: max-content;
max-width: min(360px, calc(100vw - 16px));
overflow-wrap: anywhere;
white-space: normal;
text-align: left;
}
/*
The help affordance: a row, card heading, or form field keeps its
explanation out of the layout and behind this question mark, which is the
only mark that there is more to read (D601). It is a button, so a keyboard
reaches the same sentence a pointer hovers.
*/
.ui-help-icon {
display: inline-flex;
align-items: center;
justify-content: center;
margin-left: 6px;
padding: 0;
border: 0;
background: none;
color: var(--ds-text-muted);
vertical-align: middle;
cursor: help;
}
.ui-help-icon:hover,
.ui-help-icon:focus-visible {
color: var(--ds-text-secondary);
}
.panel-card {
border-radius: var(--radius-lg);
background: var(--ds-tile);
}
.field-input,
.field-select,
.field-textarea {
width: 100%;
border: 0;
border-radius: var(--radius-sm);
background: var(--ds-tile-hover);
padding: 9px 11px;
/* The whole field vocabulary pins to one height, so a native select (whose
closed box resolves ~2px shorter on its own) and an input that asks for a
smaller font (`text-sm-plus`) still line up with the plain input beside
them. Compact surfaces that own a smaller scale override the minimum. */
min-height: var(--ds-field-height);
color: var(--ds-text-primary);
outline: none;
transition:
background var(--motion-duration-fast) var(--motion-ease-out),
box-shadow var(--motion-duration-fast) var(--motion-ease-out);
}
.field-input:focus,
.field-select:focus,
.field-textarea:focus {
background: var(--ds-raised);
box-shadow: 0 0 0 2px color-mix(in oklab, var(--ds-accent) 22%, transparent);
}
.field-input:read-only,
.field-select:disabled {
color: var(--ds-text-secondary);
cursor: default;
}
/* A password field with a reveal control: the toggle rides inside the field's
own row so the two read as one control (PasswordInput). */
.password-input {
position: relative;
display: flex;
align-items: center;
}
/* Room for the toggle, which is positioned over the well's trailing edge. */
.password-input .field-input {
padding-right: 34px;
}
.password-input-toggle {
position: absolute;
right: 4px;
display: inline-flex;
align-items: center;
justify-content: center;
width: var(--ds-control-size);
height: var(--ds-control-size);
border-radius: var(--radius-sm);
color: var(--ds-text-secondary);
transition:
background var(--motion-duration-fast) var(--motion-ease-out),
color var(--motion-duration-fast) var(--motion-ease-out);
}
.password-input-toggle:hover:not(:disabled) {
background: var(--ds-bg-hover);
color: var(--ds-text-primary);
}
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
border-radius: var(--radius-sm);
padding: 7px 12px;
font-size: var(--text-md);
transition:
background var(--motion-duration-fast) var(--motion-ease-out),
color var(--motion-duration-fast) var(--motion-ease-out),
opacity var(--motion-duration-fast) var(--motion-ease-out),
transform var(--motion-duration-fast) var(--motion-ease-out);
}
.btn:active:not(:disabled) {
transform: scale(0.98);
}
.btn-primary {
background: var(--ds-accent);
color: var(--ds-bg-primary);
}
.btn-primary:hover:not(:disabled) {
background: var(--ds-accent-hover);
opacity: 1;
}
.btn-secondary {
background: var(--ds-tile-hover);
color: var(--ds-text-primary);
}
.btn-secondary:hover:not(:disabled) {
background: var(--ds-tile-deep);
}
.btn-ghost {
color: var(--ds-text-secondary);
}
.btn-ghost:hover:not(:disabled) {
background: var(--ds-bg-hover);
color: var(--ds-text-primary);
}
/* Icon-only control geometry. `.icon-btn` (styles/composer.css) is shared with
label-driven pills and takes its width from its content — glyph plus padding
— so an icon-only use states the square instead: both axes pinned to the same
token, `flex: 0 0` so a crowded toolbar row cannot shrink it back out of
square, and no side padding, which under the global `border-box` would
otherwise leave a 12px content box for a 15px glyph. */
.icon-btn.icon-btn-square {
width: var(--ds-control-size);
height: var(--ds-control-size);
flex: 0 0 var(--ds-control-size);
padding: 0;
}
.badge {
display: inline-flex;
align-items: center;
border-radius: var(--radius-full);
padding: 2px 8px;
font-size: var(--text-xs);
line-height: var(--leading-normal);
}
.badge-neutral {
background: color-mix(in oklab, var(--ds-text-primary) 8%, transparent);
color: var(--ds-text-secondary);
}
.badge-success {
background: color-mix(in oklab, var(--ds-success) 16%, transparent);
color: var(--ds-success);
}
.badge-error {
background: color-mix(in oklab, var(--ds-error) 16%, transparent);
color: var(--ds-error);
}
.badge-warning {
background: color-mix(in oklab, var(--ds-warning) 16%, transparent);
color: var(--ds-warning);
}
#pi-desktop-overlays {
position: fixed;
inset: 0;
z-index: 40;
pointer-events: none;
}
#pi-desktop-overlays > .overlay {
pointer-events: auto;
}
.overlay {
position: fixed;
inset: 0;
z-index: 40;
display: flex;
align-items: center;
justify-content: center;
background: var(--ds-scrim);
padding: 24px;
animation: overlay-in var(--motion-duration-normal) var(--motion-ease-out) both;
}
/*
Layer host a modal (Settings, startup guide) renders right after itself.
Menus, popovers and sheets opened inside the modal mount here so they stack
above it; the empty host never takes pointer input.
*/
.modal-layer-host {
position: fixed;
inset: 0;
z-index: 41;
pointer-events: none;
}
.modal-layer-host > * {
pointer-events: auto;
}
.dialog {
width: min(100%, 440px);
/* Overlay is a flex box; auto min-width would let wide content overflow it. */
min-width: 0;
max-width: 100%;
border: 1px solid var(--ds-border-default);
border-radius: var(--radius-lg-plus);
background: var(--ds-bg-elevated-opaque);
box-shadow: var(--ds-shadow-dialog);
padding: 18px;
animation: surface-in var(--motion-duration-normal) var(--motion-ease-out) both;
}
/* Pointer-anchored right-click menu (see components/ContextMenu.tsx). It is
measured before it is revealed, so `is-open` gates a surface that would
otherwise paint at the viewport origin. It shares the sidebar menus' surface
grammar so one floating-layer grammar covers the whole renderer. */
.context-menu {
position: fixed;
top: 0;
left: 0;
z-index: 60; /* body-level menu layer, above pane stacking */
min-width: 184px;
width: max-content;
max-width: calc(100vw - 16px);
max-height: calc(100vh - 16px);
overflow-y: auto;
padding: 5px;
border: 1px solid var(--ds-border-subtle);
border-radius: var(--radius-md-plus);
background: var(--ds-bg-elevated-opaque, var(--ds-bg-primary));
box-shadow: var(--ds-shadow-dialog);
color: var(--ds-text-primary);
opacity: 0;
pointer-events: none;
visibility: hidden;
}
.context-menu.is-open {
opacity: 1;
pointer-events: auto;
visibility: visible;
}
.context-menu.is-compact { min-width: 156px; padding: 4px; }
.context-menu.is-compact .context-menu-item { min-height: 28px; padding: 4px 8px; font-size: var(--text-xs-plus); outline: none; }
.context-menu.is-compact .context-menu-item:focus-visible { box-shadow: inset 0 0 0 1px var(--ds-border-default); }
.context-menu-item {
display: flex;
width: 100%;
align-items: center;
gap: 8px;
border-radius: var(--radius-sm);
padding: 7px 8px;
color: var(--ds-text-primary);
font-size: var(--text-sm-plus);
text-align: left;
white-space: nowrap;
}
/* Keyboard arrow navigation moves focus, so the hover fill has to follow it or
the active row is invisible. */
.context-menu-item:hover,
.context-menu-item:focus-visible {
background: var(--ds-bg-hover);
}
.context-menu-item:disabled {
background: transparent;
color: var(--ds-text-muted);
cursor: not-allowed;
opacity: 0.55;
}
.context-menu-item.has-submenu {
gap: 8px;
}
.context-menu-submenu-chevron {
display: inline-flex;
flex: 0 0 auto;
margin-left: auto;
color: var(--ds-text-muted);
}
.context-menu-submenu {
z-index: 61;
}
.context-menu-item.danger {
color: var(--ds-error);
}
.context-menu-item.danger:hover,
.context-menu-item.danger:focus-visible {
background: color-mix(in oklab, var(--ds-error) 10%, transparent);
}
.context-menu-icon {
display: inline-flex;
flex: 0 0 auto;
color: var(--ds-text-muted);
}
/* A destructive row carries one signal (its ink), not two. */
.context-menu-item.danger .context-menu-icon {
color: inherit;
}
.context-menu-label {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.context-menu-check {
display: inline-flex;
flex: 0 0 14px;
margin-left: auto;
color: var(--ds-text-muted);
}
.context-menu-separator {
height: 1px;
margin: 5px 6px;
background: var(--ds-border-subtle);
}
/* Radial context menu on the empty transcript background (opt-in through
Settings → General). It joins the same floating-layer family as
`.context-menu`: viewport-fixed, measured before reveal, clamped inside the
window, disc surface with a hairline edge and the composer shadow. The SVG
plate draws the four wedges, their hairline separators, the recessed hub,
and the active fill; the buttons on top carry icon, label, focus, and hit
target, so the ring reads without hovering and one highlight covers both
layers. */
.radial-menu {
position: fixed;
z-index: 60; /* body-level menu layer, above pane stacking */
border: 1px solid var(--ds-border-subtle);
border-radius: var(--radius-round);
background: var(--ds-bg-elevated-opaque, var(--ds-bg-primary));
box-shadow: var(--ds-shadow-composer);
color: var(--ds-text-primary);
opacity: 0;
pointer-events: none;
visibility: hidden;
transform: scale(0.9);
transition:
opacity var(--motion-duration-fast) var(--motion-ease-out),
transform var(--motion-duration-normal) var(--motion-ease-out);
}
.radial-menu.is-open {
opacity: 1;
pointer-events: auto;
visibility: visible;
transform: scale(1);
}
@media (prefers-reduced-motion: reduce) {
.radial-menu {
transition: none;
transform: none;
}
}
.radial-menu-plate {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
overflow: visible;
}
.radial-menu-wedge {
fill: transparent;
stroke: var(--ds-border-subtle);
stroke-width: 1;
transition: fill var(--motion-duration-fast) var(--motion-ease-out);
}
.radial-menu-wedge.is-active {
fill: var(--ds-bg-active);
}
.radial-menu-hub {
fill: var(--ds-bg-inset);
stroke: var(--ds-border-subtle);
stroke-width: 1;
}
.radial-menu-dot {
fill: var(--ds-text-faint);
}
.radial-menu-item {
position: absolute;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
transform: translate(-50%, -50%);
padding: 4px;
color: var(--ds-text-secondary);
text-align: center;
cursor: pointer;
user-select: none;
transition:
color var(--motion-duration-fast) var(--motion-ease-out),
transform var(--motion-duration-fast) var(--motion-ease-out);
}
.radial-menu-item[data-active="true"] {
color: var(--ds-text-primary);
transform: translate(-50%, -50%) scale(1.04);
}
/* An action the conversation cannot fill keeps its direction visible instead of
collapsing the ring into three unrelated sectors. */
.radial-menu-item:disabled {
color: var(--ds-text-faint);
cursor: not-allowed;
}
.radial-menu-item:disabled .radial-menu-icon {
color: var(--ds-text-faint);
}
/* Keyboard focus keeps the wedge fill as its indicator; the default ring would
draw a rectangle over the wedge. */
.radial-menu-item:focus-visible {
outline: none;
}
.radial-menu-icon {
display: inline-flex;
color: var(--ds-text-secondary);
transition: color var(--motion-duration-fast) var(--motion-ease-out);
}
.radial-menu-item[data-active="true"] .radial-menu-icon {
color: var(--ds-text-primary);
}
.radial-menu-label {
display: -webkit-box;
width: 100%;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
overflow-wrap: anywhere;
font-size: var(--text-xs);
line-height: var(--leading-tight);
}
/* Shared labeled selections keep native input semantics, not platform paint. */
.ui-checkbox {
display: inline-flex;
align-items: center;
gap: 8px;
min-height: 28px;
max-width: 100%;
color: var(--ds-text-secondary);
font-size: var(--text-sm);
line-height: var(--leading-body);
cursor: pointer;
}
.ui-checkbox > span {
min-width: 0;
overflow-wrap: anywhere;
}
.ui-checkbox:has(> input:disabled) {
opacity: 0.45;
cursor: not-allowed;
}
.ds-checkbox {
appearance: none;
-webkit-appearance: none;
width: 18px;
height: 18px;
margin: 0;
flex: 0 0 auto;
border-radius: var(--radius-3xs);
border: 1.5px solid var(--ds-text-secondary);
background: transparent;
cursor: pointer;
position: relative;
transition:
background var(--motion-duration-fast) var(--motion-ease-out),
border-color var(--motion-duration-fast) var(--motion-ease-out);
}
.ds-checkbox:hover:not(:disabled) {
border-color: var(--ds-accent);
}
.ds-checkbox:checked,
.ds-checkbox:indeterminate {
background: var(--ds-accent);
border-color: var(--ds-accent);
}
.ds-checkbox:checked::after {
content: "";
position: absolute;
top: 2px;
left: 5px;
width: 5px;
height: 9px;
border: solid var(--ds-bg);
border-width: 0 2px 2px 0;
transform: rotate(45deg);
}
.ds-checkbox:indeterminate::after {
content: "";
position: absolute;
top: 6px;
left: 3px;
width: 9px;
height: 2px;
background: var(--ds-bg);
border: 0;
transform: none;
}
.ds-checkbox:focus-visible {
outline: 2px solid var(--ds-focus);
outline-offset: 3px;
}
.ds-checkbox:disabled {
cursor: not-allowed;
}
.ds-checkbox:disabled:not(.ui-checkbox > input) {
opacity: 0.45;
}
@media (forced-colors: active) {
.ds-checkbox {
appearance: auto;
}
.ds-checkbox::after {
display: none;
}
}