diff --git a/packages/webui/src/public/bus.js b/packages/webui/src/public/bus.js
index 409366c8a..35141e097 100644
--- a/packages/webui/src/public/bus.js
+++ b/packages/webui/src/public/bus.js
@@ -1449,7 +1449,6 @@
if (n === 0 && window.MosaicOrg) return window.MosaicWorkspace.home();
if (a === 'projects' && n === 1 && window.MosaicOrg) return window.MosaicWorkspace.projectsPage(q);
if (a === 'organization' && n === 1 && window.MosaicOrg) return window.MosaicWorkspace.dashboard();
- if (a === 'side-by-side' && n === 1 && window.MosaicOrg) return `${head('Side by side', 'Not built yet.')}${empty('Side by side is not built yet.', 'It arrives with a later unified workspace update. Projects and Agents work today.')}`;
if (a === 'inbox' && n === 1 && window.MosaicOrg) return window.MosaicWorkspace.inboxPage(q);
if (a === 'tasks' && n === 1 && window.MosaicOrg) return window.MosaicTasksBoard.view();
if (a === 'inbox' && n === 1) return inboxView(get);
@@ -1542,6 +1541,15 @@
window.MosaicChat?.leave(chatPath);
if (path === '/business') { location.replace('#/settings/business'); return; }
if (path === '/settings/display') { location.replace('#/settings/appearance'); return; }
+ // U5: Side by side draws its own two panes (panes.js); every other page stops their polling.
+ if (path !== '/side-by-side') window.MosaicPanes?.unmount();
+ else if (window.MosaicOrg && window.MosaicPanes) {
+ const fresh = navigated || shown !== path;
+ shown = path;
+ if (fresh) { unmountEditor(); await window.MosaicPanes.mount($('bus-view'), query, { navigated }); }
+ else window.MosaicPanes.refresh();
+ return;
+ }
if (chatPath === '/chat' || chatPath.startsWith('/chat/') || /^\/projects\/[0-9a-f-]+\/(?:settings|conversations|tasks|requirements|files)$/i.test(chatPath)) {
// Re-read the scoped capability as the Console and bus recover. A failed read
// withdraws the control; the chat renderer retains the draft across repaint.
diff --git a/packages/webui/src/public/index.html b/packages/webui/src/public/index.html
index 586296d90..1687c34d1 100644
--- a/packages/webui/src/public/index.html
+++ b/packages/webui/src/public/index.html
@@ -6,8 +6,8 @@
-
-
+
+
Skip to content
diff --git a/packages/webui/src/public/panes.css b/packages/webui/src/public/panes.css
new file mode 100644
index 000000000..d6b863199
--- /dev/null
+++ b/packages/webui/src/public/panes.css
@@ -0,0 +1,83 @@
+/* Side by side (U5, sample 07 "EXT 8"): a bar, then two panes with a divider between them. Each pane
+ has its own header with the organization's mark and edge, and its own scroll. One pane and a
+ shown-pane switch on a phone. Loaded after shell.css; every rule is scoped to the side-by-side page. */
+html[data-organizations] .content:has(> #bus-view > .sbs){padding:0}
+html[data-organizations] .sbs{margin:0;display:flex;flex-direction:column;min-height:0;height:calc(100vh - var(--bar-h,53px) - var(--foot-h,33px))}
+html[data-organizations] .sbs .panebar{display:flex;align-items:center;gap:10px;padding:8px 14px;border-bottom:1px solid var(--line);background:var(--canvas);flex-wrap:wrap}
+html[data-organizations] .sbs .panebar h1{font-size:16px;font-weight:700;margin:0;line-height:1.4}
+html[data-organizations] .sbs .panebar h1:focus{outline:none}
+html[data-organizations] .sbs .panebar .note{font-size:13px;color:var(--muted)}
+html[data-organizations] .sbs .panebar [data-pane-add]{margin-left:auto}
+html[data-organizations] .sbs .ws-seg.pane-tabs{display:none;margin-left:0}
+html[data-organizations] .sbs .pane-tabs>button{gap:5px;max-width:44vw}
+html[data-organizations] .sbs .pane-tabs>button>span:last-child{overflow:hidden;text-overflow:ellipsis}
+
+html[data-organizations] .panes{--sbs-a:1fr;--sbs-b:1fr;display:grid;grid-template-columns:minmax(0,1fr);flex:1;min-height:0}
+html[data-organizations] .panes.two{grid-template-columns:minmax(0,var(--sbs-a)) 1px minmax(0,var(--sbs-b))}
+html[data-organizations] .pane{display:flex;flex-direction:column;min-width:0;min-height:0}
+html[data-organizations] .pane[hidden]{display:none}
+html[data-organizations] .pane-h{display:flex;align-items:center;gap:8px;padding:8px 14px;border-bottom:1px solid var(--line);background:var(--surface);box-shadow:inset 0 3px 0 var(--org,var(--line));min-width:0}
+html[data-organizations] .pane-h .ttl{font-weight:700;color:var(--strong,var(--text));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:0 1 auto}
+html[data-organizations] .pane-h .ttl small{font-weight:500;color:var(--muted);margin-left:6px;font-size:inherit}
+html[data-organizations] .pane-h [data-pane-state]:empty{display:none}
+html[data-organizations] .pane-pick{flex:0 1 180px;min-width:0;max-width:220px;margin-left:auto;font:500 12px/1.4 var(--font);color:var(--text);background:var(--canvas);border:1px solid var(--line);border-radius:var(--r);padding:3px 6px;min-height:0}
+html[data-organizations] .pane-h .tools{display:flex;gap:2px;flex:none}
+html[data-organizations] .pane-tool{display:inline-grid;place-items:center;width:26px;height:26px;border-radius:var(--r);color:var(--muted);border:0;background:none;padding:0;min-height:0;cursor:pointer}
+html[data-organizations] .pane-tool:hover{background:var(--raised);color:var(--text)}
+html[data-organizations] .pane-tool[hidden]{display:none}
+html[data-organizations] .pane-tool svg.i{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
+html[data-organizations] .pane-line{margin:0;padding:6px 14px;border-bottom:1px solid var(--line);font-size:13px;color:var(--text);background:color-mix(in srgb,var(--warn,#b7791f) 12%,var(--surface))}
+html[data-organizations] .pane-line[hidden]{display:none}
+html[data-organizations] .pane-body{overflow:auto;padding:14px;min-height:0;flex:1}
+html[data-organizations] .pane-body:focus{outline:none}
+html[data-organizations] .pane-body:focus-visible{outline:2px solid var(--focus,var(--action));outline-offset:-2px}
+/* A page inside a pane is a section of the side-by-side page: smaller headings, no page chrome. */
+html[data-organizations] .pane-body .ws h1{font-size:20px}
+html[data-organizations] .pane-body .chat-area.pane-project{display:block;height:auto;min-height:0;overflow:visible;padding:0}
+/* A project in a pane is compact (sample 07): the pane header already names the project and its
+ organization, so the page heading stays only for assistive technology and focus, the full-page
+ actions give way (North star and PRD are on the Requirements tab, Settings in the full view), and
+ the tabs, measures and current work come first. Project pages size some parts from the window
+ (projects.css); in a pane they size from the pane. */
+html[data-organizations] .pane-body{container-type:inline-size}
+html[data-organizations] .pane-body .project-header{display:block;width:auto;max-width:100%;margin:0 0 6px;padding:0}
+html[data-organizations] .pane-body .project-header .project-heading,html[data-organizations] .pane-body .project-header .project-heading>div{display:block}
+html[data-organizations] .pane-body .project-header-icon,html[data-organizations] .pane-body .project-actions{display:none}
+html[data-organizations] .pane-body .project-header h1{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
+html[data-organizations] .pane-body:has(.project-header h1:focus-visible){outline:2px solid var(--focus,var(--action));outline-offset:-2px}
+html[data-organizations] .pane-body .project-header .project-heading p{margin:0;font-size:13px;color:var(--muted)}
+html[data-organizations] .pane-body .project-tabs a{min-height:40px;padding:0 12px;font-size:14px}
+html[data-organizations] .pane-body .project-metrics{grid-template-columns:repeat(2,minmax(0,1fr));margin-top:10px;padding:6px 0}
+html[data-organizations] .pane-body .project-metrics a{padding:4px 12px;border-right:0;border-bottom:0;line-height:1.3}
+html[data-organizations] .pane-body .project-metrics a span,html[data-organizations] .pane-body .project-metrics small{font-size:12px;overflow-wrap:anywhere}
+html[data-organizations] .pane-body .project-metrics strong{font-size:20px}
+html[data-organizations] .pane-body .project-metrics p{margin:6px 12px 0;padding-top:6px}
+html[data-organizations] .pane-body .project-columns{grid-template-columns:minmax(0,1fr);gap:14px;margin-top:12px}
+html[data-organizations] .pane-body .project-columns h2{font-size:16px;margin:12px 0 8px}
+html[data-organizations] .pane-body .project-columns h3{font-size:14px}
+html[data-organizations] .pane-body .project-columns .project-section-title h2,html[data-organizations] .pane-body .project-columns aside>h2:first-child{margin-top:0}
+@container (min-width:560px){
+ html[data-organizations] .pane-body .project-metrics{grid-template-columns:repeat(4,minmax(0,1fr))}
+ html[data-organizations] .pane-body .project-metrics a:not(:nth-child(4)){border-right:1px solid var(--line)}
+}
+/* The side-by-side page has its own bar; the page breadcrumb would name only one pane. */
+body:has(#bus-view > .sbs) #breadcrumbs{display:none}
+html[data-organizations] .content:has(> #bus-view > .sbs) > .org-cue{margin:8px 14px}
+
+html[data-organizations] .pane-div{position:relative;background:var(--line);cursor:col-resize;touch-action:none;outline:none}
+html[data-organizations] .pane-div::before{content:"";position:absolute;inset:0 -4px;z-index:1}
+html[data-organizations] .pane-div:hover,html[data-organizations] .pane-div.dragging{background:var(--action)}
+html[data-organizations] .pane-div:focus-visible{background:var(--action);box-shadow:0 0 0 2px var(--action)}
+html[data-organizations] .pane-div[hidden]{display:none}
+
+@media (max-width:760px){
+ html[data-organizations] .content:has(> #bus-view > .sbs){padding:0}
+ html[data-organizations] .sbs{height:auto}
+ html[data-organizations] .sbs .ws-seg.pane-tabs{display:inline-flex}
+ html[data-organizations] .sbs .hide-m{display:none}
+ html[data-organizations] .panes,html[data-organizations] .panes.two{grid-template-columns:minmax(0,1fr)}
+ html[data-organizations] .pane.alt,html[data-organizations] .pane-div{display:none}
+ html[data-organizations] .pane-body{overflow:visible}
+ html[data-organizations] .pane-h{flex-wrap:wrap}
+ html[data-organizations] .pane-pick{flex:1 1 100%;max-width:none;order:5;margin-left:0}
+}
diff --git a/packages/webui/src/public/panes.js b/packages/webui/src/public/panes.js
new file mode 100644
index 000000000..70f954c69
--- /dev/null
+++ b/packages/webui/src/public/panes.js
@@ -0,0 +1,477 @@
+// Side by side (U5, sample 07): two panes, each showing one page of any organization. A pane holds
+// the organization dashboard, the Agents levels or a project page (overview, conversations, tasks,
+// requirements, files), drawn by the same modules as the full view (workspace.js, projects.js) into
+// the pane instead of #bus-view. Every read names the pane's organization, so the panes never share
+// state. Pages that keep one global form, dialog or editor (a conversation, the room, settings, the
+// queue, docs, the inbox) are not offered in a pane; their links open the full view.
+//
+// The panes' routes, the divider and the phone's shown pane live in the URL
+// (#/orgs//side-by-side?a=/&b=/&w=&show=a|b), updated with
+// replaceState so nothing reloads, and the last layout is remembered in this browser.
+(() => {
+ 'use strict';
+ if (!document.documentElement.hasAttribute('data-organizations')) return;
+ const data = window.MosaicWorkspaceData, ws = () => window.MosaicWorkspace;
+ const esc = value => String(value ?? '').replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
+ const enc = encodeURIComponent;
+ const STORE = 'mosaic-side-by-side-v1', POLL = 10000, LIST_TTL = 3000, PROJECTS_TTL = 30000;
+ const MIN = 25, MAX = 75, STEP = 5;
+ const ORG = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
+ const PROJECT = /^\/projects\/([A-Za-z0-9][A-Za-z0-9._-]{0,159})(?:\/(conversations|tasks|requirements|files))?$/;
+ const SECTIONS = { overview: 'Overview', conversations: 'Conversations', tasks: 'Tasks', requirements: 'Requirements', files: 'Files' };
+ const FOCUSABLE = 'a[href],button:not([disabled]),select,textarea,input,summary,[tabindex]:not([tabindex="-1"])';
+ const NAMES = { a: 'left', b: 'right' };
+ const load = () => { try { return localStorage.getItem(STORE); } catch { return null; } };
+ const save = value => { try { localStorage.setItem(STORE, value); } catch {} };
+ const paused = () => document.getElementById('pause')?.getAttribute('aria-pressed') === 'true';
+ const svg = d => ``;
+ const FULL = svg('');
+ const CLOSE = svg('');
+ const PLUS = svg('');
+
+ // A pane's page: the routes a pane can draw. Anything else is not pane-safe.
+ function page(route) {
+ if (route === '/organization') return { kind: 'dashboard' };
+ if (route === '/agents') return { kind: 'agents' };
+ const m = PROJECT.exec(route);
+ if (m && m[1] !== 'threads' && m[1] !== 'rooms') return { kind: 'project', id: m[1], section: m[2] || 'overview' };
+ return null;
+ }
+ // "/" from the URL; null when either part is not one a pane draws.
+ function parsePane(value) {
+ if (typeof value !== 'string') return null;
+ const cut = value.indexOf('/');
+ if (cut < 1) return null;
+ const org = value.slice(0, cut), route = value.slice(cut);
+ return ORG.test(org) && page(route) ? { org, route } : null;
+ }
+ const paneValue = p => `${p.org}${p.route}`;
+ const clampW = n => Math.min(MAX, Math.max(MIN, Math.round(n)));
+
+ // ---------- shared reads (one organization list and project lists for both panes) ----------
+ let listAt = 0, listPromise = null, projectReads = new Map();
+ function orgList(fresh = false) {
+ if (!listPromise || fresh || Date.now() - listAt > LIST_TTL) {
+ listAt = Date.now();
+ listPromise = Promise.all([data.organizations(), ws()?.themes?.()]).then(([rows]) => (Array.isArray(rows) ? rows : null)).catch(() => null);
+ }
+ return listPromise;
+ }
+ function projectsOf(org, fresh = false) {
+ const hit = projectReads.get(org);
+ if (hit && !fresh && Date.now() - hit.at < PROJECTS_TTL) return hit.promise;
+ const promise = data.projects(org).then(b => (Array.isArray(b?.rows) ? b.rows.filter(p => p && typeof p.id === 'string') : null)).catch(() => null);
+ projectReads.set(org, { at: Date.now(), promise });
+ return promise;
+ }
+
+ // ---------- state ----------
+ let mounted = null; // { root, panes: [pane], w, show, gen }
+ let mountGen = 0;
+ let listCache = null; // the last organization list read, for the shown-pane tabs
+
+ function readQuery(query) {
+ const q = new URLSearchParams(query || '');
+ return { a: parsePane(q.get('a')), b: parsePane(q.get('b')), w: Number(q.get('w')), show: q.get('show'), named: q.has('a') || q.has('b') };
+ }
+ function queryOf(state) {
+ const q = new URLSearchParams();
+ state.panes.forEach((p, i) => q.set(i ? 'b' : 'a', paneValue(p)));
+ q.set('w', String(state.w));
+ q.set('show', state.show);
+ return q.toString().replace(/%2F/g, '/');
+ }
+ function writeUrl() {
+ if (!mounted) return;
+ const qs = queryOf(mounted);
+ save(qs);
+ const next = `#/orgs/${enc(window.MosaicOrg.id)}/side-by-side?${qs}`;
+ if (location.hash !== next) history.replaceState(null, '', next);
+ }
+ // The first pane is this page's organization; the second is the next organization on the list,
+ // or this one's Agents when there is no other.
+ async function defaults() {
+ const here = window.MosaicOrg.id, list = await orgList();
+ const other = (list || []).find(o => o && !o.invalid && o.id !== here && ORG.test(o.id));
+ return [{ org: here, route: '/organization' }, other ? { org: other.id, route: '/organization' } : { org: here, route: '/agents' }];
+ }
+
+ // ---------- markup ----------
+ function paneShell(key) {
+ const name = NAMES[key];
+ return `
+
+ `;
+ }
+
+ // Orgs in the picker: every organization on the list. A pane draws a valid one's dashboard, Agents or
+ // any project the organization's project read lists; an invalid one is listed and cannot be chosen.
+ async function pickerHtml(p, list) {
+ const groups = await Promise.all((list || []).filter(o => o && ORG.test(o.id)).map(async org => {
+ const name = ws().label(org);
+ if (org.invalid) return ``;
+ const rows = await projectsOf(org.id);
+ const opt = (route, text) => ``;
+ const projects = rows === null ? '' : rows.filter(r => !r.archived && PROJECT.test(`/projects/${r.id}`)).map(r => opt(`/projects/${r.id}`, `Project: ${r.name || r.id}`)).join('');
+ return ``;
+ }));
+ let html = groups.join('');
+ const value = paneValue(p);
+ // A project section, or a page the list no longer names, is still the pane's page: keep it selectable.
+ if (!html.includes(`value="${esc(value)}"`)) html = `${html}`;
+ return html;
+ }
+
+ // ---------- drawing one pane ----------
+ const els = p => ({
+ head: p.el.querySelector('[data-pane-head]'), av: p.el.querySelector('[data-pane-av]'), ttl: p.el.querySelector('[data-pane-ttl]'),
+ state: p.el.querySelector('[data-pane-state]'), pick: p.el.querySelector('[data-pane-pick]'), full: p.el.querySelector('[data-pane-full]'),
+ fullLabel: p.el.querySelector('[data-pane-full-label]'), close: p.el.querySelector('[data-pane-close]'), line: p.el.querySelector('[data-pane-line]'), body: p.el.querySelector('[data-pane-body]'),
+ });
+ const setHtml = (el, html) => { if (el && el.innerHTML !== html) el.innerHTML = html; };
+ const setText = (el, text) => { if (el && el.textContent !== text) el.textContent = text; };
+
+ // Links a page draws are relative to the page's organization. In a pane they name the pane's
+ // organization; reads the page links to (/api/...) name it too.
+ function rewrite(p, root) {
+ const prefix = `#/orgs/${enc(p.org)}`;
+ for (const a of root.querySelectorAll('a[href^="#/"]')) if (!a.getAttribute('href').startsWith('#/orgs/')) a.setAttribute('href', prefix + a.getAttribute('href').slice(1));
+ for (const a of root.querySelectorAll('a[href^="/api/"]')) if (!a.getAttribute('href').startsWith('/api/orgs/')) a.setAttribute('href', `/api/orgs/${enc(p.org)}/${a.getAttribute('href').slice(5)}`);
+ // The pane's title is the page's heading; the side-by-side page keeps the one level-1 heading.
+ for (const h of root.querySelectorAll('h1:not([aria-level])')) h.setAttribute('aria-level', '2');
+ }
+ // Focus and scroll survive a repaint of this pane only. Focus in the other pane is never taken.
+ function capture(p, root) {
+ const a = document.activeElement, inside = !!a && a !== root && root.contains(a);
+ return {
+ top: root.scrollTop,
+ focus: inside ? { key: a.dataset?.focusKey || null, href: a.getAttribute('href'), index: [...root.querySelectorAll(FOCUSABLE)].indexOf(a), h1: a.tagName === 'H1' } : null,
+ };
+ }
+ function restore(p, root, kept) {
+ root.scrollTop = kept.top;
+ const f = kept.focus, a = document.activeElement;
+ if (!f || (a && a !== document.body && !root.contains(a))) return;
+ const target = (f.key && root.querySelector(`[data-focus-key="${CSS.escape(f.key)}"]`))
+ || (f.href && [...root.querySelectorAll('a[href]')].find(x => x.getAttribute('href') === f.href))
+ || (f.h1 && root.querySelector('h1'))
+ || root.querySelectorAll(FOCUSABLE)[f.index];
+ (target || root).focus({ preventScroll: true });
+ }
+ function paintBody(p, html) {
+ const { body } = els(p);
+ if (p.html === html && body.childElementCount) return;
+ const kept = capture(p, body);
+ body.innerHTML = html; p.html = html; p.project = null;
+ rewrite(p, body);
+ restore(p, body, kept);
+ }
+
+ // A focus move that finishes after an asynchronous read happens only if the viewer has not
+ // moved on: focus is still where it was when the action started, nowhere, or inside this pane.
+ function mayFocus(p, before) {
+ const a = document.activeElement;
+ return !a || a === document.body || a === before || p.el.contains(a);
+ }
+ async function drawPane(p, { fresh = false, focusHead = false } = {}) {
+ if (!mounted || !p.el.isConnected) return;
+ const before = document.activeElement;
+ const turn = ++p.turn, gen = mountGen, live = () => mounted && gen === mountGen && turn === p.turn && p.el.isConnected;
+ clearTimeout(p.timer);
+ const e = els(p), what = page(p.route);
+ const list = await orgList(fresh);
+ if (!live()) return;
+ if (list) listCache = list;
+ const org = list?.find(o => o?.id === p.org) || null;
+ const name = org ? ws().label(org) : p.org;
+ // Header: the organization's mark, the page's title, its state, the picker and the tools.
+ if (org) e.head.setAttribute('style', ws().colours(org)); else e.head.removeAttribute('style');
+ setHtml(e.av, org ? ws().av(org, 'md') : '?');
+ const [scls, sglyph, sword] = org ? ws().state(org) : ['s-unknown', '?', 'not on your list'];
+ setHtml(e.state, org?.busHealthy && !org.invalid ? '' : ws().dot(scls, sglyph, sword, true));
+ const fullHref = `#/orgs/${enc(p.org)}${p.route}`;
+ if (e.full.getAttribute('href') !== fullHref) e.full.setAttribute('href', fullHref);
+
+ let line = '', html = null;
+ if (!list) line = 'The organization list could not be read. This pane shows what its own reads return.';
+ else if (!org) { line = `${p.org} is not on your organization list.`; html = '
Nothing is read for an organization that is not on your list.
'; }
+ else if (org.invalid) { line = `${name}: organization invalid${org.reason ? ` (${org.reason})` : ''}.`; html = '
Nothing is read from an invalid organization. Fix its file under Settings, Organizations.
'; }
+ else if (!org.busHealthy) line = `${name}: bus unavailable. Reads from this organization may fail; the other pane is not affected.`;
+ setText(e.line, line); e.line.hidden = !line;
+
+ let title = what?.kind === 'agents' ? 'Agents' : 'Dashboard';
+ if (html === null && what?.kind === 'dashboard') html = await ws().dashboard(p.org, { pane: true, idPrefix: `pane-${p.key}-` }).catch(() => '
Dashboard unavailable.
');
+ else if (html === null && what?.kind === 'agents') html = await ws().agentGrid('', p.org).catch(() => '
Agents unavailable.
');
+ if (!live()) return;
+ if (html === null && what?.kind === 'project') {
+ title = await drawProject(p, e, what, fresh, live);
+ if (title === null || !live()) return;
+ } else if (html !== null) paintBody(p, html);
+ p.title = title;
+ setHtml(e.ttl, `${esc(title)}${esc(name)}`);
+ p.el.setAttribute('aria-label', `${NAMES[p.key][0].toUpperCase()}${NAMES[p.key].slice(1)} pane: ${title}, ${name}`);
+ setText(e.fullLabel, `Open ${title}, ${name}, in full view`);
+ // The picker is rebuilt only while it is closed and unfocused, so a choice in progress stays.
+ if (document.activeElement !== e.pick) {
+ const options = await pickerHtml(p, list);
+ if (!live()) return;
+ if (document.activeElement !== e.pick) { setHtml(e.pick, options); e.pick.value = paneValue(p); }
+ }
+ paintBar(); fit();
+ if (focusHead && mayFocus(p, before)) (e.body.querySelector('h1') || e.body).focus({ preventScroll: true });
+ p.timer = setTimeout(() => tick(p), POLL);
+ }
+ function tick(p) {
+ if (!mounted || !p.el.isConnected) return;
+ if (paused()) { p.timer = setTimeout(() => tick(p), POLL); return; }
+ void drawPane(p);
+ }
+
+ // A project page: projects.js's header and content, mounted into the pane with the pane's
+ // organization, read-only (a pane never sends).
+ // Every write below happens only while this draw is still the pane's current one (live()), so a
+ // slow read never paints an old page or organization over the one the viewer has since chosen.
+ async function drawProject(p, e, what, fresh, live) {
+ const org = p.org;
+ const [projects, threadsRead] = await Promise.all([projectsOf(org, fresh), data.threads(org).catch(() => null)]);
+ if (!live() || p.org !== org) return null;
+ const project = projects?.find(r => r.id === what.id);
+ const sectionName = SECTIONS[what.section];
+ if (!project) {
+ paintBody(p, projects === null ? '
Projects unavailable. The organization did not answer the project read.
' : '
This project is not in the organization\'s project list.
Open shows plain text in a new tab. Downloaded HTML can be opened locally after saving.
`).join(''):`
${data.disabled?'Files are unavailable.':data.failed?'Reviewed files are unavailable.':data.requests.length?'No reviewed file is available.':'No request files yet. Files appear when a request in this project produces them.'}
`}
Draft workspace ${f.drafts.length}
Names only. Draft files may change and are not reviewed deliveries.
${!project.repo?'No linked repository.':data.recordsMissing?window.MosaicRecords.markup(project.repo):!docs?'Project documents unavailable. Docs could not read this project’s repository.':docs.length?docs.map(name=>`
`;
}
const expandedPrds = new Set();
- function requirementView(data,project,selected) {
+ // U5: a project in a Side by side pane keeps its own request choice and PRD disclosure, so two
+ // panes showing the same project (or two organizations' projects with one id) never share them.
+ // The pane passes `views`, kept on the pane per organization, so the state outlives a repaint
+ // that replaces the content element (a new conversation changes the header). Without it, the
+ // state lives as long as the container.
+ const paneViews = new WeakMap();
+ const viewState=(container,pane,views)=>{if(!pane) return {selected:selectedRequests,expanded:expandedPrds}; if(views?.selected instanceof Map && views.expanded instanceof Set) return views; if(!paneViews.has(container)) paneViews.set(container,{selected:new Map(),expanded:new Set()}); return paneViews.get(container);};
+ function requirementView(data,project,selected,expandedSet=expandedPrds) {
const options=data.requests.filter(r=>r.draft), r=options.find(x=>x.id===selected)||options[0], d=r?.draft;
const north=typeof data.north?.content==='string'?data.north.content:null;
const select=options.length>1?``:'';
- const candidate=d?.candidate, expanded=r && expandedPrds.has(project.id+':'+r.id);
+ const candidate=d?.candidate, expanded=r && expandedSet.has(project.id+':'+r.id);
const docPath=candidate?.prd_path, docLink=project.repo && typeof docPath==='string' && /^docs\/[A-Za-z0-9][A-Za-z0-9._-]{0,127}\.md$/.test(docPath) ? `#/docs/${encodeURIComponent(project.repo)}/${encodeURIComponent(docPath)}` : null;
const rows=candidate ? [['PRD version',candidate.prd_version],['Approved snapshot',d.snapshot.id || 'None'],['PRD file',docPath],['PRD blob',candidate.prd_blob],['Records commit',candidate.records_commit],['Confirmed intent commit',candidate.spec_commit],['Mode revision',candidate.mode_revision]].map(([label,value])=>`
North star unavailable. Docs could not read this project’s repository.
':`
This project has no linked repository. The north star and project documents live in a repository. Linking one to an existing project isn't available yet.
${(data.failed || data.requests.some(x=>x.materialFailed))?'Request or PRD unavailable. Refresh to try again.':'No current PRD candidate or approved snapshot. Waiting for a PRD submission.'}
Agents are defined at three levels: root, organization and project. Root and project agents are read from their files and are not launched yet.${note ? ` ${note}` : ''}