HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.
Python agent-apiagent-frameworkagent-harnessai-agentsai-infrastructurecoding-agentconformance-testingdeepseek-harnessharness-engineeringhermesllmopen-protocolopen-sourceopen-standardpi-coding-agentself-hosteduhpunified-apiunified-harness-protocolunified-interface
ui, gateway: the Plugins page is the console design, the same page as the hosted console (#361)
github-actions[bot]fe0dac06d670
diff --git a/gateway/app.py b/gateway/app.pyindex 02487db3..67d7608a 100644--- a/gateway/app.py+++ b/gateway/app.py@@ -785,6 +785,10 @@ async def _vault_put(tenant: str, name: str, value: str) -> None:await BACKING.secrets.put(tenant, name, value)+async def _vault_delete(tenant: str, name: str) -> None:+ await BACKING.secrets.delete(tenant, name)++_VAULT_TENANT_RE = re.compile(r"^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$")def _vault_tenant_ok(org: str | None) -> bool:# secret-store tenants must be [a-z0-9-], no '--', start/end alnum -> dotted org ids are invalid@@ -14169,6 +14173,39 @@ async def plug_attachments_public(plug_type: str, request: Request) -> dict:return {"workspace": workspace, "type": plug_type, "harnesses": len(rows), "attached": len(attached), "harness_list": attached}[email protected]("/v1/plugs/{plug_type}/tools")+async def plug_tools_public(plug_type: str, request: Request) -> dict:+ """The tools a plugin serves, from the same list the agent gets: what the detail sheet shows."""+ await _pub_org_member(request)+ if plug_type not in _PLUG_FORMS:+ raise uhp_error(404, "plug_not_found", f"No plugin of type {plug_type!r}.", "plug_type")+ return {"type": plug_type, "label": plugs_plane.TYPES[plug_type],+ "tools": [{"name": t["name"], "description": t["description"], "risk": t["risk"]} for t in plugs_plane.tools_of(plug_type)]}++[email protected]("/v1/plugs/{plug_type}")+async def delete_plug(plug_type: str, request: Request) -> dict:+ """Remove a plugin from the workspace: the record goes and the credential it kept is deleted+ from the secret store. A harness that includes it keeps its entry and loses the tools on its+ next task; nothing at the service changes, and the workspace can connect it again."""+ org, _ = await _pub_org_member(request)+ if PLUGS_REGISTRY_URL:+ raise uhp_error(409, "registry_elsewhere", "Plugins on this deployment are managed on the Plugins page of the workspace.", "plug_type")+ if plug_type not in _PLUG_FORMS:+ raise uhp_error(404, "plug_not_found", f"No plugin of type {plug_type!r}.", "plug_type")+ workspace = _plug_workspace(request)+ _status, rec = await _plug_lookup_local(org, workspace, plug_type)+ if not rec:+ raise uhp_error(404, "plug_not_connected", f"No {plugs_plane.TYPES[plug_type]} plugin is connected for this workspace.", "plug_type")+ for r in rec.get("key_refs") or []:+ if isinstance(r, dict) and r.get("ref"):+ await _vault_delete(org, str(r["ref"]))+ await BACKING.graph.delete(_plug_vid(workspace, plug_type), _PLUG_LABEL)+ _plug_fields_cache.pop(_plug_vid(workspace, plug_type), None)+ print(f"[plugs] {workspace}: {plug_type} removed", flush=True)+ return {"type": plug_type, "workspace": workspace, "removed": True}++def _plugs_types_ok(plugs: list) -> list[str]:if not isinstance(plugs, list) or not plugs or not all(isinstance(t, str) for t in plugs):raise uhp_error(400, "invalid_input", "plugs must be a non-empty list of plug type names.", "plugs")diff --git a/gateway/backing.py b/gateway/backing.pyindex b9ef81bf..0c122121 100644--- a/gateway/backing.py+++ b/gateway/backing.py@@ -50,6 +50,9 @@ class GraphStore(Protocol):async def upsert(self, label: str, vid: str, props: dict, *, raise_on_fail: bool = False) -> None: ...async def add_edge(self, label: str, src: str, dst: str) -> None: ...async def find(self, label: str, eq: dict | None = None, neq: dict | None = None) -> list[dict]: ...+ async def delete(self, vid: str, label: str | None = None) -> bool:+ """Remove one vertex and its edges; False when there was none (or the label differs)."""+ ...async def probe(self) -> None:"""Raise if the store is unreachable/misconfigured. Used by /readyz, which must FAIL on abroken plane — the normal read paths swallow errors and return empty."""@@ -66,6 +69,9 @@ class BlobStore(Protocol):class SecretStore(Protocol):async def get(self, tenant: str, name: str) -> str | None: ...+ async def delete(self, tenant: str, name: str) -> None:+ """Forget a stored secret; nothing happens when there is none."""+ ...async def put(self, tenant: str, name: str, value: str, *,require_encryption: bool = False) -> None:@@ -163,6 +169,20 @@ class SqliteGraphStore:except Exception: # noqa: BLE001 — best-effort, matches VG edge semanticspass+ async def delete(self, vid: str, label: str | None = None) -> bool:+ def _do():+ with self._conn() as c:+ row = c.execute("SELECT label FROM vertices WHERE vid=?", (vid,)).fetchone()+ if not row or (label is not None and row[0] != label):+ return False+ c.execute("DELETE FROM vertices WHERE vid=?", (vid,))+ c.execute("DELETE FROM edges WHERE src=? OR dst=?", (vid, vid))+ return True+ try:+ return await asyncio.to_thread(_do)+ except Exception: # noqa: BLE001+ return False+async def find(self, label: str, eq: dict | None = None, neq: dict | None = None) -> list[dict]:def _do():with self._conn() as c:@@ -382,6 +402,12 @@ class FileSecretStore:p.chmod(0o600) # belt to the encryption's bracesawait asyncio.to_thread(_do)+ async def delete(self, tenant: str, name: str) -> None:+ def _do():+ with contextlib.suppress(OSError):+ self._p(tenant, name).unlink()+ await asyncio.to_thread(_do)+# ── selection ─────────────────────────────────────────────────────────────────────diff --git a/gateway/tests/test_plugs_local.py b/gateway/tests/test_plugs_local.pyindex cd1bae0c..bfcbbdbd 100644--- a/gateway/tests/test_plugs_local.py+++ b/gateway/tests/test_plugs_local.py@@ -199,3 +199,27 @@ def test_a_harness_created_without_a_workspace_header_is_in_the_default_workspacwith um.patch.object(gw, "PLUGS_REGISTRY_URL", "http://registry"):assert gw._harness_workspace_for_plugs({"workspace": ""}) == ""assert gw._harness_workspace_for_plugs({"workspace": "ws1"}) == "ws1"+++def test_the_sheet_reads_the_tools_and_remove_forgets_the_record_and_its_credential(client, world):+ """The console's detail sheet lists a plugin's tools from the gateway (the same list the agent+ gets) and Remove deletes the record and the secret it kept; connecting again starts clean."""+ r = _req(client, "GET", "/v1/plugs/github/tools")+ assert r.status_code == 200 and r.json()["label"] == "GitHub"+ names = [t["name"] for t in r.json()["tools"]]+ assert "get_file_contents" in names and "create_pull_request" in names+ assert all(set(t) == {"name", "description", "risk"} for t in r.json()["tools"])+ assert _req(client, "GET", "/v1/plugs/nonsense/tools").status_code == 404++ r = _req(client, "PUT", "/v1/plugs/github", {"enabled": True, "config": {"repo": "acme/site"}, "secrets": {"token": GH_TOKEN}})+ assert r.status_code == 200 and r.json()["status"] == "connected", r.text+ ref = f"plug-{gw._plug_safe(WS)}-github-token"+ assert asyncio.run(gw.BACKING.secrets.get(ORG, ref)) == GH_TOKEN++ r = _req(client, "DELETE", "/v1/plugs/github")+ assert r.status_code == 200 and r.json() == {"type": "github", "workspace": WS, "removed": True}+ assert asyncio.run(gw.BACKING.secrets.get(ORG, ref)) is None+ cat = {p["type"]: p for p in _req(client, "GET", "/v1/plugs").json()["plugs"]}+ assert cat["github"]["status"] == "missing" and cat["github"]["secrets_set"] == []+ assert _req(client, "DELETE", "/v1/plugs/github").status_code == 404+ assert GH_TOKEN not in "".join(_seen[-6:])diff --git a/ui/src/app/(app)/plugins/page.tsx b/ui/src/app/(app)/plugins/page.tsxindex 9bd8c7c1..aa67b05a 100644--- a/ui/src/app/(app)/plugins/page.tsx+++ b/ui/src/app/(app)/plugins/page.tsx@@ -1,65 +1,127 @@'use client';-// Plugins: services a workspace connects once (a browser, a GitHub repository, a Vercel project,-// an InsForge backend); each Harness then includes the ones it needs under Harness Settings.-// One catalog, every plugin a row of it: its state here, what it costs, how many Harnesses-// include it. Nothing on this page is a copy: the catalog, the tool counts and the price come-// from the server that serves and charges them.-import { useCallback, useEffect, useState } from 'react';+// Plugins, per the console design (Plugins.dc.html), the same page as the hosted console's:+// connect a service once for the workspace, any Harness can then use it, and each Harness+// decides which ones it needs. Two tabs: Browse (the catalog, by category, with a search box and+// a detail sheet per plugin) and Installed (a table: plugin, source, how many Harnesses include+// it, status; the status is a switch and a plugin can be removed). A plugin is the workspace's+// own account: the sheet asks for the credential the organization created at the service and+// the names beside it, the gateway tries it there and keeps it in this instance's secret store,+// never shown again. Every figure on the page is the gateway's: the catalog with each plugin's+// state and price, the tool lists, the counts of Harnesses that include it.+import { useCallback, useEffect, useMemo, useState } from 'react';import { useRouter, useSearchParams } from 'next/navigation';import { SkelRows } from '@/components/Skel';-import { listPlugs, setPlug, plugAttachments, microsoftStart, microsoftComplete, microsoftSignout, type Plug } from '@/lib/harness';+import {+ listPlugs, setPlug, deletePlug, plugTools, plugAttachments, microsoftStart, microsoftComplete, microsoftSignout,+ type Plug, type PlugTool,+} from '@/lib/harness';+const CATEGORY_OF: Record<string, string> = { github: 'code', browser: 'tools', vercel: 'hosting', insforge: 'backend', microsoft365: 'productivity' };+const CATEGORY: Record<string, string> = { code: 'Developer', tools: 'Developer', hosting: 'Hosting', backend: 'Data and infrastructure', productivity: 'Productivity', agents: 'Agents', other: 'Other' };/** Each service by its own mark (public/plugs): the GitHub and Vercel glyphs, Microsoft 365's logo,* InsForge's app icon (drawn full-bleed, it carries its own ground), our browser glyph. A type- * without one shows a plug. */+ * without one shows its initial. */const MARK: Record<string, { src: string; app?: boolean }> = {github: { src: '/plugs/github.svg' }, vercel: { src: '/plugs/vercel.svg' }, microsoft365: { src: '/plugs/microsoft365.svg' },insforge: { src: '/plugs/insforge.png', app: true }, browser: { src: '/plugs/browser.svg' },};+function Tile({ type, name, large }: { type: string; name: string; large?: boolean }) {+ const m = MARK[type];+ const cls = 'pl-tile' + (large ? ' pl-tile-lg' : '') + (m?.app ? ' is-app' : '');+ // eslint-disable-next-line @next/next/no-img-element -- a static brand mark+ return <span className={cls} aria-hidden="true">{m ? <img src={m.src} alt="" /> : name.charAt(0)}</span>;+}const BLURB: Record<string, string> = {- browser: 'A real web browser the agent can open, read, click through and screenshot.',- github: 'The repository this workspace connects: files, branches and pull requests.',- vercel: 'The project this workspace connects: deployments and domains.',- insforge: 'The backend this workspace connects: its tables and records.',- microsoft365: 'Your own SharePoint, OneDrive, Outlook and directory, read as each signed-in person through your organization\u2019s Microsoft Entra application, or as the application itself.',+ browser: 'A real web browser: open pages, read them, click, type, and take screenshots',+ github: 'Your own repository: files, branches, pull requests',+ vercel: 'Your own Vercel project: deployments and domains',+ insforge: 'Your own InsForge backend: tables and records',+ microsoft365: 'Your own SharePoint, OneDrive, Outlook and directory, as each signed-in person',};-const FIELD_LABEL: Record<string, string> = {- allow_domains: 'Only these sites', deny_domains: 'Never these sites', token: 'Access token', api_key: 'API key',- repo: 'Repository (owner/name)', owner: 'Owner', default_branch: 'Default branch', project: 'Project', project_id: 'Project id',- team_id: 'Team id', url: 'Address', region: 'Region',- tenant_id: 'Directory (tenant) id', client_id: 'Application (client) id', client_secret: 'Client secret', mode: 'Identity',+const ABOUT: Record<string, string> = {+ browser: 'Connect the browser so an agent can open a public page, read what is on it, fill in forms, click through, wait for things to appear and take screenshots that are kept with the task. Each task gets its own browser, opened when the agent first needs it and closed when the task ends. Private and local addresses are never reached.',+ github: 'Connect a repository of your own GitHub account or organization with a token you create there. An agent can then read files, make commits on a branch, open pull requests and merge them in that repository and nowhere else. The token is tried against the repository before it is kept, stored securely, and never handed to the agent.',+ vercel: 'Connect a project of your own Vercel account or team with a token you create there. An agent can then read the project, trigger deployments from a branch and watch them go live. The token is tried against the project before it is kept, stored securely, and never handed to the agent.',+ insforge: 'Connect a backend project of your own InsForge account with its API key and address. An agent can then read and write its tables and check its health. The key is tried against the backend before it is kept, stored securely, and never handed to the agent.',+ microsoft365: 'Connect your organization’s own Microsoft Entra application. Each person then signs in with Microsoft once, and an agent working for them reads their SharePoint sites, OneDrive, mail and calendar exactly as they may; or run it as the application itself for unattended work. The application’s secret is checked at Entra before it is kept, stored securely, and never handed to the agent.',};-const PLACEHOLDER: Record<string, string> = { tenant_id: 'e89476d8-\u2026', client_id: 'the application (client) id from the app registration' };-/** A Microsoft 365 plug runs as each signed-in person unless it was connected as the application. */-const delegated = (p: Plug) => p.type === 'microsoft365' && String(p.config.mode || 'delegated') === 'delegated';-const accountsOf = (p: Plug) => (p.config.accounts || {}) as Record<string, { upn?: string; name?: string; signed_in_at?: string }>;-const STATUS_LABEL: Record<Plug['status'], string> = { connected: 'Connected', disabled: 'Disabled', needs_auth: 'Needs auth', missing: 'Not connected' };+const STATUS_LABEL: Record<string, string> = { connected: 'Connected', disabled: 'Disabled', needs_auth: 'Needs auth' };+const SOURCE_LABEL: Record<string, string> = { platform: 'Official', local: 'Your account' };+/** The fields the gateway names per plugin (secrets_needed, config_fields), with the label beside+ * each, the hint under it, and which may stay empty. The browser's site lists have their own+ * section, and a record's own bookkeeping never shows as a field. */+const FIELD: Record<string, { label: string; hint?: string; kind?: 'text' | 'select' }> = {+ token: { label: 'Access token', hint: 'Created in the service’s settings; tried there before it is kept.' },+ api_key: { label: 'API key' },+ client_secret: { label: 'Client secret', hint: 'From the Entra application’s certificates and secrets.' },+ repo: { label: 'Repository (owner/name)', hint: 'Agents can reach this repository and nothing else.' },+ owner: { label: 'Owner', hint: 'Left empty, the owner in the repository name.' },+ default_branch: { label: 'Default branch', hint: 'Left empty, main.' },+ project: { label: 'Project', hint: 'The project’s name or id at the service.' },+ project_id: { label: 'Project id' },+ team_id: { label: 'Team id', hint: 'For a project that belongs to a team.' },+ url: { label: 'Address', hint: 'The backend’s https address.' },+ region: { label: 'Region' },+ tenant_id: { label: 'Directory (tenant) id' },+ client_id: { label: 'Application (client) id' },+ mode: { label: 'Identity', kind: 'select' },+};+const REQUIRED: Record<string, string[]> = {+ github: ['token', 'repo'], vercel: ['token', 'project'], insforge: ['api_key', 'url'], microsoft365: ['client_secret', 'tenant_id', 'client_id'],+};+const HIDDEN_FIELDS = new Set(['allow_domains', 'deny_domains', 'proxy', 'accounts', 'directory']);+// The non-secret names a connected plugin shows back, in the order they read best.+const SHOWN: Record<string, [string, string][]> = {+ github: [['repo', 'Repository'], ['owner', 'Owner'], ['default_branch', 'Default branch']],+ vercel: [['project', 'Project'], ['project_id', 'Project id'], ['team_id', 'Team']],+ insforge: [['url', 'Address'], ['project', 'Project'], ['region', 'Region']],+ microsoft365: [['directory', 'Directory'], ['tenant_id', 'Directory id'], ['client_id', 'Application id'], ['mode', 'Identity']],+};+type Field = { name: string; label: string; hint?: string; required: boolean; secret: boolean; kind: 'text' | 'select' };const listOf = (v: unknown) => (Array.isArray(v) ? v.map(String).join(', ') : '');const domainsOf = (text: string) => text.split(/[\s,]+/).map((d) => d.trim()).filter(Boolean);+const shownValue = (v: unknown) => (Array.isArray(v) ? v.map(String).join(', ') : v == null ? '' : String(v));+const installedOf = (p: Plug) => p.status !== 'missing';+const takesCredential = (p: Plug) => p.secrets_needed.length > 0;+const delegated = (p: Plug) => p.type === 'microsoft365' && String(p.config.mode || 'delegated') === 'delegated';+const accountsOf = (p: Plug) => (p.config.accounts || {}) as Record<string, { upn?: string; name?: string; signed_in_at?: string }>;+function fieldsOf(p: Plug): Field[] {+ const req = REQUIRED[p.type] || [];+ const one = (name: string, secret: boolean): Field => ({ name, secret, label: FIELD[name]?.label || name, hint: FIELD[name]?.hint, required: req.includes(name), kind: FIELD[name]?.kind || 'text' });+ return [...p.secrets_needed.map((n) => one(n, true)), ...p.config_fields.filter((n) => !HIDDEN_FIELDS.has(n)).map((n) => one(n, false))];+}export default function PluginsPage() {const router = useRouter();+ const params = useSearchParams();const [plugs, setPlugs] = useState<Plug[] | null>(null);const [counts, setCounts] = useState<Record<string, { attached: number; harnesses: number }>>({});+ const [tools, setTools] = useState<Record<string, PlugTool[]>>({});+ const [tab, setTab] = useState<'browse' | 'installed'>('browse');+ const [q, setQ] = useState('');const [err, setErr] = useState('');const [busy, setBusy] = useState('');- const [editing, setEditing] = useState<Plug | null>(null);+ const [detail, setDetail] = useState<Plug | null>(null);const [form, setForm] = useState<Record<string, string>>({});- const params = useSearchParams();+ const [formErr, setFormErr] = useState('');+ const [replacing, setReplacing] = useState(false);+ const [removing, setRemoving] = useState<Plug | null>(null);+ const [allow, setAllow] = useState('');+ const [deny, setDeny] = useState('');const reload = useCallback(async () => {try {const d = await listPlugs();setPlugs(d.plugs);const c: Record<string, { attached: number; harnesses: number }> = {};- for (const p of d.plugs) {- if (p.status === 'missing') continue;- try { const a = await plugAttachments(p.type); c[p.type] = { attached: a.attached, harnesses: a.harnesses }; } catch { /* the line stays off */ }- }+ await Promise.all(d.plugs.filter(installedOf).map(async (p) => {+ try { const a = await plugAttachments(p.type); c[p.type] = { attached: a.attached, harnesses: a.harnesses }; } catch { /* the column stays empty */ }+ }));setCounts(c);} catch (e) { setErr(e instanceof Error ? e.message : 'The plugins could not be read.'); }}, []);useEffect(() => { void reload(); }, [reload]);+// back from Microsoft's sign-in: the query carries the code and our state; the console finishes ituseEffect(() => {const code = params.get('code'); const state = params.get('state');@@ -68,11 +130,57 @@ export default function PluginsPage() {if (!code || !state) return;void (async () => {setBusy('microsoft365');- try { await microsoftComplete(code, state); await reload(); }+ try { await microsoftComplete(code, state); setTab('installed'); await reload(); }catch (e) { setErr(e instanceof Error ? e.message : 'The sign-in did not finish. Try again.'); }finally { setBusy(''); router.replace('/plugins'); }})();}, [params, reload, router]);++ const byType = useMemo(() => Object.fromEntries((plugs || []).map((p) => [p.type, p])), [plugs]);+ const installed = useMemo(() => (plugs || []).filter(installedOf), [plugs]);+ const shown = useMemo(() => {+ const needle = q.trim().toLowerCase();+ return (plugs || []).filter((p) => !needle || p.label.toLowerCase().includes(needle) || (BLURB[p.type] || '').toLowerCase().includes(needle));+ }, [plugs, q]);+ const sections = useMemo(() => {+ const out: { title: string; items: Plug[] }[] = [];+ for (const p of shown) {+ const title = CATEGORY[CATEGORY_OF[p.type] || 'other'];+ let s = out.find((x) => x.title === title);+ if (!s) { s = { title, items: [] }; out.push(s); }+ s.items.push(p);+ }+ return out;+ }, [shown]);++ const openDetail = (p: Plug, replace = false) => {+ setAllow(listOf(p.config.allow_domains)); setDeny(listOf(p.config.deny_domains));+ const f: Record<string, string> = {};+ for (const x of fieldsOf(p)) f[x.name] = x.secret ? '' : (x.name === 'mode' ? String(p.config.mode || 'delegated') : shownValue(p.config[x.name]));+ setForm(f); setFormErr('');+ // Needs auth means a new credential, except on a Microsoft 365 plug run as each person: there it means a sign-in+ setReplacing(replace || (installedOf(p) && p.status === 'needs_auth' && !delegated(p)));+ setDetail(p);+ if (!tools[p.type]) plugTools(p.type).then((t) => setTools((cur) => ({ ...cur, [p.type]: t.tools }))).catch(() => { /* the chips stay off */ });+ };+ const bodyOf = (p: Plug) => {+ const secrets: Record<string, string> = {}; const config: Record<string, unknown> = {};+ for (const x of fieldsOf(p)) {+ const v = (form[x.name] || '').trim();+ if (x.secret) { if (v) secrets[x.name] = v; }+ else config[x.name] = v;+ }+ return { secrets, config };+ };+ const connect = async (p: Plug) => {+ setBusy(p.type); setErr(''); setFormErr('');+ try {+ const { secrets, config } = bodyOf(p);+ await setPlug(p.type, { enabled: true, config, ...(Object.keys(secrets).length ? { secrets } : {}) });+ setDetail(null); setTab('installed'); await reload();+ } catch (e) { setFormErr(e instanceof Error ? e.message : 'The plugin was not connected. Try again.'); }+ finally { setBusy(''); }+ };const signIn = async () => {setBusy('microsoft365'); setErr('');try { const { auth_url } = await microsoftStart(`${window.location.origin}/plugins`); window.location.assign(auth_url); }@@ -80,123 +188,228 @@ export default function PluginsPage() {};const signOut = async () => {setBusy('microsoft365'); setErr('');- try { await microsoftSignout(); setEditing(null); await reload(); }+ try { await microsoftSignout(); setDetail(null); await reload(); }catch (e) { setErr(e instanceof Error ? e.message : 'The sign-out did not finish. Try again.'); }finally { setBusy(''); }};-- const open = (p: Plug) => {- const f: Record<string, string> = {};- for (const k of p.config_fields) f[k] = p.type === 'browser' ? listOf(p.config[k]) : String(p.config[k] ?? '');- for (const k of p.secrets_needed) f[k] = '';- setForm(f); setEditing(p);+ const toggle = async (p: Plug) => {+ if (p.status === 'needs_auth') { openDetail(p); return; } // a new credential, or a person's sign-in+ setBusy(p.type); setErr('');+ try { await setPlug(p.type, { enabled: p.status === 'disabled' }); await reload(); }+ catch (e) { setErr(e instanceof Error ? e.message : 'The status was not changed. Try again.'); }+ finally { setBusy(''); }};- const save = async (p: Plug, enabled: boolean, withForm: boolean) => {+ const remove = async (p: Plug) => {setBusy(p.type); setErr('');- try {- const body: { enabled: boolean; config?: Record<string, unknown>; secrets?: Record<string, string> } = { enabled };- if (withForm) {- body.config = Object.fromEntries(p.config_fields.map((k) => [k, p.type === 'browser' ? domainsOf(form[k] || '') : (form[k] || '')]));- const secrets = Object.fromEntries(p.secrets_needed.filter((k) => (form[k] || '').trim()).map((k) => [k, form[k].trim()]));- if (Object.keys(secrets).length) body.secrets = secrets;- }- await setPlug(p.type, body);- setEditing(null);- await reload();- } catch (e) { setErr(e instanceof Error ? e.message : 'The plugin was not saved. Try again.'); }+ try { await deletePlug(p.type); setRemoving(null); setDetail(null); await reload(); }+ catch (e) { setErr(e instanceof Error ? e.message : 'The plugin was not removed. Try again.'); }+ finally { setBusy(''); }+ };+ const saveSites = async (p: Plug) => {+ setBusy(p.type); setErr('');+ try { await setPlug(p.type, { enabled: p.status !== 'disabled', config: { allow_domains: domainsOf(allow), deny_domains: domainsOf(deny) } }); await reload(); setDetail(null); }+ catch (e) { setErr(e instanceof Error ? e.message : 'The sites were not saved. Try again.'); }+ finally { setBusy(''); }+ };+ const saveNames = async (p: Plug) => {+ setBusy(p.type); setErr(''); setFormErr('');+ try { await setPlug(p.type, { enabled: p.status !== 'disabled', config: bodyOf(p).config }); await reload(); setDetail(null); }+ catch (e) { setFormErr(e instanceof Error ? e.message : 'The change was not saved. Try again.'); }finally { setBusy(''); }};+ const ready = plugs !== null;+ const detailRow = detail && installedOf(detail) ? byType[detail.type] : undefined;+ const sitesChanged = Boolean(detailRow && detail?.type === 'browser'+ && (domainsOf(allow).join(',') !== listOf(detailRow.config.allow_domains).split(', ').filter(Boolean).join(',')+ || domainsOf(deny).join(',') !== listOf(detailRow.config.deny_domains).split(', ').filter(Boolean).join(',')));+ const namesChanged = Boolean(detail && detailRow && !replacing && takesCredential(detail)+ && fieldsOf(detail).filter((x) => !x.secret).some((x) => (form[x.name] || '').trim() !== (x.name === 'mode' ? String(detailRow.config.mode || 'delegated') : shownValue(detailRow.config[x.name]).trim())));+ const formComplete = (p: Plug, withSecrets: boolean) => fieldsOf(p).every((x) => !x.required || (x.secret && !withSecrets) || (form[x.name] || '').trim());++ const renderField = (x: Field) => (+ <div className="field pl-field" key={x.name}>+ <label htmlFor={`pl-f-${x.name}`}>{x.label}{x.required ? '' : ' (optional)'}</label>+ {x.kind === 'select' ? (+ <select id={`pl-f-${x.name}`} value={form[x.name] || 'delegated'} onChange={(e) => setForm({ ...form, [x.name]: e.target.value })}>+ <option value="delegated">Each person signs in with Microsoft (recommended)</option>+ <option value="application">The application itself (unattended)</option>+ </select>+ ) : (+ <input id={`pl-f-${x.name}`} type={x.secret ? 'password' : 'text'} autoComplete="off" spellCheck={false}+ value={form[x.name] || ''} onChange={(e) => setForm({ ...form, [x.name]: e.target.value })} />+ )}+ {x.hint && <span className="pl-hint">{x.hint}</span>}+ </div>+ );+return (- <section className="view is-active" id="view-plugins">- <div className="page">- <div className="page-header">+ <section className="view is-active pl" id="view-plugins">+ <div className="pl-head">+ <div className="pl-head-row"><div><h1>Plugins</h1>- <p>Connect a service once for this workspace. Each Harness then chooses which plugins it includes, under its settings.</p>+ <p>Connect a service once for the workspace. Any harness can then use it, and each harness decides which ones it needs.</p></div></div>+ <div className="pl-tabs" role="tablist">+ <button type="button" role="tab" className={'pl-tab' + (tab === 'browse' ? ' is-on' : '')} aria-selected={tab === 'browse'} onClick={() => setTab('browse')}>+ <span>Browse</span>{plugs && <span className="pl-count">{plugs.length}</span>}</button>+ <button type="button" role="tab" className={'pl-tab' + (tab === 'installed' ? ' is-on' : '')} aria-selected={tab === 'installed'} onClick={() => setTab('installed')}>+ <span>Installed</span>{plugs && <span className="pl-count">{installed.length}</span>}</button>+ </div>+ </div>+ <div className="pl-body">{err && <div className="notice"><iconify-icon icon="tabler:alert-triangle"></iconify-icon><div><strong>Something went wrong</strong>{err}</div></div>}- {!plugs ? <SkelRows rows={4} /> : (- <div className="capability-list">- {plugs.map((p) => {- const on = p.status === 'connected';- const c = counts[p.type];- const price = p.pricing ? `$${p.pricing.usd_per_unit.toFixed(2)} per ${p.pricing.unit}, billed at the service's own price` : 'No charge';- return (- <div key={p.type} className="capability-row">- <span className={'capability-icon' + (MARK[p.type]?.app ? ' is-app' : '')} aria-hidden="true">- {MARK[p.type]- // eslint-disable-next-line @next/next/no-img-element -- a static brand mark- ? <img src={MARK[p.type].src} alt="" />- : <iconify-icon icon="lucide:plug"></iconify-icon>}- </span>- <div className="capability-copy">- <strong>{p.label} {p.official && <span className="status neutral">Official</span>} <span className={'status ' + (on ? 'healthy' : p.status === 'needs_auth' ? 'warning' : 'neutral')}>{STATUS_LABEL[p.status]}</span></strong>- <span>{BLURB[p.type] || ''} {p.tools} tools · {price}{c ? ` · ${c.attached} of ${c.harnesses} Harnesses include it` : ''}</span>- {p.attention && <span className="field-help">{p.attention}</span>}- </div>- <div className="capability-actions">- {p.status === 'missing' && (p.secrets_needed.length === 0- ? <button className="button small" type="button" disabled={busy === p.type} onClick={() => void save(p, true, false)}>Turn on</button>- : <button className="button small" type="button" disabled={busy === p.type} onClick={() => open(p)}>Connect</button>)}- {p.status === 'needs_auth' && (delegated(p)- ? <button className="button small" type="button" disabled={busy === p.type} onClick={() => void signIn()}>{busy === p.type ? 'Opening Microsoft\u2026' : 'Sign in with Microsoft'}</button>- : <button className="button small" type="button" disabled={busy === p.type} onClick={() => open(p)}>Add credentials</button>)}- {p.status === 'disabled' && <button className="button small" type="button" disabled={busy === p.type} onClick={() => void save(p, true, false)}>Turn on</button>}- {p.status !== 'missing' && <button className="button quiet small" type="button" disabled={busy === p.type} onClick={() => open(p)}>Settings</button>}- {on && <button className="button quiet small" type="button" disabled={busy === p.type} onClick={() => void save(p, false, false)}>Turn off</button>}+ {!ready ? <SkelRows rows={4} /> : tab === 'installed' ? (+ <>+ <div className="pl-table">+ <div className="pl-table-head"><span>Plugin</span><span>Source</span><span>Harnesses</span><span className="pl-right">Status</span></div>+ {installed.length === 0 && <div className="pl-empty">Nothing installed yet. Browse the catalog and connect a plugin for this workspace.</div>}+ {installed.map((row) => {+ const c = counts[row.type]; const st = row.status;+ return (+ <div key={row.type} className="pl-row">+ <span className="pl-cell-name">+ <Tile type={row.type} name={row.label} />+ <span className="pl-copy"><span className="pl-name">{row.label}</span>+ <span className="pl-blurb">{st === 'needs_auth' && row.attention ? row.attention : (BLURB[row.type] || '')}</span></span>+ </span>+ <span className="pl-source">{SOURCE_LABEL[row.source] || row.source}</span>+ <span className="pl-mono">{c ? `${c.attached} of ${c.harnesses}` : ''}</span>+ <span className="pl-cell-status">+ <button type="button" className={'pl-pill is-' + st} disabled={busy === row.type} onClick={() => void toggle(row)}+ title={st === 'needs_auth' ? 'Connect your account again to restore access' : st === 'disabled' ? 'Turn back on' : 'Turn off without disconnecting'}>+ {STATUS_LABEL[st] || st}</button>+ <button type="button" className="pl-x" aria-label={`Remove ${row.label}`} disabled={busy === row.type} onClick={() => setRemoving(row)}>+ <iconify-icon icon="tabler:x"></iconify-icon></button>+ </span></div>+ );+ })}+ </div>+ <div className="pl-foot">A harness includes a plugin under its settings. <button type="button" className="pl-link" onClick={() => router.push('/harnesses')}>Open Agent Harnesses</button></div>+ </>+ ) : (+ <>+ <div className="pl-search"><iconify-icon icon="tabler:search"></iconify-icon>+ <input value={q} onChange={(e) => setQ(e.target.value)} placeholder="Search plugins" aria-label="Search plugins" /></div>+ {sections.map((sec) => (+ <div key={sec.title} className="pl-section">+ <div className="pl-section-title">{sec.title}</div>+ <div className="pl-hr" />+ <div className="pl-grid">+ {sec.items.map((p) => {+ const has = installedOf(p);+ return (+ <div key={p.type} className={'pl-card' + (has ? ' has' : '')} role="button" tabIndex={0} onClick={() => openDetail(p)} onKeyDown={(e) => { if (e.key === 'Enter') openDetail(p); }}>+ <Tile type={p.type} name={p.label} />+ <span className="pl-copy"><span className="pl-name">{p.label}</span><span className="pl-blurb">{BLURB[p.type] || ''}</span>+ <span className="pl-meta">Official{p.tools ? ` · ${p.tools} tools` : ''}{p.pricing && p.pricing.usd_per_unit > 0 ? ` · $${p.pricing.usd_per_unit.toFixed(2)} per ${p.pricing.unit}` : ''}</span></span>+ <span className="pl-plus" aria-hidden="true">{has ? '✓' : '+'}</span>+ </div>+ );+ })}</div>- );- })}- </div>+ </div>+ ))}+ {sections.length === 0 && <div className="pl-empty">No plugin matches that.</div>}+ </>)}- <p className="field-help" style={{ marginTop: 14 }}>- A Harness includes a plugin under its settings. <button className="hr-link-sm" type="button" onClick={() => router.push('/harnesses')}>Open Agent Harnesses</button>- </p></div>- {editing && (- <div className="modal-backdrop" onClick={() => busy || setEditing(null)}>- <section className="modal" role="dialog" aria-modal="true" aria-labelledby="plug-title" onClick={(e) => e.stopPropagation()}>- <div className="modal-header"><div><h2 id="plug-title">{editing.label}</h2><p>{BLURB[editing.type] || ''}</p></div>- <button className="icon-button modal-close" type="button" aria-label="Close dialog" onClick={() => setEditing(null)}><iconify-icon icon="tabler:x"></iconify-icon></button></div>- <div className="modal-body">- <div className="field-stack">- {editing.secrets_needed.map((k) => (- <div className="field" key={k}><label htmlFor={`plug-${k}`}>{FIELD_LABEL[k] || k}</label>- <input id={`plug-${k}`} type="password" autoComplete="off" value={form[k] || ''}- placeholder={editing.secrets_set.includes(k) ? '•••••••• (saved, leave blank to keep)' : ''}- onChange={(e) => setForm({ ...form, [k]: e.target.value })} /></div>- ))}- {editing.config_fields.map((k) => (- <div className="field" key={k}><label htmlFor={`plug-${k}`}>{FIELD_LABEL[k] || k}</label>- {k === 'mode' ? (- <select id={`plug-${k}`} value={form[k] || 'delegated'} onChange={(e) => setForm({ ...form, [k]: e.target.value })}>- <option value="delegated">Each person signs in with Microsoft (recommended)</option>- <option value="application">The application itself (unattended)</option>- </select>- ) : (- <input id={`plug-${k}`} type="text" value={form[k] || ''}- placeholder={editing.type === 'browser' ? (k === 'allow_domains' ? 'example.com, docs.example.org (empty means any public site)' : 'ads.example.com') : (PLACEHOLDER[k] || '')}- onChange={(e) => setForm({ ...form, [k]: e.target.value })} />- )}</div>- ))}- {delegated(editing) && editing.status !== 'missing' && (() => {- const accounts = Object.values(accountsOf(editing));- return accounts.length- ? <span className="field-help">Signed in as <strong>{accounts.map((a) => a.upn || a.name).join(', ')}</strong>. Agents working for a signed-in person read what that person may read.- {' '}<button className="hr-link-sm" type="button" disabled={Boolean(busy)} onClick={() => void signOut()}>Sign out</button></span>- : <span className="field-help">{editing.attention || 'Sign in with Microsoft so the agent can act as you.'}- {' '}<button className="hr-link-sm" type="button" disabled={Boolean(busy)} onClick={() => void signIn()}>Sign in with Microsoft</button></span>;+ {detail && (+ <div className="modal-backdrop" onClick={() => busy || setDetail(null)}>+ <section className="modal pl-sheet" role="dialog" aria-modal="true" aria-labelledby="pl-detail-title" onClick={(e) => e.stopPropagation()}>+ <div className="pl-sheet-head">+ <Tile type={detail.type} name={detail.label} large />+ <span className="pl-copy"><span id="pl-detail-title" className="pl-sheet-name">{detail.label}</span>+ <span className="pl-sheet-meta">{CATEGORY[CATEGORY_OF[detail.type] || 'other'] + ' · Official'}</span></span>+ {detailRow+ ? <span className={'pl-btn is-installed' + (detailRow.status === 'needs_auth' ? ' is-attention' : '')}>{detailRow.status === 'needs_auth' ? 'Needs auth' : 'Installed'}</span>+ : !takesCredential(detail) && <button type="button" className="pl-btn" disabled={Boolean(busy)} onClick={() => void connect(detail)}>{busy === detail.type ? 'Connecting…' : 'Connect'}</button>}+ <button type="button" className="pl-x pl-x-lg" aria-label="Close" onClick={() => setDetail(null)}><iconify-icon icon="tabler:x"></iconify-icon></button>+ </div>+ <div className="pl-sheet-body">+ <div className="pl-about">{ABOUT[detail.type] || BLURB[detail.type] || ''}</div>+ {(tools[detail.type] || []).length > 0 && (<>+ <div className="pl-label">Tools</div>+ <div className="pl-chips">{tools[detail.type].map((x) => <span key={x.name} className="pl-chip" title={x.description}>{x.name}</span>)}</div>+ </>)}+ {detail.pricing && detail.pricing.usd_per_unit > 0 && (+ <div className="pl-note">{`$${detail.pricing.usd_per_unit.toFixed(2)} per ${detail.pricing.unit}, the service's own price with no markup, rounded ${detail.pricing.rounding || 'up to the minute'}.`}+ {detail.pricing.session_cap_minutes ? ` Up to ${detail.pricing.session_cap_minutes} minutes per task, at most $${(detail.pricing.session_estimate_usd || 0).toFixed(4)} a task, counted against the task's cost limit.` : ''}</div>+ )}++ {takesCredential(detail) && !detailRow && (<>+ <div className="pl-label">Connect your account</div>+ <div className="pl-form">{fieldsOf(detail).map(renderField)}</div>+ <div className="pl-hint pl-hint-form">The credential is tried against {detail.label} before it is kept. It is stored securely, never shown again, and never handed to an agent.</div>+ {formErr && <div className="pl-form-err">{formErr}</div>}+ <div className="pl-actions"><button type="button" className="pl-btn" disabled={Boolean(busy) || !formComplete(detail, true)} onClick={() => void connect(detail)}>{busy === detail.type ? 'Connecting…' : 'Connect'}</button></div>+ </>)}++ {takesCredential(detail) && detailRow && (<>+ <div className="pl-label">Your account</div>+ {detailRow.status === 'needs_auth' && !(detail.type === 'microsoft365' && replacing === false) && <div className="pl-note">{detailRow.attention || 'Connect your account again to restore access.'}</div>}+ {detail.type === 'microsoft365' && !replacing && delegated(detailRow) && (() => {+ const accounts = Object.values(accountsOf(detailRow));+ return (+ <div className="pl-signin">+ {accounts.length+ ? <div className="pl-signin-row"><span>Signed in as <strong>{accounts.map((a) => a.upn || a.name).join(', ')}</strong>. Agents working for a signed-in person read what that person may read.</span>+ <button type="button" className="pl-link" disabled={Boolean(busy)} onClick={() => void signOut()}>Sign out</button></div>+ : <div className="pl-signin-row"><span>{detailRow.attention || 'Sign in with Microsoft so the agent can act as you.'}</span>+ <button type="button" className="pl-btn" disabled={Boolean(busy)} onClick={() => void signIn()}>{busy === 'microsoft365' ? 'Opening Microsoft…' : 'Sign in with Microsoft'}</button></div>}+ </div>+ );})()}- {editing.secrets_needed.length > 0 && <span className="field-help">This plugin runs on the credential you enter here, kept in this instance and never shown again. Every call an agent makes lands in the account that credential belongs to.</span>}- {editing.pricing && <span className="field-help">{`Up to ${editing.pricing.session_cap_minutes} minutes of browsing per task, at most $${editing.pricing.session_estimate_usd.toFixed(4)} a task. Private and local addresses are never reachable.`}</span>}- </div>+ {!replacing && (<>+ <dl className="pl-facts">+ {(SHOWN[detail.type] || []).filter(([k]) => shownValue(detailRow.config[k])).map(([k, label]) => (+ <div key={k}><dt>{label}</dt><dd>{shownValue(detailRow.config[k])}</dd></div>+ ))}+ </dl>+ <div className="pl-form">{fieldsOf(detail).filter((x) => !x.secret).map(renderField)}</div>+ {formErr && <div className="pl-form-err">{formErr}</div>}+ <div className="pl-actions pl-actions-split">+ <button type="button" className="pl-link" disabled={Boolean(busy)} onClick={() => { setReplacing(true); setFormErr(''); }}>Use a different credential</button>+ {namesChanged && <button type="button" className="pl-btn" disabled={Boolean(busy) || !formComplete(detail, false)} onClick={() => void saveNames(detailRow)}>{busy ? 'Saving…' : 'Save'}</button>}+ </div>+ </>)}+ {replacing && (<>+ <div className="pl-form">{fieldsOf(detail).map(renderField)}</div>+ <div className="pl-hint pl-hint-form">The new credential is tried against {detail.label} before it replaces the stored one. It is stored securely, never shown again, and never handed to an agent.</div>+ {formErr && <div className="pl-form-err">{formErr}</div>}+ <div className="pl-actions pl-actions-split">+ {detailRow.status !== 'needs_auth' && <button type="button" className="pl-link" disabled={Boolean(busy)} onClick={() => { setReplacing(false); setFormErr(''); }}>Keep the current one</button>}+ <button type="button" className="pl-btn" disabled={Boolean(busy) || !formComplete(detail, true)} onClick={() => void connect(detail)}>{busy === detail.type ? 'Connecting…' : 'Connect'}</button>+ </div>+ </>)}+ </>)}++ {detailRow && detail.type === 'browser' && (<>+ <div className="pl-label">Sites</div>+ <div className="field pl-field"><label htmlFor="pl-allow">Only these sites</label>+ <input id="pl-allow" value={allow} onChange={(e) => setAllow(e.target.value)} placeholder="example.com, docs.example.org (empty means any public site)" /></div>+ <div className="field pl-field"><label htmlFor="pl-deny">Never these sites</label>+ <input id="pl-deny" value={deny} onChange={(e) => setDeny(e.target.value)} placeholder="ads.example.com" /></div>+ {sitesChanged && <div className="pl-actions"><button type="button" className="pl-btn" disabled={Boolean(busy)} onClick={() => void saveSites(detailRow)}>{busy ? 'Saving…' : 'Save sites'}</button></div>}+ </>)}+ </div>+ </section>+ </div>+ )}++ {removing && (+ <div className="modal-backdrop" onClick={() => busy || setRemoving(null)}>+ <section className="modal" role="dialog" aria-modal="true" aria-labelledby="pl-remove-title" onClick={(e) => e.stopPropagation()}>+ <div className="modal-header"><div><h2 id="pl-remove-title">Remove {removing.label}?</h2>+ <p>The workspace disconnects it and the stored credential is deleted; every harness that includes it loses its tools on the next task. Nothing at {removing.label} changes. You can connect it again any time.</p></div></div>+ <div className="modal-body"><div className="modal-actions">- <button className="button" type="button" onClick={() => setEditing(null)} disabled={Boolean(busy)}>Cancel</button>- <button className="button primary" type="button" disabled={Boolean(busy)} onClick={() => void save(editing, true, true)}>{busy ? 'Saving…' : editing.status === 'missing' ? 'Connect' : 'Save'}</button>+ <button className="button" type="button" onClick={() => setRemoving(null)} disabled={Boolean(busy)}>Cancel</button>+ <button className="button danger" type="button" disabled={Boolean(busy)} onClick={() => void remove(removing)}>{busy ? 'Removing…' : 'Remove'}</button></div></div></section>diff --git a/ui/src/app/v2.css b/ui/src/app/v2.cssindex 85e705e1..b92819c5 100644--- a/ui/src/app/v2.css+++ b/ui/src/app/v2.css@@ -1014,3 +1014,116 @@ button.v2-social:hover { background: var(--v2-row); }.hx-task-row:hover .hx-task-x, .hx-task-x:focus-visible, .hx-task-row.is-on .hx-task-x { opacity: 1; }.hx-task-x:hover { background: var(--v2-row, #f3f2f0); color: var(--v2-orange, #b4460f); }.hx-task-x iconify-icon { font-size: 14px; }+++/* ── Plugins, per the console design: header with tabs, the Installed table, the Browse catalog by+ category, the detail sheet. Sizes and colours are the design's. ───────────────────────────── */+.pl { display: flex; flex-direction: column; height: 100vh; min-width: 0; overflow: hidden; }+.pl-head { padding: 30px 36px 0; background: var(--v2-bg, #fff); border-bottom: 1px solid var(--v2-line, #e7e5e4); flex: none; }+.pl-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }+.pl-head h1 { margin: 0 0 7px; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }+.pl-head p { margin: 0; font-size: 14px; color: var(--v2-muted, #6b6560); max-width: 660px; }+.pl-tabs { display: flex; gap: 22px; margin-top: 22px; }+.pl-tab { display: flex; align-items: center; gap: 7px; padding: 0 0 13px; background: transparent; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--v2-muted, #6b6560); cursor: pointer; }+.pl-tab.is-on { color: var(--v2-ink, #1c1917); border-bottom-color: var(--v2-accent, #1a5cf5); }+.pl-count { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px; color: #c4beba; }+.pl-tab.is-on .pl-count { color: var(--v2-accent, #1a5cf5); }+.pl-body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 36px 32px; }+.pl-table { border: 1px solid var(--v2-line, #e7e5e4); border-radius: 10px; background: var(--v2-bg, #fff); overflow: hidden; }+.pl-table-head, .pl-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 92px 140px; gap: 14px; align-items: center; }+.pl-table-head { padding: 10px 20px; background: #fafaf9; border-bottom: 1px solid var(--v2-line, #e7e5e4); font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: #a8a29e; }+.pl-row { padding: 12px 20px; border-bottom: 1px solid #f4f2f0; }+.pl-row:last-child { border-bottom: none; }+.pl-right { text-align: right; }+.pl-cell-name { display: flex; align-items: center; gap: 12px; min-width: 0; }+.pl-tile { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; background: #f5f5f4; color: var(--v2-muted, #6b6560); font-size: 12.5px; font-weight: 700; }+.pl-copy { min-width: 0; display: block; }+.pl-name { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.pl-blurb { display: block; font-size: 12.5px; color: var(--v2-muted, #6b6560); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.pl-meta { display: block; font-size: 11.5px; color: #a8a29e; margin-top: 4px; }+.pl-source { font-size: 13px; color: var(--v2-muted, #6b6560); }+.pl-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; color: var(--v2-muted, #6b6560); }+.pl-cell-status { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }+.pl-pill { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 9.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; padding: 4px 9px; border: none; border-radius: 999px; white-space: nowrap; cursor: pointer; }+.pl-pill.is-connected { color: #15803d; background: #eaf5ee; }+.pl-pill.is-needs_auth { color: #b4460f; background: #fdf9f4; }+.pl-pill.is-disabled { color: #a8a29e; background: #f5f5f4; }+.pl-x { display: grid; place-items: center; width: 22px; height: 22px; flex: none; padding: 0; background: transparent; border: none; border-radius: 6px; cursor: pointer; color: #a8a29e; font-size: 14px; }+.pl-x:hover { background: #f5f5f4; color: var(--v2-ink, #1c1917); }+.pl-x-lg { width: 28px; height: 28px; border-radius: 8px; font-size: 16px; }+.pl-empty { padding: 26px 20px; font-size: 13.5px; color: var(--v2-muted, #6b6560); }+.pl-foot { font-size: 12.5px; color: #a8a29e; margin-top: 16px; }+.pl-link { background: none; border: none; padding: 0; font: inherit; color: var(--v2-accent, #1a5cf5); cursor: pointer; }+.pl-search { display: flex; align-items: center; gap: 9px; padding: 9px 12px; background: var(--v2-bg, #fff); border: 1px solid #e0dcd9; border-radius: 8px; color: #a8a29e; }+.pl-search input { flex: 1; min-width: 0; padding: 0; font: inherit; font-size: 13.5px; background: transparent; border: none; outline: none; color: var(--v2-ink, #1c1917); }+.pl-section { margin-top: 30px; }+.pl-section:first-of-type { margin-top: 22px; }+.pl-section-title { font-size: 18px; font-weight: 700; }+.pl-hr { height: 1px; background: var(--v2-line, #e7e5e4); margin: 12px 0 6px; }+.pl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 26px; }+.pl-card { display: flex; align-items: center; gap: 13px; padding: 11px 12px; margin: 0 -12px; border-radius: 10px; cursor: pointer; transition: background 110ms; min-width: 0; }+.pl-card:hover { background: #fafaf9; }+.pl-card .pl-tile { width: 34px; height: 34px; font-size: 13px; }+.pl-tile img { display: block; width: 16px; height: 16px; }+.pl-card .pl-tile img { width: 18px; height: 18px; }+.pl-tile-lg img { width: 22px; height: 22px; }+.pl-tile.is-app { background: none; overflow: hidden; }+.pl-tile.is-app img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }+.pl-card .pl-copy { flex: 1; }+.pl-plus { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; font-size: 16px; font-weight: 500; color: #57534e; }+.pl-card.has .pl-plus { color: #15803d; }+.pl-sheet { width: 560px; max-width: 100%; padding: 0; }+.pl-sheet-head { display: flex; align-items: center; gap: 14px; padding: 24px 26px 20px; border-bottom: 1px solid var(--v2-line, #e7e5e4); }+.pl-tile-lg { width: 42px; height: 42px; border-radius: 10px; color: #57534e; font-size: 16px; }+.pl-sheet-name { display: block; font-size: 18px; font-weight: 700; }+.pl-sheet-meta { display: block; font-size: 13px; color: var(--v2-muted, #6b6560); margin-top: 3px; }+.pl-sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 26px 26px; }+.pl-about { font-size: 13.5px; line-height: 1.65; color: #57534e; }+.pl-label { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: #a8a29e; margin: 24px 0 10px; }+.pl-chips { display: flex; flex-wrap: wrap; gap: 6px; }+.pl-chip { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; color: #57534e; padding: 4px 9px; border-radius: 999px; background: #f5f5f4; }+.pl-note { border: 1px solid #f0e2d4; border-radius: 10px; background: #fdf9f4; padding: 13px 15px; margin-top: 20px; font-size: 12.5px; line-height: 1.6; color: #6b5a48; }+.pl-btn { flex: none; font: inherit; font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; background: var(--v2-accent, #1a5cf5); color: #fff; }+.pl-btn.is-installed { cursor: default; border-color: #cfe4d6; background: #eaf5ee; color: #15803d; }+.pl-actions { display: flex; justify-content: flex-end; margin-top: 12px; }+.pl-actions-split { justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; }+/* the connect form: the plugin's own fields, from the server (a credential, the names beside it) */+.pl-form { display: flex; flex-direction: column; gap: 14px; }+.pl-field { display: flex; flex-direction: column; gap: 5px; }+.pl-field label { font-size: 13px; font-weight: 600; color: #1c1917; }+.pl-field input { width: 100%; box-sizing: border-box; padding: 9px 12px; font: inherit; font-size: 13.5px; color: #1c1917; background: #fff; border: 1px solid #e0dcd9; border-radius: 8px; outline: none; transition: border-color .12s, box-shadow .12s; }+.pl-field input::placeholder { color: #b8b2ad; }+.pl-field input:focus { border-color: var(--v2-accent, #1a5cf5); box-shadow: 0 0 0 3px rgba(26, 92, 245, .12); }+.pl-hint { display: block; font-size: 12.5px; line-height: 1.5; color: #6b6560; }+.pl-hint-form { margin-top: 14px; }+.pl-form-err { margin-top: 14px; border: 1px solid #f0e2d4; border-radius: 10px; background: #fdf9f4; padding: 11px 13px; font-size: 12.5px; line-height: 1.55; color: #b4460f; }+.pl-alt { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }+.pl-btn-quiet { background: #fff; color: #1c1917; border-color: #e0dcd9; }+.pl-btn-quiet:hover { background: #f4f2f0; }+.pl-btn.is-attention { border-color: #f0e2d4; background: #fdf9f4; color: #b4460f; }+.pl-signin { display: flex; flex-direction: column; gap: 10px; margin: 0 0 16px; padding: 14px 16px; border: 1px solid #e7e5e4; border-radius: 10px; background: #fafaf9; }+.pl-signin-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 13.5px; line-height: 1.5; color: #57534e; }+.pl-signin-row strong { color: #1c1917; }+@media (max-width: 720px) { .pl-signin-row { flex-direction: column; align-items: flex-start; } }+.pl-facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 16px; }+.pl-facts div { display: contents; }+.pl-facts dt { font-size: 12.5px; color: #6b6560; }+.pl-facts dd { margin: 0; font-size: 13.5px; color: #1c1917; overflow-wrap: anywhere; }+@media (max-width: 720px) { .pl-facts { grid-template-columns: 1fr; gap: 4px; } .pl-alt { flex-direction: column; align-items: flex-start; } .pl-actions-split { flex-wrap: wrap; } }+.pl-consent { width: 480px; max-width: 100%; padding: 0; }+.pl .field { margin-top: 10px; }+@media (max-width: 1024px) {+ .pl-head { padding: 24px 24px 0; }+ .pl-body { padding: 20px 24px 28px; }+ .pl-grid { grid-template-columns: minmax(0, 1fr); }+}+@media (max-width: 768px) {+ .pl { height: calc(100vh - var(--v2-mobilebar-h)); }+ .pl-head { padding: 20px 16px 0; }+ .pl-body { padding: 16px 16px 24px; }+ .pl-head h1 { font-size: 24px; }+ .pl-table-head, .pl-row { grid-template-columns: minmax(0, 1fr) 120px; gap: 10px; }+ .pl-table-head span:nth-child(2), .pl-table-head span:nth-child(3), .pl-row > .pl-source, .pl-row > .pl-mono { display: none; }+ .pl-row { padding: 12px 14px; }+ .pl-card { margin: 0; padding: 11px 6px; }+}diff --git a/ui/src/lib/harness.ts b/ui/src/lib/harness.tsindex e1125c6b..b99deb99 100644--- a/ui/src/lib/harness.ts+++ b/ui/src/lib/harness.ts@@ -587,6 +587,15 @@ export function microsoftComplete(code: string, state: string): Promise<Plug> {export function microsoftSignout(): Promise<Plug> {return gw<Plug>('POST', '/v1/plugs/microsoft365/microsoft/signout', {});}+export interface PlugTool { name: string; description: string; risk: string }+/** The tools a plugin serves, the same list the agent gets. */+export function plugTools(type: string): Promise<{ type: string; label: string; tools: PlugTool[] }> {+ return gw<{ type: string; label: string; tools: PlugTool[] }>('GET', `/v1/plugs/${encodeURIComponent(type)}/tools`);+}+/** Remove a plugin from the workspace: the record and the credential it kept are deleted. */+export function deletePlug(type: string): Promise<{ type: string; workspace: string; removed: boolean }> {+ return gw<{ type: string; workspace: string; removed: boolean }>('DELETE', `/v1/plugs/${encodeURIComponent(type)}`);+}export function plugAttachments(type: string): Promise<{ harnesses: number; attached: number; harness_list: { id: string; name: string }[] }> {return gw<{ harnesses: number; attached: number; harness_list: { id: string; name: string }[] }>('GET', `/v1/plugs/${encodeURIComponent(type)}/attachments`);}