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.

merge(workflow): preserve contextual quick-add and group focus on current canvas

Rahmanf83691036669
diff --cc docs/A2A.md
index 9254ae89,520454e0..912df0ab
--- a/docs/A2A.md
+++ b/docs/A2A.md
@@@ -86,28 -86,18 +86,40 @@@ mso a2a inbound rm <tokenId
The Settings → **A2A** panel exposes the same flow, shows the one-time token once, lists/revokes inbound profiles, and surfaces bounded task/audit activity.
+## A2A skill — provider-neutral workflow trace
+
+The official `a2a` Agent Skill also exposes an owner-authenticated **workflow trace bridge** for AI runtimes that are doing work locally through Codex CLI, Claude/Cloud CLI, Antigravity, or another Agent Skills-compatible CLI.
+
+This is intentionally separate from A2A protocol message streaming. Remote A2A remains a trust-domain boundary and does not inherit owner memory. The trace bridge runs only through the normal authenticated MSO owner CLI/MCP session and records concise observable milestones into one durable agent session plus one exact MSO workflow.
+
+Native MCP-capable agents should use `workflow_start`, `agent_session_note`, `agent_session_flow`, and `workflow_finish` directly. Shell-capable agents can use:
+
+```bash
+mso a2a trace start --intent "Implement the requested feature" --project my-project --agent codex
+mso a2a trace progress --run <run-id> --stage implement --message "Bounded implementation is complete."
+mso a2a trace evidence --run <run-id> --stage verify --message "Targeted tests passed."
+mso a2a trace context --run <run-id>
+mso a2a trace finish --run <run-id> --summary "Implemented and verified." --evidence @evidence.json
+```
+
+The bridge returns the durable `session_id`, exact `workflow_id`, a local `run_id`, and the isolated workspace when MSO created one. The same workflow id is attached to every milestone call, so semantic session flow and workflow receipts remain correlated for later agents.
+
+Allowed trace kinds are `plan`, `progress`, `action`, `evidence`, `blocker`, `result`, and `handoff`. They are summaries of observable work only. Hidden chain-of-thought, private reasoning, system/developer prompts, complete transcripts, credentials, cookies, and tokens must never be sent as trace events.
+
+Local correlation state lives under `~/.mso/private/a2a-traces` with owner-only permissions and contains identifiers/status only. It does not grant access to sessions from another MSO device/principal. `workflow_finish` still enforces the normal Evidence Receipt rules; streamed progress is context, not verification proof.
+
+ ## Relationship to Workflow and Organization
+
+ A2A is a **transport boundary**, not MSO's visual orchestration graph and not its organization chart.
+
+ - **Workflow Graph** owns repeatable automation topology: triggers, If/Switch, Merge, Loop Over Items, bounded Repeat Until, Execute Workflow/subflow, retry/error routing, and run receipts.
+ - **Organization** owns stable unit/seat identity, reporting lines, and the pointer from a seat to its current Project Agent, Local Agent, or remote A2A executor.
+ - **A2A** owns discovery, authentication, message/task lifecycle, streaming, cancellation, and the remote trust boundary.
+
+ A Workflow `agent` node may target an `orgSeatId`. If that seat currently maps to an A2A peer, runtime resolution reaches the existing `a2a_handoff` path; changing the concrete peer later does not rewrite the workflow. Likewise, a saved Session workflow can be called through Execute Workflow or bounded Repeat Until without turning A2A itself into a loop engine. This separation keeps transport credentials and remote task state out of portable workflow definitions and organization metadata.
+
+ See [Workflow Graph](./WORKFLOW-GRAPH.md) and [Organization](./ORGANIZATION.md).
+
## Same-host sessions are native Local Agents, not remote A2A
MSO 1.9 separates live same-host session communication from this remote interoperability protocol. `/agents`, `/message`, local `/delegate`, local inbox delivery, and the `local_agent_*` MCP tools use a private **presence lease + durable mailbox + SSE/event-bus** layer. They require no Agent Card, URL, registration, credential, refresh, or restart when another session appears or is renamed.
diff --cc docs/CHANGELOG.md
index b4bf37b6,23f23659..5ce08e09
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@@ -2,218 -2,7 +2,222 @@@
**Generated — do not edit.** `node scripts/gen-changelog.mjs`, run by `bun run ship`.
Newest first. `docs/PROGRESS.md` is the source of truth for *why* a change was made;
-this is the *what*, and it is what Settings → About shows as “What's new”.
+this is the *what*, and it is what Settings → Account → About shows as “What's new”.
+
+## 2026-09-30
+
+**Added**
+
+- `settings` surface MSO updates in footer
+- `assistant` show explicit run state and scoped approvals
+
+**Fixed**
+
+- `deps` update brace-expansion within supported major lines
+- `reconciliation` close combined environment and fixture contracts
+
+## 2026-09-29
+
+**Added**
+
+- `a2a` add provider-neutral workflow trace skill
+
+## 2026-09-28
+
+**Added**
+
+- `app-store` read bounded MANEF catalog metadata
+- `host` begin native platform runtime adapters
+- `store` import portable connected app manifests
+
+**Tests**
+
+- `host` exercise native macOS and Windows candidate build
+- `projects` isolate count and deadline continuation budgets
+
+**Chores**
+
+- `deps-dev` bump the development-minor-patch group across 1 directory with 3 updates
+- `deps` bump the actions-minor-patch group with 3 updates
+- `deps` bump the production-minor-patch group with 5 updates
+- `deps-dev` bump the test-toolchain group with 2 updates
+
+## 2026-09-27
+
+**Added**
+
+- `shell` persist and embed external app connections
+- `managed-apps` preflight install backend on host
+- `jev` persist reusable session capsules
+- `settings` nest version and updates under About
+
+**Fixed**
+
+- `settings` keep action labels readable on dark cards
+- `install` preserve portable host commits and validate WSL2
+- `jev` validate decision release contract
+- `jev` open responsive session details in release journey
+- `settings` align MCP release journey with breadcrumbs
+- `settings` scroll MCP pages without reading a ref during render
+
+**Docs**
+
+- `features` define modular external feature contract
+- `release` record Windows taskbar fidelity
+
+## 2026-09-26
+
+**Added**
+
+- `jev` productionize decision plane
+- `settings` add an Account section for profile, password, devices, and about
+- `jev` add policy-bound MCP actions
+- `workflows` isolate source-changing agents
+- `agent` recover interrupted sessions automatically
+- connect OpenRouter for JEV without switching model
+- route JEV through OpenRouter and preserve sessions
+- `integrations` clarify DOKU credential fields
+- `memory` expose backup history and checksum-bound verification receipts
+
+**Fixed**
+
+- `jev` close release contract gaps
+- `auth` rebuild the account profile before writing it
+- `windows` match native taskbar proportions
+- `worktrees` keep runtime paths out of build tracing
+- `memory` keep runtime backup paths out of build tracing
+- `tests` make recovery fixtures portable
+- `workflows` close source isolation bypasses
+- `config` document agent worktree root
+- tolerate bounded session name contention
+
+**Changed**
+
+- `mcp` preserve architecture line ratchet
+
+**Tests**
+
+- `memory` isolate backup panel accessibility and preserve failure evidence
+
+**Docs**
+
+- refresh changelog for Windows taskbar fidelity
+- `launch` focus demo on one verifiable agent journey
+- `launch` define measurable MSO readiness contract
+
+## 2026-09-25
+
+**Added**
+
+- `memory` preserve session sources and expose owner second brain
+- `integrations` add native Google OAuth and read-only APIs
+
+**Fixed**
+
+- `memory` exclude guarded runtime backup paths from build tracing
+- `integrations` expose native Google through MCP schemas
+
+**Docs**
+
+- `integrations` finalize native Google MCP verification
+- `integrations` record native Google verification
+
+**Other**
+
+- `memory` preserve non-destructive backup worker checkpoint
+- `memory` preserve bounded discovery worker checkpoint
+
+## 2026-09-24
+
+**Added**
+
+- `memory-graph` add an owner knowledge graph
+- `integrations` add JEV variables and AI providers tab
+- `workflows` add Jev flow optimizer
+
+**Changed**
+
+- `workflows` remove optimizer type cycle
+
+**Docs**
+
+- `integrations` record release verification
+
+**Chores**
+
+- `workflows` finalize Jev flow optimizer release
+
+## 2026-09-23
+
+**Added**
+
+- `mcp` add personal access tokens and auto-session fallback
+
+**Fixed**
+
+- `security` pin Termux guest installer payload
+- `architecture` keep Dokploy adapter within ratchet
+- `dokploy` sync public Docker build args
+- `security` restore federation gate checks
+- `termux` pin guest bootstrap and align platform contracts
+- `ci` keep PAT scope case parseable by strict Semgrep
+
+**Tests**
+
+- `channels` avoid secret-like Discord fixture
+- `termux` avoid check then read race in launcher fixture
+
+**Docs**
+
+- `mcp` record restored PAT quality gates
+- `termux` record PRoot isolation and verification
+
+**Other**
+
+- `channels` allowlist synthetic Discord fixtures
+
+## 2026-09-22
+
+**Added**
+
+- `channels` add Telegram and Discord channels
+- `federation` bridge Batonly to MSO and SI-Coder
+- `workflows` split n8n and improve org automation ux
+
+**Fixed**
+
+- `cli` cover federation status and PAT creation
+- `termux` make partial installs resumable on low memory
+- `mcp` restore main quality gates
+- `termux` replace legacy launcher symlink safely
+- `termux` isolate Linux runtime inside PRoot
+- `mcp` publish modern cache hints
+- `workflows` reopen details on node selection
+- `mcp` normalize widget resource discovery
+
+**Changed**
+
+- `graph` establish shared flow foundation
+- `ui` reduce organization and workflow chrome
+
+**Tests**
+
+- `workflows` update details selection contract
+
+## 2026-09-21
+
++**Added**
++
++- `workflows` refine builder and organization focus UX
++
+**Fixed**
+
+- `mcp` negotiate native app ui
+
+**Chores**
+
+- `deps-dev` bump the development-minor-patch group with 3 updates
+- `deps` bump the production-minor-patch group with 4 updates
## 2026-09-20
diff --cc docs/PROGRESS.md
index bdcf3110,38c42cec..3fe2d19c
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@@ -1,367 -1,13 +1,377 @@@
+## 2026-09-30 — Repository reconciliation candidate
+
+Integrated committed Update navigation, provider-neutral A2A traces, Assistant run state and scoped approvals, native host adapters, and the isolated CI runner. Historical branches with identical patches and package changes are reconciled as ancestry without replaying superseded source. The complete all-ref bundle was verified before cleanup. Dirty worktrees, stashes and unrelated legacy histories remain preserved until their work can be individually verified. Native host candidates remain outside the public installer pending physical-machine acceptance. This entry describes the integration candidate; main merge and runtime release require the normal gates.
+
+The combined suite identified a missing synthetic Assistant E2E fixture and undocumented A2A/PowerShell environment options; both are corrected without weakening validation.
+
+## 2026-09-29 — Provider-neutral A2A workflow trace skill
+
+Added the official `a2a` skill and `mso a2a trace` bridge so external AI CLIs can keep one owner-authenticated durable MSO session/workflow while they work. The bridge records only concise plan/progress/action/evidence/blocker/result/handoff summaries, correlates every milestone with the exact workflow id, exposes semantic context for later agents, and preserves MSO workflow isolation and Evidence Receipt gates. It explicitly rejects private chain-of-thought as a trace surface. Local run metadata is stored under the owner-private MSO state directory; remote A2A trust boundaries and cross-device session ownership remain unchanged.
+
+## 2026-09-28 — Bounded MANEF application catalog
+
+Added a versioned metadata catalog to manef-web and an Owner-only MSO reader. The site PR merged, but Vercel blocked its production deployment; live publication remains pending hosting access. The remote list may order existing reviewed Managed App adapters or offer a portable connection template; it cannot authorize a new installer, command, URL, credential or grant. Selecting a managed entry follows its existing preflight and setup; selecting a connected entry still requires an instance address and explicit Owner review. The server pins the catalog URL, bounds and validates the whole response, caches a valid copy for a short outage and leaves local installers available without the site. This completes remote discovery for this profile while generic installation recipes, domains and independent package releases remain separate work.
+## 2026-09-28 — Native host and shared relay groundwork
+
+A separate design contract maps the supplied Remote Desktop Commander actions onto MSO capabilities and defines the account, device, OAuth, scope, pairing, revocation and outbound connection boundaries for a shared mso.manef.dev/dashboard and /mcp service. The shared relay is not implemented or deployed; the hostname is not yet resolving.
+
+The host runtime now selects PowerShell for Windows PTYs, samples CPU on non-Linux systems, reads macOS/Windows process inventories, and parses OS-specific file-root delimiters. Candidate native Mac/Windows installer and foreground launcher build MSO with Node, Bun and node-pty in the host account and bind loopback; CI checks a fresh build and health route on both OS runner families. These candidates are not connected to the public installers. Physical-machine login, device approval, PTY, filesystem containment, update, service lifetime and remote MCP remain release gates. The public macOS Lima and Windows WSL2 paths remain the current installed release.
+
+## 2026-09-28 — Portable connected app manifests
+
+Added a bounded connected-app manifest profile and Store file/paste → review → connect journey. Portable publisher/version/presentation metadata stays separate from per-instance IDs and endpoints; one definition can connect several instances. The shared validator rejects unsupported fields/versions and executable payloads in both client and server. Import uses existing Owner authority, revision locking, cookie isolation and atomic registry storage. Connection edits preserve the original manifest and disconnect never touches service data. The starter JSON and current contract document what works; the full feature loader, verified remote manef.dev catalog and generic installers remain pending. No dependency on unrelated manef-ui/manef-db is introduced.
+
+The full coverage gate exposed an existing count-cap continuation test racing the independent four-second scan budget under load. Count-cap fixtures now use a controlled clock; an additional deterministic deadline case verifies that timed-out scans resume without losing or duplicating projects. Production scan limits and assertions remain unchanged.
+
+## 2026-09-27 — External feature contract and registry audit
+
+## 2026-09-27 — Readable Settings action labels
+
+PR95 CI exposed default Settings action labels at 4.13:1 against dark cards (and 4.0:1 on hover), below the required 4.5:1. Default action labels now use the same foreground token as other settings rows; icons retain the info tint and destructive labels retain their semantic color. The existing real-browser backup accessibility journey remains the release gate, without exclusions or reduced assertions.
+
+
+## 2026-09-27 — Server-persisted connected applications
+
+The Owner App Store now exposes real Managed Apps setup and a versioned external connection registry. Connected tools run separately and become dynamic shell windows without rebuilding MSO. Registry mutations share the surface-store lock and revision, reject cross-placement ownership and cookie-scope overlap, and never execute install scripts or delete service data. HTTP/no-domain connections open separately; n8n and registered tools share the reviewed iframe renderer. Legacy HTML manifests require registry admission. manef-ui and manef-db are unrelated and excluded. Remote catalog delivery and extraction of native features remain pending; see CONNECTED-APPS.md for the implemented boundary.
+
+
+Defined the v1 design contract for portable feature definitions, separate installation
+bindings and grants, embedded views, reviewed adapters, shell slots and lifecycle
+verification. Audited the existing AppShell, runtime App Store, SurfaceApp and Managed
+App registries against baseline 330d0cb4, with twelve findings and ordered migration
+gates. This documentation does not implement a dynamic plugin loader or broaden
+existing execution/embed permissions. The documentation map explicitly separates
+the proposed contract from current runtime references.
+
+## 2026-09-27 — Managed app host compatibility preflight
+
+Managed app definitions now declare the installer backends they actually support:
+Hermes user systemd or Docker, OpenClaw user systemd, and 9Router Docker.
+The install API checks the local Linux runtime and reachable backend before
+starting a job or downloading an artifact. This includes Android tablets hosting
+MSO under Ubuntu PRoot: MSO core can run there while applications whose runtime
+backend is unavailable are rejected with a specific reason. The 9Router
+not-installed diagnostic no longer mislabels an accessible Docker host as
+uncertain solely because its user systemd bus is absent.
+
+The Managed Apps documentation matches the reviewed Hermes Docker fallback.
+This step does not add a Docker daemon to Android PRoot or claim those three
+applications can all run on every tablet. Physical host verification remains open.
+
+## 2026-09-27 — Portable host installer safety
+
+An Android tablet with supported arm64/x86_64 architecture can host the MSO Linux
+runtime inside Termux/Ubuntu PRoot; the tablet does not require a second VPS.
+The adapter now rejects unsupported CPU architectures before package downloads.
+On rerun, the canonical core installer rejects a checkout whose current commit
+is not an ancestor of the fetched target. The Termux adapter only reattaches
+`main` when its old tip is an ancestor of the installed tip, avoiding the old
+forced branch reset over local commits. Both installer digest pins advance with
+the changed payloads. The Windows bootstrap now verifies the chosen distro is
+WSL2 before installing; when several distros exist without Ubuntu it asks for
+an explicit choice instead of taking the first list entry.
+
+Focused installer/platform/docs tests passed 39/39 plus TypeScript and shell syntax
+checks in an isolated worktree. A physical Android tablet and Windows/WSL2 host
+still need fresh-install, process-background, remote-access, update and recovery
+acceptance before those platforms can be claimed verified. This increment does
+not implement the managed app manifest, domain/IP provisioning or multi-host
+registry from the broader agnostic audit.
+
+## 2026-09-27 — JEV decision plane and value capsules
+
+JEV is now a versioned bounded decision plane rather than a Workflow-only adapter.
+Decision definitions, bounded state compilation, action proposal/execution separation,
+post-action semantic verification, memory admission, model/context/failure routing and
+metadata-only telemetry share one policy surface. JEV action proposals are held
+server-side, expire, bind the exact capability contract digest and can auto-execute only
+safe non-destructive reads through the existing MSO Capability Runtime; write/review/
+destructive candidates remain on the normal explicit tool path.
+
+Session preservation advances from a thin receipt to an exact-source
+`mso.jev-session-capsule.v1`. Every capsule is bound to the current session SHA-256 and
+byte count and retains bounded semantic steps, tool routes, artifact references, decision
+metadata and the LLM continuation packet. `agent_session_resume` automatically includes
+that capsule while the source identity still matches, so zero-recommendation sessions
+still have useful continuation value. Capsule existence remains preservation/value
+evidence and does not authorize deletion of raw session evidence.
+
+Integrations → AI Providers exposes JEV connection state, actual provider-reported usage
+separately from estimated avoided LLM impact, calibration/decision metadata, preservation
+coverage and an owner-only bounded JEV Lab. Workflow Sessions explicitly distinguish JEV
+DECISION, MCP ACTION and VERIFIED RESULT and show the continuation capsule value summary.
+
+The public MCP action contract advances to toolset `2026.09.27.1`. External clients that
+cache MCP descriptors must refresh or rescan actions before using the revised `jev_action`
+schema and read scope.
+
+## 2026-09-27 — Windows taskbar fidelity release
+
+The Windows desktop shell taskbar now follows the supplied Windows 11 reference
+instead of using generic dashboard-like chrome. It keeps the native 48px taskbar
+geometry, centers Start/search/apps, uses a 34px rounded search pill, keeps running
+windows as compact icon buttons, and moves VPS connection status into a
+Windows-style tray affordance. The trailing tray now presents locale,
+Wi-Fi/volume/battery, clock/date, and the thin Show Desktop target without changing
+the underlying shared window/control-center/status behavior. Browser locale selects
+the visible Search/Pencarian and ENG/IND labels; the shell remains portable rather
+than hardcoding one operator locale.
+
+PR #89 merged the taskbar implementation into main as 662e4179. Release validation
+is performed against exact merged main, not only the feature branch. The first
+exact-main full gate correctly found the Tool Forge fixture image absent on this
+host; the repository's explicit offline provisioning script restored that required
+test dependency. A later full-suite PTY timeout was isolated as environmental after
+the exact test passed twice standalone. Deployment remains gated on a clean complete
+release-gate run plus exact-SHA runtime/health/chunk/browser proof.
+## 2026-09-27 — Settings version, updates, and optional breadcrumbs
+
+Account still owns the profile, password, Devices, and the About overview.
+Version and software updates are nested pages under About, so `?section=about`
+stays the overview and `?section=about&page=version` (or `updates`) opens the
+detail. Version reads `/api/health` — the same build id, build SHA, and app
+version the watchdog already reports — and falls back to that same baked-in
+identity when the probe does not answer. Updates still calls the existing
+self-update API.
+
+Nested Settings pages opt into a trail with `SettingsFeatureCell`'s optional
+`breadcrumbs` prop. Omitting it renders the cell's children with no extra
+chrome. MCP's inbound pages use that same prop instead of a one-off back row.
+
+## 2026-09-26 — Settings Account section
+
+Settings now opens on an Account section. Rename, icon, and password reset live
+there, and Devices and About are reached from inside Account instead of as
+sibling sections. The display name and icon are the owner profile in
+`~/.mso/account.json`. The file stores a display name copied from validated
+code units and a raster icon re-encoded from magic-checked bytes, with mode
+0600 and an atomic rename. Password reset still rotates `OS_LOGIN_PASSWORD` in
+`.env.local` with the existing constant-time compare; it does not add a second
+password store. Deep links to `?section=devices` and `?section=about` still open
+those panels, and mobile back returns to Account.
+## 2026-09-26 — Crash-safe continuation and source-isolated agent work
+
+ChatGPT/MCP continuation no longer depends on the user recovering a dead tab or
+manually finding a durable session id. `agent_session_resume` can auto-select the
+newest relevant unfinished workflow/session by stable principal and project, return
+safe recent context plus a fresh `workflow_start` recipe, and return human session
+candidates rather than guessing when multiple unfinished tasks are plausible. Old
+workflow ids remain conversation-scoped and are never reused across sessions.
+
+Source-changing workflows now prepare a task-owned linked Git worktree after
+read-only discovery succeeds. Workflow-bound filesystem/project/shell mutations are
+restricted to that workspace; a dirty canonical checkout fails closed instead of
+being stashed, reset, or overwritten. Clean unused task worktrees may be removed
+only by their own workflow close path; changed work is preserved.
+
+The release reconciliation keeps both JEV session optimization and the new Workflow
+learning/second-brain surfaces. JEV archive receipts remain checksum-bound
+preservation evidence, but they are not deletion authority: fail-closed session
+preservation keeps raw archives until a separate explicit source-release policy
+exists. This supersedes the earlier same-day wording that a JEV receipt alone could
+authorize aged archive deletion.
+
+Conflict-focused regression coverage passed 35/35 plus TypeScript and targeted
+zero-warning ESLint before the full release gate. Full build/runtime evidence remains
+a separate release-stage requirement and is not implied by this entry.
+
+## 2026-09-26 — JEV session preservation + OpenRouter SSOT
+
+JEV now uses `~typesafe/jev-latest` through OpenRouter’s Decisions API by default. Its credential is read from the same `hostCredentialStore()` used by Settings → AI and Integrations → AI Providers, so MSO no longer needs a separate TypeSafe/JEV token for the normal path. Existing named MCP JEV connections and the `JEV` Integration Variable remain explicit diagnostic compatibility overrides. Workflow Sessions expose **Use JEV**, can copy a bounded `mso.jev-session-optimization.v1` packet for another LLM, and expose **Optimize all before cleanup**. Batch preservation covers both live durable sessions and archived compacted session snapshots. Old archive deletion is hard-gated by an exact SHA-256-bound JEV preservation receipt; unpreserved archives and their action indexes are retained instead of silently aging out.
+
+## 2026-09-26 — Make DOKU credential fields self-explanatory
+
+The native DOKU setup form now puts the official source beside each credential
+label instead of forcing the operator to interpret one generic help panel. Payment
+Client ID and Payment Secret Key link directly to the Sandbox and Production API
+Key surfaces; Payment Environment links to the environment guide and Sandbox
+registration. Safe, clearly synthetic placeholders show the expected shape without
+resembling a stored credential.
+
+Payment Environment is now explicit product language rather than an implied DOKU
+secret: it is the operator choice `sandbox` when the Client ID + Secret Key come
+from DOKU Sandbox/testing, or `production` when they come from the live DOKU
+Dashboard. The REST Secret Key remains distinct from the DOKU MCP API Key.
+
+The form renderer gains reusable per-field HTTPS reference links, so the same
+pattern can be applied to other integrations without duplicating provider-specific
+markup. Secret storage, masking, verification, and blank-to-keep behavior are
+unchanged.
+
+Verification: DOKU/setup regressions pass 23/23; TypeScript and zero-warning
+focused ESLint pass; the isolated Next.js production build, bundle budget,
+mandatory release E2E, native Integrations responsive shell journey, native Google
+Integrations regression, shell status checks, and deferred shell-performance gates
+all pass.
+
+## 2026-09-26 — Backup history and checksum-bound verification records
+
+Extended the existing owner-only server-memory backup, without creating another
+backup authority. Settings and CLI can page saved metadata, select an old snapshot
+for an explicit isolated restore check, distinguish partial coverage from recorded
+integrity, and show unreadable/error states instead of false empty or complete
+results. Manifest coverage totals are validated by one shared reader. Successful
+rehearsals retain an immutable checksum-bound receipt; old snapshots may lack one.
+
+Targeted synthetic manifest/history/receipt/API/CLI/transport tests pass. The
+mandatory release journey now includes the actual Settings backup UI at desktop,
+phone and landscape sizes, error/retry and accessibility checks, synthetic backup
+transport, and real API role refusals before any private backup access. Full gate
+and production evidence remain release obligations, not assertions made here.
+The first browser run also exposed an over-broad new test selector: it matched
+the desktop shell ancestor and included an existing Terminal window. The backup
+journey now names its exact feature root without disabling any accessibility rule.
+The observed Terminal tablist/input-label findings remain separate UI debt, not
+fixed by this selector correction. Failure receipts now include assertion errors
+and an explicit pass flag; an empty page-error list alone is never success.
+History pagination is not resumable copying. Source-release review, complete and
+offsite backup, learning coverage and Jev admission remain separate open work.
+
+## 2026-09-26 — Memory safety and second-brain visibility
+
+Implemented fail-closed session-source preservation, preview/confirmation-first
+owner cleanup, private local server-memory snapshots with isolated restore
+verification, owner-only cross-principal graph discovery, paginated archived
+learning with explicit errors and graph-persistence warnings, and bounded
+Organization/workflow/recipe links in the pinned Memory app.
+
+Full source verification passes 3,528 tests across 607 files with type, lint,
+coverage, architecture, documentation, contrast and high/critical audit gates.
+Runtime deployment and browser acceptance require the normal release proof.
+Full resumable
+backup, source-release review UI, cache-only cleanup separation and Jev memory
+admission remain open. No session, archive, memory, evidence or Docker volume was
+deleted by this work. See [Memory safety](./MEMORY-SAFETY.md) for behavior,
+interfaces and honest limits; operational receipts remain outside public source.
+
+## 2026-09-25 — Native Google Integrations foundation
+
+Native Google OAuth app configuration, Search Console and Google Analytics 4 now
+use the existing Integrations identity/store and generic UI/CLI/MCP dispatch.
+The consumer UI selects an OAuth app and opens Google consent instead of a
+Composio project-key form. App-only configuration remains distinct from user
+consent and actual API verification. Six bounded read operations cover property
+listing, search analytics, sitemap metadata, stored URL inspection, GA account
+summaries and GA4 reports. No Google write/event-sending action is introduced.
+
+The callback uses single-use state, PKCE, a separate host-only browser binding,
+issuing Owner-device/policy checks and app/connection revision pins. Runtime
+Google grants stay out of shared/copy/export DTOs. Native user authorization and
+actual property access still require an operator's real Google consent; tests
+with synthetic identities do not establish a production connection.
+
+Verification: all 3,505 tests in 598 files passed with TypeScript, zero-warning lint,
+architecture/documentation/skill/contrast gates and the high/critical dependency audit.
+The isolated production build, bundle budget, mandatory release browser journeys,
+new native Google UI journey (20 synthetic-account checks, light/dark mobile/desktop),
+all five shell status/performance checks and existing role/cookie isolation passed.
+The new Google UI is included in the mandatory build gate. Real Google account consent
+and property access remain an operator follow-through, not a synthetic-test claim.
+
+The pre-deploy MCP audit caught an omitted public operation enum before any
+production update. Native Google action names now come from the same operation
+catalog used by dispatch and UI; private setup methods share their enum with the
+native registry. Eight actual MCP descriptor/call regressions cover both full and
+ChatGPT profiles, scope refusal, private app setup and safe browser handoff.
+The MCP toolset advances to `2026.09.25.1`; clients caching descriptors must refresh
+before invoking newly added operations. The global tool count is unchanged.
+
+This is not full Composio provider/trigger/UI parity. The user's global embed
+padding/margin request remains a separate deferred task. Setup, exact operations,
+security controls and remaining phases are documented in
+[Native Google Integrations](./INTEGRATIONS-NATIVE-GOOGLE.md).
+
+## 2026-09-24 — Add a first-class Memory graph
+
+MSO now has a Memory app (`/memory`, Launchpad and Spotlight “Memory”, CLI `mso memory-graph`) for a navigable knowledge graph. The owner-only `GET /api/v1/memory-graph` builds it from an optional markdown vault (`OS_MEMORY_GRAPH_ROOT` or a path typed in the app, jailed to `OS_FS_READ_ROOTS`), project `.mso/KNOWLEDGE.md`, bounded repo-local `.agent` memory, the signed-in device’s typed agent memory, and assistant memories. Unresolved `[[wikilinks]]` become ghost nodes; folders and projects color groups. The client offers web, radial, and layered layouts plus a local hop neighbourhood, and opens a note in Code on a second click, double-click, or Open. Layout ideas follow open-silong’s memory graph (MIT). This is not the Workflow session graph and does not require Obsidian. Production picks it up with `mso update` after the commit is on `origin/main`; a GitHub merge does not rebuild the systemd service by itself.
+
+## 2026-09-24 — Integrations Variables + native AI Providers tab
+
+Integrations now has metadata-only variables that alias an exact named connection without copying credentials. variable.set / variable.delete are part of the existing integration_manage authority, integration_query view=variables exposes only safe references, rename/delete invariants prevent stale aliases, and an existing pre-variable mcp/jev connection can project a JEV alias without hardcoding a user. Workflow Optimizer Jev mode resolves JEV by default while preserving an explicit diagnostic override; endpoint/token remain private in Integrations.
+
+The native Integrations Settings-style manager adds **Variables** and **AI Providers** under Manage. AI Providers reuses Alfa's existing /api/config, /api/models/providers, /api/models, /api/models/test, and /api/oauth/openai surfaces for active provider/model selection, API-key updates, tests, OpenAI authorization, custom providers and disconnect. It does not introduce a second AI credential store. The MCP Page keeps secret-bearing AI management browser-only and links into the native page.
+
+Verification: focused regressions passed 46/46 across 11 files; full `bun run verify` passed (typecheck, lint, coverage, architecture/check and audit); `scripts/verify-build.sh` passed the isolated Next.js production build, bundle budget, Chromium readiness, mandatory release E2E, native Integrations desktop/mobile/landscape journey, five shell server-status checks and deferred-shell performance.
+
+## 2026-09-24 — Add review-first Jev Flow Optimizer for Workflow Graph
+
+MSO Workflow Graph now has a compact optimizer path without adding another global MCP tool. The existing `workflow_graph` surface owns `optimize_preview` and `optimize_clone`: preview never mutates the source graph, while clone requires the exact current revision and creates a new draft only when at least one optimization candidate is selected. The original workflow remains immutable during optimization.
+
+Optimizer v1 deliberately separates host authority from probabilistic judgment. MSO derives the eligible transformations, preserves capability scope/auth/confirmation/audit boundaries, and can run fully deterministic. Safe presentation grouping collapses consecutive action/context nodes through existing `metadata.customNodes` without changing execution. Structural compaction is narrower: three or more consecutive calls to the same read-only MSO tool can become one sequential Loop node carrying the exact already-prepared arguments, and this requires explicit review opt-in because the output shape changes. Write/exec tools, branched topology and referenced intermediate outputs are not compacted by this pass.
+
+Jev is optional and acts only as a decision kernel. A named direct Project MCP Integration keeps its endpoint/bearer private, applies an exact optional tool allowlist, and exposes bounded `mcp.tools.list` / `mcp.tool` execution through the existing Integration authority. The adapter discovers the remote tool schema first and supports both the bounded-alternative `jev_decide` contract and typed `state/questions` evaluators. Jev receives a compact workflow/candidate summary rather than graph credentials or new executable calls; it cannot invent arguments or bypass MSO policy. Unsupported/unavailable Jev falls back deterministically, and Jev mode reports decision-shadow agreement against the deterministic baseline without double-running workflows or duplicating side effects.
+
+The native Workflows UI adds Optimize with Analyze / Create optimized draft, provider/risk/probability summaries, node/edge reduction, fallback evidence and shadow agreement. Targeted optimizer/integration/MCP tests, Workflow Graph regressions, integration-model regressions, TypeScript, ESLint, zero-cycle architecture checks, docs/contrast/skill/audit gates, isolated production build, bundle budget and the full desktop/mobile release E2E all pass.
+
+## 2026-09-23 — Bind public Dokploy build env to Docker build args
+
+The bounded Dokploy public-build environment operation now writes each approved public key to both the application runtime env and Docker build args before queueing one redeploy. This closes the staging gap where a value such as NEXT_PUBLIC_CONVEX_URL existed at runtime but Docker ARG still received an empty value during image build. Secret/server keys remain rejected, existing build secrets and unrelated build args are preserved, and an already-synchronized key is idempotent without another deploy.
+
+A credential-isolated regression verifies runtime env, build args, preservation of neighboring settings, single redeploy, idempotent reread, and no public value reflection in the operation result.
+
+## 2026-09-23 — Add native Channels for Telegram and Discord
+
+MSO now has a first-class **Channels** application and provider-neutral messaging runtime. Telegram and Discord are adapters over one shared channel contract rather than separate feature implementations. Channel records contain only routing metadata and exact native Integrations references; bot tokens and webhook secrets remain in Integrations.
+
+Telegram supports Bot API credential verification, outbound text, normalized webhook events and webhook-secret validation. Discord supports REST bot verification, outbound channel messages, signed Ed25519 Interactions including PING/PONG, and normalized command/component/modal events. Discord Gateway message ingestion is explicitly not claimed.
+
+Native Workflows gains `Channel Trigger` and `Channel Send` nodes. Verified inbound events use the existing Workflow Graph engine and durable session/run machinery instead of a parallel automation runtime. The Channels UI exposes connection health, enabled state, default target, workflow binding, provider inbound URL, test, edit/delete and test-message controls, with direct navigation back to Integrations when setup is missing.
+
+Focused provider/schema/store/API tests and TypeScript verification cover the new boundary. `docs/CHANNELS.md` records runtime, security and capability truth.
+## 2026-09-23 — Isolate Termux installations inside Ubuntu PRoot
+
+The Termux adapter now starts installation and the generated CLI launcher with a fresh guest environment, explicit Linux-only PATH and non-root owner. It rejects an Android Node/Bun runtime accidentally visible inside the guest, retains the legacy native launcher target while replacing its symlink, and supports bounded build workers, Node heap, resumable installs and a private persistent install log for low-memory tablets. Shell tests exercise the exact guest argv boundary, hostile inherited environment, argument forwarding and failed guest-runtime probes without installing packages. The launcher test reads its generated file directly instead of first checking filesystem metadata, avoiding a check/read race flagged by CodeQL.
+
+## 2026-09-23 — Restore quality gates after the MCP personal token release
+
+The personal access token and automatic session change on main grew the Settings token view and MCP store past the repository's strict line limit. The UI dialog is now its own component, and token administration, state mutation and record types are split into focused MCP modules while preserving the existing hashed-token storage, lock and revocation behavior. Settings connection instructions and CLI entry points remain aligned with the token flow. This restores lint for the current main feature without weakening the line limit.
+
+Typecheck, zero-warning ESLint, the full coverage suite (3,369 tests), architecture, docs, contrast, skill-flow, instance-literal and high/critical dependency audit passed after provisioning the repository's isolated Tool Forge fixture image on this host. One lock-contention test failed on the first highly concurrent run; it passed alone and in the clean full rerun. Hosted Semgrep initially rejected a valid but single-line Bash `case` PAT scope guard as a partial parse in strict mode; the equivalent multiline form has zero parser errors and zero findings under the exact pinned image and rule set.
+
+## 2026-09-22 — Reduce Organization and Workflow chrome after first production pass
+
+The first Organization/Workflow/n8n release fixed the structural problem but still left too much chrome around the actual work. This polish pass removes a second overview header, boxed summary metrics and card-within-card counters from Organization. Unit and seat directories now use one compact search/status row and denser cards with inline operational metadata. The overview Directory/Map control moves into the primary Organization header, project tabs lose explanatory filler, and the redundant cross-app shortcut block is removed from the Organization sidebar.
+
+Workflow drops the duplicated Active toggle + lifecycle selector in favor of one explicit Status control. The secondary keyboard-help sentence is removed from the canvas toolbar, cross-app shortcuts no longer occupy Workflow actions, and the seven horizontally scrolling detail tabs are replaced by a narrow vertical icon rail with accessible labels/tooltips. n8n keeps navigation links in its empty-state guidance but removes duplicate Workflows/Organization/Integrations buttons from the configured editor toolbar. These changes reduce visual density without removing capabilities or changing auth/execution ownership.
+
+TypeScript, focused ESLint, architecture/docs/contrast/skill checks, targeted regressions, production build and the full release browser journey all pass across desktop, mobile and landscape.
+
+## 2026-09-22 -- Match ext-apps widget discovery after ChatGPT ecosystem 404
+
+A browser-console capture finally exposed the host failure that ordinary MCP logs could not see. ChatGPT correctly selected the registered MSO app, exact action name and ui:// template pointer, but its internal /backend-api/ecosystem/widget request returned HTTP 404 for the Native probe, Block, List, Page and integration_setup_open. At the same time MSO's own telemetry showed successful resources/read for the product resources, proving that public HTTPS, OAuth, resource bytes and MCP MIME delivery were not the failing boundary. A private equality check also proved the stored OpenAI App binding matches the ChatGPT connector ID exactly, without printing the App ID.
+
+The remaining MSO compatibility gap was in registration/discovery normalization. MSO already emitted canonical _meta.ui.resourceUri, but unlike the official ext-apps helper it did not mirror that URI into the compatibility _meta["ui/resourceUri"] field, and resources/list discarded each resource's _meta.ui even though the helper keeps listing-level UI metadata for host indexing. All five resource-bound tools now publish both URI forms while keeping _meta.ui.resourceUri authoritative; resources/list preserves bounded resource _meta; Block retains its older openai/outputTemplate fallback and the other tools do not gain it.
+
+Because the failing ChatGPT widget URLs are cache/index keys, all four canonical resources were also advanced to fresh URIs: native-probe-v2, block-v5, list-v3 and page-v16. The immediately previous canonical URIs remain read-only aliases so already-scanned clients do not break, but are not advertised. Regression now locks flat/nested descriptor parity, listing-level resource metadata and previous-URI aliases. MCP server/toolset identity advances to 1.15.3 / 2026.09.22.2. Final visual acceptance still requires a fresh ChatGPT Scan Tools snapshot and a new app-selected conversation; success means the internal widget request no longer returns 404, the component is visibly mounted, and a real component action round-trip succeeds.
+
+## 2026-09-22 — Negotiate MCP Apps UI and expose host-boundary telemetry
+
+The Native UI probe proved that MSO's tool descriptor, `ui://` resource, MCP App MIME and static HTML were valid, yet direct host acceptance still returned the structured fallback. The missing server-side contract was capability negotiation: MSO advertised its Skills extension but never declared `io.modelcontextprotocol/ui` during either legacy `initialize` or modern `server/discover`. A host could therefore execute the tool successfully without having a negotiated MCP Apps presentation channel.
+
+MSO now advertises the UI extension with `text/html;profile=mcp-app` in both protocol eras while preserving ordinary structured/text fallback for non-UI clients. Owner-private protocol telemetry records only whether initialize/discover saw compatible client UI capabilities and whether `resources/list` / `resources/read` occurred, including bounded URI/MIME/state/duration metadata but never resource HTML or credentials. Regression covers bilateral negotiation and redacted resource lifecycle. The reference MCP Inspector reports the minimal probe as `hasApp:true` with the expected URI, model/app visibility, CSP and MCP App MIME.
+
+This release fixes the MSO-owned negotiation gap; it does not redefine visual acceptance. A generic Code Mode/function wrapper can still unwrap the inner tool result and cannot prove host mounting. Final ChatGPT acceptance remains a direct registered-app invocation after the refreshed server descriptor is active, with success defined by a visibly host-mounted `MSO NATIVE UI WORKS` component and then a real List → Page interaction round-trip.
+
+## 2026-09-22 — Split n8n from Workflows and make Organization/Workflow usable at scale
+
+The Organization project map had become visually unreadable on dense units because the initial canvas fit tried to show the entire graph at once. Organization is now directory-first: the owner sees searchable unit cards and operational counts, opens a unit into explicit Projects/Seats surfaces, and can switch to relationship maps only when topology matters. Seat browsing follows the same directory-first rule. Shared graph fitting now supports a representative readable initial cluster while preserving `F` as full-graph fit, and the Organization sidebar exposes direct Workflows, Integrations and System links without changing capability authority.
+
+External n8n is no longer a provider tab inside native Workflows. It is a first-class `/n8n` app/route with its own reviewed surface placement, cookie-isolated authentication boundary, responsive embed/fallback, and direct links back to native Workflows, Organization and Integrations. Legacy reviewed `workflows` placement remains readable during migration, while new registrations use `n8n`. Role-filtered or unavailable apps now show a neutral unavailable-state instead of the misleading `Unknown app` message.
+
+Native Workflows gained the missing core management pieces needed for practical n8n-style self-hosted parity: persistent owner-private data tables plus a `data_table` node; execution stop/retry/delete controls; portable `.mso-workflow.json` import/export; clearer Builder/Current run/Executions/Versions/Variables/Data/Directory panels; a denser workflow library; and toolbar overflow behavior that keeps wide action sets from pushing the canvas beyond its pane. Execution retry retains runtime input only in the private receipt, strips it from public receipts, requires the current graph revision to match, and stop remains cooperative at bounded node boundaries. Credentials remain owned by Integrations, Organization remains units/seats/projects/routing context, and Workflow remains automation topology/execution. `docs/N8N-PARITY.md` records the domain map rather than claiming pixel/API parity or copying n8n billing/marketplace administration.
+
+Verification on the isolated candidate: TypeScript, ESLint, architecture/docs/contrast/skills/instance-literal checks, the full coverage gate, production build, and the complete release E2E all pass, including dedicated n8n, Organization flow, custom graph, desktop/mobile/landscape reflow, data-table/portability/execution-control regressions, and no browser errors.
+
+ ## 2026-09-21 — Tighten Workflow builder UX and Organization group focus
+
+ The bounded Repeat Until release completed the missing control-flow primitive, but the visual construction path still required more ceremony than mature workflow editors: node creation was a flat popover, adding a next step meant creating then wiring it manually, and collapsed Organization project groups could not become an explicit focus context. This pass improves those interaction gaps without changing Workflow execution authority or Organization persistence.
+
+ Workflows now uses a categorized node creator across Triggers, Actions, AI, Flow and Context, with search, keyboard-first first-result insertion, clearer node-family cards, and a contextual **+** on every executable output. Quick-add opens an after-node picker that intentionally excludes triggers, positions the new node to the right with sibling spacing, preserves the exact branch handle, creates the edge in the same editor mutation and opens the new node in Inspector. The reusable subflow node is presented as **Execute Workflow** while retaining the existing `subflow` contract. Canvas cards now distinguish node families and surface live run state more clearly. Collapsed Workflow groups can be selected and managed directly instead of behaving like inert proxies.
+
+ Organization project-flow groups now act as Paperclip-style focus boundaries without changing the Organization data model. Selecting a collapsed group opens a member summary, permits direct member navigation, focus/exit-focus, expand/collapse and presentation-only ungrouping. Group focus keeps all members plus their one-hop external dependencies visible; search also resolves group names. The implementation remains presentation/context metadata only: reporting lines, seat routing, Workflow topology and agent/A2A execution authorities stay in their existing stores.
+
+ Documentation was reconciled across Workflow Graph, Organization, A2A and Automation Flows. The n8n-parity section now distinguishes practical interaction parity from visual cloning and explicitly records remaining gaps such as n8n's richer drag/drop data mapper and community-node ecosystem. A2A now states that it is the remote transport boundary, while Workflow owns repeatable topology and Organization owns stable seat/routing identity. Targeted regression, typecheck, lint and full `bun run verify` pass on the candidate working tree; the committed candidate must still pass the official isolated build/browser release gate before shipping.
+
## 2026-09-21 — Add bounded Repeat Until for reusable Session workflows
Workflow Graph could already save successful/reviewable Session action history as a private workflow draft and invoke saved workflows through Subflow, but its graph schema deliberately rejected cyclic edges and the existing `loop` node only iterated arrays. That left ordinary automation patterns such as “run this saved task, inspect its result, and try again until ready” without a native bounded control-flow primitive.
diff --cc docs/WORKFLOW-GRAPH.md
index 6656d53b,cdbbb278..b430dd23
--- a/docs/WORKFLOW-GRAPH.md
+++ b/docs/WORKFLOW-GRAPH.md
@@@ -172,15 -169,55 +173,28 @@@ AI assistance has an isolated workflow-
Run automatically saves a dirty graph before execution, so execution always uses the revision visible in the editor. Disabled connections remain visible in the graph and receipts but are excluded from runtime traversal, cycle checks and tidy layout; a target reachable only through disabled connections is skipped rather than silently promoted to a new root.
+ ### Canvas construction UX
+
+ The native editor follows the same construction rhythm users expect from tools such as n8n without copying n8n code or branding:
+
+ 1. **Add node** opens a searchable category browser rather than a flat technical type list.
+ 2. Hover any executable output and use **+** to choose the next node in context. Trigger nodes are omitted because a connected trigger would violate the graph contract.
+ 3. The new node is placed to the right of its source, connected through the exact branch handle (`true`, `false`, switch case, `done`, `exhausted`, or ordinary output), and opened in Inspector immediately.
+ 4. Node cards separate Trigger / Action / AI / Flow / Context families visually and surface running/completed/failed state without changing the stored definition.
+ 5. Multi-select grouping remains presentation-only. Selecting a collapsed group makes it manageable directly on the canvas; expanding restores its original executable members and ports.
+
+ The result is a fast visual-builder path while the saved Workflow Graph remains the execution SSOT. There is no hidden browser-local automation state.
+
+
-## Reviewed external workflow tabs
+## Dedicated n8n workspace
-The Workflows workspace keeps the native MSO automation/session editor and can add
-external editors such as n8n as sibling tabs. External tabs are **off by default**.
-The owner-reviewed Page registry is shared through `lib/surfaces/config.ts`; add
-`"placements": ["workflows"]` to an approved external app in the existing
-`~/.mso/surface-apps.json` (or its configured override). Preserve existing entries.
-Workflow-only placements do not appear in the MCP Page catalog or grant ChatGPT a
-nested-frame origin. Legacy entries without placements retain their Page behavior;
-explicit `"mcp-page"` is a separate reviewed placement.
-For example, a private installation could add:
+n8n is a separate first-class MSO app at `/n8n`; it is no longer mounted as a sibling tab inside native Workflows. `/workflows` now always opens the native Workflow Graph editor, so external editor loading, authentication, or frame policy cannot shrink or replace the native canvas.
-```json
-{
- "id": "n8n", "title": "n8n", "description": "External workflow editor",
- "origin": "https://automation.example.test", "startPath": "/home/workflows",
- "renderer": "iframe", "presentation": "inline", "environment": "production",
- "externalAuthPath": "/signin", "placements": ["workflows"],
- "sandbox": "allow-scripts allow-same-origin allow-forms allow-downloads allow-popups allow-popups-to-escape-sandbox"
-}
-```
+Reviewed n8n presentation metadata still uses the owner-private surface registry in `lib/surfaces/config.ts`. New n8n registrations should use `"placements": ["n8n"]`. The compatibility reader also accepts an existing n8n registration using the legacy `"workflows"` placement so operators can migrate without losing access. The registry contains presentation metadata only; Integration credentials are never returned through this surface.
-`GET /api/v1/workflow-embeds` and `mso workflow embeds` return only reviewed
-presentation metadata to an approved Owner device. They never return Integration
-credentials. The Owner-only POST and `mso workflow embed-save` accept `{app, expectedRevision, confirm:true}`; they validate metadata, preserve unrelated entries and reject stale revisions or environment-managed configuration. No raw file or credential access is exposed.
-The registry is refreshed when the window regains focus, without a
-rebuild. External frames load on first selection; switching tabs preserves both
-the native editor's unsaved state and the external editor's frame. Keyboard tab
-navigation and narrow viewport layouts use the same workspace wrapper.
-
-MCP authorization does not sign the browser into n8n. Use the visible **Sign in**
-link to authenticate directly with the external service, then reload its frame.
-**Open** remains available if its frame policy or browser cookie policy prevents
-embedding. MSO does not strip upstream security headers, proxy credentials, or
-claim that an iframe load proves authentication. Own-cockpit origins and
-remote-only registry entries never become embedded frames.
+The dedicated n8n app keeps the same cookie-isolation rule: a reviewed external destination is blocked when it would receive the MSO cockpit session cookie. n8n retains its own login and cookies; MSO does not proxy credentials or remove upstream frame/security headers. If embedding is unavailable, the app exposes the reviewed top-level destination instead.
+
+Native feature ownership is documented in [`N8N-PARITY.md`](./N8N-PARITY.md): Workflows owns automation topology/execution/history/versions/variables, Organization owns units/seats/projects/routing context, and Integrations owns credentials/connections.
## CLI
diff --cc frontend/slices/organization/components/project-flow.tsx
index 4344c452,91a0745a..a435f6cc
--- a/frontend/slices/organization/components/project-flow.tsx
+++ b/frontend/slices/organization/components/project-flow.tsx
@@@ -37,40 -34,30 +37,43 @@@ const nodeTypes = { project: ProjectCar
type Props = { unit: OrganizationUnit; onSave: (action: OrganizationFlowAction, data: Record<string, unknown>) => Promise<void> };
export function ProjectFlow({ unit, onSave }: Props) {
const flow = useMemo(() => unit.projectFlow ?? emptyOrganizationFlow(), [unit.projectFlow]);
- const [query, setQuery] = useState(""), [selectedId, setSelectedId] = useState<string | null>(null), [selectedGroupId, setSelectedGroupId] = useState<string | null>(null), [focus, setFocus] = useState(false);
+ const [query, setQuery] = useState(""), [selectedId, setSelectedId] = useState<string | null>(null);
++ const [selectedGroupId, setSelectedGroupId] = useState<string | null>(null);
+ const [viewMode, setViewMode] = useState<ViewMode>("focus"), [focusDepth, setFocusDepth] = useState(1);
const [draft, setDraft] = useState<FlowDraft | null>(null), [error, setError] = useState(""), [busy, setBusy] = useState(false);
const groups = useMemo(() => flow.customNodes ?? [], [flow.customNodes]);
const pending = useRef(false);
- const visible = useMemo(() => organizationProjectFlowVisibleIds({
- nodes: flow.nodes,
- edges: flow.edges,
- groups,
- query,
- focusNodeId: focus ? selectedId : null,
- focusGroupId: focus ? selectedGroupId : null,
- }), [flow.nodes, flow.edges, groups, query, focus, selectedId, selectedGroupId]);
+ const nodeIds = useMemo(() => flow.nodes.map((node) => node.id), [flow.nodes]);
++ const selectedGroup = selectedGroupId ? groups.find((group) => group.id === selectedGroupId) : undefined;
++ const selectedGroupMembers = selectedGroup ? flow.nodes.filter((node) => selectedGroup.nodeIds.includes(node.id)) : [];
+ const visible = useMemo(() => {
+ const search = query.trim().toLowerCase();
+ if (search) {
+ const matches = flow.nodes
+ .filter((node) => `${node.title} ${node.summary} ${node.kind}`.toLowerCase().includes(search))
+ .map((node) => node.id);
+ if (!matches.length) return new Set<string>();
+ return new Set(graphFocusClusterIds(nodeIds, flow.edges, matches, { depth: 1, maxNodes: 36, fallbackLimit: 1 }));
+ }
+ if (viewMode === "map") return new Set(nodeIds);
- return new Set(graphFocusClusterIds(nodeIds, flow.edges, selectedId ? [selectedId] : [], {
++ return new Set(graphFocusClusterIds(nodeIds, flow.edges, selectedGroup ? selectedGroup.nodeIds : selectedId ? [selectedId] : [], {
+ depth: focusDepth,
+ maxNodes: focusDepth > 1 ? 24 : 12,
+ fallbackLimit: 1,
+ }));
- }, [flow.edges, flow.nodes, focusDepth, nodeIds, query, selectedId, viewMode]);
++ }, [flow.edges, flow.nodes, focusDepth, nodeIds, query, selectedId, selectedGroup, viewMode]);
const mapped = useMemo(() => {
const base: FlowNode[] = flow.nodes.map((item) => ({ id: item.id, type: "project", position: item.position, data: { item } }));
const lines: Edge[] = flow.edges.map((edge) => ({ ...edge, type: "routed", markerEnd: { type: MarkerType.ArrowClosed, width: 20, height: 20, color: "var(--muted-foreground)" }, style: { stroke: "var(--muted-foreground)" } }));
- const result = projectCustomNodes(base, lines, groups, selectedId ? [selectedId] : []);
+ const result = projectCustomNodes(base, lines, groups, selectedGroupId ? [selectedGroupId] : selectedId ? [selectedId] : []);
const ids = new Set(result.nodes.filter((node) => node.type === "customGroup" ? node.data.group.nodeIds.some((id) => visible.has(id)) : visible.has(node.id)).map((node) => node.id));
return { nodes: result.nodes.filter((node) => ids.has(node.id)), edges: result.edges.filter((edge) => ids.has(edge.source) && ids.has(edge.target)) };
- }, [flow.edges, flow.nodes, groups, selectedId, visible]);
- }, [flow.nodes, flow.edges, groups, selectedGroupId, selectedId, visible]);
++ }, [flow.edges, flow.nodes, groups, selectedGroupId, selectedId, visible]);
const { nodes, edges, onNodesChange, onEdgesChange, reset } = useGraphProjection<CanvasNode, Edge>(mapped);
const selectedIds = nodes.filter((node) => node.selected).map((node) => node.id);
- const selected = selectedIds.length <= 1 ? flow.nodes.find((node) => node.id === selectedId) : undefined;
- const selectedGroup = selectedGroupId ? groups.find((group) => group.id === selectedGroupId) : undefined;
- const selectedGroupMembers = selectedGroup ? selectedGroup.nodeIds.map((id) => flow.nodes.find((node) => node.id === id)).filter((node): node is NonNullable<typeof node> => Boolean(node)) : [];
+ const selected = selectedIds.length <= 1 && selectedId && visible.has(selectedId) ? flow.nodes.find((node) => node.id === selectedId) : undefined;
+ const viewportIds = nodes.map((node) => node.id).slice(0, viewMode === "map" && !query ? 0 : 12);
+
const save = async (action: OrganizationFlowAction, data: Record<string, unknown>) => {
if (pending.current) throw new Error("A change is still saving. Try again after it completes.");
pending.current = true; setBusy(true); setError("");
@@@ -79,49 -66,50 +82,59 @@@
finally { pending.current = false; setBusy(false); }
};
const quickSave = (action: OrganizationFlowAction, data: Record<string, unknown>) => { if (pending.current) return; void save(action, data).catch(() => reset()); };
- const changeGroups = (customNodes: GraphCustomNode[]) => { quickSave("flow_custom_nodes", { customNodes }); setSelectedId(null); };
+ const changeGroups = (customNodes: GraphCustomNode[]) => {
+ quickSave("flow_custom_nodes", { customNodes });
+ setSelectedId(null);
- if (selectedGroupId && !customNodes.some((group) => group.id === selectedGroupId)) { setSelectedGroupId(null); setFocus(false); }
++ if (selectedGroupId && !customNodes.some((group) => group.id === selectedGroupId)) { setSelectedGroupId(null); }
+ };
const move = (items: CanvasNode[]) => {
- let moved = flow.nodes;
- for (const item of items) { const group = groups.find((row) => row.id === item.id); moved = group ? moveCustomNode(moved, group, item.position) : moved.map((node) => node.id === item.id ? { ...node, position: item.position } : node); }
+ const moved = moveGraphNodesWithCustomGroups(flow.nodes, groups, items);
const positions = moved.filter((node, i) => node.position !== flow.nodes[i].position).map(({ id, position }) => ({ id, position }));
if (positions.length) quickSave("flow_nodes_move", { positions });
};
- const selectNode = (id: string | null) => { setSelectedId(id); if (id && viewMode === "focus") setFocusDepth(1); };
- return <div data-slot="organization-project-flow" className="flex h-full min-h-0 flex-col">
- <div className="flex shrink-0 flex-wrap items-center gap-2 border-b px-3 py-2">
- <div className="min-w-0 flex-1"><div className="truncate text-sm font-medium">{flow.title}</div><p className="text-[10px] text-muted-foreground">{flow.nodes.length} nodes · {flow.edges.length} connections · {busy ? "Saving…" : "Stored in this organization"}</p></div>
- <Button variant="outline" size="sm" onClick={() => setDraft({ kind: "notes" })}><FileText className="mr-1 size-3.5"/>Notes</Button>
- <Button variant="outline" size="sm" disabled={flow.nodes.length < 2 || busy} onClick={() => setDraft({ kind: "edge" })}><Link2 className="mr-1 size-3.5"/>Connect</Button>
- <Button size="sm" disabled={busy} onClick={() => setDraft({ kind: "node" })}><Plus className="mr-1 size-3.5"/>Node</Button>
- <div className="flex w-full items-center gap-2"><Input aria-label="Search project flow" className="h-8 min-w-0 flex-1" placeholder="Search projects, activities, groups, or notes…" value={query} onChange={(e) => setQuery(e.target.value)}/><Button size="sm" variant={focus ? "secondary" : "outline"} disabled={!selected && !selectedGroup} onClick={() => setFocus(!focus)}>{focus ? "Exit focus" : selectedGroup ? "Focus group" : "Focus"}</Button></div>
++ const selectNode = (id: string | null) => { setSelectedGroupId(null); setSelectedId(id); if (id && viewMode === "focus") setFocusDepth(1); };
+
+ return <div data-slot="organization-project-flow" className="@container flex h-full min-h-0 flex-col">
+ <div className="flex shrink-0 flex-wrap items-center gap-2 border-b px-3 py-2 [@media(max-height:520px)]:flex-nowrap [@media(max-height:520px)]:py-1">
+ <div className="min-w-0 flex-1 [@media(max-height:520px)]:hidden"><div className="truncate text-sm font-medium">{flow.title}</div><p className="text-[10px] text-muted-foreground">{flow.nodes.length} nodes · {flow.edges.length} connections · {visible.size} visible · {busy ? "Saving…" : "Stored in this organization"}</p></div>
+ <Button variant="outline" size="sm" className="[@media(max-height:520px)]:size-8 [@media(max-height:520px)]:px-0" onClick={() => setDraft({ kind: "notes" })}><FileText className="mr-1 size-3.5 [@media(max-height:520px)]:mr-0"/><span className="[@media(max-height:520px)]:sr-only">Notes</span></Button>
+ <Button variant="outline" size="sm" className="[@media(max-height:520px)]:size-8 [@media(max-height:520px)]:px-0" disabled={flow.nodes.length < 2 || busy} onClick={() => setDraft({ kind: "edge" })}><Link2 className="mr-1 size-3.5 [@media(max-height:520px)]:mr-0"/><span className="[@media(max-height:520px)]:sr-only">Connect</span></Button>
+ <Button size="sm" className="[@media(max-height:520px)]:size-8 [@media(max-height:520px)]:px-0" disabled={busy} onClick={() => setDraft({ kind: "node" })}><Plus className="mr-1 size-3.5 [@media(max-height:520px)]:mr-0"/><span className="[@media(max-height:520px)]:sr-only">Node</span></Button>
+ <div className="flex w-full min-w-0 flex-wrap items-center gap-2 [@media(max-height:520px)]:w-auto [@media(max-height:520px)]:flex-1 [@media(max-height:520px)]:flex-nowrap">
+ <Input aria-label="Search project flow" className="h-8 min-w-40 flex-1 [@media(max-height:520px)]:min-w-24" placeholder="Search projects, activities, or notes…" value={query} onChange={(event) => setQuery(event.target.value)}/>
+ <div className="flex shrink-0 items-center rounded-lg border p-0.5">
+ <Button size="sm" variant={viewMode === "focus" ? "secondary" : "ghost"} className="h-7" onClick={() => setViewMode("focus")}><LocateFixed className="mr-1 size-3.5"/>Focus</Button>
+ <Button size="sm" variant={viewMode === "map" ? "secondary" : "ghost"} className="h-7" onClick={() => setViewMode("map")}><Network className="mr-1 size-3.5"/>Map</Button>
+ </div>
+ {viewMode === "focus" && !query ? <Button size="sm" variant="outline" className="h-8" onClick={() => setFocusDepth((depth) => depth === 1 ? 2 : 1)}>{focusDepth === 1 ? "Expand neighbors" : "Collapse cluster"}</Button> : null}
+ </div>
</div>
- <GraphCustomControls groups={groups} selectedIds={selectedIds} nodeIds={flow.nodes.map((node) => node.id)} onChange={changeGroups} disabled={busy}/>
+ {groups.length || selectedIds.length ? <GraphCustomControls groups={groups} selectedIds={selectedIds} nodeIds={flow.nodes.map((node) => node.id)} onChange={changeGroups} disabled={busy}/> : null}
{error ? <div role="alert" className="shrink-0 border-b px-3 py-2 text-xs text-destructive">{error} Refresh the organization before retrying a conflicting change.</div> : null}
- <div className="relative min-h-0 flex-1">
- {flow.nodes.length ? <GraphCanvas<CanvasNode, Edge>
- ariaLabel="Organization project flow canvas" nodes={nodes} edges={edges} nodeTypes={nodeTypes} edgeTypes={graphRoutedEdgeTypes}
- nodesDraggable={!busy} nodesConnectable={!busy} deleteKeyCode={null} onNodesChange={onNodesChange} onEdgesChange={onEdgesChange}
- onNodeClick={(event, node) => {
- if (event.ctrlKey || event.metaKey) return;
- if (node.type === "customGroup") { setSelectedGroupId(node.id); setSelectedId(null); return; }
- setSelectedGroupId(null); setSelectedId(node.id);
- }} onNodeDoubleClick={(_, node) => { if (node.type === "customGroup") changeGroups(groups.map((group) => group.id === node.id ? { ...group, collapsed: false } : group)); else setDraft({ kind: "node", node: (node as FlowNode).data.item }); }}
- onPaneClick={() => { setSelectedId(null); setSelectedGroupId(null); setFocus(false); }}
- onNodeDragStop={(_, node, items) => move(items.length ? items : [node])} onSelectionDragStop={(_, items) => move(items)}
- onConnect={(connection) => { if (flow.nodes.some((n) => n.id === connection.source) && flow.nodes.some((n) => n.id === connection.target)) quickSave("flow_edge_upsert", { edge: { source: connection.source, target: connection.target, label: "" } }); }}
- onEdgeClick={(_, edge) => setDraft({ kind: "edge", edge: flow.edges.find((item) => item.id === edge.id) })}
- compactFitNodeIds={selectedGroup && selectedGroup.collapsed ? [selectedGroup.id] : selected ? [selected.id] : nodes.slice(0, 2).map((node) => node.id)}
- /> : <div className="grid h-full place-items-center p-6"><div className="max-w-sm text-center"><FolderKanban className="mx-auto mb-3 size-7 text-muted-foreground"/><h3 className="font-medium">Project flow inside {unit.name}</h3><p className="mt-2 text-sm text-muted-foreground">Add projects, activities, notes and connections here. The organization overview stays compact.</p><Button className="mt-4" onClick={() => setDraft({ kind: "node" })}>Add first node</Button></div></div>}
+ <div className={cn("relative grid min-h-0 flex-1 grid-cols-1", selected && "@min-[920px]:grid-cols-[minmax(0,1fr)_320px]")}>
+ <div className="relative min-h-0 min-w-0">
+ {flow.nodes.length ? nodes.length ? <GraphCanvas<CanvasNode, Edge>
+ ariaLabel="Organization project flow canvas" nodes={nodes} edges={edges} nodeTypes={nodeTypes} edgeTypes={graphRoutedEdgeTypes}
+ nodesDraggable={!busy} nodesConnectable={!busy} deleteKeyCode={null} onNodesChange={onNodesChange} onEdgesChange={onEdgesChange}
- onNodeClick={(event, node) => { if (!event.ctrlKey && !event.metaKey) selectNode(node.type === "customGroup" ? null : node.id); }} onNodeDoubleClick={(_, node) => { if (node.type === "customGroup") changeGroups(groups.map((group) => group.id === node.id ? { ...group, collapsed: false } : group)); else setDraft({ kind: "node", node: (node as FlowNode).data.item }); }}
++ onNodeClick={(event, node) => { if (!event.ctrlKey && !event.metaKey) { if (node.type === "customGroup") { setSelectedGroupId(node.id); setSelectedId(null); } else selectNode(node.id); } }} onNodeDoubleClick={(_, node) => { if (node.type === "customGroup") changeGroups(groups.map((group) => group.id === node.id ? { ...group, collapsed: false } : group)); else setDraft({ kind: "node", node: (node as FlowNode).data.item }); }}
+ onPaneClick={() => selectNode(null)}
+ onNodeDragStop={(_, node, items) => move(items.length ? items : [node])} onSelectionDragStop={(_, items) => move(items)}
+ onConnect={(connection) => { if (flow.nodes.some((node) => node.id === connection.source) && flow.nodes.some((node) => node.id === connection.target)) quickSave("flow_edge_upsert", { edge: { source: connection.source, target: connection.target, label: "" } }); }}
+ onEdgeClick={(_, edge) => setDraft({ kind: "edge", edge: flow.edges.find((item) => item.id === edge.id) })}
+ compactFitNodeIds={selected ? [selected.id] : nodes.slice(0, 4).map((node) => node.id)}
+ initialFitNodeIds={viewportIds}
+ initialFitMaxZoom={0.96}
+ /> : <div className="grid h-full place-items-center p-6 text-center text-sm text-muted-foreground">No nodes match this search.</div>
+ : <div className="grid h-full place-items-center p-6"><div className="max-w-sm text-center"><FolderKanban className="mx-auto mb-3 size-7 text-muted-foreground"/><h3 className="font-medium">Project flow inside {unit.name}</h3><p className="mt-2 text-sm text-muted-foreground">Add projects, activities, notes and connections here. The organization overview stays compact.</p><Button className="mt-4" onClick={() => setDraft({ kind: "node" })}>Add first node</Button></div></div>}
+ </div>
+ {selectedGroup ? <div data-slot="organization-group-focus" className="absolute inset-x-2 top-2 z-10 max-h-[calc(100%-1rem)] overflow-y-auto rounded-xl border bg-popover p-3 shadow-lg @min-[700px]:left-auto @min-[700px]:right-3 @min-[700px]:w-80">
- <div className="flex items-start gap-2"><div className="min-w-0 flex-1"><div className="text-[10px] font-medium uppercase tracking-wide text-muted-foreground">Group focus</div><h3 className="mt-1 break-words text-sm font-semibold">{selectedGroup.name}</h3><p className="mt-1 text-xs text-muted-foreground">{selectedGroupMembers.length} mapped members · {selectedGroup.collapsed ? "collapsed" : "expanded"}</p></div><Button size="icon" variant="ghost" className="size-7 shrink-0" aria-label="Close group details" onClick={() => { setSelectedGroupId(null); setFocus(false); }}><X className="size-4"/></Button></div>
++ <div className="flex items-start gap-2"><div className="min-w-0 flex-1"><div className="text-[10px] font-medium uppercase tracking-wide text-muted-foreground">Group focus</div><h3 className="mt-1 break-words text-sm font-semibold">{selectedGroup.name}</h3><p className="mt-1 text-xs text-muted-foreground">{selectedGroupMembers.length} mapped members · {selectedGroup.collapsed ? "collapsed" : "expanded"}</p></div><Button size="icon" variant="ghost" className="size-7 shrink-0" aria-label="Close group details" onClick={() => { setSelectedGroupId(null); setViewMode("map"); }}><X className="size-4"/></Button></div>
+ <div className="mt-3 space-y-1.5">{selectedGroupMembers.map((member) => <button type="button" key={member.id} className="flex w-full items-center justify-between gap-2 rounded-md border px-2.5 py-2 text-left hover:bg-accent/60" onClick={() => { setSelectedGroupId(null); setSelectedId(member.id); }}><span className="min-w-0 truncate text-xs font-medium">{member.title}</span><Badge variant="outline" className="shrink-0 text-[9px]">{member.status}</Badge></button>)}</div>
- <div className="mt-3 grid grid-cols-2 gap-2"><Button size="sm" variant={focus ? "secondary" : "outline"} onClick={() => setFocus(!focus)}>{focus ? "Exit focus" : "Focus group"}</Button><Button size="sm" variant="outline" onClick={() => changeGroups(groups.map((group) => group.id === selectedGroup.id ? { ...group, collapsed: !group.collapsed } : group))}>{selectedGroup.collapsed ? "Expand" : "Collapse"}</Button></div>
++ <div className="mt-3 grid grid-cols-2 gap-2"><Button size="sm" variant={viewMode === "focus" ? "secondary" : "outline"} onClick={() => setViewMode(viewMode === "focus" ? "map" : "focus")}>{viewMode === "focus" ? "Exit focus" : "Focus group"}</Button><Button size="sm" variant="outline" onClick={() => changeGroups(groups.map((group) => group.id === selectedGroup.id ? { ...group, collapsed: !group.collapsed } : group))}>{selectedGroup.collapsed ? "Expand" : "Collapse"}</Button></div>
+ <Button className="mt-2 w-full" size="sm" variant="ghost" onClick={() => changeGroups(groups.filter((group) => group.id !== selectedGroup.id))}>Ungroup presentation only</Button>
+ </div> : null}
- {selected ? <div className="absolute inset-x-2 top-2 z-10 max-h-[calc(100%-1rem)] overflow-y-auto rounded-xl border bg-popover p-3 shadow-lg @min-[700px]:left-auto @min-[700px]:right-3 @min-[700px]:w-80">
- <div className="flex items-start gap-2"><h3 className="min-w-0 flex-1 break-words text-sm font-semibold">{selected.title}</h3><Button size="icon" variant="ghost" className="size-7 shrink-0" aria-label="Close node details" onClick={() => setSelectedId(null)}><X className="size-4"/></Button></div>
+ {selected ? <aside className="absolute inset-x-2 top-2 z-10 max-h-[calc(100%-1rem)] overflow-y-auto rounded-xl border bg-popover p-3 shadow-lg @min-[920px]:static @min-[920px]:inset-auto @min-[920px]:max-h-none @min-[920px]:rounded-none @min-[920px]:border-y-0 @min-[920px]:border-r-0 @min-[920px]:border-l @min-[920px]:bg-card/60 @min-[920px]:shadow-none">
+ <div className="flex items-start gap-2"><h3 className="min-w-0 flex-1 break-words text-sm font-semibold">{selected.title}</h3><Button size="icon" variant="ghost" className="size-7 shrink-0" aria-label="Close node details" onClick={() => selectNode(null)}><X className="size-4"/></Button></div>
<div className="mt-2 flex gap-1"><Badge variant="secondary">{selected.kind}</Badge><Badge variant="outline">{selected.status}</Badge></div>
{selected.summary ? <p className="mt-3 whitespace-pre-wrap break-words text-sm">{selected.summary}</p> : null}
{selected.notes ? <div className="mt-3 whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground">{selected.notes}</div> : null}
diff --cc frontend/slices/workflows/app.tsx
index c6b0810e,aecab078..dff22a5b
--- a/frontend/slices/workflows/app.tsx
+++ b/frontend/slices/workflows/app.tsx
@@@ -132,7 -121,7 +143,7 @@@ export default function WorkflowsApp(pr
<div className={`grid h-full min-h-0 min-w-0 ${showLibraryPanel ? "grid-cols-[300px_minmax(0,1fr)] @min-[1200px]:grid-cols-[340px_minmax(0,1fr)]" : "grid-cols-1"}`}>
{showLibraryPanel ? <aside className="min-h-0 min-w-0 border-r">{library}</aside> : null}
<main className="flex min-h-0 min-w-0 overflow-hidden">
- {libraryMode === "sources" ? <div className="flex h-full flex-1 items-center justify-center p-6 text-center text-sm text-muted-foreground">Owner sources are listed in the library. Open an own workflow or copy a foreign source as a disabled draft for review.</div> : libraryMode === "automations" ? graph ? <div className="flex min-h-0 min-w-0 flex-1 flex-col"><div className="flex min-h-10 min-w-0 shrink-0 flex-wrap items-center gap-1.5 border-b px-2 py-1 @min-[520px]:flex-nowrap @min-[520px]:gap-2"><label className="flex shrink-0 items-center gap-1.5 text-[10px] text-muted-foreground"><span>Status</span><select aria-label="Workflow status" className="h-7 min-w-0 max-w-24 rounded border bg-background px-2 text-xs text-foreground" value={graph.status} onChange={(event) => mutate({ ...graph, status: event.target.value as WorkflowGraph["status"] })}><option value="draft">Draft</option><option value="active">Active</option><option value="archived">Archived</option></select></label><WorkflowNodePalette onAdd={addNode}/>{message ? <span className="w-full min-w-0 truncate text-[11px] text-muted-foreground @min-[520px]:ml-auto @min-[520px]:w-auto @min-[520px]:max-w-72">{message}</span> : null}</div><div className="min-h-0 min-w-0 flex-1 overflow-hidden"><WorkflowCanvas key={graph.id} graph={graph} selectedId={selected} onSelect={chooseNode} onCustomNodes={(customNodes) => mutate({ ...graph, metadata: { ...graph.metadata, customNodes } })} onMoveMany={(nodes) => mutate({ ...graph, nodes })} nodeStates={runStates} edgeStates={runEdgeStates} onOpen={(id) => void openNode(id)} onConnect={connect} onMove={(id, position) => mutate({ ...graph, nodes: graph.nodes.map((item) => item.id === id ? { ...item, position } : item) })} onDeleteNodes={deleteNodes} onDeleteEdges={deleteEdges} onTidy={tidy}/></div></div> : <div className="flex h-full min-w-0 flex-1 items-center justify-center px-4 text-center text-sm text-muted-foreground">Create an automation, or open Sources to discover workflows saved by MCP and other browser identities.</div>
- {libraryMode === "automations" ? graph ? <div className="flex min-h-0 min-w-0 flex-1 flex-col"><div className="flex min-h-10 min-w-0 shrink-0 flex-wrap items-center gap-1.5 border-b px-2 py-1 @min-[520px]:flex-nowrap @min-[520px]:gap-2"><label className="flex shrink-0 items-center gap-1.5 text-[10px] font-medium"><Switch checked={graph.status === "active"} disabled={graph.status === "archived"} onCheckedChange={(checked) => mutate({ ...graph, status: checked ? "active" : "draft" })}/><span>Active</span></label><select aria-label="Workflow lifecycle" className="h-7 min-w-0 max-w-24 rounded border bg-background px-2 text-xs" value={graph.status} onChange={(event) => mutate({ ...graph, status: event.target.value as WorkflowGraph["status"] })}><option value="draft">Draft</option><option value="active">Active</option><option value="archived">Archived</option></select><WorkflowNodePalette onAdd={addNode} open={nodeCreator.open} context={nodeCreator.sourceId ? "after-node" : "all"} onOpenChange={(open) => setNodeCreator(open ? { open: true } : { open: false })}/><span className="hidden min-w-0 truncate text-[10px] text-muted-foreground @min-[900px]:inline">Drag output → input or use + to insert. V Select · H Pan · +/- Zoom · F Fit · Space pan.</span>{message ? <span className="w-full min-w-0 truncate text-[11px] text-muted-foreground @min-[520px]:ml-auto @min-[520px]:w-auto @min-[520px]:max-w-72">{message}</span> : null}</div><div className="min-h-0 min-w-0 flex-1 overflow-hidden"><WorkflowCanvas key={graph.id} graph={graph} selectedId={selected} onSelect={chooseNode} onCustomNodes={(customNodes) => mutate({ ...graph, metadata: { ...graph.metadata, customNodes } })} onMoveMany={(nodes) => mutate({ ...graph, nodes })} nodeStates={runStates} edgeStates={runEdgeStates} onOpen={(id) => void openNode(id)} onConnect={connect} onQuickAdd={(sourceId, sourceHandle) => setNodeCreator({ open: true, sourceId, ...(sourceHandle ? { sourceHandle } : {}) })} onMove={(id, position) => mutate({ ...graph, nodes: graph.nodes.map((item) => item.id === id ? { ...item, position } : item) })} onDeleteNodes={deleteNodes} onDeleteEdges={deleteEdges} onTidy={tidy}/></div></div> : <div className="flex h-full min-w-0 flex-1 items-center justify-center px-4 text-center text-sm text-muted-foreground">Create or select an automation.</div>
++ {libraryMode === "sources" ? <div className="flex h-full flex-1 items-center justify-center p-6 text-center text-sm text-muted-foreground">Owner sources are listed in the library. Open an own workflow or copy a foreign source as a disabled draft for review.</div> : libraryMode === "automations" ? graph ? <div className="flex min-h-0 min-w-0 flex-1 flex-col"><div className="flex min-h-10 min-w-0 shrink-0 flex-wrap items-center gap-1.5 border-b px-2 py-1 @min-[520px]:flex-nowrap @min-[520px]:gap-2"><label className="flex shrink-0 items-center gap-1.5 text-[10px] text-muted-foreground"><span>Status</span><select aria-label="Workflow status" className="h-7 min-w-0 max-w-24 rounded border bg-background px-2 text-xs text-foreground" value={graph.status} onChange={(event) => mutate({ ...graph, status: event.target.value as WorkflowGraph["status"] })}><option value="draft">Draft</option><option value="active">Active</option><option value="archived">Archived</option></select></label><WorkflowNodePalette onAdd={addNode} open={nodeCreator.open} context={nodeCreator.sourceId ? "after-node" : "all"} onOpenChange={(open) => setNodeCreator(open ? { open: true } : { open: false })}/>{message ? <span className="w-full min-w-0 truncate text-[11px] text-muted-foreground @min-[520px]:ml-auto @min-[520px]:w-auto @min-[520px]:max-w-72">{message}</span> : null}</div><div className="min-h-0 min-w-0 flex-1 overflow-hidden"><WorkflowCanvas key={graph.id} graph={graph} selectedId={selected} onSelect={chooseNode} onCustomNodes={(customNodes) => mutate({ ...graph, metadata: { ...graph.metadata, customNodes } })} onMoveMany={(nodes) => mutate({ ...graph, nodes })} nodeStates={runStates} edgeStates={runEdgeStates} onOpen={(id) => void openNode(id)} onConnect={connect} onQuickAdd={(sourceId, sourceHandle) => setNodeCreator({ open: true, sourceId, ...(sourceHandle ? { sourceHandle } : {}) })} onMove={(id, position) => mutate({ ...graph, nodes: graph.nodes.map((item) => item.id === id ? { ...item, position } : item) })} onDeleteNodes={deleteNodes} onDeleteEdges={deleteEdges} onTidy={tidy}/></div></div> : <div className="flex h-full min-w-0 flex-1 items-center justify-center px-4 text-center text-sm text-muted-foreground">Create an automation, or open Sources to discover workflows saved by MCP and other browser identities.</div>
: sessionView ? <div className="flex min-h-0 min-w-0 flex-1 flex-col"><div className="flex min-h-10 shrink-0 items-center gap-2 border-b px-3 text-[11px] text-muted-foreground [@media(max-height:520px)]:hidden"><span className="font-medium text-foreground">{sessionView.session.label}</span><span>read-only</span><span>·</span><span>{sessionView.steps.length} steps</span><span>·</span><span>{sessionView.shownEvents}/{sessionView.totalEvents} actions</span>{message ? <span className="ml-auto truncate">{message}</span> : null}</div><div className="min-h-0 min-w-0 flex-1 overflow-hidden"><WorkflowCanvas key={sessionView.graph.revision} graph={sessionView.graph} selectedId={sessionSelected} onSelect={chooseSessionNode} onConnect={() => undefined} onMove={() => undefined} readOnly/></div></div> : <div className="flex h-full min-w-0 flex-1 items-center justify-center px-4 text-center text-sm text-muted-foreground">Select a session to inspect its semantic execution flow.</div>}
{showDetailsPanel ? <aside className="w-[320px] shrink-0 border-l @min-[1200px]:w-[360px]">{details}</aside> : null}
</main>
diff --cc frontend/slices/workflows/components/workflow-canvas.tsx
index 8f77ab4b,401f6420..c6688d74
--- a/frontend/slices/workflows/components/workflow-canvas.tsx
+++ b/frontend/slices/workflows/components/workflow-canvas.tsx
@@@ -24,64 -36,136 +38,132 @@@ function nodeFamily(node: WorkflowGraph
function sourceHandles(node: WorkflowGraphNode): Array<string | undefined> {
if (node.type === "condition") return ["true", "false"];
if (node.type === "repeat") return ["done", "exhausted"];
- if (node.type === "switch") { const cases = Array.isArray(node.config.cases) ? node.config.cases : []; return [...cases.map((row,index)=>row&&typeof row==="object"&&typeof (row as {handle?:unknown}).handle==="string"?String((row as {handle:string}).handle):`case-${index+1}`),"default"]; }
+ if (node.type === "switch") {
+ const cases = Array.isArray(node.config.cases) ? node.config.cases : [];
+ return [...cases.map((row, index) => row && typeof row === "object" && typeof (row as {handle?: unknown}).handle === "string" ? String((row as {handle: string}).handle) : `case-${index + 1}`), "default"];
+ }
return [undefined];
}
- const canError=(node:WorkflowGraphNode)=>!["manual","schedule","webhook","output"].includes(node.type);
- const canInput=(node:WorkflowGraphNode)=>!["manual","schedule","webhook"].includes(node.type);
- const canOutput=(node:WorkflowGraphNode)=>node.type!=="output";
- function nodeMetrics(node:WorkflowGraphNode){
- const semantic=node.config.sessionStep===true||node.config.sessionRoot===true,handles=sourceHandles(node);
- return {width:semantic?250:200,height:semantic?104:Math.max(78,48+Math.max(handles.length,canError(node)?2:1)*20)};
+ const canError = (node: WorkflowGraphNode) => !["manual", "schedule", "webhook", "output"].includes(node.type);
+ const canInput = (node: WorkflowGraphNode) => !["manual", "schedule", "webhook"].includes(node.type);
+ const canOutput = (node: WorkflowGraphNode) => node.type !== "output";
+ function nodeMetrics(node: WorkflowGraphNode) {
+ const semantic = node.config.sessionStep === true || node.config.sessionRoot === true, handles = sourceHandles(node);
+ return { width: semantic ? 250 : 210, height: semantic ? 104 : Math.max(84, 54 + Math.max(handles.length, canError(node) ? 2 : 1) * 20) };
}
- function WorkflowNodeCard({data,selected}:NodeProps<FlowNode>){
- const{node,state}=data,handles=sourceHandles(node),metrics=nodeMetrics(node),semantic=node.config.sessionStep===true||node.config.sessionRoot===true;
- const actionCount=typeof node.config.actionCount==="number"?node.config.actionCount:undefined,summary=typeof node.config.summary==="string"?node.config.summary:undefined;
- return <GraphNodeShell selected={selected} className={cn(semantic?"w-[250px]":"w-[200px]",state==="failed"&&"border-destructive ring-1 ring-destructive",state==="running"&&"border-primary ring-1 ring-primary",["skipped","blocked"].includes(state??"")&&"opacity-55",node.disabled&&"opacity-50")} style={{minHeight:metrics.height}}>
- {canInput(node)?<Handle type="target" position={Position.Left} id="input" className="!size-3.5 !border-2 !border-background !bg-muted-foreground"/>:null}
- <div className={cn("text-xs font-semibold",semantic?"line-clamp-2 leading-4":"truncate")}>{node.name}</div>
- <div className="mt-1 flex items-center gap-1.5 text-[10px] uppercase tracking-wide text-muted-foreground"><span>{node.type.replaceAll("_"," ")}{state?` · ${state}`:""}</span>{actionCount!==undefined?<span className="rounded bg-muted px-1.5 py-0.5 normal-case tracking-normal">{actionCount} actions</span>:null}</div>
- {summary?<p className="mt-1.5 line-clamp-2 text-[10px] leading-4 text-muted-foreground">{summary}</p>:null}
- {canOutput(node)?handles.map((handle,index)=><div key={handle??"output"} className="absolute right-0 flex translate-x-1/2 items-center" style={{top:38+index*20}}>{handle?<span className="pointer-events-none absolute right-4 whitespace-nowrap pr-1 text-[8px] text-muted-foreground">{handle}</span>:null}<Handle type="source" position={Position.Right} id={handle??"output"} className="!relative !right-auto !top-auto !size-3.5 !translate-x-0 !translate-y-0 !border-2 !border-background !bg-muted-foreground"/></div>):null}
- {canError(node)?<Handle type="source" position={Position.Bottom} id="error" className="!size-3 !border-2 !border-background !bg-destructive"/>:null}
+ function WorkflowNodeCard({ data, selected }: NodeProps<FlowNode>) {
+ const { node, state, quickAdd } = data, handles = sourceHandles(node), metrics = nodeMetrics(node), semantic = node.config.sessionStep === true || node.config.sessionRoot === true;
+ const actionCount = typeof node.config.actionCount === "number" ? node.config.actionCount : undefined, summary = typeof node.config.summary === "string" ? node.config.summary : undefined;
+ const { label, Icon } = nodeFamily(node);
- return <div className={cn("relative rounded-xl border bg-card px-3 py-3 shadow-sm transition-shadow", semantic ? "w-[250px]" : "w-[210px]", selected && "ring-2 ring-ring shadow-md", state === "failed" && "border-destructive ring-1 ring-destructive", state === "running" && "border-primary ring-1 ring-primary", ["skipped", "blocked"].includes(state ?? "") && "opacity-55", node.disabled && "opacity-50")} style={{ minHeight: metrics.height }}>
++ return <GraphNodeShell selected={selected} className={cn(semantic ? "w-[250px]" : "w-[210px]", state === "failed" && "border-destructive ring-1 ring-destructive", state === "running" && "border-primary ring-1 ring-primary", ["skipped", "blocked"].includes(state ?? "") && "opacity-55", node.disabled && "opacity-50")} style={{ minHeight: metrics.height }}>
+ {canInput(node) ? <Handle type="target" position={Position.Left} id="input" className="!size-3.5 !border-2 !border-background !bg-muted-foreground"/> : null}
+ <div className="flex items-start gap-2">
+ <span className="grid size-7 shrink-0 place-items-center rounded-lg border bg-background"><Icon className="size-3.5 text-muted-foreground"/></span>
+ <div className="min-w-0 flex-1">
+ <div className={cn("text-xs font-semibold", semantic ? "line-clamp-2 leading-4" : "truncate")}>{node.name}</div>
+ <div className="mt-1 flex flex-wrap items-center gap-1.5 text-[9px] uppercase tracking-wide text-muted-foreground">
+ <span>{label}</span><span>·</span><span>{node.type.replaceAll("_", " ")}</span>
+ {state ? <><span>·</span><span className={cn(state === "failed" && "text-destructive", state === "completed" && "text-success", state === "running" && "text-primary")}>{state}</span></> : null}
+ </div>
+ </div>
+ </div>
+ {actionCount !== undefined ? <span className="mt-2 inline-flex rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground">{actionCount} actions</span> : null}
+ {summary ? <p className="mt-1.5 line-clamp-2 text-[10px] leading-4 text-muted-foreground">{summary}</p> : null}
+ {canOutput(node) ? handles.map((handle, index) => <div key={handle ?? "output"} className="absolute right-0 flex translate-x-1/2 items-center" style={{ top: 42 + index * 20 }}>
+ {handle ? <span className="pointer-events-none absolute right-4 whitespace-nowrap pr-1 text-[8px] text-muted-foreground">{handle}</span> : null}
+ <Handle type="source" position={Position.Right} id={handle ?? "output"} className="!relative !right-auto !top-auto !size-3.5 !translate-x-0 !translate-y-0 !border-2 !border-background !bg-muted-foreground"/>
+ {quickAdd ? <button type="button" aria-label={`Add after ${node.name}${handle ? ` (${handle})` : ""}`} title="Add and connect next node" className="nodrag nopan absolute left-5 grid size-5 place-items-center rounded-full border bg-background text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 [.react-flow__node:hover_&]:opacity-100" onPointerDown={(event) => event.stopPropagation()} onClick={(event) => { event.stopPropagation(); quickAdd(node.id, handle); }}><Plus className="size-3"/></button> : null}
+ </div>) : null}
+ {canError(node) ? <Handle type="source" position={Position.Bottom} id="error" className="!size-3 !border-2 !border-background !bg-destructive"/> : null}
- </div>;
+ </GraphNodeShell>;
}
- const nodeTypes={workflow:WorkflowNodeCard, customGroup:GraphCustomCard};
+ const nodeTypes = { workflow: WorkflowNodeCard, customGroup: GraphCustomCard };
type CanvasNode = FlowNode | CustomCanvasNode;
- function toNodes(graph:WorkflowGraph,selectedId:string|null,nodeStates?:ReadonlyMap<string,WorkflowGraphNodeState>):FlowNode[]{return graph.nodes.map((node)=>{const metrics=nodeMetrics(node);return{id:node.id,type:"workflow",position:node.position,width:metrics.width,height:metrics.height,selected:node.id===selectedId,data:{node,state:nodeStates?.get(node.id)}};});}
- function edgeVisual(edge:WorkflowGraph["edges"][number],state:WorkflowGraphRunEdgeState|undefined,nodeStates?:ReadonlyMap<string,WorkflowGraphNodeState>){
- const running=nodeStates?.get(edge.source)==="running"||nodeStates?.get(edge.target)==="running",error=edge.sourceHandle==="error",branch=Boolean(edge.sourceHandle&&edge.sourceHandle!=="output"),disabled=edge.disabled||state==="disabled";
- const stroke=error?"var(--destructive)":running?"var(--accent)":state==="enabled"?"var(--success)":"var(--muted-foreground)";
- const strokeDasharray=disabled?"2 6":edge.style==="dashed"?"7 5":edge.style==="solid"?undefined:branch?"7 5":undefined;
+ function toNodes(graph: WorkflowGraph, selectedId: string | null, nodeStates?: ReadonlyMap<string, WorkflowGraphNodeState>, quickAdd?: (sourceId: string, sourceHandle?: string) => void): FlowNode[] {
+ return graph.nodes.map((node) => {
+ const metrics = nodeMetrics(node);
+ return { id: node.id, type: "workflow", position: node.position, width: metrics.width, height: metrics.height, selected: node.id === selectedId, data: { node, state: nodeStates?.get(node.id), quickAdd } };
+ });
+ }
+ function edgeVisual(edge: WorkflowGraph["edges"][number], state: WorkflowGraphRunEdgeState | undefined, nodeStates?: ReadonlyMap<string, WorkflowGraphNodeState>) {
+ const running = nodeStates?.get(edge.source) === "running" || nodeStates?.get(edge.target) === "running", error = edge.sourceHandle === "error", branch = Boolean(edge.sourceHandle && edge.sourceHandle !== "output"), disabled = edge.disabled || state === "disabled";
+ const stroke = error ? "var(--destructive)" : running ? "var(--accent)" : state === "enabled" ? "var(--success)" : "var(--muted-foreground)";
+ const strokeDasharray = disabled ? "2 6" : edge.style === "dashed" ? "7 5" : edge.style === "solid" ? undefined : branch ? "7 5" : undefined;
const opacity = disabled ? 0.24 : state === "pending" ? 0.55 : 1;
- return {animated:running&&!disabled,style:{stroke,strokeWidth:running?2.5:state==="enabled"?2:1.5,opacity,strokeDasharray},markerEnd:{type:MarkerType.ArrowClosed,width:18,height:18,color:stroke}};
+ return { animated: running && !disabled, style: { stroke, strokeWidth: running ? 2.5 : state === "enabled" ? 2 : 1.5, opacity, strokeDasharray }, markerEnd: { type: MarkerType.ArrowClosed, width: 18, height: 18, color: stroke } };
+ }
+ function toEdges(graph: WorkflowGraph, nodeStates?: ReadonlyMap<string, WorkflowGraphNodeState>, edgeStates?: ReadonlyMap<string, WorkflowGraphRunEdgeState>): FlowEdge[] {
+ return graph.edges.map((edge) => ({ id: edge.id, source: edge.source, target: edge.target, sourceHandle: edge.sourceHandle ?? "output", targetHandle: edge.targetHandle ?? "input", type: "routed", ...edgeVisual(edge, edgeStates?.get(edge.id), nodeStates) }));
+ }
+ function minimapColor(node: FlowNode) {
+ const state = node.data.state;
+ if (state === "running") return "var(--accent)";
+ if (state === "failed") return "var(--destructive)";
+ if (state === "completed") return "var(--success)";
+ if (state === "skipped" || state === "blocked") return "var(--text-dim)";
+ return "var(--info)";
}
- function toEdges(graph:WorkflowGraph,nodeStates?:ReadonlyMap<string,WorkflowGraphNodeState>,edgeStates?:ReadonlyMap<string,WorkflowGraphRunEdgeState>):FlowEdge[]{return graph.edges.map((edge)=>({id:edge.id,source:edge.source,target:edge.target,sourceHandle:edge.sourceHandle??"output",targetHandle:edge.targetHandle??"input",type:"routed",...edgeVisual(edge,edgeStates?.get(edge.id),nodeStates)}));}
- function minimapColor(node:FlowNode){const state=node.data.state;if(state==="running")return"var(--accent)";if(state==="failed")return"var(--destructive)";if(state==="completed")return"var(--success)";if(state==="skipped"||state==="blocked")return"var(--text-dim)";return"var(--info)";}
- export function WorkflowCanvas({graph,selectedId,onSelect,onMove,onMoveMany,onCustomNodes,onConnect,nodeStates,edgeStates,onOpen,onDeleteNodes,onDeleteEdges,onTidy,readOnly=false}:{graph:WorkflowGraph;selectedId:string|null;onSelect:(id:string|null)=>void;onMove:(id:string,position:{x:number;y:number})=>void;onMoveMany?:(nodes:WorkflowGraphNode[])=>void;onCustomNodes?:(groups:GraphCustomNode[])=>void;onConnect:(source:string,target:string,sourceHandle?:string)=>void;nodeStates?:ReadonlyMap<string,WorkflowGraphNodeState>;edgeStates?:ReadonlyMap<string,WorkflowGraphRunEdgeState>;onOpen?:(id:string)=>void;onDeleteNodes?:(ids:string[])=>void;onDeleteEdges?:(ids:string[])=>void;onTidy?:()=>void;readOnly?:boolean;}){
- const groups=useMemo(()=>graph.metadata.customNodes??[],[graph.metadata.customNodes]);
- const mapped=useMemo(()=>projectCustomNodes(toNodes(graph,null,nodeStates),toEdges(graph,nodeStates,edgeStates),groups,selectedId?[selectedId]:[]),[graph,nodeStates,edgeStates,groups,selectedId]);
- const {nodes,edges,onNodesChange,onEdgesChange}=useGraphProjection<CanvasNode,FlowEdge>(mapped);
- const selectedIds=nodes.filter((node)=>node.selected).map((node)=>node.id);
- const changeGroups=(next:GraphCustomNode[])=>{onCustomNodes?.(next);onSelect(null);};
- const move=(items:CanvasNode[])=>{const next=moveGraphNodesWithCustomGroups(graph.nodes,groups,items);if(onMoveMany)onMoveMany(next);else for(const item of items)onMove(item.id,item.position);};
- const connect=(connection:Connection)=>{if(!graph.nodes.some((n)=>n.id===connection.source)||!graph.nodes.some((n)=>n.id===connection.target)||connection.source===connection.target)return;const handle=connection.sourceHandle&&connection.sourceHandle!=="output"?connection.sourceHandle:undefined;onConnect(connection.source!,connection.target!,handle);};
- const visibleIds=useMemo(()=>new Set(nodes.map((node)=>node.id)),[nodes]);
- const rootFocusIds=useMemo(()=>compactWorkflowFocusIds(graph.nodes,groups,visibleIds,readOnly?2:1),[graph.nodes,groups,readOnly,visibleIds]);
- const compactIds=graphFocusClusterIds(nodes.map((node)=>node.id),edges,selectedId?[selectedId]:rootFocusIds,{depth:1,maxNodes:readOnly?12:8,fallbackLimit:readOnly?2:1});
+ export function WorkflowCanvas({ graph, selectedId, onSelect, onMove, onMoveMany, onCustomNodes, onConnect, onQuickAdd, nodeStates, edgeStates, onOpen, onDeleteNodes, onDeleteEdges, onTidy, readOnly = false }: {
+ graph: WorkflowGraph;
+ selectedId: string | null;
+ onSelect: (id: string | null) => void;
+ onMove: (id: string, position: {x: number; y: number}) => void;
+ onMoveMany?: (nodes: WorkflowGraphNode[]) => void;
+ onCustomNodes?: (groups: GraphCustomNode[]) => void;
+ onConnect: (source: string, target: string, sourceHandle?: string) => void;
+ onQuickAdd?: (sourceId: string, sourceHandle?: string) => void;
+ nodeStates?: ReadonlyMap<string, WorkflowGraphNodeState>;
+ edgeStates?: ReadonlyMap<string, WorkflowGraphRunEdgeState>;
+ onOpen?: (id: string) => void;
+ onDeleteNodes?: (ids: string[]) => void;
+ onDeleteEdges?: (ids: string[]) => void;
+ onTidy?: () => void;
+ readOnly?: boolean;
+ }) {
+ const [activeGroupId, setActiveGroupId] = useState<string | null>(null);
+ const groups = useMemo(() => graph.metadata.customNodes ?? [], [graph.metadata.customNodes]);
+ const selection = useMemo(() => activeGroupId ? [activeGroupId] : selectedId ? [selectedId] : [], [activeGroupId, selectedId]);
+ const mapped = useMemo(() => projectCustomNodes(toNodes(graph, null, nodeStates, readOnly ? undefined : onQuickAdd), toEdges(graph, nodeStates, edgeStates), groups, selection), [edgeStates, graph, groups, nodeStates, onQuickAdd, readOnly, selection]);
+ const { nodes, edges, onNodesChange, onEdgesChange } = useGraphProjection<CanvasNode, FlowEdge>(mapped);
+ const selectedIds = nodes.filter((node) => node.selected).map((node) => node.id);
+ const changeGroups = (next: GraphCustomNode[]) => {
+ onCustomNodes?.(next);
+ if (activeGroupId && !next.some((group) => group.id === activeGroupId)) setActiveGroupId(null);
+ onSelect(null);
+ };
+ const move = (items: CanvasNode[]) => {
- let next = graph.nodes;
- for (const item of items) {
- const group = groups.find((g) => g.id === item.id);
- next = group ? moveCustomNode(next, group, item.position) : next.map((n) => n.id === item.id ? { ...n, position: item.position } : n);
- }
++ const next = moveGraphNodesWithCustomGroups(graph.nodes, groups, items);
+ if (onMoveMany) onMoveMany(next); else for (const item of items) onMove(item.id, item.position);
+ };
+ const connect = (connection: Connection) => {
+ if (!graph.nodes.some((n) => n.id === connection.source) || !graph.nodes.some((n) => n.id === connection.target) || connection.source === connection.target) return;
+ const handle = connection.sourceHandle && connection.sourceHandle !== "output" ? connection.sourceHandle : undefined;
+ onConnect(connection.source!, connection.target!, handle);
+ };
+ const visibleIds = useMemo(() => new Set(nodes.map((node) => node.id)), [nodes]);
- const rootFocusIds = useMemo(() => compactWorkflowFocusIds(graph.nodes, groups, visibleIds, readOnly ? 9 : 2), [graph.nodes, groups, readOnly, visibleIds]);
- const compactIds = rootFocusIds.length ? rootFocusIds : (readOnly ? nodes.slice(0, 9) : nodes.slice(0, 2)).map((node) => node.id);
++ const rootFocusIds = useMemo(() => compactWorkflowFocusIds(graph.nodes, groups, visibleIds, readOnly ? 2 : 1), [graph.nodes, groups, readOnly, visibleIds]);
++ const compactIds = graphFocusClusterIds(nodes.map((node) => node.id), edges, selectedId ? [selectedId] : rootFocusIds, { depth: 1, maxNodes: readOnly ? 12 : 8, fallbackLimit: readOnly ? 2 : 1 });
return <div className="flex h-full min-h-0 flex-col">
- {!readOnly&&onCustomNodes?<GraphCustomControls groups={groups} selectedIds={selectedIds} nodeIds={graph.nodes.map((n)=>n.id)} onChange={changeGroups}/>:null}
- <div className="min-h-0 flex-1"><GraphCanvas<CanvasNode,FlowEdge> ariaLabel="Workflow canvas" showMinimap={nodes.length > 3} nodes={nodes} edges={edges} nodeTypes={nodeTypes} edgeTypes={graphRoutedEdgeTypes}
- onNodesChange={onNodesChange} onEdgesChange={onEdgesChange} onConnect={readOnly?undefined:connect}
- onPaneClick={()=>{onSelect(null);}}
- onNodeClick={(event,item)=>{if(event.ctrlKey||event.metaKey)return;onSelect(item.type==="customGroup"?null:item.id);}}
- onEdgeClick={readOnly?undefined:(_,edge)=>{if(graph.nodes.some((n)=>n.id===edge.source))onSelect(edge.source);}}
- onNodeDoubleClick={(_,item)=>{if(item.type==="customGroup"){if(!readOnly)changeGroups(groups.map((g)=>g.id===item.id?{...g,collapsed:false}:g));return;}const node=(item as FlowNode).data.node;if((readOnly||node.type==="project"||node.type==="folder")&&onOpen)onOpen(node.id);}}
- onNodeDragStop={(_,item,items)=>move(items.length?items:[item])} onSelectionDragStop={(_,items)=>move(items)}
- onNodesDelete={readOnly?undefined:(items)=>onDeleteNodes?.(items.filter((n)=>n.type!=="customGroup").map((n)=>n.id))}
- onEdgesDelete={readOnly?undefined:(items)=>onDeleteEdges?.(items.map((item)=>item.id))}
- nodesDraggable={!readOnly} nodesConnectable={!readOnly} edgesReconnectable={false} deleteKeyCode={readOnly?null:["Backspace","Delete"]} onTidy={onTidy} snapToGrid snapGrid={[12,12]}
- miniMapNodeColor={(node)=>node.type==="customGroup"?"var(--primary)":minimapColor(node as FlowNode)} compactFitNodeIds={compactIds} compactFitMaxZoom={readOnly?0.72:0.9} initialFitNodeIds={compactIds} initialFitMaxZoom={readOnly?0.78:0.94}/></div>
+ {!readOnly && onCustomNodes ? <GraphCustomControls groups={groups} selectedIds={selectedIds} nodeIds={graph.nodes.map((n) => n.id)} onChange={changeGroups}/> : null}
- <div className="min-h-0 flex-1"><GraphCanvas<CanvasNode, FlowEdge> ariaLabel="Workflow canvas" showMinimap={!readOnly} nodes={nodes} edges={edges} nodeTypes={nodeTypes} edgeTypes={graphRoutedEdgeTypes}
++ <div className="min-h-0 flex-1"><GraphCanvas<CanvasNode, FlowEdge> ariaLabel="Workflow canvas" showMinimap={nodes.length > 3} nodes={nodes} edges={edges} nodeTypes={nodeTypes} edgeTypes={graphRoutedEdgeTypes}
+ onNodesChange={onNodesChange} onEdgesChange={onEdgesChange} onConnect={readOnly ? undefined : connect}
+ onPaneClick={() => { setActiveGroupId(null); onSelect(null); }}
+ onNodeClick={(event, item) => {
+ if (event.ctrlKey || event.metaKey) return;
+ if (item.type === "customGroup") { setActiveGroupId(item.id); onSelect(null); return; }
+ setActiveGroupId(null); onSelect(item.id);
+ }}
+ onEdgeClick={readOnly ? undefined : (_, edge) => { if (graph.nodes.some((n) => n.id === edge.source)) { setActiveGroupId(null); onSelect(edge.source); } }}
+ onNodeDoubleClick={(_, item) => {
+ if (item.type === "customGroup") { if (!readOnly) changeGroups(groups.map((g) => g.id === item.id ? { ...g, collapsed: false } : g)); return; }
+ const node = (item as FlowNode).data.node;
+ if ((readOnly || node.type === "project" || node.type === "folder") && onOpen) onOpen(node.id);
+ }}
+ onNodeDragStop={(_, item, items) => move(items.length ? items : [item])} onSelectionDragStop={(_, items) => move(items)}
+ onNodesDelete={readOnly ? undefined : (items) => onDeleteNodes?.(items.filter((n) => n.type !== "customGroup").map((n) => n.id))}
+ onEdgesDelete={readOnly ? undefined : (items) => onDeleteEdges?.(items.map((item) => item.id))}
+ nodesDraggable={!readOnly} nodesConnectable={!readOnly} edgesReconnectable={false} deleteKeyCode={readOnly ? null : ["Backspace", "Delete"]} onTidy={onTidy} snapToGrid snapGrid={[12, 12]}
- miniMapNodeColor={(node) => node.type === "customGroup" ? "var(--primary)" : minimapColor(node as FlowNode)} compactFitNodeIds={compactIds} compactFitMaxZoom={readOnly ? 0.72 : 0.9}/></div>
++ miniMapNodeColor={(node) => node.type === "customGroup" ? "var(--primary)" : minimapColor(node as FlowNode)} compactFitNodeIds={compactIds} compactFitMaxZoom={readOnly ? 0.72 : 0.9} initialFitNodeIds={compactIds} initialFitMaxZoom={readOnly ? 0.78 : 0.94}/></div>
</div>;
}
diff --cc lib/workflow/node-catalog.ts
index 550a4350,0babcad0..e75bf16a
--- a/lib/workflow/node-catalog.ts
+++ b/lib/workflow/node-catalog.ts
@@@ -21,10 -19,9 +21,10 @@@ export const WORKFLOW_NODE_CATALOG:Work
{type:"project_function",title:"Project Function",category:"Actions",description:"Call a project-owned function.",defaults:{}},
{type:"project_mcp",title:"Project MCP",category:"Actions",description:"Call a project-owned MCP tool.",defaults:{}},
{type:"integration",title:"Integration",category:"Actions",description:"Execute through an existing MSO integration connection; credentials stay outside the graph.",defaults:{}},
+ {type:"channel_send",title:"Channel Send",category:"Actions",description:"Send text through an existing MSO Channel. Channel credentials remain in Integrations.",defaults:{channelId:"",text:{"$ref":"input.event.text"}}},
{type:"script",title:"Script",category:"Actions",description:"Run a saved validated RASMIC script by project and script id.",defaults:{}},
{type:"agent",title:"Agent",category:"AI",description:"Run an organization seat or focused project agent action.",defaults:{wait:true,max_scope:"write"}},
- {type:"subflow",title:"Subflow",category:"Flow",description:"Run an existing project flow.",defaults:{}},
+ {type:"subflow",title:"Execute Workflow",category:"Flow",description:"Run a saved Workflow Graph or a legacy project flow as a reusable sub-workflow.",defaults:{}},
{type:"project",title:"Project",category:"Context",description:"Resolve canonical project identity/path at runtime.",defaults:{}},
{type:"folder",title:"Folder",category:"Context",description:"Resolve a real folder inside a canonical project.",defaults:{path:"."}},
{type:"skill",title:"Skill",category:"Context",description:"Search trusted skill catalog with provenance.",defaults:{}},
diff --cc scripts/e2e/graph-custom.mjs
index a2eb244f,7fc5980d..070a37f4
--- a/scripts/e2e/graph-custom.mjs
+++ b/scripts/e2e/graph-custom.mjs
@@@ -35,9 -35,16 +35,17 @@@ try
let saved = chart.units.find((u) => u.id === "custom-test").projectFlow;
expect(saved.nodes).toEqual(orgNodes); expect(saved.edges).toEqual(orgEdges); expect(saved.customNodes[0].nodeIds.sort()).toEqual(["a", "b"]);
await openOrg(); await expect(orgCanvas.locator(".react-flow__node-customGroup")).toHaveCount(1);
+ await page.getByRole("button", { name: "Map", exact: true }).click();
await expect(orgCanvas.locator(".react-flow__edge")).toHaveCount(1);
const customCard = orgCanvas.locator(".react-flow__node-customGroup");
+ await customCard.click();
+ const groupFocus = page.locator('[data-slot="organization-group-focus"]');
+ await expect(groupFocus).toContainText("Delivery custom");
+ await expect(groupFocus).toContainText("2 mapped members");
+ await groupFocus.getByRole("button", { name: "Focus group", exact: true }).click();
+ await expect(groupFocus.getByRole("button", { name: "Exit focus", exact: true })).toBeVisible();
+ await expect(orgCanvas.locator('[data-id="c"]')).toBeVisible();
+ await groupFocus.getByRole("button", { name: "Exit focus", exact: true }).click();
await page.waitForTimeout(350);
const box = await customCard.boundingBox();
await page.mouse.move(box.x + box.width / 2, box.y + 24); await page.mouse.down();