Fills a gap the blueprint names: the admin had to hand-author every
`mcp_catalog` entry. A remote feed of vetted connectors now proposes them
and the admin installs — the feed is *consultative*, so §14's risk axis is
untouched and the trust anchor stays on the box.
Marketplace client (`src/frontend/api/marketplace.rs`):
- Fetches the feed server-side (it sends no CORS headers) and caches it;
icons are proxied for the same reason.
- Verifies every declared SHA-256 before writing, fail-closed and
all-or-nothing. Feed-supplied paths are refused if they escape
`./scripts/<id>/`. Importing an `mcp_local` entry still demands the
admin-only `mcp.register_local_script`.
- Translates the feed's vocabulary into Skald's: `user`→`per_user`,
`mcp_local`→`local_script`. Scope is read, never inferred from transport
(a remote connector can be per-user — that is what `mcp.register_remote`
is for), and an unreadable `type` fails closed to the answer needing more
authority. The feed's `llm_short_description` maps to `description`, the
column `render_mcp_list` puts in front of the LLM for `activate_tools()`.
- Feed URL is config (`marketplace.url`), not a constant: an on-premise
product must not hard-require reaching one vendor's host.
Two silent failures found while wiring it:
- `transport_of` maps anything unknown to Stdio, so the feed's
`streamable-http` would have tried to spawn a command. Normalised on import.
- Some servers want their key as a query param, not a bearer header, and say
so with a `{key}` placeholder. Substituted at connect time in
`global_row_spec`/`user_row_spec` — never at rest, so the key stays in its
own column and the stored URL stays a template.
Pages, split by the question each answers:
- Connectors — what runs (`UserMcpView` = global ∪ per-user) and what I can
add. Same page for everyone; the admin just has more verbs. One Available
list with the verb per row: `per_user`→Activate, `global`→Enable globally.
Enabling a global is the admin's counterpart to activating a per-user one,
so the catalog picker dropdown is gone — the entry comes from the row.
- Connector Catalog (admin) — what this box offers. One `Add connector`
with two sources: marketplace first (vetted, hashed), manual second
(unvetted by nature) — the order mirrors the trust model.
- Marketplace (admin) — reached from the catalog, not the sidebar: it is a
destination of an action, not a place.
`available()` no longer returns `McpGlobalServerRow`: that row carries
`api_key` and this view now reaches every logged-in user. A slim `GlobalView`
crosses instead, and an admin sees every global (with `can_use` marking their
own) so one enabled for someone else stays manageable.
Also fixes `connectors-page` having no CSS rule at all — every sibling page
has one, so it never got `flex: 1` and left an empty column beside it.
101 lines
5.2 KiB
JavaScript
101 lines
5.2 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 { ConnectorsPage } from './components/connectors.js';
|
|
import { MarketplacePage } from './components/marketplace.js';
|
|
import { CatalogPage } from './components/catalog.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 { AgentInboxPage } from './components/agent-inbox.js';
|
|
import { HomePage } from './components/home-page.js';
|
|
import { LlmRequestsPage } from './components/llm-requests.js';
|
|
import { LlmRequestDetail } from './components/llm-request-detail.js';
|
|
import { SessionDetailPage } from './components/session-detail.js';
|
|
import { TicSessionsPage } from './components/tic-sessions.js';
|
|
import { ProjectsPage } from './components/projects/index.js';
|
|
import { FileViewerPage } from './components/file-viewer-page.js';
|
|
import { SetupPage } from './components/setup-page.js';
|
|
import { LoginPage } from './components/login-page.js';
|
|
|
|
// Register the global `openFile(path)` helper (window.openFile → location.hash).
|
|
import './lib/open-file.js';
|
|
|
|
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('connectors-page', ConnectorsPage);
|
|
customElements.define('marketplace-page', MarketplacePage);
|
|
customElements.define('catalog-page', CatalogPage);
|
|
customElements.define('profile-page', ProfilePage);
|
|
customElements.define('approval-groups-page', ApprovalGroupsPage);
|
|
customElements.define('approval-rules-page', ApprovalRulesPage);
|
|
customElements.define('config-page', ConfigPage);
|
|
customElements.define('agent-inbox-page', AgentInboxPage);
|
|
customElements.define('home-page', HomePage);
|
|
customElements.define('llm-requests-page', LlmRequestsPage);
|
|
customElements.define('llm-request-detail', LlmRequestDetail);
|
|
customElements.define('session-detail-page', SessionDetailPage);
|
|
customElements.define('tic-sessions-page', TicSessionsPage);
|
|
customElements.define('projects-page', ProjectsPage);
|
|
customElements.define('file-viewer-page', FileViewerPage);
|
|
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;
|
|
}
|
|
} catch { /* show app by default */ }
|
|
})();
|