The current holder of each claimed role. A role nobody holds does not appear. Working: the holder has messages it received and hasn't answered yet. Waiting: a decision the role raised is open in your inbox. Otherwise idle.
` : empty('No role is held right now.', 'A role shows here while a run holds its claim on the bus.')}
${threadSection}
-
Board seats stay on the control board. This view is about roles.
`;
+
Board seats stay on the control board. This view is about roles.
`;
}
// ---------------------------------------------------------------- queue, business, settings
@@ -1391,7 +1391,7 @@
});
// Not found and states
- function notFound(why) { return `${head('Not found')}
${why || 'No page at this address.'}
Nothing is at ${txt(location.hash || '#/')}. Go to the Board or press Ctrl K to search.
`; }
+ function notFound(why) { return `${head('Not found')}
${source ? `Reading the ${esc(source.toLowerCase())}.` : 'Reading from the bus.'}
`;
const retry = '';
// Why a read failed, in words, with the bus code as given. Never a path or a guess.
@@ -1452,9 +1452,11 @@
const parts = path.split('/').filter(Boolean).map(p => { try { return decodeURIComponent(p); } catch { return null; } });
if (parts.includes(null)) return notFound();
const [a, b, c] = parts, n = parts.length;
+ 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 inboxView(get).then(html => afterHead(html, 'The inbox across all organizations is not built yet. This is the selected organization\'s inbox.'));
+ if (a === 'inbox' && n === 1 && window.MosaicOrg) return window.MosaicWorkspace.inboxPage(q);
if (a === 'tasks' && n === 1 && window.MosaicOrg) return tasksView(get).then(html => afterHead(html, 'Tasks across all organizations are not built yet. These are the selected organization\'s tasks.'));
if (a === 'inbox' && n === 1) return inboxView(get);
if (a === 'inbox' && n === 2) return SAFE.test(b) ? decisionView(get, b, current) : notFound(`${txt(b)} is not a decision id.`);
@@ -1475,7 +1477,9 @@
let gen = 0, shown = null, timer, proxyCleanup=null, orgCleanup=null;
const paused = () => $('pause')?.getAttribute('aria-pressed') === 'true';
// A file open in the editor is never refreshed from under its draft; Reload is the person's to press.
- function schedule() { clearTimeout(timer); if (!paused() && !out() && !routeOf().startsWith('/docs/')) timer = setTimeout(() => render(false), 10000); }
+ // The cross-organization pages (U3) poll at the workspace read's pollMs.
+ const wsPage = path => !!window.MosaicOrg && (path === '/' || path === '' || path === '/projects' || path === '/inbox');
+ function schedule() { clearTimeout(timer); if (!paused() && !out() && !routeOf().startsWith('/docs/')) timer = setTimeout(() => render(false), wsPage(routeOf().split('?')[0]) ? window.MosaicWorkspace?.pollMs || 10000 : 10000); }
// Keep focus, open and the copy status across a refresh of the same page.
// In the send form, the focused field and its caret too (its values come from `draft`).
function keep() {
@@ -1489,6 +1493,7 @@
field: view.contains(a) ? a.dataset?.field : null, caret: view.contains(a) && typeof a.selectionStart === 'number' ? [a.selectionStart, a.selectionEnd, a.scrollTop] : null, send: view.contains(a) && a.hasAttribute?.('data-send'),
decide: view.contains(a) ? a.dataset?.decide ?? (a.id === 'decide-status' ? 'status' : null) : null,
open: [...view.querySelectorAll('details[id]')].filter(d => d.open).map(d => d.id), status: $('copy-status')?.textContent || '',
+ scroll: [document.scrollingElement?.scrollTop ?? 0, $('main').scrollTop, [...view.querySelectorAll('.ws-tbl, .ws-insp')].map(e => [e.scrollLeft, e.scrollTop])],
};
}
function restore(k) {
@@ -1502,7 +1507,7 @@
const setting=k.settingsField && [...$('bus-view').querySelectorAll('[data-instance-field],[data-assistant-field],[data-route],[data-setting]')].find(e=>e.dataset[k.settingsField.key]===k.settingsField.value && (!k.settingsField.form || e.closest('form')?.id===k.settingsField.form) && (!k.settingsField.instance || e.closest('[data-instance]')?.dataset.instance===k.settingsField.instance));
// The workspace screens mark their controls with data-focus-key: several Open links share an href.
const keyed = k.focusKey ? $('bus-view').querySelector(k.focusKey === 'bus-restart' ? '[data-bus-restart]' : `[data-focus-key="${CSS.escape(k.focusKey)}"]`) : null;
- if (keyed) keyed.focus({ preventScroll: true });
+ if (keyed) { keyed.focus({ preventScroll: true }); if (k.caret && keyed.tagName === 'INPUT' && typeof keyed.setSelectionRange === 'function') try { keyed.setSelectionRange(k.caret[0], k.caret[1]); } catch {} }
else if (setting) { setting.focus({preventScroll:true}); if(k.caret && typeof setting.setSelectionRange==='function'){setting.setSelectionRange(k.caret[0],k.caret[1]);setting.scrollTop=k.caret[2];} }
else if (choice) choice.focus({preventScroll:true});
else if (dec) dec.focus({ preventScroll: true });
@@ -1511,23 +1516,35 @@
if (k.caret && el.tagName === 'TEXTAREA') { el.setSelectionRange(k.caret[0], k.caret[1]); el.scrollTop = k.caret[2]; }
}
else if (k.h1) $('bus-view').querySelector('h1')?.focus({ preventScroll: true });
+ // A repaint replaces the tables: put their horizontal scroll and the page's back.
+ if (k.scroll) {
+ const [top, main, inner] = k.scroll;
+ [...$('bus-view').querySelectorAll('.ws-tbl, .ws-insp')].forEach((e, i) => { if (inner[i]) { e.scrollLeft = inner[i][0]; e.scrollTop = inner[i][1]; } });
+ if (document.scrollingElement && document.scrollingElement.scrollTop !== top) document.scrollingElement.scrollTop = top;
+ if ($('main').scrollTop !== main) $('main').scrollTop = main;
+ }
}
async function render(navigated, opts = {}) {
// A refresh due while this render reads would replace it: a navigation would lose its heading focus.
clearTimeout(timer);
if (out()) return;
- const route = routeOf(), [path, query = ''] = route.split('?'), board = path === '/' || path === '' || path === '/board';
+ const route = routeOf(), [path, query = ''] = route.split('?'), board = window.MosaicOrg ? path === '/board' : path === '/' || path === '' || path === '/board';
+ // On the cross-organization pages a filter or selection changes only the query: that is a
+ // repaint of the same page, not a navigation (no loading view, focus and scroll kept).
+ const samePage = wsPage(path) && typeof shown === 'string' && shown.split('?')[0] === path;
if (path !== '/settings/model-proxy' && proxyCleanup) {proxyCleanup();proxyCleanup=null;}
if ((navigated || path !== '/settings/organizations') && orgCleanup) {orgCleanup();orgCleanup=null;}
// Leaving a decision discards its confirmation immediately, including a preview in flight.
if (answer && (navigated || path !== `/inbox/${answer.id}`)) answer = null;
const g = ++gen, routeVersion = routesEditVersion;
const current = () => g === gen && route === routeOf() && !out();
+ // In organization mode #/ is the cross-organization dashboard; the processing controls stay on the board.
+ if (window.MosaicOrg) for (const id of ['processing-link', 'mobile-processing-link']) if ($(id) && $(id).getAttribute('href') !== '#/board') $(id).setAttribute('href', '#/board');
document.body.classList.toggle('on-bus', !board);
$('bus-view').hidden = board;
sections(path);
document.querySelectorAll('.rail a').forEach(a => { const target = a.getAttribute('href').slice(1); const active = target === '/projects' ? /^\/(projects|chat)(\/|$)/.test(path) : target === '/' ? path === '/' : path === target; if (active) a.setAttribute('aria-current', 'page'); else a.removeAttribute('aria-current'); });
- const chatPath = path === '/projects' ? '/chat' : /^\/projects\/(threads|rooms)\//.test(path) ? '/chat' + path.slice('/projects'.length) : /^\/projects\/[^/]+$/.test(path) ? '/chat/projects/' + path.slice('/projects/'.length) : path;
+ const chatPath = path === '/projects' && !window.MosaicOrg ? '/chat' : /^\/projects\/(threads|rooms)\//.test(path) ? '/chat' + path.slice('/projects'.length) : /^\/projects\/[^/]+$/.test(path) ? '/chat/projects/' + path.slice('/projects/'.length) : path;
window.MosaicChat?.leave(chatPath);
if (path === '/business') { location.replace('#/settings/business'); return; }
if (path === '/settings/display') { location.replace('#/settings/appearance'); return; }
@@ -1597,11 +1614,11 @@
if (path === '/settings/model-proxy' && shown === route && !navigated) return;
if (path === '/settings/organizations' && shown?.split('?')[0] === path && !navigated) return;
if (($('agent-dialog')?.open || document.querySelector('.agent-more[aria-expanded=true]')) && !navigated) { schedule(); return; }
- if (navigated || shown !== route) { unmountEditor(); $('bus-view').innerHTML = loadingView(SOURCES[path.split('/')[1]]); }
+ if (navigated || (shown !== route && !samePage)) { unmountEditor(); $('bus-view').innerHTML = loadingView(SOURCES[path.split('/')[1]]); }
let html, state = 'fresh';
const live = reader(true);
try {
- if (path !== '/organization' && !(path === '/agents' && window.MosaicOrg) && path !== '/messages' && !['/settings','/settings/appearance','/settings/model-proxy','/settings/organizations'].includes(path)) {
+ if (path !== '/organization' && !wsPage(path) && !(path === '/agents' && window.MosaicOrg) && path !== '/messages' && !['/settings','/settings/appearance','/settings/model-proxy','/settings/organizations'].includes(path)) {
try { await live('messages'); }
catch (err) { messageCount = null; if (err.status === 403 || err.code === 'signed-out') throw err; }
}
@@ -1617,7 +1634,7 @@
freshBus(state, SOURCES[path.split('/')[1]]);
// A route edit after the markup was prepared must win over that pending redraw.
if(path==='/settings/routing' && routeVersion!==routesEditVersion){render(false);return;}
- const k = !navigated && shown === route ? keep() : null;
+ const k = !navigated && (shown === route || samePage) ? keep() : null;
unmountEditor();
$('bus-view').innerHTML = html; shown = route;
syncAppearance(true);
@@ -1800,10 +1817,14 @@
}
if (!canSend && !isTester && !ssoOn) return;
const path = routeOf().split('?')[0];
- if (path.startsWith('/chat')||path.startsWith('/projects')||path.startsWith('/inbox')||path.startsWith('/settings')||path.startsWith('/docs/')) render(false); else if (path === '/' || path === '') paintHeld(heldErr);
+ if (path.startsWith('/chat')||path.startsWith('/projects')||path.startsWith('/inbox')||path.startsWith('/settings')||path.startsWith('/docs/')||wsPage(path)) render(false); else if (window.MosaicOrg ? path === '/board' : path === '/' || path === '') paintHeld(heldErr);
};
configRead = fetch('/api/config', { cache: 'no-store', redirect: 'manual' }).then(r => { if (r.type === 'opaqueredirect') { signOut(); return null; } return r.json(); }).then(applyConfig).catch(() => {});
document.addEventListener('mosaic-config', e => { if (e.detail && typeof e.detail === 'object') applyConfig(e.detail); });
+ // The cross-organization pages ask for a repaint after a filter, sort or selection change,
+ // and report the inbox count across organizations for the sidebar.
+ document.addEventListener('mosaic-workspace-render', () => { if (wsPage(routeOf().split('?')[0])) render(false); });
+ document.addEventListener('mosaic-workspace-inbox', e => { const d = e.detail; if (d && Number.isFinite(d.open)) { inboxCount = { open: d.open, blocking: Number.isFinite(d.blocking) ? d.blocking : 0 }; sections(routeOf().split('?')[0]); } });
// This context comes from the conversations renderer after its authorized read.
let projectContext = null;
document.addEventListener('mosaic-project-context', event => {
diff --git a/packages/webui/src/public/chat.js b/packages/webui/src/public/chat.js
index 3c6816221..6acbe74a6 100644
--- a/packages/webui/src/public/chat.js
+++ b/packages/webui/src/public/chat.js
@@ -99,7 +99,9 @@
}
return data;
}
- const legacyRoute = () => (window.MosaicOrg?.route() ?? location.hash.slice(1)).startsWith('/chat');
+ // In organization mode #/projects is the cross-organization page, so the organization's own
+ // project list lives at #/chat. That list keeps the project surface and its #/projects links.
+ const legacyRoute = () => { const r = window.MosaicOrg?.route() ?? location.hash.slice(1); return r.startsWith('/chat') && !(window.MosaicOrg && r.split('?')[0] === '/chat'); };
const projectPath = id => legacyRoute() ? `#/chat/projects/${id}` : `#/projects/${id}`;
const threadPath = id => legacyRoute() ? `#/chat/threads/${id}` : `#/projects/threads/${id}`;
const roomPath = id => legacyRoute() ? `#/chat/rooms/${id}` : `#/projects/rooms/${id}`;
diff --git a/packages/webui/src/public/display.js b/packages/webui/src/public/display.js
index 691346f0f..97e382c49 100644
--- a/packages/webui/src/public/display.js
+++ b/packages/webui/src/public/display.js
@@ -34,7 +34,7 @@ window.MosaicLocalTime = value => Number.isFinite(Date.parse(value)) ? new Date(
}
const route = () => location.hash.replace(/^#\/orgs\/[^/]+/, '') || '/';
window.fetch = (input, init) => {
- if (typeof input === 'string' && input.startsWith('/api/') && !/^\/api\/(?:orgs(?:\/|$)|themes(?:\?|$)|org-template(?:\?|$)|org-presets(?:\?|$)|org-admin(?:\?|$)|org-validate(?:\?|$)|agents\/levels(?:\?|$))/.test(input))
+ if (typeof input === 'string' && input.startsWith('/api/') && !/^\/api\/(?:orgs(?:\/|$)|themes(?:\?|$)|org-template(?:\?|$)|org-presets(?:\?|$)|org-admin(?:\?|$)|org-validate(?:\?|$)|workspace(?:\?|$)|agents\/levels(?:\?|$))/.test(input))
input = `/api/orgs/${id}/${input.slice('/api/'.length)}`;
return nativeFetch(input, init);
};
diff --git a/packages/webui/src/public/org-create.js b/packages/webui/src/public/org-create.js
index d3554f4e2..bd454aecb 100644
--- a/packages/webui/src/public/org-create.js
+++ b/packages/webui/src/public/org-create.js
@@ -628,7 +628,7 @@
[$('org-quick-run'), 'click', quickRun],
// F2: the interview opens a conversation with the assistant; Open organization skips it.
[$('org-quick-interview'), 'click', async () => { const b = $('org-quick-interview'); b.disabled = true; if (!await window.MosaicOnboarding?.start({ ...quickDone, status })) b.disabled = false; }],
- [$('org-quick-open-org'), 'click', () => { history.replaceState(null, '', `#/orgs/${encodeURIComponent(st.id)}/projects`); location.reload(); }],
+ [$('org-quick-open-org'), 'click', () => { history.replaceState(null, '', `#/orgs/${encodeURIComponent(st.id)}/chat`); location.reload(); }],
[$('org-open-form'), 'submit', e => { e.preventDefault(); const id = $('org-open-id').value; if (id) openExisting(id); }],
[$('org-form'), 'submit', save],
[$('org-form'), 'input', onFormInput],
diff --git a/packages/webui/src/public/shell.css b/packages/webui/src/public/shell.css
index 9c15d445b..25df2cb58 100644
--- a/packages/webui/src/public/shell.css
+++ b/packages/webui/src/public/shell.css
@@ -538,6 +538,139 @@ html[data-organizations] .ws-off{display:block;margin-top:4px}
html[data-organizations] .ws-rules .ws-lvl{margin-right:0}
html[data-organizations] .ws-scope{margin:-8px 0 14px}
+/* Across organizations (U3): the main dashboard, projects and inbox, samples 02, 04 and 05. */
+body:has([data-ws-home]) #breadcrumbs,body:has([data-ws-projects]) #breadcrumbs,body:has([data-ws-inbox]) #breadcrumbs{display:none}
+html[data-organizations] .ws-edge{box-shadow:inset 3px 0 0 var(--org)}
+html[data-organizations] .ws-orgref{display:inline-flex;align-items:center;gap:6px;white-space:nowrap;color:var(--strong);font-weight:600}
+html[data-organizations] .ws-chip{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:600;padding:1px 7px;border-radius:4px;background:var(--raised);color:var(--strong);white-space:nowrap;line-height:1.5}
+html[data-organizations] .ws-chip.gated{background:color-mix(in srgb,var(--danger) 14%,var(--surface));color:var(--danger)}
+html[data-organizations] .ws-chip.block{background:var(--danger);color:var(--surface)}
+html[data-organizations] .ws-chip.outline{background:none;box-shadow:inset 0 0 0 1px var(--line);color:var(--text);font-family:var(--mono);font-weight:500;font-size:11.5px}
+html[data-organizations] .ws-dot.s-ok{color:var(--success)}
+html[data-organizations] .ws-tbl .ws-dot,html[data-organizations] .ws-sess .ws-dot{color:var(--text)}
+html[data-organizations] .ws-tbl .ws-dot.s-working b,html[data-organizations] .ws-tbl .ws-dot.s-ok b{color:var(--success)}
+html[data-organizations] .ws-tbl .ws-dot.s-waiting b{color:var(--warning)}
+html[data-organizations] .ws-tbl .ws-dot.s-error b{color:var(--danger)}
+html[data-organizations] .ws-tbl .ws-dot.s-idle b,html[data-organizations] .ws-tbl .ws-dot.s-offline b{color:var(--muted)}
+html[data-organizations] .ws-g5{display:grid;gap:10px;grid-template-columns:repeat(5,minmax(0,1fr))}
+html[data-organizations] .ws-tile .ws-big{font-size:24px;font-weight:800;color:var(--strong);letter-spacing:-.02em;font-variant-numeric:tabular-nums;line-height:1.1}
+html[data-organizations] .ws-tile .ws-big small{font-size:13px;font-weight:600;color:var(--muted);letter-spacing:0;margin-left:4px}
+html[data-organizations] .ws-tile .ws-delta{font-size:12px;color:var(--muted)}
+html[data-organizations] .ws-tile .ws-delta b{color:var(--success);font-weight:600}
+html[data-organizations] .ws-tile.quiet{border-style:dashed;background:transparent}
+html[data-organizations] .ws-bar{display:flex;height:6px;border-radius:3px;overflow:hidden;background:var(--raised);gap:2px}
+html[data-organizations] .ws-bar i{display:block;background:var(--org,var(--action))}
+html[data-organizations] .ws-by{display:flex;flex-wrap:wrap;gap:4px 10px;font-size:12px;color:var(--text)}
+html[data-organizations] .ws-by>span{display:inline-flex;align-items:center;gap:4px;white-space:nowrap;font-variant-numeric:tabular-nums}
+html[data-organizations] .ws-by .ws-av{width:14px;height:14px;border-radius:3px;font-size:7px}
+html[data-organizations] .ws-orgcards{list-style:none;margin:0;padding:0;display:grid;gap:8px;grid-template-columns:repeat(auto-fill,minmax(220px,1fr))}
+html[data-organizations] .ws-orgcard a{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:2px 10px;align-items:center;padding:9px 12px;border:1px solid var(--line);border-radius:8px;background:var(--surface);box-shadow:inset 3px 0 0 var(--org);color:var(--text);text-decoration:none;font-size:13px;height:100%}
+html[data-organizations] .ws-orgcard a:hover{background:var(--raised)}
+html[data-organizations] .ws-orgcard .ws-av{grid-row:1/3}
+html[data-organizations] .ws-orgcard .nm{font-weight:700;color:var(--strong);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
+html[data-organizations] .ws-orgcard .ws-dot{grid-column:2;grid-row:2;font-size:12.5px;color:var(--text)}
+html[data-organizations] .ws-orgcard .ws-dot.s-working b{color:var(--success)}
+html[data-organizations] .ws-orgcard .ws-dot.s-waiting b{color:var(--warning)}
+html[data-organizations] .ws-orgcard .ws-dot.s-error b{color:var(--danger)}
+html[data-organizations] .ws-orgcard .at{grid-column:3;grid-row:1;font:500 11.5px var(--mono);color:var(--muted)}
+html[data-organizations] .ws-orgcard .why{grid-column:1/-1;font-size:12px;color:var(--muted)}
+html[data-organizations] .ws-orgcard.off a{border-style:dashed}
+html[data-organizations] .ws-home-split{margin-top:4px}
+html[data-organizations] .ws-trail{list-style:none;margin:0;padding:0;border:1px solid var(--line);border-radius:8px;background:var(--surface)}
+html[data-organizations] .ws-trail li{display:grid;grid-template-columns:48px 20px minmax(0,1fr);gap:10px;padding:7px 12px;border-bottom:1px solid color-mix(in srgb,var(--line) 60%,transparent);font-size:13px;align-items:center}
+html[data-organizations] .ws-trail li:last-child{border-bottom:0}
+html[data-organizations] .ws-trail time{font-family:var(--mono);font-size:12px;color:var(--muted)}
+html[data-organizations] .ws-trail .what{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
+html[data-organizations] .ws-trail .what a{color:var(--strong);text-decoration:none}
+html[data-organizations] .ws-trail .what a:hover{text-decoration:underline}
+html[data-organizations] .ws-trail .what b{font-weight:600}
+html[data-organizations] .ws-trail .src{color:var(--muted)}
+html[data-organizations] .ws-states{display:grid;gap:8px}
+html[data-organizations] .ws-srow{display:grid;grid-template-columns:112px 24px minmax(0,1fr) auto;gap:10px;align-items:center;font-size:13px}
+html[data-organizations] .ws-srow .sl{color:var(--strong);font-weight:600}
+html[data-organizations] .ws-srow .sn{font:700 13px var(--mono);color:var(--strong);text-align:right}
+html[data-organizations] .ws-srow .ws-bar{height:8px;max-width:100%}
+html[data-organizations] .ws-needs{list-style:none;margin:0;padding:0;display:grid;gap:8px}
+html[data-organizations] .ws-needs li{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:4px 10px;align-items:center;background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:9px 12px}
+html[data-organizations] .ws-needs li>.ws-av{grid-row:1/3}
+html[data-organizations] .ws-needs .q{color:var(--strong);font-weight:600;font-size:13.5px;text-decoration:none}
+html[data-organizations] .ws-needs .q:hover{text-decoration:underline}
+html[data-organizations] .ws-needs .src{grid-column:2;font-size:12px;color:var(--muted)}
+html[data-organizations] .ws-needs .ws-chip{grid-row:1/3;grid-column:3}
+html[data-organizations] .ws-more-line{margin:6px 0 0}
+html[data-organizations] .ws-sess td.who{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:0;width:100%}
+html[data-organizations] .ws-sess td.who .ws-orgref{vertical-align:middle}
+html[data-organizations] .ws-sess td.st{white-space:nowrap}
+/* Filters and tables on Projects and Inbox. */
+html[data-organizations] .ws-toolbar{display:flex;flex-wrap:wrap;gap:8px 10px;align-items:center;margin-bottom:12px}
+html[data-organizations] .ws-toolbar .ws-right{align-items:center}
+html[data-organizations] .ws-toolbar .ws-seg{margin-left:0}
+html[data-organizations] .ws-fchips{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
+html[data-organizations] .ws-fchips .f{display:inline-flex;align-items:center;gap:6px;min-height:0;border:1px solid var(--line);background:var(--surface);border-radius:999px;padding:2px 10px 2px 4px;font:600 12.5px/1.5 var(--font);color:var(--text);white-space:nowrap;cursor:pointer;box-shadow:none}
+html[data-organizations] .ws-fchips .f.plain{padding-left:10px}
+html[data-organizations] .ws-fchips .f:hover{background:var(--raised)}
+html[data-organizations] .ws-fchips .f[aria-pressed="true"]{background:var(--strong);color:var(--surface);border-color:var(--strong)}
+html[data-organizations] .ws-fchips .f .ws-av{width:18px;height:18px;border-radius:999px;font-size:8.5px;letter-spacing:0}
+html[data-organizations] .ws-fchips .f .n{margin-left:2px;font:600 11px var(--mono);opacity:.8}
+html[data-organizations] .ws-sel{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);background:var(--surface);border-radius:var(--r);padding:0 0 0 8px;font-size:13px;color:var(--strong);white-space:nowrap}
+html[data-organizations] .ws-sel .ws-label{font-size:10px}
+html[data-organizations] .ws-sel select{border:0;background:transparent;color:var(--strong);font:500 13px/1.5 var(--font);padding:3px 6px 3px 2px;min-height:0;box-shadow:none;width:auto}
+html[data-organizations] .ws-search{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);background:var(--surface);border-radius:var(--r);padding:0 8px;color:var(--muted);font-size:13px;min-width:180px}
+html[data-organizations] .ws-search svg.i{width:14px;height:14px;flex:none}
+html[data-organizations] .ws-search input{border:0;background:transparent;color:var(--strong);font:500 13px/1.5 var(--font);padding:3px 0;min-height:0;box-shadow:none;width:100%;min-width:0}
+html[data-organizations] .ws-search:focus-within,html[data-organizations] .ws-sel:focus-within{outline:2px solid var(--focus,var(--action));outline-offset:1px}
+html[data-organizations] .ws-search input:focus,html[data-organizations] .ws-sel select:focus{outline:none}
+html[data-organizations] .ws-tbl th.sorted{color:var(--strong)}
+html[data-organizations] .ws-tbl th .ar{font-family:var(--mono);margin-left:3px;color:var(--action)}
+html[data-organizations] .ws-tbl td.num,html[data-organizations] .ws-tbl th.num{text-align:right;font-variant-numeric:tabular-nums}
+html[data-organizations] .ws-tbl tr.ws-edge td:first-child{box-shadow:inset 3px 0 0 var(--org)}
+html[data-organizations] .ws-tbl tr.ws-edge{box-shadow:none}
+html[data-organizations] .ws-tbl .nm{color:var(--strong);font-weight:600;text-decoration:none}
+html[data-organizations] .ws-tbl a.nm:hover{text-decoration:underline}
+html[data-organizations] .ws-tbl .ws-n{margin-left:0}
+html[data-organizations] .ws-grp-row th{padding:8px 10px 6px;background:color-mix(in srgb,var(--raised) 45%,var(--surface));text-transform:none;letter-spacing:0;font-size:12.5px;color:var(--strong);box-shadow:inset 3px 0 0 var(--org)}
+html[data-organizations] .ws-grp-row th>*{vertical-align:middle}
+html[data-organizations] .ws-grp-row th>span{margin-left:8px}
+html[data-organizations] .ws-tbl .ws-grp-row th>.ws-n{margin-left:8px}
+html[data-organizations] .ws-unread td{font-size:12.5px}
+html[data-organizations] .ws-unread-note{margin:-4px 0 10px}
+html[data-organizations] .ws-av.mob{display:none}
+html[data-organizations] .ws .show-m{display:none}
+/* Inbox. */
+html[data-organizations] .ws-ibx-grid{display:grid;gap:16px;grid-template-columns:minmax(0,1fr)}
+html[data-organizations] .ws-ibx-grid.with-insp{grid-template-columns:minmax(0,1fr) minmax(300px,360px);align-items:start}
+html[data-organizations] .ws-ibx-list>.ws-sec-h{margin-top:22px}
+html[data-organizations] .ws-ibx td.src{white-space:nowrap}
+html[data-organizations] .ws-ibx .q{color:var(--strong);font-weight:600;text-decoration:none}
+html[data-organizations] .ws-ibx .q:hover{text-decoration:underline}
+html[data-organizations] .ws-ibx .via{display:block;font-size:12px;color:var(--muted)}
+html[data-organizations] .ws-ibx tr.on{background:color-mix(in srgb,var(--action) 10%,var(--surface))}
+html[data-organizations] .ws-ibx tr.on td:first-child{box-shadow:inset 3px 0 0 var(--action)}
+html[data-organizations] .ws-msrc{align-items:center;gap:5px;font-size:12px;color:var(--muted);margin-bottom:2px}
+html[data-organizations] .ws-insp{border:1px solid var(--line);border-radius:10px;background:var(--surface);display:flex;flex-direction:column;min-width:0;position:sticky;top:12px;max-height:calc(100vh - 80px);overflow:auto}
+html[data-organizations] .ws-insp header{display:flex;align-items:center;gap:8px;padding:10px 14px;border-bottom:1px solid var(--line);background:var(--surface);position:sticky;top:0;z-index:1;box-shadow:inset 3px 0 0 var(--org)}
+html[data-organizations] .ws-insp header .x{margin-left:auto;color:var(--muted);display:inline-flex}
+html[data-organizations] .ws-insp header .x svg.i{width:18px;height:18px}
+html[data-organizations] .ws-insp .body{padding:14px;display:grid;gap:14px}
+html[data-organizations] .ws-insp h3{margin:0;font-size:16px;font-weight:700;color:var(--strong)}
+html[data-organizations] .ws-insp .note{margin:0}
+html[data-organizations] .ws-auth{border:1px solid var(--line);border-left:3px solid var(--org,var(--action));border-radius:0 6px 6px 0;padding:8px 10px;background:var(--canvas);font-size:13px;color:var(--strong)}
+html[data-organizations] .ws-opts{list-style:none;margin:0;padding:0;display:grid;gap:8px}
+html[data-organizations] .ws-opts li{border:1px solid var(--line);border-radius:8px;padding:9px 10px;display:grid;gap:6px;background:var(--canvas)}
+html[data-organizations] .ws-opts .k{font:700 13px var(--mono);color:var(--strong)}
+html[data-organizations] .ws-opts .row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
+html[data-organizations] .ws-opts b{font-weight:600;color:var(--strong)}
+html[data-organizations] [data-ws-cmds]{display:grid;gap:6px}
+html[data-organizations] .ws-cmd{display:flex;gap:6px;align-items:center;min-width:0}
+html[data-organizations] .ws-cmd code{flex:1;min-width:0;overflow-x:auto;white-space:nowrap;background:var(--surface);border:1px solid var(--line);border-radius:4px;padding:3px 6px;font-size:12px;color:var(--strong)}
+html[data-organizations] .ws-cmd .ws-btn{padding:4px 6px}
+html[data-organizations] #copy-status:empty{display:none}
+@media (max-width:1100px){
+ html[data-organizations] .ws-g5{grid-template-columns:repeat(3,minmax(0,1fr))}
+ html[data-organizations] .ws-ibx-grid.with-insp{grid-template-columns:minmax(0,1fr)}
+ html[data-organizations] .ws-insp{position:static;max-height:none}
+}
+
@media (pointer:coarse){html[data-organizations] .ws-nav,html[data-organizations] .s1-section.ws-nav{min-height:40px}}
@media (max-width:759px){
html[data-organizations] .content:has(.ws){padding:14px 16px 24px}
@@ -559,4 +692,19 @@ html[data-organizations] .ws-scope{margin:-8px 0 14px}
html[data-organizations] .ws-levels>.span{grid-column:auto}
html[data-organizations] .ws-levels>.last.lh{border-bottom:1px solid color-mix(in srgb,var(--line) 60%,transparent)}
html[data-organizations] .ws-levels .mlabel{display:flex}
+ html[data-organizations] .ws-g5{grid-template-columns:minmax(0,1fr)}
+ html[data-organizations] .ws-g5.keep2{grid-template-columns:repeat(2,minmax(0,1fr))}
+ html[data-organizations] .ws-g5.keep2>:last-child:nth-child(odd){grid-column:1/-1}
+ html[data-organizations] .ws-orgcards{grid-template-columns:minmax(0,1fr)}
+ html[data-organizations] .ws-srow{grid-template-columns:92px 20px minmax(0,1fr)}
+ html[data-organizations] .ws-srow .ws-by{grid-column:1/-1}
+ html[data-organizations] .ws-trail li{grid-template-columns:42px 18px minmax(0,1fr);gap:8px}
+ html[data-organizations] .ws-trail .what{white-space:normal}
+ html[data-organizations] .ws-toolbar .ws-right{margin-left:0}
+ html[data-organizations] .ws-search{min-width:0;flex:1 1 100%}
+ html[data-organizations] .ws .show-m,html[data-organizations] .ws-tbl .t2.show-m{display:block}
+ html[data-organizations] .ws span.show-m{display:inline-flex}
+ html[data-organizations] .ws span.ws-msrc.show-m{display:flex}
+ html[data-organizations] .ws-av.mob{display:inline-grid;margin-right:6px;vertical-align:-3px}
+ html[data-organizations] .ws-tbl .t2.mono.hide-m{display:none}
}
diff --git a/packages/webui/src/public/workspace-data.js b/packages/webui/src/public/workspace-data.js
index 845fee6d5..418a18350 100644
--- a/packages/webui/src/public/workspace-data.js
+++ b/packages/webui/src/public/workspace-data.js
@@ -4,7 +4,8 @@
(() => {
const read = async path => {
const response = await fetch(path, { cache: 'no-store', redirect: 'manual' });
- if (!response.ok || response.type === 'opaqueredirect') throw new Error('Read unavailable');
+ // The status travels with the failure, so a caller can tell a refusal (403) from a bus that is down.
+ if (!response.ok || response.type === 'opaqueredirect') { const error = new Error('Read unavailable'); error.status = response.type === 'opaqueredirect' ? 0 : response.status; throw error; }
return response.json();
};
const orgPath = (id, path) => `/api/orgs/${encodeURIComponent(id)}/${path}`;
@@ -20,7 +21,16 @@
const business = id => read(orgPath(id, 'business'));
const settings = id => read(orgPath(id, 'settings'));
const projectFiles = (id, project) => read(orgPath(id, `project-files?project=${encodeURIComponent(project)}`));
+ // U1's cross-organization read (GET /api/workspace). Only the keys it accepts are sent, each once:
+ // an unknown or repeated key is a 400 there.
+ const WORKSPACE_KEYS = ['sections', 'org', 'status', 'state', 'name', 'sort', 'order', 'project'];
+ const workspace = (params = {}) => {
+ const q = new URLSearchParams();
+ for (const key of WORKSPACE_KEYS) { const v = params[key]; if (v !== undefined && v !== null && v !== '') q.set(key, Array.isArray(v) ? v.join(',') : String(v)); }
+ const qs = q.toString();
+ return read(`/api/workspace${qs ? `?${qs}` : ''}`);
+ };
// The three agent levels (root, organization, project) for every organization on the list, owner only.
const agentLevels = () => read('/api/agents/levels');
- window.MosaicWorkspaceData = Object.freeze({ organizations, themes, projects, threads, instances, agents, claims, queue, business, settings, projectFiles, agentLevels });
+ window.MosaicWorkspaceData = Object.freeze({ organizations, themes, projects, threads, instances, agents, claims, queue, business, settings, projectFiles, workspace, agentLevels });
})();
diff --git a/packages/webui/src/public/workspace.js b/packages/webui/src/public/workspace.js
index e9968c4f9..6f81ad2d7 100644
--- a/packages/webui/src/public/workspace.js
+++ b/packages/webui/src/public/workspace.js
@@ -128,7 +128,7 @@
if (toggle) { expanded = !expanded; save(ORGS_OPEN, expanded ? 'open' : 'closed'); paint(); document.querySelector('[data-org-toggle]')?.focus(); return; }
if (e.target.closest?.('[data-projects-toggle]')) { projectsOpen = !projectsOpen; save(PROJECTS_OPEN, projectsOpen ? 'open' : 'closed'); paint(); document.querySelector('[data-projects-toggle]')?.focus(); return; }
const group = e.target.closest?.('#workspace-nav [data-group]');
- if (group) { grouping = group.dataset.group === 'flat' ? 'flat' : 'org'; save(GROUPING, grouping); paint(); document.querySelector(`#workspace-nav [data-group="${grouping}"]`)?.focus(); }
+ if (group) { grouping = group.dataset.group === 'flat' ? 'flat' : 'org'; save(GROUPING, grouping); paint(); document.querySelector(`#workspace-nav [data-group="${grouping}"]`)?.focus(); if (route().split('?')[0] === '/projects') document.dispatchEvent(new CustomEvent('mosaic-workspace-render')); }
});
window.addEventListener('hashchange', () => { if (orgs) paint(); });
document.addEventListener('mosaic-org-list', e => refresh(e.detail?.rows));
@@ -389,6 +389,338 @@
box.innerHTML = agentsAvailable(select.value);
});
- window.MosaicWorkspace = Object.freeze({ dashboard, agentGrid, icon, refresh: () => refresh() });
+ // ---------- across organizations (U3: samples 02, 04 and 05) ----------
+ // One read, GET /api/workspace (U1), backs the three pages. Each organization carries a state and
+ // the time it was read: one that is down, starting or slow is named with that state, and the rest
+ // still render. Filters live in the page's hash query, so a poll repaints the same view and a
+ // link reproduces it. Numbers come only from the read; a field no read gives is one honest line.
+ let pollMs = 10000;
+ const took = body => { const n = Number(body?.pollMs); if (Number.isFinite(n) && n >= 1000) pollMs = n; return body; };
+ const selHref = path => `#/orgs/${enc(window.MosaicOrg?.id || '')}${path}`;
+ const ORG_STATE = { ok: ['s-working', '●', 'running'], starting: ['s-waiting', '◐', 'starting'], down: ['s-offline', '○', 'down'], timeout: ['s-error', '▲', 'not answering'], invalid: ['s-error', '▲', 'invalid'] };
+ const orgState = o => ORG_STATE[o?.state] || ['s-unknown', '?', 'not reported'];
+ const msOf = iso => { const t = Date.parse(iso || ''); return Number.isFinite(t) ? t : null; };
+ const hm = iso => { const t = msOf(iso); return t === null ? '' : new Date(t).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); };
+ // Today's times as HH:MM, older ones as a short date.
+ const when = iso => { const t = msOf(iso); if (t === null) return ''; const d = new Date(t); return d.toDateString() === new Date().toDateString() ? hm(iso) : d.toLocaleDateString([], { month: 'short', day: 'numeric' }); };
+ const span = iso => { const t = msOf(iso); if (t === null) return ''; const m = Math.max(0, Math.floor((Date.now() - t) / 60000)); return m < 1 ? 'under a minute' : m < 60 ? `${m} min` : m < 2880 ? `${Math.floor(m / 60)} h` : `${Math.floor(m / 1440)} days`; };
+ const ago = iso => { const s = span(iso); return !s ? '' : s === 'under a minute' ? 'just now' : `${s} ago`; };
+ const num = v => (Number.isFinite(v) ? v : 0);
+ const arr = v => (Array.isArray(v) ? v : []);
+ // The organizations the read names, with their colours, marks and states.
+ function orgsOf(body) {
+ const rows = arr(body?.orgs).filter(o => o && typeof o.org === 'string');
+ // The read names an organization by id; the sidebar's list carries its display label.
+ const known = id => (Array.isArray(orgs) ? orgs.find(x => x?.id === id) : null);
+ const byId = new Map(rows.map(o => [o.org, { id: o.org, label: known(o.org)?.label || o.label || o.org, theme: o.theme ?? known(o.org)?.theme ?? null }]));
+ const meta = id => byId.get(id) || { id, label: id };
+ return {
+ rows, meta, name: id => label(meta(id)), style: id => colours(meta(id)),
+ ref: (id, cls = '') => `${av(meta(id))}${esc(label(meta(id)))}`,
+ unread: rows.filter(o => o.state !== 'ok'),
+ };
+ }
+ const stateWords = o => `${esc((Array.isArray(orgs) ? orgs.find(x => x?.id === o.org)?.label : null) || o.label || o.org)} ${orgState(o)[2]}${o.at ? `, read ${hm(o.at)}` : ''}`;
+ const andList = items => (items.length < 2 ? items.join('') : `${items.slice(0, -1).join(', ')} and ${items[items.length - 1]}`);
+ // An organization that answered can still fail one read (errors in GET /api/workspace). The page
+ // names that organization and the reason rather than count the read as zero.
+ const READ_WHY = { 'channel-disabled': 'the chat channel is off', 'outcome-unknown': 'no answer', timeout: 'no answer in time' };
+ const missOf = (r, names) => { const n = r?.state === 'ok' && r.errors ? names.find(x => r.errors[x]) : null; return n ? READ_WHY[r.errors[n]] || String(r.errors[n]) : null; };
+ const missed = (o, names) => o.rows.filter(r => missOf(r, names)).map(r => `${esc(o.name(r.org))} (${esc(missOf(r, names))})`);
+ const missLine = (o, names, key) => { const m = missed(o, names); return m.length ? `
Not read in ${andList(m)}.
` : ''; };
+ function failedPage(cls, attr, title, err) {
+ const why = err?.status === 403 ? 'This Console refused the read across organizations.' : err?.status === 0 ? 'You are signed out. Reload the page to sign in again.' : err?.status === 400 ? 'The read refused these filters. Clear them and try again.' : 'The read across organizations did not answer. The page tries again on its next refresh.';
+ return `
${title}
${why}
`;
+ }
+ // The Inbox count in the navigation follows the cross-organization read wherever it was made.
+ const tellInbox = rows => { if (Array.isArray(rows)) document.dispatchEvent(new CustomEvent('mosaic-workspace-inbox', { detail: { open: rows.length, blocking: rows.filter(d => d?.blocking).length } })); };
+ // A stacked bar and its per-organization figures, one segment per organization.
+ const bar = (o, parts, style = '') => `
No session working right now${idle ? `; ${plural(idle, 'idle session')}` : ''}
`;
+
+ const total = t ? num(t.projects?.active) + num(t.projects?.archived) : null;
+ const allRead = !o.unread.length;
+ const sub = !o.rows.length ? 'You belong to no organization yet.'
+ : allRead ? `All ${plural(o.rows.length, 'organization')}${missed(o, ['projects']).length ? '' : ` and ${plural(total ?? 0, 'project')}`}. Totals add up every organization you belong to; each tile breaks them down by organization.`
+ : `${body.summary?.read ?? o.rows.length - o.unread.length} of ${plural(o.rows.length, 'organization')} answered. Totals add up the ones that answered; ${andList(o.unread.map(stateWords))}.`;
+ return `
+
The inbox mixes organizations, so the copied command always names the organization's bus.
` : '
No terminal command for this item: its id or options cannot be passed to a shell safely.
';
+ const by = roleOf(d);
+ insp = ``;
+ }
+ const orgsWith = new Set(rows.map(d => d.org)).size;
+ const sub = rows.length ? `${plural(rows.length, 'item')} need${rows.length === 1 ? 's' : ''} you, from ${plural(orgsWith, 'organization')}. Each row names where it came from. An item leaves only when it is answered.` : `${missed(o, ['inbox']).length || o.unread.length ? 'Nothing needs you in the organizations that were read.' : 'Nothing needs you right now.'} An item leaves only when it is answered.`;
+ return `
+