Nightly Build / build (push) Successful in 7m51s
An eye next to the paperclip shares what the user has open with their next
message: the page, the folder being browsed, the file open in the viewer and
any highlighted passage (line numbers where a source view exists), plus which
entity a detail page is about. The bag is client-authored {label, value} pairs
in English — the backend only clamps (chars, never bytes), neutralizes the
harness tag and renders one <system-extra> block per message, deduped
consecutively so it appears exactly when the view changed. On by default,
per-device toggle, hover/tap to preview, a chip on every sent message;
docs/view-context.md for users, an updated harness.md clause for the model.
129 lines
6.8 KiB
JavaScript
129 lines
6.8 KiB
JavaScript
import { AppTopbar } from './components/topbar.js';
|
|
import { AppSidebar } from './components/sidebar.js';
|
|
import { AppCopilot } from './components/copilot.js';
|
|
import { LlmProvidersPage } from './components/llm-providers.js';
|
|
import { ModelsHubPage } from './components/models-hub.js';
|
|
import { ModelsLlmSection } from './components/models-llm.js';
|
|
import { ModelsTranscribeSection } from './components/models-transcribe.js';
|
|
import { ModelsImageSection } from './components/models-image.js';
|
|
import { ModelsTtsSection } from './components/models-tts.js';
|
|
import { TasksPage } from './components/tasks/index.js';
|
|
import { AgentsPage } from './components/agents.js';
|
|
import { UsersPage } from './components/users-page.js';
|
|
import { RolesPage } from './components/roles-page.js';
|
|
import { SharedFoldersPage } from './components/shared-folders.js';
|
|
import { ConnectorsPage } from './components/connectors.js';
|
|
import { ConnectorDetailPage } from './components/connector-detail.js';
|
|
import { PluginPageHost } from './components/plugin-page-host.js';
|
|
import { PluginCatalogPage } from './components/plugin-catalog.js';
|
|
import { PluginDetailPage } from './components/plugin-detail.js';
|
|
import { MarketplacePage } from './components/marketplace.js';
|
|
import { ProfilePage } from './components/profile-page.js';
|
|
import { ApprovalGroupsPage } from './components/approval-groups.js';
|
|
import { ApprovalRulesPage } from './components/approval-rules.js';
|
|
import { ConfigPage } from './components/config-page.js';
|
|
import { DashboardPage } from './components/dashboard-page.js';
|
|
import { AgentInboxPage } from './components/agent-inbox.js';
|
|
import { LlmRequestsPage } from './components/llm-requests.js';
|
|
import { LlmRequestDetail } from './components/llm-request-detail.js';
|
|
import { SessionDetailPage } from './components/session-detail.js';
|
|
import { SystemAgentsPage } from './components/system-agents.js';
|
|
import { ProjectsPage } from './components/projects/index.js';
|
|
import { FilesPage } from './components/files-page.js';
|
|
import { FileViewerPage } from './components/file-viewer-page.js';
|
|
import { ToolDetailPage } from './components/tool-detail-page.js';
|
|
import { SetupPage } from './components/setup-page.js';
|
|
import { LoginPage } from './components/login-page.js';
|
|
|
|
// Register the global `openFile(path)` / `openToolDetail(id)` helpers.
|
|
import './lib/open-file.js';
|
|
import './lib/open-tool.js';
|
|
// The view-context store keeps its own `route` slice in step with navigation,
|
|
// so it has to be loaded from boot — not lazily by whoever reads it first.
|
|
import './lib/view-context.js';
|
|
import { initI18n } from './lib/i18n.js';
|
|
import { installSessionExpiryWatch } from './lib/session-expiry.js';
|
|
import { installSessionRelogin } from './components/session-relogin.js';
|
|
|
|
// Installed before anything can call the API, so no component's first fetch
|
|
// escapes the 401 watch. A session that dies under an open tab is renewed in a
|
|
// modal over the page, leaving the app's state — an unsent message included —
|
|
// exactly where it was.
|
|
installSessionExpiryWatch();
|
|
installSessionRelogin();
|
|
|
|
customElements.define('app-topbar', AppTopbar);
|
|
customElements.define('app-sidebar', AppSidebar);
|
|
customElements.define('app-copilot', AppCopilot);
|
|
customElements.define('llm-providers-page', LlmProvidersPage);
|
|
customElements.define('models-hub-page', ModelsHubPage);
|
|
customElements.define('models-llm-section', ModelsLlmSection);
|
|
customElements.define('models-transcribe-section', ModelsTranscribeSection);
|
|
customElements.define('models-image-section', ModelsImageSection);
|
|
customElements.define('models-tts-section', ModelsTtsSection);
|
|
customElements.define('tasks-page', TasksPage);
|
|
customElements.define('agents-page', AgentsPage);
|
|
customElements.define('users-page', UsersPage);
|
|
customElements.define('roles-page', RolesPage);
|
|
customElements.define('shared-folders-page', SharedFoldersPage);
|
|
customElements.define('connectors-page', ConnectorsPage);
|
|
customElements.define('connector-detail-page', ConnectorDetailPage);
|
|
customElements.define('plugin-page-host', PluginPageHost);
|
|
customElements.define('plugin-catalog-page', PluginCatalogPage);
|
|
customElements.define('plugin-detail-page', PluginDetailPage);
|
|
customElements.define('marketplace-page', MarketplacePage);
|
|
customElements.define('profile-page', ProfilePage);
|
|
customElements.define('approval-groups-page', ApprovalGroupsPage);
|
|
customElements.define('approval-rules-page', ApprovalRulesPage);
|
|
customElements.define('config-page', ConfigPage);
|
|
customElements.define('dashboard-page', DashboardPage);
|
|
customElements.define('agent-inbox-page', AgentInboxPage);
|
|
customElements.define('llm-requests-page', LlmRequestsPage);
|
|
customElements.define('llm-request-detail', LlmRequestDetail);
|
|
customElements.define('session-detail-page', SessionDetailPage);
|
|
customElements.define('system-agents-page', SystemAgentsPage);
|
|
customElements.define('projects-page', ProjectsPage);
|
|
customElements.define('files-page', FilesPage);
|
|
customElements.define('file-viewer-page', FileViewerPage);
|
|
customElements.define('tool-detail-page', ToolDetailPage);
|
|
customElements.define('setup-page', SetupPage);
|
|
customElements.define('login-page', LoginPage);
|
|
|
|
// Toggle the workspace placeholder when an LLM page opens/closes.
|
|
const workspace = document.getElementById('app-workspace');
|
|
window.addEventListener('llm-page-change', (e) => {
|
|
workspace.style.display = e.detail.page ? 'none' : 'flex';
|
|
});
|
|
|
|
// ── First-run check ─────────────────────────────────────────────────────────
|
|
// If no user exists yet, show the setup screen. Otherwise, check if we have
|
|
// a valid session: if not, show the login screen. If logged in, show the app.
|
|
(async () => {
|
|
const app = document.getElementById('app');
|
|
const setup = document.querySelector('setup-page');
|
|
const login = document.querySelector('login-page');
|
|
|
|
try {
|
|
const setupRes = await fetch('/api/setup/status');
|
|
if (setupRes.ok) {
|
|
const { needs_setup } = await setupRes.json();
|
|
if (needs_setup) {
|
|
if (app) app.style.display = 'none';
|
|
if (setup) setup.style.display = '';
|
|
return;
|
|
}
|
|
}
|
|
} catch { /* fall through to auth check */ }
|
|
|
|
try {
|
|
const meRes = await fetch('/api/auth/me');
|
|
if (meRes.status === 401) {
|
|
if (app) app.style.display = 'none';
|
|
if (login) login.style.display = '';
|
|
return;
|
|
}
|
|
// Logged in: resolve the effective locale (user pref → instance default).
|
|
initI18n();
|
|
} catch { /* show app by default */ }
|
|
})();
|