Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

fix(ui): define frontend contract and accessible action icons

Abdurrahman Fakhrulfc2750b06297
diff --git a/AGENTS.md b/AGENTS.md
index 89d5dc83..33dc1816 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -32,6 +32,14 @@ For debugging, integrations, refactors, deployments, and MCP work, use this loop
`CLAUDE.md`, or a trusted `SKILL.md`; implementation contracts belong in current docs;
volatile host facts stay in project/runbook notes.
+## Frontend ownership
+
+Before any UI, UX, state or responsive change, read
+[`docs/FRONTEND-CONTRACT.md`](./docs/FRONTEND-CONTRACT.md), `DESIGN.md` and the affected
+shell/feature contracts. This applies to every feature and native DOM UI in `lib/`, not only
+Integrations. Whole-product work must record per-feature evidence and unverified/configuration
+limits; a shared foundation change alone is not proof of every consumer journey.
+
## Architecture ownership
Before adding another adapter/facade/barrel, read [`docs/ARCHITECTURE.md`](./docs/ARCHITECTURE.md) and run `node scripts/check-architecture.mjs`. The architecture policy is ratcheted: transports share `lib/capabilities`, cross-layer DTOs live in `lib/contracts`, host calls use narrow `lib/host/*-api.ts`, generic apps use AppShell directly, and workflow persistence belongs to `lib/workflow`. Do not raise a ratchet just to make a change pass. Exact MCP catalog facts are generated with `node scripts/gen-mcp-catalog.mjs`; never hand-copy the current tool list into reference docs.
diff --git a/CLAUDE.md b/CLAUDE.md
index 2b840a36..93d9a721 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -33,6 +33,9 @@ agent — it runs AS a host process and controls its own machine.
reference docs (including `docs/ARCHITECTURE.md`) must track `main`; dated audits/plans
are explicitly historical and may preserve obsolete implementation details only inside
that historical context.
+- [`docs/FRONTEND-CONTRACT.md`](./docs/FRONTEND-CONTRACT.md) — required for every frontend,
+ state and responsive change, including native DOM surfaces; shell → feature → UI-kit ownership,
+ action semantics, accessibility, state lifetimes and per-feature evidence.
- `frontend/slices/assistant/CONTRACT.md` — current, and authoritative for what an
Agent / Tool / Skill / Playbook is and what reaches the model.
- `docs/MCP-FEATURE-IMPLEMENTATION.md` — stepwise observe/map/bound/reverse-engineer/
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index aa6d37c2..67881cdf 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -14,6 +14,7 @@ this is the *what*, and it is what Settings → Account → About shows as “Wh
**Fixed**
+- `ui` define frontend contract and accessible action icons
- `ui` preserve workspace state and share dynamic shell layout
- `ci` stop the CodeQL analysis job from gating on open alerts
- `export` create the markdown export atomically, closing a TOCTOU write
diff --git a/docs/FRONTEND-CONTRACT.md b/docs/FRONTEND-CONTRACT.md
new file mode 100644
index 00000000..a7609842
--- /dev/null
+++ b/docs/FRONTEND-CONTRACT.md
@@ -0,0 +1,158 @@
+# MSO frontend implementation contract
+
+> Current reference for every agent and contributor changing a visible MSO surface.
+> Applies to `frontend/`, `app/`, shared UI, and native HTML/CSS/JS surfaces in `lib/`.
+> This is a required implementation/review contract, not a claim that every existing
+> feature already meets every rule. Record adoption and evidence per changed feature.
+
+## Read before changing a feature
+
+1. Read root `AGENTS.md` and `CLAUDE.md` for source, host, permissions and release rules.
+2. Read [`DESIGN.md`](../DESIGN.md) for the established product direction and semantic tokens.
+3. Read this contract and [`UI-UX-FOUNDATION.md`](./UI-UX-FOUNDATION.md) for shared layout/state.
+4. Read [`Shell UI architecture`](../frontend/slices/appshell/design/README.md) and the
+ affected shell's local `design.md`; preserve all five shell identities.
+5. Read the feature's own contract and find a working sibling implementation.
+ [`SLICE-CATALOG.md`](./SLICE-CATALOG.md) is the feature inventory SSOT.
+6. Follow [`ARCHITECTURE.md`](./ARCHITECTURE.md); run its ratchet before adding a seam.
+
+For a whole-product request, inventory every registered feature before narrowing changes.
+Mark each item as fixed, verified unchanged, configuration-blocked, or not yet verified.
+A shared primitive improvement does not prove all consumer journeys were exercised.
+
+## Ownership: shell, feature, UI kit
+
+| Layer | Owns | Required seam |
+|---|---|---|
+| Shell | Platform chrome, work area, typography, native navigation, default metrics | `ShellManifest.layout`, active design profile and `LayoutBoundary` |
+| Feature | Content hierarchy, local override, loading/data/error states, feature actions | `AppFrame`, optional `layout` and `padded`, container-driven navigation |
+| UI kit | Control geometry, semantic colour, focus, disabled/busy states, dialogs | Existing shared components and inherited metrics |
+
+Do not fork API calls, validation, permission logic or durable state by operating system.
+Mobile shells own feature navigation: one shell header, centered title and the established
+back/AI actions. Do not add a second competing mobile feature header.
+Use `ResponsiveDialog`/`FormDrawer` for native shell presentation unless a documented feature
+need requires an override. Portals must inherit the active layout and theme boundary.
+Native DOM surfaces use their existing shared DOM components and the reviewed token bridge;
+do not import React frontend components into server infrastructure.
+
+## Layout, padding and responsiveness
+
+- Inherit `--feature-padding`, `--feature-gap`, `--feature-sidebar-width`,
+ `--ui-control-height` and `--ui-control-padding`. Put reusable defaults at the shell or
+ UI-kit layer, feature-specific exceptions on `AppFrame.layout`, not in every consumer.
+- Use semantic spacing/type/colour tokens. New literal values need a feature-specific reason;
+ do not add another global scale or scatter OS checks through feature components.
+- Opt into page spacing with `padded`; editors, terminal and canvases can remain edge-to-edge.
+- Adapt to the **feature container**, including a narrow desktop window. Viewport width alone
+ cannot decide whether a feature sidebar is inline or a drawer.
+- Constrain flex/grid children with `min-width:0` and `min-height:0` where necessary. Assign
+ one intentional scroll owner per region; avoid clipped controls and accidental nested scroll.
+- Long names, URLs, translated copy and real empty data must wrap or truncate with a way to
+ recover the full value. Essential actions cannot disappear offscreen.
+- Respect mobile safe areas, portrait/landscape, software keyboard, touch and larger text.
+ A canvas may scroll internally; the whole document must not acquire accidental overflow.
+- Fine-pointer dense desktop controls may follow shell metrics; touch targets must be at least
+ 44 CSS px. Do not shrink tap targets merely to preserve a desktop row on a phone.
+- Preserve intended window/widget geometry separately from constrained rendered geometry.
+ Resizing the viewport must not permanently overwrite the user's preferred position/size.
+
+## State and asynchronous work
+
+- Name the owner and lifetime of state: local interaction, exact window, URL, persisted user
+ preference, durable feature record or server response. Do not conflate these identities.
+- Use `useFeatureState(winId, key, initial)` when ephemeral state must survive shell remounts.
+ Forward the same window ID through desktop, Dashboard, iOS and Android. Closing the window
+ clears that state; browser reload does not imply unsaved drafts are durable.
+- Use the existing feature store/API for durable data. Never persist secrets in localStorage,
+ duplicate a second store, or store sensitive data merely to preserve a visual state.
+- Drafts need explicit save/discard behaviour and an unsaved-change guard at the relevant
+ close, route, record and reload boundaries. State from one window/owner cannot bleed into another.
+- Abort superseded requests and unmounted effects, or ignore results with a sequence/identity
+ guard. Changing selected owner/provider/project must not display a late result for the old one.
+- Prevent duplicate writes, show pending feedback, handle rejection and restore retry controls.
+ Optimistic updates need a defined rollback. A completed request must update the canonical state.
+- Distinguish initial loading, empty data, no filter matches, error, unavailable service and
+ permission denied. A timeout or iframe load event alone is not successful readiness.
+- URL/deep-link restoration must wait for asynchronous feature/connected-app registration.
+ Keep the existing History API routing contract; do not force full shell remounts for focus.
+- Persist through the repository's validated schema and flush lifecycle. Malformed cache,
+ storage failure and legacy state must degrade without breaking the feature.
+
+## Actions, menus, forms and copy
+
+- Every visible interactive control must perform its stated action. No placeholder buttons,
+ fabricated measurements, false success, invented security claims or demo data presented as live.
+- Use icons for familiar repeated utilities such as reveal, copy, delete and overflow. Give
+ icon-only controls a precise accessible name and tooltip. Decorative SVGs are hidden from AT.
+- Keep text for primary/unfamiliar actions and for dropdown items; leading icons aid scanning.
+ Dropdown triggers expose open/closed state. Preserve keyboard opening, Escape, outside close
+ and focus return. Do not claim ARIA menu semantics without implementing its keyboard model.
+- Reveal/copy secrets only after a human action. Keep Copy masked, provide feedback and discard
+ temporary values on hide, timeout or failure. Never put secret values in labels, logs or URLs.
+- Destructive actions keep the established confirmation, exact target and permission check.
+ Cancel restores focus to that target or the closed trigger, not an arbitrary matching icon.
+- Forms have associated labels, field-specific errors, useful validation and predictable submit
+ behaviour. Explain disabled/unavailable actions when the reason is not obvious.
+- Use plain, task-specific copy. No user-visible em dash. Empty and failure states offer a real
+ recovery action where the feature can provide one.
+- UI filtering is not authorization. Preserve server role checks and fail-closed permissions.
+ Do not weaken iframe, origin, filesystem or service policy to make a preview appear successful.
+
+## Accessibility, theme and motion
+
+- Both shipped themes use semantic colours and WCAG AA text contrast. Run the contrast gate;
+ also inspect the rendered composition, since token checks alone cannot prove every overlap.
+- Support keyboard-only navigation, visible focus, meaningful headings/landmarks and labels.
+ Dialog/drawer focus is contained while open; background regions are inert where appropriate.
+- Use the correct native element before adding ARIA. Announce asynchronous status without
+ repeatedly stealing focus. Status must not depend only on colour or an unlabeled icon.
+- Respect reduced motion, touch input and larger text. Avoid motion that changes the effective
+ layout measurement or prevents access to a control during an animation.
+- Loading/skeleton states preserve meaningful hierarchy without masquerading as real data.
+
+## Feature-specific acceptance
+
+The same contract applies to every family below; use the catalog for exact feature ownership.
+
+| Feature family | Additional journey to verify |
+|---|---|
+| Files, terminal, code and host tools | Selection/path/session identity, resize, scroll, keyboard, permission failure and real error recovery |
+| Assistant, channels, agents, managed runtimes | Conversation/turn identity, stream cancellation, activity state, reconnect and unavailable runtime |
+| Workflows, Organization, Memory and canvas/media editors | Draft/save/discard, selection, canvas bounds, filters, undo where supported and reload boundaries |
+| Settings, Integrations and infrastructure | Owner/project scope, input validation, pending/error state, secrets, confirmation and long menus |
+| Browser, n8n and external/connected apps | Ready handshake, denied embedding, failed route, reload, external-open fallback and origin isolation |
+| Store, Create, Quicklinks, Docs and pickers | Empty/search/no-match, valid navigation, real action completion and focus return |
+| Shell, authentication and lock surfaces | Five-shell transitions, deep links, locked privacy, safe areas, portals and restored/minimized windows |
+
+## Verification and definition of done
+
+1. Reproduce the original problem; preserve the first error or screenshot and identify the real
+ repository/runtime. Choose the smallest authoritative reversible fix.
+2. Add behaviour tests for state or interaction regressions. Do not add tests that only mirror
+ cosmetic markup. Wire important journeys into existing mandatory gates.
+3. Inspect the actual frontend using synthetic fixtures for sensitive writes. Follow the operator's
+ chosen design/browser tools. When pen.dev MCP and Browser are requested, use those surfaces;
+ do not take over the native desktop. Keep source edits in the authorized checkout.
+4. For changed shared layout/state, inspect all five shells and both themes. For local feature
+ changes, inspect the affected shell contexts plus representative desktop, narrow window and
+ mobile sizes. Record exact sizes, larger-text checks and keyboard behaviour. Continuous CSS
+ support is the goal; finite samples are not proof of every possible resolution or real device.
+5. Check loading, empty, no-match, error, permission, pending and success states that apply.
+ Include a route/reload or shell-remount round trip when the changed state promises to survive it.
+6. Run targeted tests, architecture/docs/contrast gates and the repository-required full local,
+ security and remote checks on the exact committed SHA. A build pass alone is insufficient.
+7. In the PR/final report include: feature and owner, before/after, affected layers, state lifetime,
+ shell/theme/viewport evidence, test results, untested paths, external configuration limits and
+ deployed SHA if released. Mark blocked or unverified items honestly; do not call them fixed.
+8. Ship through the canonical main/release path in root instructions. Preserve rollback and
+ verify runtime health plus the actual user journey before claiming a deployed fix.
+
+### Evidence row for each feature in a whole-product audit
+
+| Feature / catalog entry | Observed problem | Shared/local change | Shell/theme/size journey | Result and limit |
+|---|---|---|---|---|
+| Exact feature name | Concrete error/screenshot | Owning layer and file | Named interactions and sample dimensions | Fixed / verified unchanged / configuration-blocked / not verified |
+
+A rule exception must identify the rule, concrete reason, affected consumers and proof. If it
+conflicts with a task or root policy, name the conflict and ask; do not silently change the rule.
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index d98ba940..a372de75 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,33 @@
+## 2026-11-03: frontend contract for every feature and agent
+
+Frontend rules were spread across product direction, shell design notes and the dynamic
+foundation contract. `docs/FRONTEND-CONTRACT.md` now gives every feature one implementation
+and acceptance contract: layer ownership, token/container layout, state lifetimes, asynchronous
+recovery, icon/menu semantics, accessibility, themes and per-feature verification evidence.
+
+Both root agent entry points and a scoped `frontend/AGENTS.md` require it. The docs gate checks
+those links, including the shell/foundation references, so a later edit cannot silently detach
+agent routing. This documents required practice and explicit migration limits; it does not
+claim every existing feature has already been individually polished or exercised in production.
+
+## 2026-11-03: compact credential actions and connection menus
+
+Credential rows use labelled eye, copy and trash icon buttons with native tooltips. The
+connection action trigger uses an ellipsis; menu items retain text with leading icons.
+Owner pickers show a chevron and selected check without changing keyboard behaviour.
+The masked value reserves eight character widths so 200% text reflows controls instead of
+collapsing the value into a vertical column.
+
+Copying keeps the displayed value masked. Reveal after Copy now opens the cached value
+instead of silently clearing it. Hide, the 30-second timeout and clipboard failures discard
+the cache. Pending reads disable both read actions. Destructive actions still require typed
+confirmation; cancellation restores the exact field action or the closed menu trigger.
+
+The same native DOM helpers serve browser and embedded integrations. Targeted synthetic
+browser journeys, now required by the isolated build gate, cover these state transitions,
+deletion guards and keyboard focus, alongside
+the existing 320–1920 px light/dark layout checks. Release evidence is tracked by the PR.
+
## 2026-11-03: dynamic shell presentation and workspace recovery (local verification)
The shell manifest now accepts per-shell layout metrics. Feature frames can override those
diff --git a/docs/README.md b/docs/README.md
index 8a7912ca..a911ecaa 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -86,6 +86,7 @@ evidence and review freshness. The repository quality gate runs both automatical
| [`ORCA-INTEGRATION.md`](./ORCA-INTEGRATION.md) | Orca web bridge readiness/identity contract, private state root and shared-runtime operator limits |
| [`MODELS-INTEGRATION.md`](./MODELS-INTEGRATION.md) | Alfa BYOK/custom/Codex provider model |
| [`SLICE-CATALOG.md`](./SLICE-CATALOG.md) | Current slice/AppShell feature inventory |
+| [`FRONTEND-CONTRACT.md`](./FRONTEND-CONTRACT.md) | Required UI/UX implementation rules for every feature, state lifetime, responsive layout, actions, accessibility and evidence |
| [`UI-UX-FOUNDATION.md`](./UI-UX-FOUNDATION.md) | Dynamic shell, feature and UI-kit spacing, workspace geometry and per-window feature state |
| [`TROUBLESHOOTING.md`](./TROUBLESHOOTING.md) | Symptom → cause → supported recovery |
| [`FAQ.md`](./FAQ.md) | Product/security/operator boundaries |
diff --git a/docs/UI-UX-FOUNDATION.md b/docs/UI-UX-FOUNDATION.md
index e09a19bb..47ee6c6d 100644
--- a/docs/UI-UX-FOUNDATION.md
+++ b/docs/UI-UX-FOUNDATION.md
@@ -1,5 +1,8 @@
# Dynamic MSO interface contract
+Required contributor rules for every feature live in [FRONTEND-CONTRACT.md](./FRONTEND-CONTRACT.md).
+This document describes the implementation seams; it does not claim every feature is migrated.
+
This is a refinement of the existing five shell identities in DESIGN.md. Shell chrome remains
platform specific; feature behaviour and state are shared. No new adapter or backend provider
has been added. Public MCP tools and authorization remain unchanged.
@@ -68,7 +71,7 @@ capture cancel dragging; pointer-up computes its final movement from the event c
- Integrations: solid sidebar background; one sidebar scroll; full owner picker header;
container-based initial inert state measured before visual transforms; resized panes reset navigation correctly; old observers
- disconnect on redraw; credential fields use four desktop columns; duplicate source badges
+ disconnect on redraw; credential fields use three desktop columns with grouped icon actions; duplicate source badges
collapse; Composio tools/session use progressive disclosure.
- Manager readiness: the iframe posts a ready event after mounting. Parent accepts the exact
event only from that iframe and the same origin. A non-empty iframe src is not success.
diff --git a/frontend/AGENTS.md b/frontend/AGENTS.md
new file mode 100644
index 00000000..06b83763
--- /dev/null
+++ b/frontend/AGENTS.md
@@ -0,0 +1,10 @@
+# Frontend agent instructions
+
+Root `AGENTS.md` and `CLAUDE.md` remain authoritative. Before editing any frontend surface,
+read [the frontend implementation contract](../docs/FRONTEND-CONTRACT.md),
+[DESIGN.md](../DESIGN.md) and the affected shell/feature contracts linked there.
+
+Apply the shared shell → feature → UI-kit ownership, state lifetime, responsiveness,
+accessibility and verification rules. Do not treat Integrations as the only consumer or claim
+all features are complete from one panel's evidence. Whole-product work requires a result
+and limit for every catalog feature. The same contract covers native DOM UI in `lib/`.
diff --git a/frontend/slices/appshell/design/README.md b/frontend/slices/appshell/design/README.md
index b0b13cc6..d9951c25 100644
--- a/frontend/slices/appshell/design/README.md
+++ b/frontend/slices/appshell/design/README.md
@@ -8,3 +8,5 @@ MSO has one behavior model and multiple presentation systems.
- Every shell has a local `design.md`. Code that changes a shell-specific visual rule should update/read that document first.
- Mobile feature navigation is shell-owned. Root contract: **`< Home` | centered feature title | AI**. Drill-down replaces `Home` with the parent label but does not add a second header.
- Dialogs/forms use `ResponsiveDialog`/`FormDrawer`; the active `ShellDesignProfile` chooses the native mobile presentation unless a feature explicitly overrides it.
+
+All feature work follows the [frontend implementation contract](../../../../docs/FRONTEND-CONTRACT.md).
diff --git a/lib/infra/connection-ui-actions.ts b/lib/infra/connection-ui-actions.ts
new file mode 100644
index 00000000..cae79627
--- /dev/null
+++ b/lib/infra/connection-ui-actions.ts
@@ -0,0 +1,35 @@
+// Lucide icon geometry, lucide-react 1.61.0 (ISC), copyright Lucide Contributors.
+// Permission to use, copy, modify, and/or distribute this software for any purpose with or
+// without fee is hereby granted, provided this notice appears in all copies.
+// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES INCLUDING
+// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
+// DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR DAMAGES RESULTING FROM LOSS OF USE, DATA
+// OR PROFITS, WHETHER IN CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+export const CONNECTION_ACTION_SCRIPT = String.raw`
+const CONNECTION_ACTION_ICONS = {"eye":[["path",{"d":"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{"cx":"12","cy":"12","r":"3"}]],"eye-off":[["path",{"d":"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{"d":"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{"d":"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{"d":"m2 2 20 20"}]],"copy":[["rect",{"width":"14","height":"14","x":"8","y":"8","rx":"2","ry":"2"}],["path",{"d":"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]],"trash-2":[["path",{"d":"M10 11v6"}],["path",{"d":"M14 11v6"}],["path",{"d":"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{"d":"M3 6h18"}],["path",{"d":"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]],"ellipsis-vertical":[["circle",{"cx":"12","cy":"12","r":"1"}],["circle",{"cx":"12","cy":"5","r":"1"}],["circle",{"cx":"12","cy":"19","r":"1"}]],"pencil":[["path",{"d":"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}],["path",{"d":"m15 5 4 4"}]],"star":[["path",{"d":"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"}]],"share-2":[["circle",{"cx":"18","cy":"5","r":"3"}],["circle",{"cx":"6","cy":"12","r":"3"}],["circle",{"cx":"18","cy":"19","r":"3"}],["line",{"x1":"8.59","x2":"15.42","y1":"13.51","y2":"17.49"}],["line",{"x1":"15.41","x2":"8.59","y1":"6.51","y2":"10.49"}]],"eraser":[["path",{"d":"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21"}],["path",{"d":"m5.082 11.09 8.828 8.828"}]],"unlink":[["path",{"d":"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71"}],["path",{"d":"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71"}],["line",{"x1":"8","x2":"8","y1":"2","y2":"5"}],["line",{"x1":"2","x2":"5","y1":"8","y2":"8"}],["line",{"x1":"16","x2":"16","y1":"19","y2":"22"}],["line",{"x1":"19","x2":"22","y1":"16","y2":"16"}]],"chevron-down":[["path",{"d":"m6 9 6 6 6-6"}]],"check":[["path",{"d":"M20 6 9 17l-5-5"}]]};
+function connectionIcon(name){
+ const ns="http://www.w3.org/2000/svg",svg=document.createElementNS(ns,"svg");
+ for(const [key,value] of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false"}))svg.setAttribute(key,value);
+ svg.classList.add("identity-action-icon");
+ for(const [tag,attributes] of CONNECTION_ACTION_ICONS[name]){const child=document.createElementNS(ns,tag);for(const [key,value] of Object.entries(attributes))child.setAttribute(key,value);svg.append(child)}return svg;
+}
+function decorateConnectionAction(element,label,icon,iconOnly=false){
+ element.replaceChildren(connectionIcon(icon));element.classList.add(iconOnly?"identity-icon-action":"identity-label-action");
+ if(element.tagName==="SUMMARY")element.setAttribute("role","button");
+ if(iconOnly){element.setAttribute("aria-label",label);element.title=label}else element.append(document.createTextNode(label));return element;
+}
+function connectionMenu(label){
+ const more=integrationNode("details"),secondary=integrationNode("div");more.className="identity-tools";secondary.className="identity-actions";
+ const trigger=decorateConnectionAction(integrationNode("summary"),"More actions for "+label,"ellipsis-vertical",true);
+ trigger.setAttribute("aria-expanded","false");
+ const away=event=>{if(!more.contains(event.target))more.open=false};
+ more.addEventListener("keydown",event=>{if(event.key==="Escape"){event.preventDefault();more.open=false;trigger.focus()}});
+ more.addEventListener("toggle",()=>{trigger.setAttribute("aria-expanded",String(more.open));document.removeEventListener("pointerdown",away,true);if(more.open)document.addEventListener("pointerdown",away,true)});
+ more.append(trigger,secondary);return{more,secondary};
+}
+function connectionAction(label,icon,handler,cls,iconOnly=false){
+ const button=integrationNode("button");button.type="button";if(cls)button.className=cls;
+ button.addEventListener("click",handler);return decorateConnectionAction(button,label,icon,iconOnly);
+}
+`;
diff --git a/lib/infra/connection-ui-style.ts b/lib/infra/connection-ui-style.ts
index 8ff05993..6b02db40 100644
--- a/lib/infra/connection-ui-style.ts
+++ b/lib/infra/connection-ui-style.ts
@@ -12,9 +12,18 @@ export const CONNECTION_MANAGER_STYLE = String.raw`
.integration .provider-mark{display:grid;place-items:center;flex:none;width:var(--brand-size);height:var(--brand-size);border:var(--stroke) solid var(--border);border-radius:var(--radius-control);background:var(--secondary);color:var(--foreground)}
.integration .provider-mark svg{width:var(--icon-size);height:var(--icon-size);fill:currentColor}
.integration .integration-signin{display:inline-flex;align-items:center;min-height:var(--control-size);padding:var(--space-3) var(--space-4);margin-bottom:var(--space-4);border-radius:var(--radius-control);text-decoration:none;background:var(--primary);color:var(--primary-foreground)}
+.integration .identity-action-icon{width:var(--icon-size);height:var(--icon-size);flex:none;pointer-events:none}
+.integration .identity-icon-action{display:inline-flex;align-items:center;justify-content:center;flex:none;width:var(--control-size);min-width:var(--control-size);min-height:var(--control-size);padding:0}
+.integration .identity-tools summary.identity-icon-action{padding:0}.integration .identity-tools summary::-webkit-details-marker{display:none}
+.integration .identity-label-action{display:flex;align-items:center;gap:var(--space-2);text-align:left}
+.integration .identity-secret>.identity-muted{flex-basis:100%}.integration .identity-secret>.identity-muted:empty{display:none}
+.integration .owner-picker-trigger>span,.integration .owner-picker-option>span{min-width:0;overflow-wrap:anywhere}
+.integration .owner-picker-trigger,.integration .owner-picker-option{gap:var(--space-2)}.integration .owner-picker-option{align-items:center;justify-content:space-between}
+.integration .owner-picker-option:not([aria-selected=true])>.identity-action-icon{visibility:hidden}
+@media(pointer:coarse){.integration .identity-icon-action{min-height:max(var(--control-size),var(--touch-target-min));min-width:max(var(--control-size),var(--touch-target-min))}}
.integration .identity-actions{display:flex;gap:var(--space-2);flex-wrap:wrap;margin-top:var(--space-4)}
.integration .identity-tools{position:relative;margin:0;padding:0;border:0;background:none}
-.integration .identity-tools summary{min-height:var(--control-size);display:flex;align-items:center;border:var(--stroke) solid var(--input);border-radius:var(--radius-control);padding:var(--space-2) var(--space-3);font-size:var(--type-small);cursor:pointer}
+.integration .identity-tools summary{list-style:none;min-height:var(--control-size);display:flex;align-items:center;border:var(--stroke) solid var(--input);border-radius:var(--radius-control);padding:var(--space-2) var(--space-3);font-size:var(--type-small);cursor:pointer}
.integration .identity-tools[open] .identity-actions{position:absolute;right:0;top:100%;z-index:var(--settings-layer-popover);min-width:var(--settings-popover-width);display:grid;background:var(--card);padding:var(--space-3);border:var(--stroke) solid var(--border);border-radius:var(--radius-panel);box-shadow:var(--shadow-pop)}
.integration .identity-guide{border:var(--stroke) solid var(--border);border-radius:var(--radius-panel);padding:var(--space-3);background:var(--card);margin:var(--space-3) 0}
.integration .identity-guide[open]{padding-bottom:var(--space-3)}
@@ -28,8 +37,8 @@ export const CONNECTION_MANAGER_STYLE = String.raw`
.integration .connection-card h3{margin:0;font-size:var(--type-section);font-weight:var(--weight-strong);overflow-wrap:anywhere}.integration .connection-heading small{display:block;margin-top:var(--space-1);color:var(--muted-foreground)}
.integration .connection-state{display:inline-block;max-width:100%;font-size:var(--type-caption);line-height:var(--line-body);border:var(--stroke) solid var(--border);border-radius:var(--radius-pill);padding:var(--space-1) var(--space-2);overflow-wrap:anywhere}.integration .connection-state[data-ready=true]{color:var(--success-text);background:var(--settings-success-fill)}
.integration .identity-tags{display:flex;flex-wrap:wrap;gap:var(--space-2);margin:var(--space-3) 0;color:var(--muted-foreground);font-size:var(--type-caption)}.integration .identity-tags span{display:inline-block;max-width:100%;border-radius:var(--radius-pill);background:var(--muted);padding:var(--space-1) var(--space-2);overflow-wrap:anywhere}
-.integration .identity-secret{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2);min-width:0;max-width:100%}.integration .identity-secret-value{display:inline-block;max-width:100%;min-width:0;padding:var(--space-1) var(--space-2);font:var(--type-small)/var(--line-body) var(--font-mono);background:var(--secondary);color:var(--foreground);border:var(--stroke) solid var(--border);border-radius:var(--radius-control);overflow-wrap:anywhere;word-break:break-word}.integration .identity-secret-toggle{min-height:var(--control-size);min-width:var(--control-size)}.integration .identity-secret-copy{min-height:var(--control-size);min-width:var(--control-size)}
-.integration .identity-credential-status{display:grid;margin:var(--space-3) calc(var(--space-4) * -1) 0;font-size:var(--type-small);border-top:var(--stroke) solid var(--border)}.integration .identity-credential-status>div{display:grid;grid-template-columns:minmax(0,1fr) auto auto auto;align-items:center;gap:var(--space-2);min-height:var(--control-size);padding:var(--space-2) var(--space-4);border-bottom:var(--stroke) solid var(--border)}.integration .identity-credential-status>div:last-child{border-bottom:0}.integration .credential-field-state{font-size:var(--type-caption);color:var(--destructive-text)}.integration .credential-field-state[data-stored=true]{color:var(--success-text)}
+.integration .identity-secret{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2);min-width:0;max-width:100%}.integration .identity-secret-value{display:inline-block;flex:1 1 var(--settings-secret-min-width);max-width:100%;min-width:0;padding:var(--space-1) var(--space-2);font:var(--type-small)/var(--line-body) var(--font-mono);background:var(--secondary);color:var(--foreground);border:var(--stroke) solid var(--border);border-radius:var(--radius-control);overflow-wrap:anywhere;word-break:break-word}.integration .identity-secret-toggle{min-height:var(--control-size);min-width:var(--control-size)}.integration .identity-secret-copy{min-height:var(--control-size);min-width:var(--control-size)}
+.integration .identity-credential-status{display:grid;margin:var(--space-3) calc(var(--space-4) * -1) 0;font-size:var(--type-small);border-top:var(--stroke) solid var(--border)}.integration .identity-credential-status>div{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:var(--space-2);min-height:var(--control-size);padding:var(--space-2) var(--space-4);border-bottom:var(--stroke) solid var(--border)}.integration .identity-credential-status>div:last-child{border-bottom:0}.integration .credential-field-state{font-size:var(--type-caption);color:var(--destructive-text)}.integration .credential-field-state[data-stored=true]{color:var(--success-text)}
.integration .identity-fields{display:grid;grid-template-columns:1fr 1fr;gap:var(--space-4);margin:var(--space-4) 0}.integration .identity-fields label{min-width:0}.integration .identity-fields input,.integration .identity-fields select{margin-top:var(--space-2)}
.integration .identity-feedback{min-height:var(--control-size);margin:var(--space-3) 0;color:var(--muted-foreground);overflow-wrap:anywhere}.integration .identity-path{font:var(--type-caption) var(--font-mono);overflow-wrap:anywhere;margin:var(--space-3) 0 var(--space-4);color:var(--muted-foreground)}
.integration .identity-check{display:flex;align-items:center;gap:var(--space-2);min-height:var(--control-size);cursor:pointer;font-weight:var(--weight-regular)}.integration .identity-check input{width:var(--icon-size);height:var(--icon-size);flex:none;margin:0;accent-color:var(--primary)}
diff --git a/lib/infra/connection-ui.ts b/lib/infra/connection-ui.ts
index 06279831..ee5a2340 100644
--- a/lib/infra/connection-ui.ts
+++ b/lib/infra/connection-ui.ts
@@ -2,8 +2,9 @@ import { GOOGLE_CONNECTION_UI_SCRIPT } from "./google-connection-ui";
import { PROJECT_MCP_UI_SCRIPT } from "./project-mcp-ui";
export { CONNECTION_MANAGER_STYLE } from "./connection-ui-style";
import { CONNECTION_MANAGER_ASSETS } from "./connection-ui-assets";
+import { CONNECTION_ACTION_SCRIPT } from "./connection-ui-actions";
-export const CONNECTION_MANAGER_SCRIPT=GOOGLE_CONNECTION_UI_SCRIPT+PROJECT_MCP_UI_SCRIPT+CONNECTION_MANAGER_ASSETS+String.raw`
+export const CONNECTION_MANAGER_SCRIPT=CONNECTION_ACTION_SCRIPT+GOOGLE_CONNECTION_UI_SCRIPT+PROJECT_MCP_UI_SCRIPT+CONNECTION_MANAGER_ASSETS+String.raw`
function mountConnectionManager(root,catalog,bridge,initial={}){
let disposed=false,sequence=0,snapshot=initial.snapshot||{users:[],connections:[],bindings:[]},user=initial.user||snapshot.user||null,provider=catalog.find(p=>p.id===initial.provider)||catalog.find(p=>p.id==="github")||catalog[0];
let detail,status,container,sidebarPanel,sidebarBackdrop,sidebarToggle,content,ro,navButtons=[],navMode=["variables","ai-providers"].includes(initial.section)?initial.section:"provider",sidebarOpen=false;
@@ -17,9 +18,9 @@ function mountConnectionManager(root,catalog,bridge,initial={}){
const choicePicker=(label,rows,selected,onChoose)=>{
const wrap=n("div",undefined,"owner-picker"),caption=n("span",label,"identity-picker-label"),trigger=b("",()=>{popup.hidden?open():close()},"owner-picker-trigger"),popup=n("div",undefined,"owner-picker-popup");let value=selected||"";const options=[];
wrap.setAttribute("role","group");wrap.setAttribute("aria-label",label);trigger.setAttribute("aria-haspopup","listbox");trigger.setAttribute("aria-expanded","false");popup.hidden=true;popup.setAttribute("role","listbox");popup.setAttribute("aria-label",label+" options");
- const current=()=>rows.find(row=>row.id===value),paint=()=>{const row=current();trigger.textContent=row?row.text:"Choose "+label.toLowerCase();for(const pair of options)pair[1].setAttribute("aria-selected",String(pair[0].id===value))};
+ const current=()=>rows.find(row=>row.id===value),paint=()=>{const row=current();trigger.replaceChildren(n("span",row?row.text:"Choose "+label.toLowerCase()),connectionIcon("chevron-down"));for(const pair of options)pair[1].setAttribute("aria-selected",String(pair[0].id===value))};
const close=(focus=false)=>{popup.hidden=true;trigger.setAttribute("aria-expanded","false");if(focus)trigger.focus()},open=()=>{popup.hidden=false;trigger.setAttribute("aria-expanded","true");const pair=options.find(pair=>pair[0].id===value)||options[0];pair?.[1].focus()},pick=row=>{value=row.id;paint();close(true);onChoose(row)};
- for(const row of rows){const option=b(row.text,()=>pick(row),"owner-picker-option");option.setAttribute("role","option");option.tabIndex=-1;options.push([row,option]);popup.append(option)}
+ for(const row of rows){const option=b(undefined,()=>pick(row),"owner-picker-option");option.append(n("span",row.text),connectionIcon("check"));option.setAttribute("role","option");option.tabIndex=-1;options.push([row,option]);popup.append(option)}
const move=(event,delta)=>{event.preventDefault();if(popup.hidden){open();return}const active=options.findIndex(pair=>pair[1]===document.activeElement),next=(active<0?(delta>0?0:options.length-1):(active+delta+options.length)%options.length);options[next]?.[1].focus()};
trigger.addEventListener("keydown",event=>{if(event.key==="ArrowDown")move(event,1);else if(event.key==="ArrowUp")move(event,-1);else if(event.key==="Escape"){event.preventDefault();close()}});
popup.addEventListener("keydown",event=>{if(event.key==="ArrowDown")move(event,1);else if(event.key==="ArrowUp")move(event,-1);else if(event.key==="Home"){event.preventDefault();options[0]?.[1].focus()}else if(event.key==="End"){event.preventDefault();options.at(-1)?.[1].focus()}else if(event.key==="Escape"){event.preventDefault();close(true)}});
@@ -43,14 +44,13 @@ function mountConnectionManager(root,catalog,bridge,initial={}){
async function reveal(body){const r=await fetch("/api/v1/integrations",{method:"POST",credentials:"same-origin",cache:"no-store",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"reveal",...body})});const data=await r.json().catch(()=>({}));if(!r.ok)throw Object.assign(new Error(data.error||"reveal_failed"),{code:data.error});return data}
// Masked value + eye toggle + copy. The value is fetched only when the human asks,
// re-masks on toggle-off and after a timeout.
- function secretControl(body,label){
- const wrap=n("span",undefined,"identity-secret"),shown=n("code","••••••••","identity-secret-value"),note=n("small","","identity-muted");let value=null,timer;
- const clear=()=>{value=null;shown.textContent="••••••••";eye.textContent="Reveal";note.textContent="";clearTimeout(timer)};
- const fetchValue=async()=>{if(value!==null)return value;const data=await reveal(body);if(typeof data.value!=="string")throw new Error("reveal_failed");value=data.value;return value};
- const eye=b("Reveal",async()=>{if(value!==null){clear();return}try{const next=await fetchValue();shown.textContent=next;eye.textContent="Hide";note.textContent="Revealed. This read is logged.";timer=setTimeout(clear,30000)}catch(e){clear();status.textContent=textError(e)}},"identity-secret-toggle");
- const copy=b("Copy",async()=>{try{await navigator.clipboard.writeText(await fetchValue());note.textContent="Copied. This read is logged.";timer=setTimeout(clear,30000)}catch(e){status.textContent=textError(e)}},"identity-secret-copy");
- eye.setAttribute("aria-label","Reveal "+label);copy.setAttribute("aria-label","Copy "+label);
- wrap.append(shown,eye,copy,note);return wrap;
+ function secretControl(body,label,remove){
+ const wrap=n("span",undefined,"identity-secret"),shown=n("code","••••••••","identity-secret-value"),note=n("small","","identity-muted");let value=null,visible=false,timer,pending=false;
+ const clear=()=>{value=null;visible=false;shown.textContent="••••••••";decorateConnectionAction(eye,"Reveal "+label,"eye",true);eye.setAttribute("aria-pressed","false");note.textContent="";clearTimeout(timer)};
+ const arm=()=>{clearTimeout(timer);timer=setTimeout(clear,30000)},fetchValue=async()=>{if(value!==null)return value;const data=await reveal(body);if(typeof data.value!=="string")throw new Error("reveal_failed");value=data.value;return value},run=async fn=>{if(pending)return;pending=true;eye.disabled=copy.disabled=true;try{await fn()}catch(e){clear();status.textContent=textError(e)}finally{pending=false;eye.disabled=copy.disabled=false}};
+ const eye=connectionAction("Reveal "+label,"eye",()=>run(async()=>{if(visible){clear();return}shown.textContent=await fetchValue();visible=true;decorateConnectionAction(eye,"Hide "+label,"eye-off",true);eye.setAttribute("aria-pressed","true");note.textContent="Revealed. This read is logged.";arm()}),"identity-secret-toggle",true);
+ const copy=connectionAction("Copy "+label,"copy",()=>run(async()=>{await navigator.clipboard.writeText(await fetchValue());note.textContent="Copied. This read is logged.";arm()}),"identity-secret-copy",true);
+ note.setAttribute("aria-live","polite");eye.setAttribute("aria-pressed","false");wrap.append(shown,eye,copy);if(remove)wrap.append(remove);wrap.append(note);return wrap;
}
function showAiProviders(){navMode="ai-providers";activateNav(navMode);setSidebar(false);void aiProviders()}
function selectProvider(p){provider=p;navMode="provider";remember();activateNav(navMode);setSidebar(false);drawProvider()}
@@ -91,7 +91,7 @@ function mountConnectionManager(root,catalog,bridge,initial={}){
activateNav(navMode);
if(navMode==="owners")profiles();else if(navMode==="variables")variables();else if(navMode==="demo-users")void demoUsers();else if(navMode==="ai-providers")void aiProviders();else if(navMode==="routing")bindings();else if(navMode==="project-mcp")showProjectMcp();else drawProvider();
}
- function confirmation(title,id,fn){const trigger=document.activeElement,cancel=()=>{if(navMode==="owners")profiles();else if(navMode==="demo-users")void demoUsers();else{navMode="provider";activateNav(navMode);drawProvider();}if(trigger&&typeof trigger.focus==="function"){if(document.contains(trigger))trigger.focus();else{const m=Array.from(detail.querySelectorAll("button")).find(e=>e.textContent===trigger.textContent);if(m)m.focus();else trigger.focus();}setTimeout(()=>{if(document.contains(trigger))trigger.focus();},0);}};const box=n("div",undefined,"identity-confirmation");box.setAttribute("role","alertdialog");box.setAttribute("aria-modal","true");const titleId="confirmation-title-"+(++sequence),heading=n("h2",title);heading.id=titleId;box.setAttribute("aria-labelledby",titleId);box.addEventListener("keydown",event=>{if(event.key==="Escape"){event.preventDefault();cancel();}});const desc=n("p","This changes only the selected identity. Type “"+id+"” to confirm."),value=input("Confirmation"),confirmBtn=b(title,()=>{if(value.input.value!==id){status.textContent="Confirmation does not match.";return}void fn()},"danger"),cancelBtn=b("Cancel",cancel);box.append(heading,desc,value.label,confirmBtn,cancelBtn);detail.replaceChildren(box);cancelBtn.focus();setTimeout(()=>cancelBtn.focus(),0);}
+ function confirmation(title,id,fn){const trigger=document.activeElement,triggerName=trigger?.getAttribute("aria-label")||trigger?.textContent,connectionId=trigger?.closest(".connection-card")?.dataset.connectionId,cancel=()=>{if(navMode==="owners")profiles();else if(navMode==="demo-users")void demoUsers();else{navMode="provider";activateNav(navMode);drawProvider();}if(trigger&&typeof trigger.focus==="function"){if(document.contains(trigger))trigger.focus();else{const scope=Array.from(detail.querySelectorAll(".connection-card")).find(e=>e.dataset.connectionId===connectionId)||detail,m=Array.from(scope.querySelectorAll("button,summary")).find(e=>(e.getAttribute("aria-label")||e.textContent)===triggerName);if(m){const menu=m.closest("details");(menu&&!menu.open?menu.querySelector("summary"):m)?.focus();}else trigger.focus();}setTimeout(()=>{if(document.contains(trigger))trigger.focus();},0);}};const box=n("div",undefined,"identity-confirmation");box.setAttribute("role","alertdialog");box.setAttribute("aria-modal","true");const titleId="confirmation-title-"+(++sequence),heading=n("h2",title);heading.id=titleId;box.setAttribute("aria-labelledby",titleId);box.addEventListener("keydown",event=>{if(event.key==="Escape"){event.preventDefault();cancel();}});const desc=n("p","This changes only the selected identity. Type “"+id+"” to confirm."),value=input("Confirmation"),confirmBtn=b(title,()=>{if(value.input.value!==id){status.textContent="Confirmation does not match.";return}void fn()},"danger"),cancelBtn=b("Cancel",cancel);box.append(heading,desc,value.label,confirmBtn,cancelBtn);detail.replaceChildren(box);cancelBtn.focus();setTimeout(()=>cancelBtn.focus(),0);}
function profiles(){
detail.replaceChildren(n("h2","Credential owners"),n("p","These profiles isolate service accounts. They do not grant MSO device roles."));
const id=input("New user ID"),name=input("Display label");detail.append(id.label,name.label);const create=b("Create user",()=>change({action:"user.create",user:id.input.value,label:name.input.value||id.input.value},async()=>{user=id.input.value;await reload()}),"primary");create.disabled=!bridge.manage;detail.append(create);
@@ -150,7 +150,7 @@ function mountConnectionManager(root,catalog,bridge,initial={}){
const passwordLine=n("div");passwordLine.append(n("span","Password"),secretControl({demoId:row.id,key:"password",cwd:folder.value},"demo password"));creds.append(passwordLine);
if(row.notes)card.append(n("p",row.notes,"identity-muted"));
card.append(creds);
- const actions=n("div",undefined,"identity-actions"),del=b("Delete",()=>confirmation("Delete demo user",row.id,async()=>{try{await bridge.execute({operation:"demo.delete",confirm:true,arguments:{cwd:folder.value,id:row.id}});await demoUsers()}catch(e){status.textContent=textError(e)}}),"danger");del.disabled=!bridge.manage;actions.append(del);card.append(actions);cards.append(card)}
+ const actions=n("div",undefined,"identity-actions"),del=connectionAction("Delete","trash-2",()=>confirmation("Delete demo user",row.id,async()=>{try{await bridge.execute({operation:"demo.delete",confirm:true,arguments:{cwd:folder.value,id:row.id}});await demoUsers()}catch(e){status.textContent=textError(e)}}),"danger");del.disabled=!bridge.manage;actions.append(del);card.append(actions);cards.append(card)}
}catch(e){cards.replaceChildren();status.textContent=textError(e)}};
folder.addEventListener("change",()=>void list());await list();
}
@@ -185,15 +185,15 @@ function mountConnectionManager(root,catalog,bridge,initial={}){
const rows=snapshot.connections.filter(c=>c.provider===provider.id);if(rows.length){const count=rows.filter(ready).length;detail.append(n("p",rows.length+" connection"+(rows.length===1?"":"s")+" · "+count+" verified","identity-summary-line"));}
if(!rows.length){const empty=n("div",undefined,"identity-empty");empty.append(n("h3","Connect "+provider.title),n("p",user?"Add an account to start using "+provider.title+" in your projects.":bridge.manage?"Select a credential owner to add an account.":"Read the setup guide below, then sign in to connect your account."));const start=b("Add "+provider.title+" account",newConnection,"primary");start.disabled=!user||!bridge.manage;if(bridge.manage)empty.append(start);detail.append(empty);const help=n("details");help.append(n("summary","Connection methods & setup guides"));for(const s of provider.sources)for(const m of s.methods){const info=n("section");info.append(n("h3",s.label+" · "+m.label));guide(m,info);help.append(info)}detail.append(help)}
- for(const c of rows){const card=n("article",undefined,"connection-card");const top=n("header",undefined,"connection-heading"),name=n("div");name.append(n("h3",c.label),n("small",c.id));const state=n("span",stateLabel(c),"connection-state");state.dataset.ready=String(ready(c));top.append(name,state);card.append(top);const tags=n("div",undefined,"identity-tags");for(const value of new Set([human(c.source),human(c.authMethod),c.sharedFrom?"Shared from "+c.sharedFrom.user:"",c.isDefault?"Default account":""]))if(value)tags.append(n("span",value));card.append(tags);const actions=n("div",undefined,"identity-actions"),more=n("details",undefined,"identity-tools"),secondary=n("div",undefined,"identity-actions");more.addEventListener("keydown",event=>{if(event.key==="Escape"){event.preventDefault();more.open=false;const summary=more.querySelector("summary");if(summary)summary.focus()}});more.addEventListener("toggle",()=>{if(!more.open)return;const away=event=>{if(!more.contains(event.target)){more.open=false;document.removeEventListener("pointerdown",away,true)}};document.addEventListener("pointerdown",away,true)});more.append(n("summary","More"));more.append(secondary);
+ for(const c of rows){const card=n("article",undefined,"connection-card");card.dataset.connectionId=c.id;const top=n("header",undefined,"connection-heading"),name=n("div");name.append(n("h3",c.label),n("small",c.id));const state=n("span",stateLabel(c),"connection-state");state.dataset.ready=String(ready(c));top.append(name,state);card.append(top);const tags=n("div",undefined,"identity-tags");for(const value of new Set([human(c.source),human(c.authMethod),c.sharedFrom?"Shared from "+c.sharedFrom.user:"",c.isDefault?"Default account":""]))if(value)tags.append(n("span",value));card.append(tags);const actions=n("div",undefined,"identity-actions"),{more,secondary}=connectionMenu(c.label);
if(provider.nativeGoogle&&!provider.configurationOnly){mountNativeGoogleConnection(card,c,{n,b,user,provider,catalog,snapshot,bridge,status,reload,selectProvider});detail.append(card);continue}
const open=b(c.source==="direct"?(c.fields.some(f=>f.stored)?"Update credentials":"Finish setup"):"Authorize",()=>{if(c.source==="direct")void bridge.openSetup({user,provider:provider.id,connection:c.id}).catch(e=>status.textContent=textError(e));else external(c)});open.disabled=!bridge.manage;if(!c.sharedFrom)actions.append(open);
const verify=b("Verify",async()=>{try{status.textContent="Checking selected connection…";const result=await bridge.execute({user,provider:provider.id,connection:c.id,operation:"verify"});await reload();status.textContent=(result.ok===true?"Verified: ":"Status: ")+result.detail}catch(e){status.textContent=textError(e)}});verify.disabled=!bridge.execute;actions.append(verify);
- const rename=b("Rename",()=>{detail.replaceChildren(n("h2","Rename connection"));const name=input("Label",c.label);detail.append(name.label,b("Save label",()=>change({action:"connection.rename",user,provider:provider.id,connection:c.id,label:name.input.value})),b("Cancel",()=>{navMode="provider";activateNav(navMode);drawProvider()}))});rename.disabled=!bridge.manage;secondary.append(rename);
- if(c.sharedFrom){card.append(n("p","Read-only shared backing: "+c.sharedFrom.user+" / "+c.sharedFrom.connection,"identity-muted"));}else if(c.source==="direct"){const fields=n("div",undefined,"identity-credential-status");for(const f of c.fields){const line=n("div");line.append(n("span",f.label));const fieldState=n("span",f.stored?"Stored":"Missing","credential-field-state");fieldState.dataset.stored=String(f.stored);line.append(fieldState);if(f.stored){line.append(secretControl({user,provider:provider.id,connection:c.id,key:f.key},f.label));const remove=b("Remove",()=>confirmation("Remove credential field",f.key,()=>change({action:"credential.delete",user,provider:provider.id,connection:c.id,key:f.key})),"danger");remove.disabled=!bridge.manage;line.append(remove)}fields.append(line)}card.append(fields);if(c.fields.some(f=>f.stored)){const clear=b("Clear credentials",()=>confirmation("Clear this connection's credential fields",c.id,()=>change({action:"credential.delete",user,provider:provider.id,connection:c.id})),"danger");clear.disabled=!bridge.manage;secondary.append(clear)}}
- if(!c.isDefault){const def=b("Make default",()=>change({action:"connection.default",user,provider:provider.id,connection:c.id}));def.disabled=!bridge.manage;secondary.append(def)}
- if(c.sharedFrom){const unshare=b("Unshare",()=>confirmation("Remove shared alias",c.id,()=>change({action:"connection.unshare",user,provider:provider.id,connection:c.id})),"danger");unshare.disabled=!bridge.manage;secondary.append(unshare)}else{if(c.source==="direct"&&!provider.nativeGoogle){const share=b("Share linked access",()=>shareConnection(c));share.disabled=!bridge.manage;secondary.append(share)}const duplicate=b("Copy to another owner",()=>copyConnection(c));duplicate.disabled=!bridge.manage;secondary.append(duplicate)}
- if(!c.sharedFrom){const del=b("Delete",()=>confirmation("Delete named connection",c.id,()=>change({action:"connection.delete",user,provider:provider.id,connection:c.id})),"danger");del.disabled=!bridge.manage;secondary.append(del);}actions.append(more);card.append(actions);if(c.lastCheck)card.append(n("small","Last checked "+new Date(c.lastCheck.checkedAt).toLocaleString()+" · "+stateLabel(c)));else if(c.verifiedAt)card.append(n("small","Last verified "+new Date(c.verifiedAt).toLocaleString()));detail.append(card);
+ const rename=connectionAction("Rename","pencil",()=>{detail.replaceChildren(n("h2","Rename connection"));const name=input("Label",c.label);detail.append(name.label,b("Save label",()=>change({action:"connection.rename",user,provider:provider.id,connection:c.id,label:name.input.value})),b("Cancel",()=>{navMode="provider";activateNav(navMode);drawProvider()}))});rename.disabled=!bridge.manage;secondary.append(rename);
+ if(c.sharedFrom){card.append(n("p","Read-only shared backing: "+c.sharedFrom.user+" / "+c.sharedFrom.connection,"identity-muted"));}else if(c.source==="direct"){const fields=n("div",undefined,"identity-credential-status");for(const f of c.fields){const line=n("div");line.append(n("span",f.label));const fieldState=n("span",f.stored?"Stored":"Missing","credential-field-state");fieldState.dataset.stored=String(f.stored);line.append(fieldState);if(f.stored){const remove=connectionAction("Remove "+f.label,"trash-2",()=>confirmation("Remove credential field",f.key,()=>change({action:"credential.delete",user,provider:provider.id,connection:c.id,key:f.key})),"danger",true);remove.disabled=!bridge.manage;line.append(secretControl({user,provider:provider.id,connection:c.id,key:f.key},f.label,remove))}fields.append(line)}card.append(fields);if(c.fields.some(f=>f.stored)){const clear=connectionAction("Clear credentials","eraser",()=>confirmation("Clear this connection's credential fields",c.id,()=>change({action:"credential.delete",user,provider:provider.id,connection:c.id})),"danger");clear.disabled=!bridge.manage;secondary.append(clear)}}
+ if(!c.isDefault){const def=connectionAction("Make default","star",()=>change({action:"connection.default",user,provider:provider.id,connection:c.id}));def.disabled=!bridge.manage;secondary.append(def)}
+ if(c.sharedFrom){const unshare=connectionAction("Unshare","unlink",()=>confirmation("Remove shared alias",c.id,()=>change({action:"connection.unshare",user,provider:provider.id,connection:c.id})),"danger");unshare.disabled=!bridge.manage;secondary.append(unshare)}else{if(c.source==="direct"&&!provider.nativeGoogle){const share=connectionAction("Share linked access","share-2",()=>shareConnection(c));share.disabled=!bridge.manage;secondary.append(share)}const duplicate=connectionAction("Copy to another owner","copy",()=>copyConnection(c));duplicate.disabled=!bridge.manage;secondary.append(duplicate)}
+ if(!c.sharedFrom){const del=connectionAction("Delete","trash-2",()=>confirmation("Delete named connection",c.id,()=>change({action:"connection.delete",user,provider:provider.id,connection:c.id})),"danger");del.disabled=!bridge.manage;secondary.append(del);}actions.append(more);card.append(actions);if(c.lastCheck)card.append(n("small","Last checked "+new Date(c.lastCheck.checkedAt).toLocaleString()+" · "+stateLabel(c)));else if(c.verifiedAt)card.append(n("small","Last verified "+new Date(c.verifiedAt).toLocaleString()));detail.append(card);
}
}
function newConnection(){
diff --git a/lib/infra/google-connection-ui.ts b/lib/infra/google-connection-ui.ts
index 3ba839ce..3d5bf27f 100644
--- a/lib/infra/google-connection-ui.ts
+++ b/lib/infra/google-connection-ui.ts
@@ -27,11 +27,11 @@ function mountNativeGoogleConnection(card,c,ctx){
const disconnect=b("Disconnect from MSO",async()=>{if(!window.confirm("Remove this Google authorization from MSO? This does not revoke the app in your Google account."))return;const result=await run("google.disconnect");if(result)status.textContent=result.detail});disconnect.disabled=!bridge.execute;actions.append(disconnect);
card.append(actions,linkBox);
const operations=n("details");operations.append(n("summary","Available read-only operations"));for(const op of provider.operations||[]){const row=n("div");row.append(n("small",op.name),n("p",op.description));operations.append(row)}card.append(operations);
- const more=n("details"),manage=n("div",undefined,"identity-actions");more.append(n("summary","Connection management"));
+ const{more,secondary:manage}=connectionMenu(c.label);
if(bridge.manage){
- if(!c.isDefault)manage.append(b("Make default",async()=>{try{await bridge.manage({action:"connection.default",confirm:true,user,provider:provider.id,connection:c.id});await reload()}catch(error){fail(error)}}));
- manage.append(b("Delete connection",async()=>{if(!window.confirm("Delete this named Google connection and its local authorization?"))return;try{await bridge.manage({action:"connection.delete",confirm:true,user,provider:provider.id,connection:c.id});await reload()}catch(error){fail(error)}},"danger"));
+ if(!c.isDefault)manage.append(connectionAction("Make default","star",async()=>{try{await bridge.manage({action:"connection.default",confirm:true,user,provider:provider.id,connection:c.id});await reload()}catch(error){fail(error)}}));
+ manage.append(connectionAction("Delete connection","trash-2",async()=>{if(!window.confirm("Delete this named Google connection and its local authorization?"))return;try{await bridge.manage({action:"connection.delete",confirm:true,user,provider:provider.id,connection:c.id});await reload()}catch(error){fail(error)}},"danger"));
}
- more.append(manage,n("small","Google user authorizations are not shared or transferred to other owners. Each account requires explicit consent."));card.append(more);
+ more.append(n("small","Google user authorizations are not shared or transferred to other owners. Each account requires explicit consent."));card.append(more);
}
`;
diff --git a/lib/infra/integration-keyboard-a11y.test.ts b/lib/infra/integration-keyboard-a11y.test.ts
index b301a8c4..98ef9705 100644
--- a/lib/infra/integration-keyboard-a11y.test.ts
+++ b/lib/infra/integration-keyboard-a11y.test.ts
@@ -1,5 +1,6 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
+import { CONNECTION_MANAGER_SCRIPT } from "./connection-ui";
// Four keyboard defects found by a browser audit of the integrations page. All four are the kind
// that pass every unit test: they are about what the DOM does when you press keys, not about what
@@ -37,7 +38,7 @@ describe("skip link reaches the primary content", () => {
});
describe("integrations sidebar keyboard behaviour", () => {
- const src = read("lib/infra/connection-ui.ts");
+ const src = CONNECTION_MANAGER_SCRIPT;
it("makes the closed drawer inert so its items leave the tab order", () => {
expect(src, "a translated-off-screen drawer is still focusable").toContain("sidebarPanel.inert=!sidebarOpen");
diff --git a/lib/infra/setup-page.ts b/lib/infra/setup-page.ts
index f0c0a979..c3e55ab6 100644
--- a/lib/infra/setup-page.ts
+++ b/lib/infra/setup-page.ts
@@ -1,3 +1,4 @@
+import { SETTINGS_COMPACT_MAX } from "@/lib/presentation/responsive-contract";
import { MSO_LOGO_SVG } from "@/lib/presentation/logo";
import {PORTABILITY_SCRIPT,PORTABILITY_STYLE} from "./portable/ui";
import { randomBytes } from "node:crypto";
@@ -12,6 +13,7 @@ export const INTEGRATION_PAGE_STYLE = String.raw`
body{margin:0;background:var(--background);padding:var(--space-6);font-family:var(--font-body);color:var(--foreground)}
.site-bar{max-width:var(--measure);margin:0 auto var(--space-6);font-size:var(--type-small);display:flex;justify-content:space-between;gap:var(--space-3)}
.site-bar strong{display:flex;align-items:center;gap:var(--space-3);font-weight:var(--weight-strong)}.site-bar svg{width:var(--brand-size);height:var(--brand-size)}.site-bar span{color:var(--muted-foreground)}
+@media(max-width:${SETTINGS_COMPACT_MAX}){body{padding:0}.site-bar{padding:var(--space-3);flex-wrap:wrap}.site-bar span{overflow-wrap:anywhere}}
button{border:var(--stroke) solid var(--input);border-radius:var(--radius-control);background:var(--secondary);color:var(--secondary-foreground);padding:var(--space-2) var(--space-3);font:var(--type-small)/var(--line-body) var(--font-body);cursor:pointer}a{color:var(--settings-action-text)}
`;
diff --git a/lib/presentation/widget-tokens.ts b/lib/presentation/widget-tokens.ts
index 3f364c51..c7ddfae6 100644
--- a/lib/presentation/widget-tokens.ts
+++ b/lib/presentation/widget-tokens.ts
@@ -63,7 +63,7 @@ color-scheme:light;
--type-title:var(--font-heading-md-size,1.5rem);--type-section:var(--font-heading-sm-size,1.125rem);
--line-body:var(--font-text-md-line-height,1.5);--line-title:var(--font-heading-md-line-height,1.25);
--weight-regular:var(--font-weight-normal,400);--weight-medium:var(--font-weight-medium,500);--weight-strong:var(--font-weight-semibold,600);--weight-bold:var(--font-weight-bold,700);--weight-heavy:var(--font-weight-extrabold,800);
---control-size:2.75rem;--icon-size:1.25rem;--brand-size:2rem;
+--touch-target-min:2.75rem;--control-size:2.75rem;--icon-size:1.25rem;--brand-size:2rem;
--stroke:1px;--stroke-active:calc(var(--stroke) * 2);--stroke-emphasis:calc(var(--stroke) * 3);--focus-width:2px;--focus-gap:2px;
--measure:72rem;--measure-copy:65ch;
--scroll-thumb:var(--sep-strong);
@@ -81,6 +81,7 @@ color-scheme:light;
--settings-danger-fill:color-mix(in srgb,var(--destructive-text) 6%,var(--surface));
--settings-danger-border:color-mix(in srgb,var(--destructive-text) 38%,var(--border));
--settings-sidebar-width:14rem;--settings-sidebar-sheet-width:18rem;--settings-content-width:48rem;
+--settings-secret-min-width:calc(8ch + (var(--space-2) + var(--stroke)) * 2);
--settings-popover-width:calc(var(--control-size)*5);--settings-popover-max-height:calc(var(--control-size)*6);
--settings-scroll-max-height:calc(var(--control-size)*8);--settings-code-max-height:calc(var(--control-size)*7);
--settings-nav-icon-size:calc(var(--icon-size) + var(--space-1));--settings-section-icon-size:var(--control-size);
diff --git a/scripts/check-docs.mjs b/scripts/check-docs.mjs
index d38e5c27..deaf08ea 100755
--- a/scripts/check-docs.mjs
+++ b/scripts/check-docs.mjs
@@ -37,6 +37,15 @@ for (const [file, ref] of catalogRefs) {
fail.push(`${file}: duplicated MCP catalog marker; keep volatile markers only in docs/generated/MCP-CATALOG.md`);
}
+// --- Every supported agent entry point must route to the frontend contract.
+for (const [file, ref] of [
+ ["AGENTS.md", "./docs/FRONTEND-CONTRACT.md"],
+ ["CLAUDE.md", "./docs/FRONTEND-CONTRACT.md"],
+ ["frontend/AGENTS.md", "../docs/FRONTEND-CONTRACT.md"],
+ ["docs/UI-UX-FOUNDATION.md", "./FRONTEND-CONTRACT.md"],
+ ["frontend/slices/appshell/design/README.md", "../../../../docs/FRONTEND-CONTRACT.md"],
+]) if (!read(file).includes(ref)) fail.push(`${file}: must reference the frontend implementation contract (${ref})`);
+
// --- Slice catalog counts.
const dirs = (p) => readdirSync(join(ROOT, p), { withFileTypes: true }).filter((x) => x.isDirectory()).map((x) => x.name);
const sliceCount = dirs("frontend/slices").length;
@@ -63,7 +72,7 @@ for (const name of readdirSync(join(ROOT, "docs")).filter((x) => x.endsWith(".md
}
// --- Relative Markdown links across project-authored docs/skills must resolve.
-const markdownRoots = ["README.md", "SECURITY.md", "CONTRIBUTING.md", "CLAUDE.md", "docs", "skills", "claude-skills"];
+const markdownRoots = ["AGENTS.md", "frontend/AGENTS.md", "README.md", "SECURITY.md", "CONTRIBUTING.md", "CLAUDE.md", "docs", "skills", "claude-skills"];
const markdown = [];
function walk(path) {
const full = join(ROOT, path);
diff --git a/scripts/e2e/integrations.mjs b/scripts/e2e/integrations.mjs
index 5ef7234e..d0b71d20 100644
--- a/scripts/e2e/integrations.mjs
+++ b/scripts/e2e/integrations.mjs
@@ -3,7 +3,7 @@
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { chromium } from "@playwright/test";
-const html = execFileSync("bun", ["-e", 'import { integrationSetupPage } from "./lib/infra/setup-page"; console.log(integrationSetupPage().html)'], {encoding:"utf8"});
+const pages = JSON.parse(execFileSync("bun", ["-e", 'import { integrationSetupPage } from "./lib/infra/setup-page"; console.log(JSON.stringify({standalone:integrationSetupPage().html,embedded:integrationSetupPage(true).html}))'], {encoding:"utf8"}));
const users=[{id:"studio",label:"Studio",isDefault:true},{id:"personal",label:"Personal",isDefault:false}];
const fixture={id:"work",label:"Delivery GitHub",provider:"github",source:"direct",authMethod:"token",scope:"account",state:"verified",isDefault:true,fields:[{key:"apiKey",label:"API key",stored:true}],verifiedAt:Date.now(),sharedFrom:null};
const snapshot=user=>({version:2,user,users:users.map(row=>({...row,connectionCount:row.id==="studio"?1:0})),connections:user==="studio"?[fixture]:[],bindings:[]});
@@ -16,24 +16,27 @@ function manage(body){
return {ok:true,action:body.action};
}
const browser=await chromium.launch({...(process.env.CHROME_PATH ? {executablePath:process.env.CHROME_PATH} : {}),args:["--no-sandbox","--disable-dev-shm-usage"]});
-let checks=0;
+let checks=0,reveals=0,mutations=0;
try{
const page=await browser.newPage();
const waitDelivery=async stage=>{try{await page.getByRole("heading",{name:"Delivery GitHub"}).waitFor({timeout:5000})}catch(error){console.error("Delivery GitHub missing at "+stage+"\n"+(await page.locator("body").innerText()).slice(0,2500));throw error}};
+ await page.addInitScript(()=>{window.testClipboard={writes:[],fail:false};Object.defineProperty(navigator,"clipboard",{configurable:true,value:{writeText:async value=>{if(window.testClipboard.fail)throw new Error("Clipboard unavailable");window.testClipboard.writes.push(value)}}})});
const errors=[];page.on("pageerror",error=>errors.push(error.message));
await page.route("https://mso.example.com/**",route=>{
const url=new URL(route.request().url());
- if(url.pathname==="/integrations")return route.fulfill({contentType:"text/html",body:html});
+ if(url.pathname==="/integrations")return route.fulfill({contentType:"text/html",body:pages.standalone});
+ if(url.pathname==="/integrations/manager")return route.fulfill({contentType:"text/html",body:pages.embedded});
if(url.pathname==="/api/auth/me")return route.fulfill({json:{role:"owner"}});
if(url.pathname==="/api/v1/integrations"&&route.request().method()==="GET")return route.fulfill({json:snapshot(url.searchParams.get("user")||users.find(row=>row.isDefault)?.id||users[0]?.id||null)});
if(url.pathname==="/api/v1/integrations"){
- const body=route.request().postDataJSON();return route.fulfill({json:body.mode==="manage"?manage(body):{ok:true,detail:"Connected to GitHub"}});
+ const body=route.request().postDataJSON();if(body.mode==="reveal"){reveals++;return route.fulfill({json:{value:"synthetic-token-for-ui-test"}})}if(body.mode==="manage")mutations++;return route.fulfill({json:body.mode==="manage"?manage(body):{ok:true,detail:"Connected to GitHub"}});
}
return route.fulfill({status:404,json:{error:"unhandled_fixture"}});
});
await page.goto("https://mso.example.com/integrations");
await waitDelivery("initial");
const nav=page.getByRole("navigation",{name:"Integrations sections",exact:true});
+ const providerCount=await page.locator(".integration-nav-group").first().getByRole("button",{includeHidden:true}).count();
const mobileToggle=page.getByRole("button",{name:"Integrations sections",exact:true});
const openSidebar=async()=>{if(await mobileToggle.isVisible()){if(await mobileToggle.getAttribute("aria-expanded")!=="true")await mobileToggle.click();await nav.waitFor();}};
const closeSidebar=async()=>{if(await mobileToggle.isVisible()&&await mobileToggle.getAttribute("aria-expanded")==="true")await page.keyboard.press("Escape");};
@@ -47,12 +50,35 @@ try{
await openSidebar();for(const action of ["Credential owners","Project routing","Transfer & backup","Add project MCP"])assert(await nav.getByRole("button",{name:action,exact:true}).isVisible(),action+" must stay discoverable in the Settings-style sidebar");checks++;await closeSidebar();
}
}
+ for(const surface of ["/integrations","/integrations/manager"]){
+ await page.goto("https://mso.example.com"+surface);await waitDelivery("large text "+surface);
+ for(const width of [320,390]){
+ await page.setViewportSize({width,height:844});
+ for(const theme of ["light","dark"]){
+ await page.evaluate(theme=>{document.documentElement.dataset.theme=theme;document.documentElement.style.fontSize="32px"},theme);
+ assert(await page.evaluate(()=>{const node=document.querySelector(".identity-secret-value"),style=getComputedStyle(node),height=node.getBoundingClientRect().height,oneLine=parseFloat(style.lineHeight)+parseFloat(style.paddingTop)+parseFloat(style.paddingBottom)+parseFloat(style.borderTopWidth)+parseFloat(style.borderBottomWidth);return document.documentElement.scrollWidth<=innerWidth+1&&height<=oneLine+1}),"200% text keeps the mask on one line without document overflow at "+width+" "+theme);checks++;
+ }
+ }
+ }
+ await page.goto("https://mso.example.com/integrations");await waitDelivery("after large text");
await page.setViewportSize({width:1440,height:900});
await nav.getByRole("button",{name:"Transfer & backup",exact:true}).click();await page.getByRole("heading",{name:"Transfer & backup",exact:true}).waitFor();assert(await nav.isVisible(),"Settings-style sidebar remains visible inside Transfer & backup");checks++;await page.getByRole("button",{name:"← Connections",exact:true}).click();await waitDelivery("after inline Transfer & backup");
await page.getByRole("button",{name:"Verify",exact:true}).click();
await page.getByRole("status").filter({hasText:"Verified: Connected to GitHub"}).waitFor();checks++;
- assert(await page.getByRole("button",{name:"Remove",exact:true}).isVisible(),"stored credential fields expose per-field removal");checks++;
- const connectionCard=page.getByRole("article").filter({hasText:"Delivery GitHub"});await connectionCard.getByText("More",{exact:true}).click();assert(await connectionCard.getByRole("button",{name:"Copy to another owner",exact:true}).isVisible());await connectionCard.getByRole("button",{name:"Share linked access",exact:true}).click();await page.getByRole("heading",{name:"Share Delivery GitHub"}).waitFor();assert(await page.getByRole("group",{name:"Target credential owner"}).getByRole("button").isVisible());assert(await page.getByRole("textbox",{name:"New alias label",exact:true}).isVisible());checks++;await page.getByRole("button",{name:"Cancel",exact:true}).click();
+ assert(await page.getByRole("button",{name:"Remove API key",exact:true}).isVisible(),"stored credential fields expose per-field removal");checks++;
+ assert.equal(reveals,0,"render and verify never fetch a credential value");checks++;
+ await page.clock.install();
+ const secret=page.locator(".identity-secret-value"),eye=()=>page.getByRole("button",{name:"Reveal API key",exact:true}),copy=()=>page.getByRole("button",{name:"Copy API key",exact:true});
+ await copy().click();await page.getByText("Copied. This read is logged.",{exact:true}).waitFor();assert.equal(await secret.innerText(),"••••••••");assert.equal(reveals,1);checks++;
+ await eye().click();await page.getByRole("button",{name:"Hide API key",exact:true}).waitFor();assert.equal(await secret.innerText(),"synthetic-token-for-ui-test");assert.equal(reveals,1,"copy then reveal shares the short-lived value and actually reveals");checks++;
+ await page.getByRole("button",{name:"Hide API key",exact:true}).click();assert.equal(await secret.innerText(),"••••••••");assert.equal(await eye().getAttribute("aria-pressed"),"false");checks++;
+ await eye().click();await page.getByRole("button",{name:"Hide API key",exact:true}).waitFor();assert.equal(reveals,2,"hide clears the cached value");await page.clock.fastForward(30001);assert.equal(await secret.innerText(),"••••••••");assert.equal(await eye().getAttribute("title"),"Reveal API key");checks++;
+ await page.evaluate(()=>window.testClipboard.fail=true);await copy().click();await page.getByRole("status").filter({hasText:"Clipboard unavailable"}).waitFor();assert.equal(await secret.innerText(),"••••••••");assert.equal(reveals,3);await page.evaluate(()=>window.testClipboard.fail=false);await eye().click();await page.getByRole("button",{name:"Hide API key",exact:true}).waitFor();assert.equal(reveals,4,"failed clipboard read is discarded");await page.getByRole("button",{name:"Hide API key",exact:true}).click();checks++;
+ const beforeDelete=mutations;await page.getByRole("button",{name:"Remove API key",exact:true}).click();await page.getByRole("alertdialog",{name:"Remove credential field"}).waitFor();await page.getByRole("button",{name:"Remove credential field",exact:true}).click();assert.equal(mutations,beforeDelete,"deletion needs typed confirmation");await page.keyboard.press("Escape");await waitDelivery("cancel credential deletion");assert(await page.getByRole("button",{name:"Remove API key",exact:true}).evaluate(node=>node===document.activeElement),"cancel returns focus to the exact icon action");checks++;
+ const connectionCard=page.getByRole("article").filter({hasText:"Delivery GitHub"});
+ const more=()=>connectionCard.getByRole("button",{name:"More actions for Delivery GitHub",exact:true});await more().click();await connectionCard.getByRole("button",{name:"Delete",exact:true}).click();await page.getByRole("alertdialog",{name:"Delete named connection"}).waitFor();await page.keyboard.press("Escape");await waitDelivery("cancel connection deletion");assert(await more().evaluate(node=>node===document.activeElement),"menu confirmation cancel returns focus to the closed trigger");assert.equal(mutations,beforeDelete);checks++;
+ await more().click();await page.waitForFunction(()=>document.querySelector(".identity-tools summary").getAttribute("aria-expanded")==="true");await connectionCard.getByRole("button",{name:"Rename",exact:true}).focus();await page.keyboard.press("Escape");assert(await more().evaluate(node=>node===document.activeElement));assert.equal(await page.locator(".identity-tools").getAttribute("open"),null);await page.waitForFunction(()=>document.querySelector(".identity-tools summary").getAttribute("aria-expanded")==="false");checks++;
+await connectionCard.getByRole("button",{name:"More actions for Delivery GitHub",exact:true}).click();assert(await connectionCard.getByRole("button",{name:"Copy to another owner",exact:true}).isVisible());await connectionCard.getByRole("button",{name:"Share linked access",exact:true}).click();await page.getByRole("heading",{name:"Share Delivery GitHub"}).waitFor();assert(await page.getByRole("group",{name:"Target credential owner"}).getByRole("button").isVisible());assert(await page.getByRole("textbox",{name:"New alias label",exact:true}).isVisible());checks++;await page.getByRole("button",{name:"Cancel",exact:true}).click();
await openSidebar();
const owner=page.getByRole("group",{name:"Credential owner"}).getByRole("button");await owner.focus();await owner.press("ArrowDown");await page.getByRole("option",{name:/Studio/}).waitFor();await page.getByRole("option",{name:/Studio/}).press("ArrowDown");await page.getByRole("option",{name:/Personal/}).press("Enter");
await page.getByRole("button",{name:"Add GitHub account",exact:true}).waitFor();assert.equal(await page.getByRole("heading",{name:"Delivery GitHub"}).count(),0);checks++;
@@ -60,10 +86,10 @@ try{
await openSidebar();await page.getByRole("button",{name:"Credential owners",exact:true}).click();await page.getByRole("textbox",{name:"New user ID",exact:true}).fill("client-a");await page.getByRole("textbox",{name:"Display label",exact:true}).fill("Client A");await page.getByRole("button",{name:"Create user",exact:true}).click();await page.getByRole("group",{name:"Credential owner"}).getByRole("button").filter({hasText:/Client A/}).waitFor();checks++;
await openSidebar();await page.getByRole("button",{name:"Credential owners",exact:true}).click();await page.getByRole("textbox",{name:"Target user ID",exact:true}).fill("client-main");await page.getByRole("textbox",{name:"New display label",exact:true}).fill("Client Main");await page.getByRole("button",{name:"Rename user",exact:true}).click();await page.getByRole("group",{name:"Credential owner"}).getByRole("button").filter({hasText:/Client Main/}).waitFor();checks++;
await openSidebar();await page.getByRole("button",{name:"Credential owners",exact:true}).click();await page.getByRole("textbox",{name:"Target user ID",exact:true}).fill("client-copy");await page.getByRole("textbox",{name:"New display label",exact:true}).fill("Client Copy");await page.getByRole("button",{name:"Duplicate user",exact:true}).click();await page.getByRole("group",{name:"Credential owner"}).getByRole("button").filter({hasText:/Client Copy/}).waitFor();checks++;
- await openSidebar();await page.getByRole("button",{name:"Credential owners",exact:true}).click();await page.getByRole("button",{name:"Delete user",exact:true}).click();await page.getByRole("textbox",{name:"Confirmation",exact:true}).fill("client-copy");await page.getByRole("button",{name:"Confirm",exact:true}).click();await page.getByRole("group",{name:"Credential owner"}).getByRole("button").waitFor();assert.equal(users.some(row=>row.id==="client-copy"),false);checks++;
+ await openSidebar();await page.getByRole("button",{name:"Credential owners",exact:true}).click();await page.getByRole("button",{name:"Delete user",exact:true}).click();await page.getByRole("textbox",{name:"Confirmation",exact:true}).fill("client-copy");await page.getByRole("button",{name:"Delete credential owner",exact:true}).click();await page.getByRole("group",{name:"Credential owner"}).getByRole("button").waitFor();assert.equal(users.some(row=>row.id==="client-copy"),false);checks++;
await openSidebar();await owner.click();await page.getByRole("option",{name:/Studio/}).click();await nav.getByRole("button",{name:"GitHub",exact:true}).click();await waitDelivery("after user CRUD returns to Studio and selects GitHub");
await page.getByRole("button",{name:"Add GitHub account",exact:true}).count();
- await page.getByRole("searchbox",{name:"Search integrations"}).fill("cloudflare");assert.equal(await page.locator(".integration-nav-group").first().getByRole("button",{includeHidden:true}).count(),14);assert.equal(await page.locator(".integration-nav-group").first().getByRole("button").filter({visible:true}).count(),1);checks++;
+ await page.getByRole("searchbox",{name:"Search integrations"}).fill("cloudflare");assert.equal(await page.locator(".integration-nav-group").first().getByRole("button",{includeHidden:true}).count(),providerCount);assert.equal(await page.locator(".integration-nav-group").first().getByRole("button").filter({visible:true}).count(),1);checks++;
await page.getByRole("searchbox",{name:"Search integrations"}).fill("");
assert.deepEqual(errors,[]);checks++;
console.log("Integrations browser: "+checks+" checks passed (Settings-style sidebar/detail, 320–1920 px, mobile drawer, light/dark, inline transfer, user CRUD).");
diff --git a/scripts/verify-build.sh b/scripts/verify-build.sh
index bcd41b3b..99a8b506 100755
--- a/scripts/verify-build.sh
+++ b/scripts/verify-build.sh
@@ -72,6 +72,12 @@ if ! node scripts/e2e/integrations-shell.mjs; then
exit 43
fi
+echo "== verify Integrations credential actions (synthetic accounts)"
+if ! node scripts/e2e/integrations.mjs; then
+ echo "verification failed during Integrations credential actions E2E" >&2
+ exit 43
+fi
+
echo "== verify native Google Integrations UI (synthetic accounts)"
if ! node scripts/e2e/google-integrations.mjs; then
echo "verification failed during native Google Integrations UI E2E" >&2
diff --git a/scripts/worktree-gates.test.ts b/scripts/worktree-gates.test.ts
index fd7692b4..2558dec4 100644
--- a/scripts/worktree-gates.test.ts
+++ b/scripts/worktree-gates.test.ts
@@ -57,6 +57,7 @@ function fixture(script: string) {
["scripts/check-bundle.mjs", "bundle budget"],
["scripts/e2e/bundle-performance.mjs", "deferred performance"],
["scripts/e2e/google-integrations.mjs", "native Google UI"],
+ ["scripts/e2e/integrations.mjs", "credential actions"],
["scripts/e2e/assistant-chat-ux.mjs", "Assistant chat UX"],
["scripts/e2e/macos-figma.mjs", "macOS chrome"],
["scripts/e2e/ios-lock.mjs", "iOS lock"],
@@ -137,6 +138,7 @@ describe("isolated worktree release guards", () => {
expect(run.stdout).toContain("isolated bundle budget fixture passed");
expect(run.stdout).toContain("isolated deferred performance fixture passed");
expect(run.stdout).toContain("isolated native Google UI fixture passed");
+ expect(run.stdout).toContain("isolated credential actions fixture passed");
expect(run.stdout).toContain("isolated Assistant chat UX fixture passed");
expect(run.stdout).toContain("isolated macOS chrome fixture passed");
expect(run.stdout).toContain("isolated iOS lock fixture passed");