Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Improve MSP onboarding guidance
rcourtmanfe067474188e
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 18bec54849..7814f77b9a 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -176,9 +176,14 @@ Pulse Account workspace summaries carry setup state as a backend-owned payloadcontract. Browser bootstrap and `/api/portal/dashboard` workspace entries mayinclude `setup_status` with only `ready`, `setup_path`, `install_agents`,`configure_outputs`, or `review`, plus optional setup evidence counts such as-`agent_count`, `last_agent_seen_at`, `alert_route_count`, and-`report_schedule_count` when the control plane has a canonical source for-them. The canonical source is a read-only tenant-local setup facts reader, not+`agent_count`, `agent_token_count`, `unused_agent_token_count`,+`last_agent_seen_at`, `alert_route_count`, `disabled_alert_route_count`,+`report_schedule_count`, and `disabled_report_schedule_count` when the control+plane has a canonical source for them. MSP account bootstrap may also include+account-level `setup_templates` for provider guidance, but those templates are+copy and sequence guidance only; workspace readiness remains owned by the+workspace setup facts. The canonical source is a read-only tenant-local setup+facts reader, notbrowser inference or portal-local state. Health review still wins first:active workspaces with a failed latest health check report `review`. Healthyor unchecked workspaces with no used non-expired `agent:report` token reportdiff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex 1e953398db..602a88313a 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -338,10 +338,13 @@ or other self-hosted uncapped continuity plans.from read-only tenant-local setup facts without creating tenant config,encryption keys, migrations, agent credentials, alert routes, or reportschedules as a side effect. The provider shell may show an unfinished-setup- queue and fact counts for active workspaces, but `Ready` requires at least- one reporting agent, one enabled alert route, and one enabled report- schedule; a failed latest health check remains `Review` ahead of setup- counts.+ queue, disabled-output diagnostics, workspace-scoped primary actions, and+ provider setup templates for MSP accounts, but those templates are guidance+ rather than configuration. `Ready` requires at least one reporting agent, one+ enabled alert route, and one enabled report schedule; a failed latest health+ check remains `Review` ahead of setup counts. Local MSP onboarding previews+ should be scenario-backed portal bootstrap data, not static screenshots, so+ they stay grounded in the real portal shape as the bundle changes.Portal workspace payloads are live-workspace surfaces, not registry historydumps: tenants in `deleting` or `deleted` state must stay hidden from thebrowser bootstrap, `/api/portal/dashboard`, and workspace-detail API sodiff --git a/internal/cloudcp/portal/bootstrap.go b/internal/cloudcp/portal/bootstrap.goindex 7576e9083f..bd6fb052de 100644--- a/internal/cloudcp/portal/bootstrap.go+++ b/internal/cloudcp/portal/bootstrap.go@@ -4,21 +4,27 @@ import ("encoding/json""html/template""time"++ "github.com/rcourtman/pulse-go-rewrite/internal/cloudcp/registry")type BootstrapWorkspace struct {- ID string `json:"id"`- DisplayName string `json:"display_name"`- State string `json:"state"`- Healthy bool `json:"healthy"`- HealthStatus string `json:"health_status"`- SetupStatus string `json:"setup_status,omitempty"`- AgentCount *int `json:"agent_count,omitempty"`- LastAgentSeenAt string `json:"last_agent_seen_at,omitempty"`- AlertRouteCount *int `json:"alert_route_count,omitempty"`- ReportScheduleCount *int `json:"report_schedule_count,omitempty"`- LastHealthCheck string `json:"last_health_check,omitempty"`- CreatedAt string `json:"created_at"`+ ID string `json:"id"`+ DisplayName string `json:"display_name"`+ State string `json:"state"`+ Healthy bool `json:"healthy"`+ HealthStatus string `json:"health_status"`+ SetupStatus string `json:"setup_status,omitempty"`+ AgentCount *int `json:"agent_count,omitempty"`+ AgentTokenCount *int `json:"agent_token_count,omitempty"`+ UnusedAgentTokenCount *int `json:"unused_agent_token_count,omitempty"`+ LastAgentSeenAt string `json:"last_agent_seen_at,omitempty"`+ AlertRouteCount *int `json:"alert_route_count,omitempty"`+ DisabledAlertRouteCount *int `json:"disabled_alert_route_count,omitempty"`+ ReportScheduleCount *int `json:"report_schedule_count,omitempty"`+ DisabledReportScheduleCount *int `json:"disabled_report_schedule_count,omitempty"`+ LastHealthCheck string `json:"last_health_check,omitempty"`+ CreatedAt string `json:"created_at"`}type BootstrapMember struct {@@ -30,16 +36,26 @@ type BootstrapMember struct {CreatedAt string `json:"created_at,omitempty"`}+type BootstrapSetupTemplate struct {+ ID string `json:"id"`+ Title string `json:"title"`+ AgentNaming string `json:"agent_naming"`+ AlertRouting string `json:"alert_routing"`+ Reporting string `json:"reporting"`+ Access string `json:"access"`+}+type BootstrapAccount struct {- ID string `json:"id"`- Kind string `json:"kind"`- KindLabel string `json:"kind_label"`- Name string `json:"name"`- Role string `json:"role"`- CanManage bool `json:"can_manage"`- HasBilling bool `json:"has_billing"`- Workspaces []BootstrapWorkspace `json:"workspaces"`- Members []BootstrapMember `json:"members"`+ ID string `json:"id"`+ Kind string `json:"kind"`+ KindLabel string `json:"kind_label"`+ Name string `json:"name"`+ Role string `json:"role"`+ CanManage bool `json:"can_manage"`+ HasBilling bool `json:"has_billing"`+ Workspaces []BootstrapWorkspace `json:"workspaces"`+ Members []BootstrapMember `json:"members"`+ SetupTemplates []BootstrapSetupTemplate `json:"setup_templates,omitempty"`}type BootstrapData struct {@@ -82,18 +98,22 @@ func BuildBootstrapDataWithSignupPath(authenticated bool, email string, accountslastAgentSeenAt = workspace.LastAgentSeenAt.UTC().Format(time.RFC3339)}workspaces = append(workspaces, BootstrapWorkspace{- ID: workspace.ID,- DisplayName: workspace.DisplayName,- State: workspace.State,- Healthy: workspace.Healthy,- HealthStatus: workspace.HealthStatus,- SetupStatus: workspace.SetupStatus,- AgentCount: workspace.AgentCount,- LastAgentSeenAt: lastAgentSeenAt,- AlertRouteCount: workspace.AlertRouteCount,- ReportScheduleCount: workspace.ReportScheduleCount,- LastHealthCheck: lastHealthCheck,- CreatedAt: workspace.CreatedAt.UTC().Format(time.RFC3339),+ ID: workspace.ID,+ DisplayName: workspace.DisplayName,+ State: workspace.State,+ Healthy: workspace.Healthy,+ HealthStatus: workspace.HealthStatus,+ SetupStatus: workspace.SetupStatus,+ AgentCount: workspace.AgentCount,+ AgentTokenCount: workspace.AgentTokenCount,+ UnusedAgentTokenCount: workspace.UnusedAgentTokenCount,+ LastAgentSeenAt: lastAgentSeenAt,+ AlertRouteCount: workspace.AlertRouteCount,+ DisabledAlertRouteCount: workspace.DisabledAlertRouteCount,+ ReportScheduleCount: workspace.ReportScheduleCount,+ DisabledReportScheduleCount: workspace.DisabledReportScheduleCount,+ LastHealthCheck: lastHealthCheck,+ CreatedAt: workspace.CreatedAt.UTC().Format(time.RFC3339),})}members := make([]BootstrapMember, 0, len(account.Members))@@ -112,15 +132,16 @@ func BuildBootstrapDataWithSignupPath(authenticated bool, email string, accounts})}bootstrapAccounts = append(bootstrapAccounts, BootstrapAccount{- ID: account.ID,- Kind: account.Kind,- KindLabel: account.KindLabel,- Name: account.Name,- Role: account.Role,- CanManage: account.CanManage,- HasBilling: account.HasBilling,- Workspaces: workspaces,- Members: members,+ ID: account.ID,+ Kind: account.Kind,+ KindLabel: account.KindLabel,+ Name: account.Name,+ Role: account.Role,+ CanManage: account.CanManage,+ HasBilling: account.HasBilling,+ Workspaces: workspaces,+ Members: members,+ SetupTemplates: defaultSetupTemplatesForAccount(account),})}@@ -143,6 +164,22 @@ func BuildBootstrapDataWithSignupPath(authenticated bool, email string, accounts}}+func defaultSetupTemplatesForAccount(account portalPageAccount) []BootstrapSetupTemplate {+ if account.Kind != string(registry.AccountKindMSP) {+ return nil+ }+ return []BootstrapSetupTemplate{+ {+ ID: "standard-client-onboarding",+ Title: "Standard client onboarding",+ AgentNaming: "Keep the client workspace as the identity boundary; repeated hostnames are expected across clients.",+ AlertRouting: "Create at least one enabled alert route inside each client workspace.",+ Reporting: "Schedule at least one client performance report before the workspace is marked ready.",+ Access: "Invite provider staff from Access and keep client users on the smallest useful role.",+ },+ }+}+func BuildBootstrapData(authenticated bool, email string, accounts []portalPageAccount, hasSelfHostedCommercial bool) BootstrapData {return BuildBootstrapDataWithSignupPath(authenticated, email, accounts, hasSelfHostedCommercial, PortalSignupPath)}diff --git a/internal/cloudcp/portal/dist/build_manifest.json b/internal/cloudcp/portal/dist/build_manifest.jsonindex 1918fe7d4d..6c89b10cca 100644--- a/internal/cloudcp/portal/dist/build_manifest.json+++ b/internal/cloudcp/portal/dist/build_manifest.json@@ -1,5 +1,5 @@{- "source_hash": "9063274971f801824ef7f87270abb7a358e7e7ba941a294d1557f8a4c12ce1e2",+ "source_hash": "22ab649acd4376eeb6f06f6a00d0f3ae3eb18240f6c0e7748154d0c13e35f6a2","build_inputs": ["package.json","tsconfig.json",diff --git a/internal/cloudcp/portal/dist/portal_app.css b/internal/cloudcp/portal/dist/portal_app.cssindex b02bbc9fcd..c2b7580420 100644--- a/internal/cloudcp/portal/dist/portal_app.css+++ b/internal/cloudcp/portal/dist/portal_app.css@@ -577,6 +577,62 @@ header .logout-btn:hover,font-size: 13px;color: var(--ink-secondary);}+.workspace-management-identity {+ padding: 10px 12px;+ border: 1px solid #c6d9f0;+ border-radius: var(--radius);+ background: var(--accent-subtle);+ color: var(--ink);+ font-size: 12px;+ line-height: 1.45;+}+.workspace-setup-guide {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: center;+ gap: 14px;+ padding: 12px;+ border: 1px solid var(--border);+ border-radius: var(--radius);+ background: var(--bg);+}+.workspace-setup-guide-copy {+ min-width: 0;+}+.workspace-setup-guide-copy > span {+ display: block;+ margin-bottom: 4px;+ color: var(--ink-muted);+ font-size: 11px;+ font-weight: 600;+ text-transform: uppercase;+ letter-spacing: 0;+}+.workspace-setup-guide h4 {+ margin: 0;+ font-size: 15px;+ color: var(--ink);+}+.workspace-setup-guide p {+ margin: 4px 0 0;+ color: var(--ink-secondary);+ font-size: 13px;+}+.workspace-setup-guide ul {+ display: grid;+ gap: 3px;+ margin: 8px 0 0;+ padding: 0;+ list-style: none;+}+.workspace-setup-guide li {+ color: var(--ink-secondary);+ font-size: 12px;+ line-height: 1.4;+}+.workspace-setup-guide form {+ margin: 0;+}.workspace-setup-checklist {display: grid;gap: 8px;@@ -1622,6 +1678,61 @@ header .logout-btn:hover,justify-content: flex-end;gap: 8px;}+.workspace-template-panel {+ display: flex;+ flex-direction: column;+ gap: 12px;+ padding: 12px;+ border: 1px solid var(--border-muted);+ border-radius: var(--radius);+ background: var(--bg);+}+.workspace-template-heading {+ display: flex;+ align-items: flex-start;+ justify-content: space-between;+ gap: 12px;+}+.workspace-template-heading h3 {+ margin: 0;+ font-size: 14px;+ color: var(--ink);+}+.workspace-template-heading p {+ margin: 3px 0 0;+ color: var(--ink-secondary);+ font-size: 12px;+}+.workspace-template-heading > span {+ flex: 0 0 auto;+ color: var(--ink-secondary);+ font-size: 12px;+}+.workspace-template-grid {+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ gap: 8px;+}+.workspace-template-grid > div {+ padding: 10px;+ border: 1px solid var(--border-muted);+ border-radius: var(--radius);+ background: var(--bg-subtle);+}+.workspace-template-grid strong,+.workspace-template-grid span {+ display: block;+}+.workspace-template-grid strong {+ color: var(--ink);+ font-size: 12px;+}+.workspace-template-grid span {+ margin-top: 3px;+ color: var(--ink-secondary);+ font-size: 12px;+ line-height: 1.4;+}.account-panel-kicker,.billing-card-kicker,.account-eyebrow {@@ -1842,6 +1953,16 @@ header .logout-btn:hover,.workspace-setup-queue-actions {justify-content: flex-start;}+ .workspace-template-heading {+ flex-direction: column;+ }+ .workspace-template-grid,+ .workspace-setup-guide {+ grid-template-columns: 1fr;+ }+ .workspace-setup-guide form {+ justify-self: flex-start;+ }.workspace-list-head {display: none;}diff --git a/internal/cloudcp/portal/dist/portal_app.js b/internal/cloudcp/portal/dist/portal_app.jsindex 42275b105a..b0c7522840 100644--- a/internal/cloudcp/portal/dist/portal_app.js+++ b/internal/cloudcp/portal/dist/portal_app.js@@ -82,6 +82,9 @@function positiveCount(value) {return hasNumber(value) && Number(value) > 0;}+ function zeroCount(value) {+ return hasNumber(value) && Number(value) <= 0;+ }function explicitSetupStatus(workspace) {var value = String(workspace.setup_status || "");if (value === "ready" || value === "setup_path" || value === "install_agents" || value === "configure_outputs" || value === "review") {@@ -139,6 +142,138 @@return "Open the workspace or install agents from the workspace-bound setup path.";}}+ function workspaceIdentityCopy(workspace) {+ return "Client boundary: " + workspace.display_name + ". Hostnames can repeat across clients; this workspace keeps agents, alerts, and reports scoped to this client.";+ }+ function workspaceSetupDiagnostics(workspace) {+ var setup = workspaceSetupState(workspace);+ var diagnostics = [];+ if (setup === "ready") {+ diagnostics.push("Reporting agent, enabled alert route, and enabled report schedule are present.");+ return diagnostics;+ }+ if (setup === "review") {+ diagnostics.push(workspaceStatusCopy(workspace));+ return diagnostics;+ }+ if (zeroCount(workspace.agent_count)) {+ if (positiveCount(workspace.unused_agent_token_count) || positiveCount(workspace.agent_token_count)) {+ diagnostics.push("Agent install token exists, but no reporting agent has checked in yet.");+ } else {+ diagnostics.push("No reporting agent has checked in yet.");+ }+ }+ if (positiveCount(workspace.agent_count) && zeroCount(workspace.alert_route_count)) {+ diagnostics.push(+ positiveCount(workspace.disabled_alert_route_count) ? "Alert route configuration exists, but no route is enabled." : "No enabled alert route is configured yet."+ );+ }+ if (positiveCount(workspace.agent_count) && zeroCount(workspaceReportScheduleCount(workspace))) {+ diagnostics.push(+ positiveCount(workspace.disabled_report_schedule_count) ? "Report schedule exists, but no schedule is enabled." : "No enabled report schedule is configured yet."+ );+ }+ if (!diagnostics.length) {+ diagnostics.push(workspaceSetupNextStep(workspace));+ }+ return diagnostics;+ }+ function workspaceReportScheduleCount(workspace) {+ return workspace.report_schedule_count;+ }+ function workspaceSetupGuide(workspace) {+ var setup = workspaceSetupState(workspace);+ if (setup === "ready") {+ return {+ title: "Ready",+ description: "Agents, alert routing, and reports are in place for this client workspace.",+ primaryAction: "open",+ primaryLabel: "Open workspace",+ diagnostics: workspaceSetupDiagnostics(workspace)+ };+ }+ if (setup === "review") {+ return {+ title: "Review workspace state",+ description: "Resolve the workspace state before continuing client setup.",+ primaryAction: "review",+ primaryLabel: "Review workspace",+ diagnostics: workspaceSetupDiagnostics(workspace)+ };+ }+ if (setup === "install_agents") {+ return {+ title: "Install the first agent",+ description: "Start inside this client workspace so the first reporting token and future hostnames stay scoped to the client.",+ primaryAction: "install",+ primaryLabel: "Install agents",+ diagnostics: workspaceSetupDiagnostics(workspace)+ };+ }+ if (setup === "configure_outputs") {+ var needsAlerts = zeroCount(workspace.alert_route_count);+ var needsReports = zeroCount(workspaceReportScheduleCount(workspace));+ return {+ title: needsAlerts && needsReports ? "Configure alerts and reports" : needsAlerts ? "Configure alert routes" : "Schedule reports",+ description: "Finish the output side before this workspace leaves onboarding.",+ primaryAction: "outputs",+ primaryLabel: needsReports && !needsAlerts ? "Open reports" : "Configure outputs",+ diagnostics: workspaceSetupDiagnostics(workspace)+ };+ }+ return {+ title: "Follow the setup path",+ description: "Open the client workspace and continue the next setup task from there.",+ primaryAction: "install",+ primaryLabel: "Open setup",+ diagnostics: workspaceSetupDiagnostics(workspace)+ };+ }+ function workspaceSetupSteps(workspace) {+ var setup = workspaceSetupState(workspace);+ var state = String(workspace.state || "");+ var isActive = state === "active";+ var hasAgents = positiveCount(workspace.agent_count) || setup === "configure_outputs" || setup === "ready";+ var hasAlerts = positiveCount(workspace.alert_route_count);+ var hasReports = positiveCount(workspaceReportScheduleCount(workspace));+ return [+ {+ id: "workspace",+ title: "Create workspace",+ detail: "Separate client boundary created.",+ tone: state ? "done" : "pending",+ label: state ? "Done" : "Pending"+ },+ {+ id: "agent",+ title: "Install first agent",+ detail: "First reporting agent checks in inside this workspace.",+ tone: hasAgents ? "done" : setup === "review" || !isActive ? "blocked" : "next",+ label: hasAgents ? "Done" : setup === "review" || !isActive ? "Review" : "Next"+ },+ {+ id: "alerts",+ title: "Configure alert routes",+ detail: "Enabled notification route exists for this client.",+ tone: hasAlerts ? "done" : setup === "review" ? "blocked" : isActive && hasAgents ? "next" : "pending",+ label: hasAlerts ? "Done" : setup === "review" ? "Review" : isActive && hasAgents ? "Next" : "Pending"+ },+ {+ id: "reports",+ title: "Schedule reports",+ detail: "Enabled report schedule exists for client reporting.",+ tone: hasReports ? "done" : setup === "review" ? "blocked" : isActive && hasAgents && hasAlerts ? "next" : "pending",+ label: hasReports ? "Done" : setup === "review" ? "Review" : isActive && hasAgents && hasAlerts ? "Next" : "Pending"+ },+ {+ id: "access",+ title: "Review access",+ detail: "Provider staff and client users are handled from Access.",+ tone: "available",+ label: "Available"+ }+ ];+ }function workspaceGuidanceCopy(workspace) {var status = workspaceHealthState(workspace);var state = String(workspace.state || "");@@ -180,9 +315,6 @@function hasKnownCount(value) {return typeof value === "number" && Number.isFinite(value);}- function hasPositiveCount(value) {- return hasKnownCount(value) && Number(value) > 0;- }function setupCountLabel(value, singular, plural) {if (!hasKnownCount(value)) return "Unknown";var count = Number(value);@@ -244,6 +376,12 @@var reports = getElement("workspace-management-reports-" + account.id);var created = getElement("workspace-management-created-" + account.id);var guidance = getElement("workspace-management-guidance-" + account.id);+ var identity = getElement("workspace-management-identity-" + account.id);+ var guideTitle = getElement("workspace-management-guide-title-" + account.id);+ var guideDescription = getElement("workspace-management-guide-description-" + account.id);+ var guideDiagnostics = getElement("workspace-management-guide-diagnostics-" + account.id);+ var guidePrimaryForm = getElement("workspace-management-primary-form-" + account.id);+ var guidePrimaryButton = getElement("workspace-management-primary-" + account.id);var checkCreated = getElement("workspace-management-check-created-" + account.id);var checkInstall = getElement("workspace-management-check-install-" + account.id);var checkAlerts = getElement("workspace-management-check-alerts-" + account.id);@@ -289,9 +427,11 @@openForm?.removeAttribute("action");installForm?.removeAttribute("action");reportingForm?.removeAttribute("action");+ guidePrimaryForm?.removeAttribute("action");if (openButton) openButton.disabled = true;if (installButton) installButton.disabled = true;if (reportingButton) reportingButton.disabled = true;+ if (guidePrimaryButton) guidePrimaryButton.disabled = true;return;}title.textContent = workspace.display_name;@@ -304,38 +444,37 @@if (reports) reports.textContent = setupCountLabel(workspace.report_schedule_count, "schedule", "schedules");created.textContent = workspaceCreatedLabel(workspace);guidance.textContent = workspaceGuidanceCopy(workspace);- var setupState = workspaceSetupState(workspace);- var isActive = workspace.state === "active";- var hasAgents = hasPositiveCount(workspace.agent_count) || setupState === "configure_outputs" || setupState === "ready";- var hasAlertRoutes = hasPositiveCount(workspace.alert_route_count);- var hasReportSchedules = hasPositiveCount(workspace.report_schedule_count);- setChecklistStatus(checkCreated, workspace.state ? "done" : "pending", workspace.state ? "Done" : "Pending");- if (hasAgents) {- setChecklistStatus(checkInstall, "done", "Done");- } else if (setupState === "install_agents" || setupState === "setup_path") {- setChecklistStatus(checkInstall, isActive ? "next" : "blocked", isActive ? "Next" : "Blocked");- } else {- setChecklistStatus(checkInstall, "blocked", "Review");- }- if (hasAlertRoutes) {- setChecklistStatus(checkAlerts, "done", "Done");- } else if (setupState === "review") {- setChecklistStatus(checkAlerts, "blocked", "Review");- } else if (isActive && hasAgents) {- setChecklistStatus(checkAlerts, "next", "Next");- } else {- setChecklistStatus(checkAlerts, "pending", "Pending");- }- if (hasReportSchedules) {- setChecklistStatus(checkReports, "done", "Done");- } else if (setupState === "review") {- setChecklistStatus(checkReports, "blocked", "Review");- } else if (isActive && hasAgents && hasAlertRoutes) {- setChecklistStatus(checkReports, "next", "Next");- } else {- setChecklistStatus(checkReports, "pending", "Pending");+ if (identity) identity.textContent = workspaceIdentityCopy(workspace);+ var guide = workspaceSetupGuide(workspace);+ if (guideTitle) guideTitle.textContent = guide.title;+ if (guideDescription) guideDescription.textContent = guide.description;+ if (guideDiagnostics) {+ guideDiagnostics.textContent = "";+ for (var d = 0; d < guide.diagnostics.length; d += 1) {+ var item = document.createElement("li");+ item.textContent = guide.diagnostics[d];+ guideDiagnostics.appendChild(item);+ }+ }+ var primaryTargetPath = "";+ if (guide.primaryAction === "install") {+ primaryTargetPath = WORKSPACE_INSTALL_TARGET_PATH;+ } else if (guide.primaryAction === "outputs") {+ primaryTargetPath = WORKSPACE_REPORTING_TARGET_PATH;+ }+ if (guidePrimaryButton) guidePrimaryButton.textContent = guide.primaryLabel;+ setWorkspaceHandoffForm(guidePrimaryForm, guidePrimaryButton, accountAPIBasePath, account.id, workspace, primaryTargetPath, entry.manageWorkspace.pending);+ var steps = workspaceSetupSteps(workspace);+ var stepByID = {+ workspace: checkCreated,+ agent: checkInstall,+ alerts: checkAlerts,+ reports: checkReports,+ access: checkAccess+ };+ for (var s = 0; s < steps.length; s += 1) {+ setChecklistStatus(stepByID[steps[s].id], steps[s].tone, steps[s].label);}- setChecklistStatus(checkAccess, "available", "Available");actionButton.textContent = workspaceActionLabel(workspace);actionButton.disabled = entry.manageWorkspace.pending;actionButton.setAttribute("data-workspace-id", workspace.id);@@ -2515,7 +2654,7 @@function countReadyWorkspaces(workspaces) {var count = 0;for (var i = 0; i < workspaces.length; i += 1) {- if (String(workspaces[i].state || "") === "active" && workspaceHealthState(workspaces[i]) === "healthy") {+ if (String(workspaces[i].state || "") === "active" && workspaceSetupState(workspaces[i]) === "ready") {count += 1;}}@@ -2712,6 +2851,10 @@setupFactCountLabel(workspace.report_schedule_count, "report schedule", "report schedules")].join(" \xB7 ");}+ function workspaceSetupDiagnosticsLine(workspace) {+ var guide = workspaceSetupGuide(workspace);+ return guide.diagnostics.length ? guide.diagnostics[0] : workspaceSetupNextStep(workspace);+ }function workspaceSummaryContext(entry, includeAccountName, note) {if (!includeAccountName) return note;return entry.account.name + " \xB7 " + note;@@ -2855,12 +2998,20 @@"btn-primary btn-compact");}+ function renderProviderSetupTemplates(accounts) {+ var templateAccount = accounts.find(function(account) {+ return account.kind === "msp" && Array.isArray(account.setup_templates) && account.setup_templates.length > 0;+ });+ if (!templateAccount || !templateAccount.setup_templates || !templateAccount.setup_templates.length) return "";+ var template = templateAccount.setup_templates[0];+ return '<section class="workspace-template-panel" aria-label="Provider setup template"><div class="workspace-template-heading"><div><h3>' + escapeHTML(template.title || "Provider setup template") + "</h3><p>Use the same setup shape for each client workspace, then finish the tenant-owned configuration inside that workspace.</p></div><span>" + escapeHTML(templateAccount.name) + '</span></div><div class="workspace-template-grid"><div><strong>Agent naming</strong><span>' + escapeHTML(template.agent_naming) + "</span></div><div><strong>Alert routing</strong><span>" + escapeHTML(template.alert_routing) + "</span></div><div><strong>Reports</strong><span>" + escapeHTML(template.reporting) + "</span></div><div><strong>Access</strong><span>" + escapeHTML(template.access) + "</span></div></div></section>";+ }function renderWorkspaceSetupQueue(entries, accountAPIBasePath) {var setupNeeded = setupNeededWorkspaceEntries(entries);if (!setupNeeded.length) return "";var visible = setupNeeded.slice(0, 5);return '<section class="workspace-setup-queue" aria-label="Unfinished workspace setup"><div class="workspace-setup-queue-header"><div><h3>Unfinished setup</h3><p>Client workspaces stay here until agents, alert routing, and reports are in place.</p></div><span>' + escapeHTML(setupNeededWorkspaceChipLabel(setupNeeded.length)) + '</span></div><div class="workspace-setup-queue-list">' + visible.map(function(entry) {- return '<article class="workspace-setup-queue-row"><div class="workspace-setup-queue-main">' + setupBadgeHTML(entry.workspace) + "<div><strong>" + escapeHTML(entry.workspace.display_name) + "</strong><span>" + escapeHTML(entry.account.name + " \xB7 " + workspaceSetupNextStep(entry.workspace)) + "</span><small>" + escapeHTML(workspaceSetupFactsLine(entry.workspace)) + '</small></div></div><div class="workspace-setup-queue-actions">' + renderWorkspaceSetupQueueAction(entry, accountAPIBasePath) + (entry.account.can_manage ? '<button type="button" class="btn-secondary btn-compact" data-action="select-workspace" data-account-id="' + escapeAttr(entry.account.id) + '" data-workspace-id="' + escapeAttr(entry.workspace.id) + '">Checklist</button>' : renderWorkspaceHandoffForm(entry.account.id, entry.workspace.id, accountAPIBasePath, "Open workspace")) + "</div></article>";+ return '<article class="workspace-setup-queue-row"><div class="workspace-setup-queue-main">' + setupBadgeHTML(entry.workspace) + "<div><strong>" + escapeHTML(entry.workspace.display_name) + "</strong><span>" + escapeHTML(entry.account.name + " \xB7 " + workspaceSetupDiagnosticsLine(entry.workspace)) + "</span><small>" + escapeHTML(workspaceSetupFactsLine(entry.workspace)) + '</small></div></div><div class="workspace-setup-queue-actions">' + renderWorkspaceSetupQueueAction(entry, accountAPIBasePath) + (entry.account.can_manage ? '<button type="button" class="btn-secondary btn-compact" data-action="select-workspace" data-account-id="' + escapeAttr(entry.account.id) + '" data-workspace-id="' + escapeAttr(entry.workspace.id) + '">Checklist</button>' : renderWorkspaceHandoffForm(entry.account.id, entry.workspace.id, accountAPIBasePath, "Open workspace")) + "</div></article>";}).join("") + "</div></section>";}function workspaceSectionHeaderCopy(accounts, entries) {@@ -2879,7 +3030,7 @@var accounts = Array.isArray(context.bootstrap.accounts) ? context.bootstrap.accounts : [];var entries = collectWorkspaceSummaryEntries(accounts);var showSelfHostedCommercial = hasSelfHostedCommercial(context.bootstrap);- return '<section class="workspace-summary-shell"><div class="portal-page-header"><h2>Workspaces</h2><p>' + escapeHTML(workspaceSectionHeaderCopy(accounts, entries)) + "</p></div>" + renderFactLine("workspace-summary-facts", renderWorkspaceSummaryFacts(accounts, entries)) + renderWorkspaceSummaryInline(accounts, entries, context.accountAPIBasePath, showSelfHostedCommercial) + renderWorkspaceSetupQueue(entries, context.accountAPIBasePath) + "</section>";+ return '<section class="workspace-summary-shell"><div class="portal-page-header"><h2>Workspaces</h2><p>' + escapeHTML(workspaceSectionHeaderCopy(accounts, entries)) + "</p></div>" + renderFactLine("workspace-summary-facts", renderWorkspaceSummaryFacts(accounts, entries)) + renderWorkspaceSummaryInline(accounts, entries, context.accountAPIBasePath, showSelfHostedCommercial) + renderProviderSetupTemplates(accounts) + renderWorkspaceSetupQueue(entries, context.accountAPIBasePath) + "</section>";}function renderNoHostedWorkspacesSection() {return '<section class="account-content-panel account-content-panel-workspaces"><div class="empty-state"><p>No hosted workspaces are attached to this account. Use Billing for self-hosted subscriptions and licenses.</p></div></section>';@@ -2903,7 +3054,7 @@if (account.kind === "msp") {addWorkspaceForm = '<div class="add-workspace-form" id="add-ws-form-' + escapeAttr(account.id) + '"><label for="ws-name-' + escapeAttr(account.id) + '">Workspace name (for example, a client name)</label><input type="text" id="ws-name-' + escapeAttr(account.id) + '" placeholder="Acme Corp" maxlength="80" autocomplete="off"><div class="form-actions"><button type="button" class="btn-primary" data-action="create-workspace" data-account-id="' + escapeAttr(account.id) + '">Create workspace</button><button type="button" class="btn-secondary" data-action="toggle-add-workspace" data-account-id="' + escapeAttr(account.id) + '">Cancel</button><div class="spinner" id="ws-spinner-' + escapeAttr(account.id) + '" hidden></div></div></div>';}- workspaceManagement = '<section class="workspace-management-panel workspace-management-panel-idle" id="workspace-management-' + escapeAttr(account.id) + '" hidden><div class="workspace-management-header"><div><h3>Workspace setup checklist</h3><p>Finish the client setup steps without mixing client data across workspaces.</p></div><button type="button" class="btn-secondary btn-compact" id="workspace-management-close-' + escapeAttr(account.id) + '" data-action="clear-workspace-selection" data-account-id="' + escapeAttr(account.id) + '">Close panel</button></div><div class="workspace-management-empty" id="workspace-management-empty-' + escapeAttr(account.id) + '"><div class="workspace-management-empty-shell"><div class="workspace-management-empty-actions-card"><div class="workspace-management-empty-actions-copy"><h4>Create a workspace</h4><p>Add a new hosted workspace for a customer or operating boundary.</p></div>' + addWorkspaceForm + '</div><div class="workspace-management-empty-note">Access changes stay in Access. Billing changes stay in Billing.</div></div></div><div class="workspace-management-content" id="workspace-management-content-' + escapeAttr(account.id) + '" hidden><div class="workspace-management-meta" id="workspace-management-meta-' + escapeAttr(account.id) + '"></div><h4 id="workspace-management-title-' + escapeAttr(account.id) + '"></h4><p class="workspace-management-summary" id="workspace-management-summary-' + escapeAttr(account.id) + '"></p><div class="workspace-management-facts"><div class="workspace-management-fact"><span>Health</span><strong id="workspace-management-health-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Setup</span><strong id="workspace-management-setup-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Agents</span><strong id="workspace-management-agents-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Alert routes</span><strong id="workspace-management-alerts-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Report schedules</span><strong id="workspace-management-reports-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Created</span><strong id="workspace-management-created-' + escapeAttr(account.id) + '"></strong></div></div><div class="workspace-management-guidance" id="workspace-management-guidance-' + escapeAttr(account.id) + '"></div><div class="workspace-setup-checklist" aria-label="Workspace setup checklist"><div class="workspace-setup-step workspace-setup-step-created"><span class="workspace-setup-status" id="workspace-management-check-created-' + escapeAttr(account.id) + '"></span><div><strong>Workspace created</strong><span>This client has a separate account boundary.</span></div></div><div class="workspace-setup-step"><span class="workspace-setup-status" id="workspace-management-check-install-' + escapeAttr(account.id) + '"></span><div><strong>Install the first agent</strong><span>Use the workspace-bound install path so data lands in this client.</span></div></div><div class="workspace-setup-step"><span class="workspace-setup-status" id="workspace-management-check-alerts-' + escapeAttr(account.id) + '"></span><div><strong>Configure alert routes</strong><span>Keep notifications scoped to this client.</span></div></div><div class="workspace-setup-step"><span class="workspace-setup-status" id="workspace-management-check-reports-' + escapeAttr(account.id) + '"></span><div><strong>Schedule reports</strong><span>Send client performance reports from this workspace.</span></div></div><div class="workspace-setup-step"><span class="workspace-setup-status" id="workspace-management-check-access-' + escapeAttr(account.id) + '"></span><div><strong>Review access</strong><span>Invite provider staff or client users from Access.</span></div></div></div><div class="workspace-management-next-steps" id="workspace-management-next-steps-' + escapeAttr(account.id) + '"><div class="workspace-next-step"><div><strong>Open workspace</strong><span>Work inside this client boundary.</span></div><form method="POST" id="workspace-management-open-form-' + escapeAttr(account.id) + '"><button type="submit" class="btn-primary btn-compact" id="workspace-management-open-' + escapeAttr(account.id) + '">Open workspace</button></form></div><div class="workspace-next-step"><div><strong>Install agents</strong><span>Open the workspace-bound install commands.</span></div><form method="POST" id="workspace-management-install-form-' + escapeAttr(account.id) + '"><button type="submit" class="btn-secondary btn-compact" id="workspace-management-install-' + escapeAttr(account.id) + '">Install agents</button></form></div><div class="workspace-next-step workspace-next-step-readonly"><div><strong>Alerts and reports</strong><span>Alerts and performance reports stay inside the client workspace.</span></div><form method="POST" id="workspace-management-reporting-form-' + escapeAttr(account.id) + '"><button type="submit" class="btn-secondary btn-compact" id="workspace-management-reporting-' + escapeAttr(account.id) + '">Open reports</button></form></div><div class="workspace-next-step workspace-next-step-readonly"><div><strong>Access</strong><span>Invite people or adjust roles from the account access boundary.</span></div><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="access">Open Access</button></div></div><div class="workspace-management-actions"><button type="button" class="btn-danger" id="workspace-management-action-' + escapeAttr(account.id) + '" data-action="workspace-action" data-account-id="' + escapeAttr(account.id) + '">Manage workspace</button></div></div></section>';+ workspaceManagement = '<section class="workspace-management-panel workspace-management-panel-idle" id="workspace-management-' + escapeAttr(account.id) + '" hidden><div class="workspace-management-header"><div><h3>Workspace setup checklist</h3><p>Finish the client setup steps without mixing client data across workspaces.</p></div><button type="button" class="btn-secondary btn-compact" id="workspace-management-close-' + escapeAttr(account.id) + '" data-action="clear-workspace-selection" data-account-id="' + escapeAttr(account.id) + '">Close panel</button></div><div class="workspace-management-empty" id="workspace-management-empty-' + escapeAttr(account.id) + '"><div class="workspace-management-empty-shell"><div class="workspace-management-empty-actions-card"><div class="workspace-management-empty-actions-copy"><h4>Create a workspace</h4><p>Add a new hosted workspace for a customer or operating boundary.</p></div>' + addWorkspaceForm + '</div><div class="workspace-management-empty-note">Access changes stay in Access. Billing changes stay in Billing.</div></div></div><div class="workspace-management-content" id="workspace-management-content-' + escapeAttr(account.id) + '" hidden><div class="workspace-management-meta" id="workspace-management-meta-' + escapeAttr(account.id) + '"></div><h4 id="workspace-management-title-' + escapeAttr(account.id) + '"></h4><p class="workspace-management-summary" id="workspace-management-summary-' + escapeAttr(account.id) + '"></p><div class="workspace-management-facts"><div class="workspace-management-fact"><span>Health</span><strong id="workspace-management-health-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Setup</span><strong id="workspace-management-setup-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Agents</span><strong id="workspace-management-agents-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Alert routes</span><strong id="workspace-management-alerts-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Report schedules</span><strong id="workspace-management-reports-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Created</span><strong id="workspace-management-created-' + escapeAttr(account.id) + '"></strong></div></div><div class="workspace-management-guidance" id="workspace-management-guidance-' + escapeAttr(account.id) + '"></div><div class="workspace-management-identity" id="workspace-management-identity-' + escapeAttr(account.id) + '"></div><div class="workspace-setup-guide" aria-label="Guided workspace setup"><div class="workspace-setup-guide-copy"><span>Current step</span><h4 id="workspace-management-guide-title-' + escapeAttr(account.id) + '"></h4><p id="workspace-management-guide-description-' + escapeAttr(account.id) + '"></p><ul id="workspace-management-guide-diagnostics-' + escapeAttr(account.id) + '"></ul></div><form method="POST" id="workspace-management-primary-form-' + escapeAttr(account.id) + '"><button type="submit" class="btn-primary btn-compact" id="workspace-management-primary-' + escapeAttr(account.id) + '">Continue setup</button></form></div><div class="workspace-setup-checklist" aria-label="Workspace setup checklist"><div class="workspace-setup-step workspace-setup-step-created"><span class="workspace-setup-status" id="workspace-management-check-created-' + escapeAttr(account.id) + '"></span><div><strong>Workspace created</strong><span>This client has a separate account boundary.</span></div></div><div class="workspace-setup-step"><span class="workspace-setup-status" id="workspace-management-check-install-' + escapeAttr(account.id) + '"></span><div><strong>Install the first agent</strong><span>Use the workspace-bound install path so data lands in this client.</span></div></div><div class="workspace-setup-step"><span class="workspace-setup-status" id="workspace-management-check-alerts-' + escapeAttr(account.id) + '"></span><div><strong>Configure alert routes</strong><span>Keep notifications scoped to this client.</span></div></div><div class="workspace-setup-step"><span class="workspace-setup-status" id="workspace-management-check-reports-' + escapeAttr(account.id) + '"></span><div><strong>Schedule reports</strong><span>Send client performance reports from this workspace.</span></div></div><div class="workspace-setup-step"><span class="workspace-setup-status" id="workspace-management-check-access-' + escapeAttr(account.id) + '"></span><div><strong>Review access</strong><span>Invite provider staff or client users from Access.</span></div></div></div><div class="workspace-management-next-steps" id="workspace-management-next-steps-' + escapeAttr(account.id) + '"><div class="workspace-next-step"><div><strong>Open workspace</strong><span>Work inside this client boundary.</span></div><form method="POST" id="workspace-management-open-form-' + escapeAttr(account.id) + '"><button type="submit" class="btn-primary btn-compact" id="workspace-management-open-' + escapeAttr(account.id) + '">Open workspace</button></form></div><div class="workspace-next-step"><div><strong>Install agents</strong><span>Open the workspace-bound install commands.</span></div><form method="POST" id="workspace-management-install-form-' + escapeAttr(account.id) + '"><button type="submit" class="btn-secondary btn-compact" id="workspace-management-install-' + escapeAttr(account.id) + '">Install agents</button></form></div><div class="workspace-next-step workspace-next-step-readonly"><div><strong>Alerts and reports</strong><span>Alerts and performance reports stay inside the client workspace.</span></div><form method="POST" id="workspace-management-reporting-form-' + escapeAttr(account.id) + '"><button type="submit" class="btn-secondary btn-compact" id="workspace-management-reporting-' + escapeAttr(account.id) + '">Open reports</button></form></div><div class="workspace-next-step workspace-next-step-readonly"><div><strong>Access</strong><span>Invite people or adjust roles from the account access boundary.</span></div><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="access">Open Access</button></div></div><div class="workspace-management-actions"><button type="button" class="btn-danger" id="workspace-management-action-' + escapeAttr(account.id) + '" data-action="workspace-action" data-account-id="' + escapeAttr(account.id) + '">Manage workspace</button></div></div></section>';}var workspaceHTML = workspaces.length ? '<div class="workspace-list-wrap" id="' + escapeAttr(workspaceListAnchorID(account.id)) + '">' + (workspaceHeaderActions ? '<div class="workspace-list-toolbar">' + workspaceHeaderActions + "</div>" : "") + '<div class="workspace-list-head"><span>Workspace</span><span>Setup</span><span>Health</span><span>Actions</span></div><div class="workspace-list">' + workspaces.map(function(workspace) {return renderWorkspaceCard(account, workspace, accountAPIBasePath);@@ -3227,7 +3378,8 @@return {...account,workspaces: normalizeWorkspaces(account && Array.isArray(account.workspaces) ? account.workspaces : []),- members: normalizeMembers(account && Array.isArray(account.members) ? account.members : [])+ members: normalizeMembers(account && Array.isArray(account.members) ? account.members : []),+ setup_templates: Array.isArray(account.setup_templates) ? account.setup_templates.slice() : []};});}diff --git a/internal/cloudcp/portal/frontend/dev.mjs b/internal/cloudcp/portal/frontend/dev.mjsindex aded564820..9cf5df725c 100644--- a/internal/cloudcp/portal/frontend/dev.mjs+++ b/internal/cloudcp/portal/frontend/dev.mjs@@ -9,7 +9,7 @@ import { createPortalBuildOptions, frontendRoot } from './build_config.mjs';const scenarioCookieName = 'pulse_portal_preview_scenario';const previewHost = process.env.PULSE_PORTAL_PREVIEW_HOST || '127.0.0.1';const previewPort = Number(process.env.PULSE_PORTAL_PREVIEW_PORT || '8765');-const previewScenarios = ['managed', 'readonly', 'selfhosted', 'empty'];+const previewScenarios = ['managed', 'readonly', 'selfhosted', 'empty', 'onboarding'];const previewFaviconSVG = fs.readFileSync(path.join(frontendRoot, '..', '..', 'favicon.svg'), 'utf8');const previewFaviconHref = '/favicon.svg?v=' + createHash('sha256').update(previewFaviconSVG).digest('hex').slice(0, 16);@@ -21,6 +21,17 @@ function deepClone(value) {return JSON.parse(JSON.stringify(value));}+function standardSetupTemplates() {+ return [{+ id: 'standard-client-onboarding',+ title: 'Standard client onboarding',+ agent_naming: 'Keep the client workspace as the identity boundary; repeated hostnames are expected across clients.',+ alert_routing: 'Create at least one enabled alert route inside each client workspace.',+ reporting: 'Schedule at least one client performance report before the workspace is marked ready.',+ access: 'Invite provider staff from Access and keep client users on the smallest useful role.',+ }];+}+function buildScenarioTemplate(name) {const base = {authenticated: true,@@ -50,6 +61,7 @@ function buildScenarioTemplate(name) {role: 'read_only',can_manage: false,has_billing: true,+ setup_templates: standardSetupTemplates(),workspaces: [{id: 'ws_alpha',@@ -59,8 +71,12 @@ function buildScenarioTemplate(name) {health_status: 'healthy',setup_status: 'ready',agent_count: 2,+ agent_token_count: 2,+ unused_agent_token_count: 0,alert_route_count: 1,+ disabled_alert_route_count: 0,report_schedule_count: 1,+ disabled_report_schedule_count: 0,created_at: iso('2026-03-20T10:00:00Z'),},{@@ -71,8 +87,12 @@ function buildScenarioTemplate(name) {health_status: 'healthy',setup_status: 'ready',agent_count: 1,+ agent_token_count: 1,+ unused_agent_token_count: 0,alert_route_count: 1,+ disabled_alert_route_count: 0,report_schedule_count: 1,+ disabled_report_schedule_count: 0,created_at: iso('2026-03-21T10:00:00Z'),},],@@ -105,6 +125,7 @@ function buildScenarioTemplate(name) {role: 'owner',can_manage: true,has_billing: true,+ setup_templates: standardSetupTemplates(),workspaces: [],members: [{ email: '[email protected]', role: 'owner', user_id: 'u_owner' },@@ -113,6 +134,76 @@ function buildScenarioTemplate(name) {};}+ if (name === 'onboarding') {+ return {+ ...base,+ accounts: [{+ id: 'acct_onboarding',+ name: 'Pulse MSP Demo',+ kind: 'msp',+ kind_label: 'MSP',+ role: 'owner',+ can_manage: true,+ has_billing: true,+ setup_templates: standardSetupTemplates(),+ workspaces: [+ {+ id: 'ws_acme',+ display_name: 'Acme Dental',+ state: 'active',+ healthy: true,+ health_status: 'healthy',+ setup_status: 'install_agents',+ agent_count: 0,+ agent_token_count: 1,+ unused_agent_token_count: 1,+ alert_route_count: 0,+ disabled_alert_route_count: 0,+ report_schedule_count: 0,+ disabled_report_schedule_count: 0,+ created_at: iso('2026-05-28T10:00:00Z'),+ },+ {+ id: 'ws_northbridge',+ display_name: 'Northbridge Legal',+ state: 'active',+ healthy: true,+ health_status: 'healthy',+ setup_status: 'configure_outputs',+ agent_count: 1,+ agent_token_count: 1,+ unused_agent_token_count: 0,+ alert_route_count: 0,+ disabled_alert_route_count: 1,+ report_schedule_count: 0,+ disabled_report_schedule_count: 1,+ created_at: iso('2026-05-29T10:00:00Z'),+ },+ {+ id: 'ws_hilltop',+ display_name: 'Hilltop Care',+ state: 'active',+ healthy: true,+ health_status: 'healthy',+ setup_status: 'ready',+ agent_count: 2,+ agent_token_count: 2,+ unused_agent_token_count: 0,+ alert_route_count: 1,+ disabled_alert_route_count: 0,+ report_schedule_count: 1,+ disabled_report_schedule_count: 0,+ created_at: iso('2026-05-30T10:00:00Z'),+ },+ ],+ members: [+ { email: '[email protected]', role: 'owner', user_id: 'u_owner' },+ { email: '[email protected]', role: 'tech', user_id: 'u_helpdesk' },+ ],+ }],+ };+ }+return {...base,accounts: [{@@ -123,6 +214,7 @@ function buildScenarioTemplate(name) {role: 'owner',can_manage: true,has_billing: true,+ setup_templates: standardSetupTemplates(),workspaces: [{id: 'ws_alpha',@@ -141,8 +233,12 @@ function buildScenarioTemplate(name) {health_status: 'healthy',setup_status: 'configure_outputs',agent_count: 1,+ agent_token_count: 1,+ unused_agent_token_count: 0,alert_route_count: 0,+ disabled_alert_route_count: 1,report_schedule_count: 0,+ disabled_report_schedule_count: 1,created_at: iso('2026-03-21T10:00:00Z'),},{@@ -153,8 +249,12 @@ function buildScenarioTemplate(name) {health_status: 'healthy',setup_status: 'install_agents',agent_count: 0,+ agent_token_count: 1,+ unused_agent_token_count: 1,alert_route_count: 0,+ disabled_alert_route_count: 0,report_schedule_count: 0,+ disabled_report_schedule_count: 0,created_at: iso('2026-03-22T10:00:00Z'),},],@@ -309,6 +409,7 @@ function buildPreviewWorkspaceHTML(bootstrap, workspaceID, targetPath, scenario)const title = entry ? entry.workspace.display_name : workspaceID;const accountName = entry ? entry.account.name : 'Pulse Account';const accountID = entry ? entry.account.id : '';+ const setupStatus = entry && entry.workspace.setup_status ? entry.workspace.setup_status : 'workspace';const targetLabel = previewTargetLabel(targetPath);const portalURL = '/?scenario=' + encodeURIComponent(scenario);const portalWorkspaceURL = accountID@@ -341,7 +442,7 @@ function buildPreviewWorkspaceHTML(bootstrap, workspaceID, targetPath, scenario)'h1{margin:0 0 8px;font-size:24px;letter-spacing:0}' +'h2{margin:24px 0 8px;font-size:16px}' +'p{margin:0 0 16px;color:#475467;line-height:1.5}' +- '.facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:20px 0}' ++ '.facts{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin:20px 0}' +'.fact{border:1px solid #eaecf0;border-radius:6px;padding:10px;background:#fcfcfd}' +'.fact span{display:block;font-size:12px;color:#667085}' +'.fact strong{display:block;margin-top:2px;font-size:13px}' +@@ -365,9 +466,11 @@ function buildPreviewWorkspaceHTML(bootstrap, workspaceID, targetPath, scenario)'<p>Preview workspace handoff</p>' +'<h1>' + escapeHTML(targetHeading) + '</h1>' +'<p>You are inside the <strong>' + escapeHTML(title) + '</strong> client workspace. In production the signed handoff creates a tenant session and opens ' + escapeHTML(targetLabel) + '.</p>' ++ '<p>This client boundary is the thing that keeps repeated hostnames, alerts, and reports from being mixed across MSP customers.</p>' +'<div class="facts">' +'<div class="fact"><span>Account</span><strong>' + escapeHTML(accountName) + '</strong></div>' +'<div class="fact"><span>Workspace</span><strong>' + escapeHTML(workspaceID) + '</strong></div>' ++ '<div class="fact"><span>Setup status</span><strong>' + escapeHTML(setupStatus) + '</strong></div>' +'<div class="fact"><span>Target</span><strong>' + escapeHTML(targetPathLabel) + '</strong></div>' +'</div>' +'<div class="task">' +@@ -378,9 +481,11 @@ function buildPreviewWorkspaceHTML(bootstrap, workspaceID, targetPath, scenario): '') +'</div>' +'<div class="steps" aria-label="Workspace setup flow">' +- '<div class="step"><b>1</b><div><strong>Install agents in this workspace</strong><span>The handoff keeps the agent command tied to this client boundary.</span></div></div>' +- '<div class="step"><b>2</b><div><strong>Confirm data is arriving</strong><span>Pulse Account marks the workspace as installed only after an agent-scoped token is used.</span></div></div>' +- '<div class="step"><b>3</b><div><strong>Add alert routes and reports</strong><span>Alerts and scheduled reports are part of the setup state, not optional polish.</span></div></div>' ++ '<div class="step"><b>1</b><div><strong>Workspace created</strong><span>The client gets a separate workspace boundary before monitoring data arrives.</span></div></div>' ++ '<div class="step"><b>2</b><div><strong>Install agents in this workspace</strong><span>The handoff keeps the agent command tied to this client boundary.</span></div></div>' ++ '<div class="step"><b>3</b><div><strong>Confirm data is arriving</strong><span>Pulse Account marks the workspace as installed only after an agent-scoped token is used.</span></div></div>' ++ '<div class="step"><b>4</b><div><strong>Add alert routes</strong><span>Notification routes stay tenant-owned and enabled inside the client workspace.</span></div></div>' ++ '<div class="step"><b>5</b><div><strong>Schedule reports</strong><span>Performance reports are part of ready state for MSP onboarding.</span></div></div>' +'</div>' +'<div class="actions">' +'<a class="button" href="' + escapeHTML(portalWorkspaceURL) + '">Back to workspace row</a>' +@@ -613,8 +718,12 @@ function routeAccountAPI(request, response, url, bootstrap, scenario) {health_status: 'healthy',setup_status: 'install_agents',agent_count: 0,+ agent_token_count: 1,+ unused_agent_token_count: 1,alert_route_count: 0,+ disabled_alert_route_count: 0,report_schedule_count: 0,+ disabled_report_schedule_count: 0,created_at: iso(new Date()),};account.workspaces.push(workspace);diff --git a/internal/cloudcp/portal/frontend/src/account_view.test.ts b/internal/cloudcp/portal/frontend/src/account_view.test.tsindex 63f7084dbb..f0fc502920 100644--- a/internal/cloudcp/portal/frontend/src/account_view.test.ts+++ b/internal/cloudcp/portal/frontend/src/account_view.test.ts@@ -80,6 +80,11 @@ describe('account view', function() {'<div id="workspace-management-reports-' + accountID + '"></div>' +'<div id="workspace-management-created-' + accountID + '"></div>' +'<div id="workspace-management-guidance-' + accountID + '"></div>' ++ '<div id="workspace-management-identity-' + accountID + '"></div>' ++ '<div id="workspace-management-guide-title-' + accountID + '"></div>' ++ '<div id="workspace-management-guide-description-' + accountID + '"></div>' ++ '<ul id="workspace-management-guide-diagnostics-' + accountID + '"></ul>' ++ '<form id="workspace-management-primary-form-' + accountID + '"><button id="workspace-management-primary-' + accountID + '"></button></form>' +'<span id="workspace-management-check-created-' + accountID + '"></span>' +'<span id="workspace-management-check-install-' + accountID + '"></span>' +'<span id="workspace-management-check-alerts-' + accountID + '"></span>' +@@ -310,6 +315,10 @@ describe('account view', function() {expect(document.getElementById('workspace-management-agents-acct_1')?.textContent).toContain('Unknown');expect(document.getElementById('workspace-management-alerts-acct_1')?.textContent).toContain('Unknown');expect(document.getElementById('workspace-management-reports-acct_1')?.textContent).toContain('Unknown');+ expect(document.getElementById('workspace-management-identity-acct_1')?.textContent).toContain('Hostnames can repeat across clients');+ expect(document.getElementById('workspace-management-guide-title-acct_1')?.textContent).toContain('Follow the setup path');+ expect(document.getElementById('workspace-management-guide-diagnostics-acct_1')?.textContent).toContain('Open the workspace or install agents');+ expect(document.getElementById('workspace-management-primary-acct_1')?.textContent).toContain('Open setup');expect(document.getElementById('workspace-management-check-install-acct_1')?.textContent).toContain('Next');expect(document.getElementById('workspace-management-check-alerts-acct_1')?.textContent).toContain('Pending');expect(document.getElementById('workspace-management-check-reports-acct_1')?.textContent).toContain('Pending');@@ -318,6 +327,7 @@ describe('account view', function() {expect((document.getElementById('workspace-management-open-form-acct_1') as HTMLFormElement).action).toContain('/api/accounts/acct_1/tenants/ws_1/handoff');expect((document.getElementById('workspace-management-install-form-acct_1') as HTMLFormElement).action).toContain('/api/accounts/acct_1/tenants/ws_1/handoff?target_path=%2Fsettings%2Finfrastructure%3Fadd%3Dlinux-host');expect((document.getElementById('workspace-management-reporting-form-acct_1') as HTMLFormElement).action).toContain('/api/accounts/acct_1/tenants/ws_1/handoff?target_path=%2Fsettings%2Fsupport%2Freporting');+ expect((document.getElementById('workspace-management-primary-form-acct_1') as HTMLFormElement).action).toContain('/api/accounts/acct_1/tenants/ws_1/handoff?target_path=%2Fsettings%2Finfrastructure%3Fadd%3Dlinux-host');});it('renders account UI for every tracked account entry', function() {diff --git a/internal/cloudcp/portal/frontend/src/account_view.ts b/internal/cloudcp/portal/frontend/src/account_view.tsindex bc1441b5c6..1b39ccbfba 100644--- a/internal/cloudcp/portal/frontend/src/account_view.ts+++ b/internal/cloudcp/portal/frontend/src/account_view.ts@@ -10,8 +10,10 @@ import { normalizePortalRole, portalRoleCapabilityCopy, portalRoleLabel } from 'import {workspaceGuidanceCopy,workspaceHealthLabel,+ workspaceIdentityCopy,+ workspaceSetupGuide,workspaceSetupLabel,- workspaceSetupState,+ workspaceSetupSteps,workspaceStatusCopy,} from './workspace_presentation';@@ -45,10 +47,6 @@ function hasKnownCount(value: unknown): boolean {return typeof value === 'number' && Number.isFinite(value);}-function hasPositiveCount(value: unknown): boolean {- return hasKnownCount(value) && Number(value) > 0;-}-function setupCountLabel(value: unknown, singular: string, plural: string): string {if (!hasKnownCount(value)) return 'Unknown';var count = Number(value);@@ -125,6 +123,12 @@ export function renderWorkspaceManagement(account: PortalAccountSummary, entry:var reports = getElement<HTMLElement>('workspace-management-reports-' + account.id);var created = getElement<HTMLElement>('workspace-management-created-' + account.id);var guidance = getElement<HTMLElement>('workspace-management-guidance-' + account.id);+ var identity = getElement<HTMLElement>('workspace-management-identity-' + account.id);+ var guideTitle = getElement<HTMLElement>('workspace-management-guide-title-' + account.id);+ var guideDescription = getElement<HTMLElement>('workspace-management-guide-description-' + account.id);+ var guideDiagnostics = getElement<HTMLElement>('workspace-management-guide-diagnostics-' + account.id);+ var guidePrimaryForm = getElement<HTMLFormElement>('workspace-management-primary-form-' + account.id);+ var guidePrimaryButton = getElement<HTMLButtonElement>('workspace-management-primary-' + account.id);var checkCreated = getElement<HTMLElement>('workspace-management-check-created-' + account.id);var checkInstall = getElement<HTMLElement>('workspace-management-check-install-' + account.id);var checkAlerts = getElement<HTMLElement>('workspace-management-check-alerts-' + account.id);@@ -172,9 +176,11 @@ export function renderWorkspaceManagement(account: PortalAccountSummary, entry:openForm?.removeAttribute('action');installForm?.removeAttribute('action');reportingForm?.removeAttribute('action');+ guidePrimaryForm?.removeAttribute('action');if (openButton) openButton.disabled = true;if (installButton) installButton.disabled = true;if (reportingButton) reportingButton.disabled = true;+ if (guidePrimaryButton) guidePrimaryButton.disabled = true;return;}@@ -188,38 +194,37 @@ export function renderWorkspaceManagement(account: PortalAccountSummary, entry:if (reports) reports.textContent = setupCountLabel(workspace.report_schedule_count, 'schedule', 'schedules');created.textContent = workspaceCreatedLabel(workspace);guidance.textContent = workspaceGuidanceCopy(workspace);- var setupState = workspaceSetupState(workspace);- var isActive = workspace.state === 'active';- var hasAgents = hasPositiveCount(workspace.agent_count) || setupState === 'configure_outputs' || setupState === 'ready';- var hasAlertRoutes = hasPositiveCount(workspace.alert_route_count);- var hasReportSchedules = hasPositiveCount(workspace.report_schedule_count);- setChecklistStatus(checkCreated, workspace.state ? 'done' : 'pending', workspace.state ? 'Done' : 'Pending');- if (hasAgents) {- setChecklistStatus(checkInstall, 'done', 'Done');- } else if (setupState === 'install_agents' || setupState === 'setup_path') {- setChecklistStatus(checkInstall, isActive ? 'next' : 'blocked', isActive ? 'Next' : 'Blocked');- } else {- setChecklistStatus(checkInstall, 'blocked', 'Review');- }- if (hasAlertRoutes) {- setChecklistStatus(checkAlerts, 'done', 'Done');- } else if (setupState === 'review') {- setChecklistStatus(checkAlerts, 'blocked', 'Review');- } else if (isActive && hasAgents) {- setChecklistStatus(checkAlerts, 'next', 'Next');- } else {- setChecklistStatus(checkAlerts, 'pending', 'Pending');- }- if (hasReportSchedules) {- setChecklistStatus(checkReports, 'done', 'Done');- } else if (setupState === 'review') {- setChecklistStatus(checkReports, 'blocked', 'Review');- } else if (isActive && hasAgents && hasAlertRoutes) {- setChecklistStatus(checkReports, 'next', 'Next');- } else {- setChecklistStatus(checkReports, 'pending', 'Pending');+ if (identity) identity.textContent = workspaceIdentityCopy(workspace);+ var guide = workspaceSetupGuide(workspace);+ if (guideTitle) guideTitle.textContent = guide.title;+ if (guideDescription) guideDescription.textContent = guide.description;+ if (guideDiagnostics) {+ guideDiagnostics.textContent = '';+ for (var d = 0; d < guide.diagnostics.length; d += 1) {+ var item = document.createElement('li');+ item.textContent = guide.diagnostics[d];+ guideDiagnostics.appendChild(item);+ }+ }+ var primaryTargetPath = '';+ if (guide.primaryAction === 'install') {+ primaryTargetPath = WORKSPACE_INSTALL_TARGET_PATH;+ } else if (guide.primaryAction === 'outputs') {+ primaryTargetPath = WORKSPACE_REPORTING_TARGET_PATH;+ }+ if (guidePrimaryButton) guidePrimaryButton.textContent = guide.primaryLabel;+ setWorkspaceHandoffForm(guidePrimaryForm, guidePrimaryButton, accountAPIBasePath, account.id, workspace, primaryTargetPath, entry.manageWorkspace.pending);+ var steps = workspaceSetupSteps(workspace);+ var stepByID = {+ workspace: checkCreated,+ agent: checkInstall,+ alerts: checkAlerts,+ reports: checkReports,+ access: checkAccess,+ };+ for (var s = 0; s < steps.length; s += 1) {+ setChecklistStatus(stepByID[steps[s].id], steps[s].tone, steps[s].label);}- setChecklistStatus(checkAccess, 'available', 'Available');actionButton.textContent = workspaceActionLabel(workspace);actionButton.disabled = entry.manageWorkspace.pending;actionButton.setAttribute('data-workspace-id', workspace.id);diff --git a/internal/cloudcp/portal/frontend/src/shell_view.test.ts b/internal/cloudcp/portal/frontend/src/shell_view.test.tsindex 27a5aff81f..1002344764 100644--- a/internal/cloudcp/portal/frontend/src/shell_view.test.ts+++ b/internal/cloudcp/portal/frontend/src/shell_view.test.ts@@ -107,6 +107,14 @@ describe('shell view', function() {can_manage: true,has_billing: true,members: [],+ setup_templates: [{+ id: 'standard-client-onboarding',+ title: 'Standard client onboarding',+ agent_naming: 'Workspace boundary keeps repeated hostnames separate.',+ alert_routing: 'Enable one route per client.',+ reporting: 'Schedule one report per client.',+ access: 'Invite staff from Access.',+ }],workspaces: [{id: 'ws_summary',@@ -127,6 +135,8 @@ describe('shell view', function() {expect(html).toContain('Next:</strong> Set up Summary Workspace');expect(html).toContain('Unfinished setup');expect(html).toContain('Unknown agents');+ expect(html).toContain('Standard client onboarding');+ expect(html).toContain('Workspace boundary keeps repeated hostnames separate.');expect(html).toContain('1 workspace in setup');expect(html).toContain('Summary Workspace');expect(html).not.toContain('overview-task-grid');@@ -146,6 +156,14 @@ describe('shell view', function() {can_manage: true,has_billing: true,members: [],+ setup_templates: [{+ id: 'standard-client-onboarding',+ title: 'Standard client onboarding',+ agent_naming: 'Client workspace is the identity boundary.',+ alert_routing: 'Enabled route required.',+ reporting: 'Enabled report schedule required.',+ access: 'Provider staff use Access.',+ }],workspaces: [{id: 'ws_active',@@ -195,6 +213,8 @@ describe('shell view', function() {expect(html).toContain('2 workspaces to review');expect(html).toContain('Next:</strong> Review Beta Workspace');expect(html).toContain('Unfinished setup');+ expect(html).toContain('Provider setup template');+ expect(html).toContain('Client workspace is the identity boundary.');expect(html).toContain('Create workspace');expect(html).not.toContain('Manage billing');expect(html).not.toContain('Manage team');diff --git a/internal/cloudcp/portal/frontend/src/shell_view.ts b/internal/cloudcp/portal/frontend/src/shell_view.tsindex 8c7902a4ef..dcb2c34af5 100644--- a/internal/cloudcp/portal/frontend/src/shell_view.ts+++ b/internal/cloudcp/portal/frontend/src/shell_view.ts@@ -12,6 +12,7 @@ import {workspaceHealthLabel,workspaceHealthState,workspaceRowNote,+ workspaceSetupGuide,workspaceSetupLabel,workspaceSetupNextStep,workspaceSetupState,@@ -244,7 +245,7 @@ function countWorkspacesByState(workspaces: PortalWorkspaceSummary[], state: strfunction countReadyWorkspaces(workspaces: PortalWorkspaceSummary[]): number {var count = 0;for (var i = 0; i < workspaces.length; i += 1) {- if (String(workspaces[i].state || '') === 'active' && workspaceHealthState(workspaces[i]) === 'healthy') {+ if (String(workspaces[i].state || '') === 'active' && workspaceSetupState(workspaces[i]) === 'ready') {count += 1;}}@@ -605,6 +606,11 @@ function workspaceSetupFactsLine(workspace: PortalWorkspaceSummary): string {].join(' · ');}+function workspaceSetupDiagnosticsLine(workspace: PortalWorkspaceSummary): string {+ var guide = workspaceSetupGuide(workspace);+ return guide.diagnostics.length ? guide.diagnostics[0] : workspaceSetupNextStep(workspace);+}+function workspaceSummaryContext(entry: WorkspaceSummaryEntry, includeAccountName: boolean, note: string): string {if (!includeAccountName) return note;return entry.account.name + ' · ' + note;@@ -822,6 +828,31 @@ function renderWorkspaceSetupQueueAction(entry: WorkspaceSummaryEntry, accountAP);}+function renderProviderSetupTemplates(accounts: PortalAccountSummary[]): string {+ var templateAccount = accounts.find(function(account) {+ return account.kind === 'msp' && Array.isArray(account.setup_templates) && account.setup_templates.length > 0;+ });+ if (!templateAccount || !templateAccount.setup_templates || !templateAccount.setup_templates.length) return '';+ var template = templateAccount.setup_templates[0];+ return (+ '<section class="workspace-template-panel" aria-label="Provider setup template">' ++ '<div class="workspace-template-heading">' ++ '<div>' ++ '<h3>' + escapeHTML(template.title || 'Provider setup template') + '</h3>' ++ '<p>Use the same setup shape for each client workspace, then finish the tenant-owned configuration inside that workspace.</p>' ++ '</div>' ++ '<span>' + escapeHTML(templateAccount.name) + '</span>' ++ '</div>' ++ '<div class="workspace-template-grid">' ++ '<div><strong>Agent naming</strong><span>' + escapeHTML(template.agent_naming) + '</span></div>' ++ '<div><strong>Alert routing</strong><span>' + escapeHTML(template.alert_routing) + '</span></div>' ++ '<div><strong>Reports</strong><span>' + escapeHTML(template.reporting) + '</span></div>' ++ '<div><strong>Access</strong><span>' + escapeHTML(template.access) + '</span></div>' ++ '</div>' ++ '</section>'+ );+}+function renderWorkspaceSetupQueue(entries: WorkspaceSummaryEntry[], accountAPIBasePath: string): string {var setupNeeded = setupNeededWorkspaceEntries(entries);if (!setupNeeded.length) return '';@@ -843,7 +874,7 @@ function renderWorkspaceSetupQueue(entries: WorkspaceSummaryEntry[], accountAPIBsetupBadgeHTML(entry.workspace) +'<div>' +'<strong>' + escapeHTML(entry.workspace.display_name) + '</strong>' +- '<span>' + escapeHTML(entry.account.name + ' · ' + workspaceSetupNextStep(entry.workspace)) + '</span>' ++ '<span>' + escapeHTML(entry.account.name + ' · ' + workspaceSetupDiagnosticsLine(entry.workspace)) + '</span>' +'<small>' + escapeHTML(workspaceSetupFactsLine(entry.workspace)) + '</small>' +'</div>' +'</div>' +@@ -891,6 +922,7 @@ export function renderWorkspaceSummarySection(context: ShellViewContext): string'</div>' +renderFactLine('workspace-summary-facts', renderWorkspaceSummaryFacts(accounts, entries)) +renderWorkspaceSummaryInline(accounts, entries, context.accountAPIBasePath, showSelfHostedCommercial) ++ renderProviderSetupTemplates(accounts) +renderWorkspaceSetupQueue(entries, context.accountAPIBasePath) +'</section>');@@ -1040,6 +1072,30 @@ function renderAccountWorkspaceSection(account: PortalAccountSummary, accountAPI'<div class="workspace-management-guidance" id="workspace-management-guidance-' +escapeAttr(account.id) +'"></div>' ++ '<div class="workspace-management-identity" id="workspace-management-identity-' ++ escapeAttr(account.id) ++ '"></div>' ++ '<div class="workspace-setup-guide" aria-label="Guided workspace setup">' ++ '<div class="workspace-setup-guide-copy">' ++ '<span>Current step</span>' ++ '<h4 id="workspace-management-guide-title-' ++ escapeAttr(account.id) ++ '"></h4>' ++ '<p id="workspace-management-guide-description-' ++ escapeAttr(account.id) ++ '"></p>' ++ '<ul id="workspace-management-guide-diagnostics-' ++ escapeAttr(account.id) ++ '"></ul>' ++ '</div>' ++ '<form method="POST" id="workspace-management-primary-form-' ++ escapeAttr(account.id) ++ '">' ++ '<button type="submit" class="btn-primary btn-compact" id="workspace-management-primary-' ++ escapeAttr(account.id) ++ '">Continue setup</button>' ++ '</form>' ++ '</div>' +'<div class="workspace-setup-checklist" aria-label="Workspace setup checklist">' +'<div class="workspace-setup-step workspace-setup-step-created">' +'<span class="workspace-setup-status" id="workspace-management-check-created-' + escapeAttr(account.id) + '"></span>' +diff --git a/internal/cloudcp/portal/frontend/src/store.test.ts b/internal/cloudcp/portal/frontend/src/store.test.tsindex 0c508f6fbb..8562df68be 100644--- a/internal/cloudcp/portal/frontend/src/store.test.ts+++ b/internal/cloudcp/portal/frontend/src/store.test.ts@@ -51,6 +51,7 @@ describe('portal store', function() {expect(bootstrap.authenticated).toBe(true);expect(bootstrap.email).toBe('[email protected]');expect(bootstrap.accounts).toHaveLength(1);+ expect(bootstrap.accounts[0].setup_templates).toEqual([]);expect(bootstrap.portal_path).toBe('/portal');});diff --git a/internal/cloudcp/portal/frontend/src/store.ts b/internal/cloudcp/portal/frontend/src/store.tsindex 1d2fcf784e..17cb6c3453 100644--- a/internal/cloudcp/portal/frontend/src/store.ts+++ b/internal/cloudcp/portal/frontend/src/store.ts@@ -177,6 +177,7 @@ function normalizeAccounts(accounts: Partial<PortalBootstrapData>['accounts']):...(account as PortalAccountSummary),workspaces: normalizeWorkspaces(account && Array.isArray(account.workspaces) ? account.workspaces : []),members: normalizeMembers(account && Array.isArray(account.members) ? account.members : []),+ setup_templates: Array.isArray(account.setup_templates) ? account.setup_templates.slice() : [],};});}diff --git a/internal/cloudcp/portal/frontend/src/styles.css b/internal/cloudcp/portal/frontend/src/styles.cssindex 30b4271290..e8e21f87c8 100644--- a/internal/cloudcp/portal/frontend/src/styles.css+++ b/internal/cloudcp/portal/frontend/src/styles.css@@ -526,6 +526,71 @@ header .logout-btn:hover,color: var(--ink-secondary);}+.workspace-management-identity {+ padding: 10px 12px;+ border: 1px solid #c6d9f0;+ border-radius: var(--radius);+ background: var(--accent-subtle);+ color: var(--ink);+ font-size: 12px;+ line-height: 1.45;+}++.workspace-setup-guide {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: center;+ gap: 14px;+ padding: 12px;+ border: 1px solid var(--border);+ border-radius: var(--radius);+ background: var(--bg);+}++.workspace-setup-guide-copy {+ min-width: 0;+}++.workspace-setup-guide-copy > span {+ display: block;+ margin-bottom: 4px;+ color: var(--ink-muted);+ font-size: 11px;+ font-weight: 600;+ text-transform: uppercase;+ letter-spacing: 0;+}++.workspace-setup-guide h4 {+ margin: 0;+ font-size: 15px;+ color: var(--ink);+}++.workspace-setup-guide p {+ margin: 4px 0 0;+ color: var(--ink-secondary);+ font-size: 13px;+}++.workspace-setup-guide ul {+ display: grid;+ gap: 3px;+ margin: 8px 0 0;+ padding: 0;+ list-style: none;+}++.workspace-setup-guide li {+ color: var(--ink-secondary);+ font-size: 12px;+ line-height: 1.4;+}++.workspace-setup-guide form {+ margin: 0;+}+.workspace-setup-checklist {display: grid;gap: 8px;@@ -1449,6 +1514,71 @@ header .logout-btn:hover,gap: 8px;}+.workspace-template-panel {+ display: flex;+ flex-direction: column;+ gap: 12px;+ padding: 12px;+ border: 1px solid var(--border-muted);+ border-radius: var(--radius);+ background: var(--bg);+}++.workspace-template-heading {+ display: flex;+ align-items: flex-start;+ justify-content: space-between;+ gap: 12px;+}++.workspace-template-heading h3 {+ margin: 0;+ font-size: 14px;+ color: var(--ink);+}++.workspace-template-heading p {+ margin: 3px 0 0;+ color: var(--ink-secondary);+ font-size: 12px;+}++.workspace-template-heading > span {+ flex: 0 0 auto;+ color: var(--ink-secondary);+ font-size: 12px;+}++.workspace-template-grid {+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ gap: 8px;+}++.workspace-template-grid > div {+ padding: 10px;+ border: 1px solid var(--border-muted);+ border-radius: var(--radius);+ background: var(--bg-subtle);+}++.workspace-template-grid strong,+.workspace-template-grid span {+ display: block;+}++.workspace-template-grid strong {+ color: var(--ink);+ font-size: 12px;+}++.workspace-template-grid span {+ margin-top: 3px;+ color: var(--ink-secondary);+ font-size: 12px;+ line-height: 1.4;+}+/* Remove kicker labels — they feel like a custom portal. Use section context instead. */.account-panel-kicker,.billing-card-kicker,@@ -1624,6 +1754,16 @@ header .logout-btn:hover,.workspace-setup-queue-actions {justify-content: flex-start;}+ .workspace-template-heading {+ flex-direction: column;+ }+ .workspace-template-grid,+ .workspace-setup-guide {+ grid-template-columns: 1fr;+ }+ .workspace-setup-guide form {+ justify-self: flex-start;+ }.workspace-list-head { display: none; }.workspace-row { grid-template-columns: 1fr; gap: 8px; }diff --git a/internal/cloudcp/portal/frontend/src/types.ts b/internal/cloudcp/portal/frontend/src/types.tsindex 1b826fbc2f..943d0672a4 100644--- a/internal/cloudcp/portal/frontend/src/types.ts+++ b/internal/cloudcp/portal/frontend/src/types.ts@@ -6,9 +6,13 @@ export interface PortalWorkspaceSummary {health_status: 'healthy' | 'checking' | 'unhealthy';setup_status?: 'ready' | 'setup_path' | 'install_agents' | 'configure_outputs' | 'review';agent_count?: number;+ agent_token_count?: number;+ unused_agent_token_count?: number;last_agent_seen_at?: string;alert_route_count?: number;+ disabled_alert_route_count?: number;report_schedule_count?: number;+ disabled_report_schedule_count?: number;last_health_check?: string;created_at?: string;}@@ -22,6 +26,15 @@ export interface PortalAccessMember {created_at?: string;}+export interface PortalSetupTemplate {+ id: string;+ title: string;+ agent_naming: string;+ alert_routing: string;+ reporting: string;+ access: string;+}+export interface PortalAccountSummary {id: string;name: string;@@ -32,6 +45,7 @@ export interface PortalAccountSummary {has_billing: boolean;workspaces: PortalWorkspaceSummary[];members: PortalAccessMember[];+ setup_templates?: PortalSetupTemplate[];}export interface PortalBootstrapData {diff --git a/internal/cloudcp/portal/frontend/src/workspace_presentation.test.ts b/internal/cloudcp/portal/frontend/src/workspace_presentation.test.tsindex 50df13a1c6..ce95a2a5b0 100644--- a/internal/cloudcp/portal/frontend/src/workspace_presentation.test.ts+++ b/internal/cloudcp/portal/frontend/src/workspace_presentation.test.ts@@ -4,9 +4,13 @@ import {workspaceGuidanceCopy,workspaceHealthLabel,workspaceHealthState,+ workspaceIdentityCopy,workspaceRowNote,+ workspaceSetupDiagnostics,+ workspaceSetupGuide,workspaceSetupLabel,workspaceSetupNextStep,+ workspaceSetupSteps,workspaceSetupState,workspaceStatusCopy,} from './workspace_presentation';@@ -68,4 +72,43 @@ describe('workspace presentation', function() {expect(workspaceSetupState(createWorkspace({ agent_count: 1, alert_route_count: 1, report_schedule_count: 1 }))).toBe('ready');expect(workspaceSetupState(createWorkspace({ state: 'failed', healthy: false, health_status: 'unhealthy' }))).toBe('review');});++ it('explains setup blockers from backend-owned diagnostic facts', function() {+ var install = createWorkspace({+ agent_count: 0,+ agent_token_count: 1,+ unused_agent_token_count: 1,+ alert_route_count: 0,+ report_schedule_count: 0,+ });+ expect(workspaceSetupGuide(install).title).toBe('Install the first agent');+ expect(workspaceSetupGuide(install).primaryAction).toBe('install');+ expect(workspaceSetupDiagnostics(install)).toContain('Agent install token exists, but no reporting agent has checked in yet.');+ expect(workspaceIdentityCopy(install)).toContain('Hostnames can repeat across clients');++ var outputs = createWorkspace({+ agent_count: 1,+ alert_route_count: 0,+ disabled_alert_route_count: 1,+ report_schedule_count: 0,+ disabled_report_schedule_count: 1,+ });+ expect(workspaceSetupGuide(outputs).title).toBe('Configure alerts and reports');+ expect(workspaceSetupGuide(outputs).primaryAction).toBe('outputs');+ expect(workspaceSetupDiagnostics(outputs)).toContain('Alert route configuration exists, but no route is enabled.');+ expect(workspaceSetupDiagnostics(outputs)).toContain('Report schedule exists, but no schedule is enabled.');+ });++ it('builds a guided setup step model from the same readiness rules', function() {+ var steps = workspaceSetupSteps(createWorkspace({+ agent_count: 1,+ alert_route_count: 1,+ report_schedule_count: 0,+ }));++ expect(steps.map(function(step) { return step.id; })).toEqual(['workspace', 'agent', 'alerts', 'reports', 'access']);+ expect(steps.find(function(step) { return step.id === 'agent'; })?.tone).toBe('done');+ expect(steps.find(function(step) { return step.id === 'alerts'; })?.tone).toBe('done');+ expect(steps.find(function(step) { return step.id === 'reports'; })?.tone).toBe('next');+ });});diff --git a/internal/cloudcp/portal/frontend/src/workspace_presentation.ts b/internal/cloudcp/portal/frontend/src/workspace_presentation.tsindex f1da7b4eae..3a4954a8d8 100644--- a/internal/cloudcp/portal/frontend/src/workspace_presentation.ts+++ b/internal/cloudcp/portal/frontend/src/workspace_presentation.ts@@ -1,6 +1,24 @@import type { PortalWorkspaceSummary } from './types';export type WorkspaceSetupState = 'ready' | 'setup_path' | 'install_agents' | 'configure_outputs' | 'review';+export type WorkspaceSetupStepID = 'workspace' | 'agent' | 'alerts' | 'reports' | 'access';+export type WorkspaceSetupStepTone = 'done' | 'next' | 'pending' | 'blocked' | 'available';++export interface WorkspaceSetupStepModel {+ id: WorkspaceSetupStepID;+ title: string;+ detail: string;+ tone: WorkspaceSetupStepTone;+ label: string;+}++export interface WorkspaceSetupGuide {+ title: string;+ description: string;+ primaryAction: 'open' | 'install' | 'outputs' | 'access' | 'review';+ primaryLabel: string;+ diagnostics: string[];+}export function workspaceHealthState(workspace: PortalWorkspaceSummary): 'healthy' | 'checking' | 'unhealthy' {if (workspace.health_status === 'healthy' || workspace.health_status === 'checking' || workspace.health_status === 'unhealthy') {@@ -52,6 +70,10 @@ function positiveCount(value: unknown): boolean {return hasNumber(value) && Number(value) > 0;}+function zeroCount(value: unknown): boolean {+ return hasNumber(value) && Number(value) <= 0;+}+function explicitSetupStatus(workspace: PortalWorkspaceSummary): WorkspaceSetupState | '' {var value = String(workspace.setup_status || '');if (@@ -121,6 +143,152 @@ export function workspaceSetupNextStep(workspace: PortalWorkspaceSummary): strin}}+export function workspaceIdentityCopy(workspace: PortalWorkspaceSummary): string {+ return 'Client boundary: ' + workspace.display_name + '. Hostnames can repeat across clients; this workspace keeps agents, alerts, and reports scoped to this client.';+}++export function workspaceSetupDiagnostics(workspace: PortalWorkspaceSummary): string[] {+ var setup = workspaceSetupState(workspace);+ var diagnostics: string[] = [];+ if (setup === 'ready') {+ diagnostics.push('Reporting agent, enabled alert route, and enabled report schedule are present.');+ return diagnostics;+ }+ if (setup === 'review') {+ diagnostics.push(workspaceStatusCopy(workspace));+ return diagnostics;+ }++ if (zeroCount(workspace.agent_count)) {+ if (positiveCount(workspace.unused_agent_token_count) || positiveCount(workspace.agent_token_count)) {+ diagnostics.push('Agent install token exists, but no reporting agent has checked in yet.');+ } else {+ diagnostics.push('No reporting agent has checked in yet.');+ }+ }++ if (positiveCount(workspace.agent_count) && zeroCount(workspace.alert_route_count)) {+ diagnostics.push(+ positiveCount(workspace.disabled_alert_route_count)+ ? 'Alert route configuration exists, but no route is enabled.'+ : 'No enabled alert route is configured yet.',+ );+ }++ if (positiveCount(workspace.agent_count) && zeroCount(workspaceReportScheduleCount(workspace))) {+ diagnostics.push(+ positiveCount(workspace.disabled_report_schedule_count)+ ? 'Report schedule exists, but no schedule is enabled.'+ : 'No enabled report schedule is configured yet.',+ );+ }++ if (!diagnostics.length) {+ diagnostics.push(workspaceSetupNextStep(workspace));+ }+ return diagnostics;+}++function workspaceReportScheduleCount(workspace: PortalWorkspaceSummary): unknown {+ return workspace.report_schedule_count;+}++export function workspaceSetupGuide(workspace: PortalWorkspaceSummary): WorkspaceSetupGuide {+ var setup = workspaceSetupState(workspace);+ if (setup === 'ready') {+ return {+ title: 'Ready',+ description: 'Agents, alert routing, and reports are in place for this client workspace.',+ primaryAction: 'open',+ primaryLabel: 'Open workspace',+ diagnostics: workspaceSetupDiagnostics(workspace),+ };+ }+ if (setup === 'review') {+ return {+ title: 'Review workspace state',+ description: 'Resolve the workspace state before continuing client setup.',+ primaryAction: 'review',+ primaryLabel: 'Review workspace',+ diagnostics: workspaceSetupDiagnostics(workspace),+ };+ }+ if (setup === 'install_agents') {+ return {+ title: 'Install the first agent',+ description: 'Start inside this client workspace so the first reporting token and future hostnames stay scoped to the client.',+ primaryAction: 'install',+ primaryLabel: 'Install agents',+ diagnostics: workspaceSetupDiagnostics(workspace),+ };+ }+ if (setup === 'configure_outputs') {+ var needsAlerts = zeroCount(workspace.alert_route_count);+ var needsReports = zeroCount(workspaceReportScheduleCount(workspace));+ return {+ title: needsAlerts && needsReports ? 'Configure alerts and reports' : needsAlerts ? 'Configure alert routes' : 'Schedule reports',+ description: 'Finish the output side before this workspace leaves onboarding.',+ primaryAction: 'outputs',+ primaryLabel: needsReports && !needsAlerts ? 'Open reports' : 'Configure outputs',+ diagnostics: workspaceSetupDiagnostics(workspace),+ };+ }+ return {+ title: 'Follow the setup path',+ description: 'Open the client workspace and continue the next setup task from there.',+ primaryAction: 'install',+ primaryLabel: 'Open setup',+ diagnostics: workspaceSetupDiagnostics(workspace),+ };+}++export function workspaceSetupSteps(workspace: PortalWorkspaceSummary): WorkspaceSetupStepModel[] {+ var setup = workspaceSetupState(workspace);+ var state = String(workspace.state || '');+ var isActive = state === 'active';+ var hasAgents = positiveCount(workspace.agent_count) || setup === 'configure_outputs' || setup === 'ready';+ var hasAlerts = positiveCount(workspace.alert_route_count);+ var hasReports = positiveCount(workspaceReportScheduleCount(workspace));++ return [+ {+ id: 'workspace',+ title: 'Create workspace',+ detail: 'Separate client boundary created.',+ tone: state ? 'done' : 'pending',+ label: state ? 'Done' : 'Pending',+ },+ {+ id: 'agent',+ title: 'Install first agent',+ detail: 'First reporting agent checks in inside this workspace.',+ tone: hasAgents ? 'done' : setup === 'review' || !isActive ? 'blocked' : 'next',+ label: hasAgents ? 'Done' : setup === 'review' || !isActive ? 'Review' : 'Next',+ },+ {+ id: 'alerts',+ title: 'Configure alert routes',+ detail: 'Enabled notification route exists for this client.',+ tone: hasAlerts ? 'done' : setup === 'review' ? 'blocked' : isActive && hasAgents ? 'next' : 'pending',+ label: hasAlerts ? 'Done' : setup === 'review' ? 'Review' : isActive && hasAgents ? 'Next' : 'Pending',+ },+ {+ id: 'reports',+ title: 'Schedule reports',+ detail: 'Enabled report schedule exists for client reporting.',+ tone: hasReports ? 'done' : setup === 'review' ? 'blocked' : isActive && hasAgents && hasAlerts ? 'next' : 'pending',+ label: hasReports ? 'Done' : setup === 'review' ? 'Review' : isActive && hasAgents && hasAlerts ? 'Next' : 'Pending',+ },+ {+ id: 'access',+ title: 'Review access',+ detail: 'Provider staff and client users are handled from Access.',+ tone: 'available',+ label: 'Available',+ },+ ];+}+export function workspaceGuidanceCopy(workspace: PortalWorkspaceSummary): string {var status = workspaceHealthState(workspace);var state = String(workspace.state || '');diff --git a/internal/cloudcp/portal/handlers.go b/internal/cloudcp/portal/handlers.goindex 972fe1d1ed..0f161db6ba 100644--- a/internal/cloudcp/portal/handlers.go+++ b/internal/cloudcp/portal/handlers.go@@ -21,17 +21,21 @@ type accountInfo struct {}type workspaceSummaryItem struct {- ID string `json:"id"`- DisplayName string `json:"display_name"`- State registry.TenantState `json:"state"`- HealthCheckOK bool `json:"health_check_ok"`- SetupStatus string `json:"setup_status,omitempty"`- AgentCount *int `json:"agent_count,omitempty"`- LastAgentSeenAt *time.Time `json:"last_agent_seen_at,omitempty"`- AlertRouteCount *int `json:"alert_route_count,omitempty"`- ReportScheduleCount *int `json:"report_schedule_count,omitempty"`- LastHealthCheck *time.Time `json:"last_health_check"`- CreatedAt time.Time `json:"created_at"`+ ID string `json:"id"`+ DisplayName string `json:"display_name"`+ State registry.TenantState `json:"state"`+ HealthCheckOK bool `json:"health_check_ok"`+ SetupStatus string `json:"setup_status,omitempty"`+ AgentCount *int `json:"agent_count,omitempty"`+ AgentTokenCount *int `json:"agent_token_count,omitempty"`+ UnusedAgentTokenCount *int `json:"unused_agent_token_count,omitempty"`+ LastAgentSeenAt *time.Time `json:"last_agent_seen_at,omitempty"`+ AlertRouteCount *int `json:"alert_route_count,omitempty"`+ DisabledAlertRouteCount *int `json:"disabled_alert_route_count,omitempty"`+ ReportScheduleCount *int `json:"report_schedule_count,omitempty"`+ DisabledReportScheduleCount *int `json:"disabled_report_schedule_count,omitempty"`+ LastHealthCheck *time.Time `json:"last_health_check"`+ CreatedAt time.Time `json:"created_at"`}type dashboardSummary struct {@@ -130,17 +134,21 @@ func HandlePortalDashboardWithSetupFacts(reg *registry.TenantRegistry, setupFactfacts := workspaceSetupFactsForTenant(setupFacts, t.ID)resp.Workspaces = append(resp.Workspaces, workspaceSummaryItem{- ID: t.ID,- DisplayName: t.DisplayName,- State: t.State,- HealthCheckOK: t.HealthCheckOK,- SetupStatus: workspaceSetupStatus(t.State, t.HealthCheckOK, t.LastHealthCheck, facts),- AgentCount: facts.AgentCount,- LastAgentSeenAt: facts.LastAgentSeenAt,- AlertRouteCount: facts.AlertRouteCount,- ReportScheduleCount: facts.ReportScheduleCount,- LastHealthCheck: t.LastHealthCheck,- CreatedAt: t.CreatedAt,+ ID: t.ID,+ DisplayName: t.DisplayName,+ State: t.State,+ HealthCheckOK: t.HealthCheckOK,+ SetupStatus: workspaceSetupStatus(t.State, t.HealthCheckOK, t.LastHealthCheck, facts),+ AgentCount: facts.AgentCount,+ AgentTokenCount: facts.AgentTokenCount,+ UnusedAgentTokenCount: facts.UnusedAgentTokenCount,+ LastAgentSeenAt: facts.LastAgentSeenAt,+ AlertRouteCount: facts.AlertRouteCount,+ DisabledAlertRouteCount: facts.DisabledAlertRouteCount,+ ReportScheduleCount: facts.ReportScheduleCount,+ DisabledReportScheduleCount: facts.DisabledReportScheduleCount,+ LastHealthCheck: t.LastHealthCheck,+ CreatedAt: t.CreatedAt,})resp.Summary.Total++diff --git a/internal/cloudcp/portal/handlers_test.go b/internal/cloudcp/portal/handlers_test.goindex d287006e8c..d57d178e63 100644--- a/internal/cloudcp/portal/handlers_test.go+++ b/internal/cloudcp/portal/handlers_test.go@@ -121,17 +121,21 @@ type dashboardResp struct {Kind registry.AccountKind `json:"kind"`} `json:"account"`Workspaces []struct {- ID string `json:"id"`- DisplayName string `json:"display_name"`- State registry.TenantState `json:"state"`- HealthCheckOK bool `json:"health_check_ok"`- SetupStatus string `json:"setup_status"`- AgentCount *int `json:"agent_count"`- LastAgentSeenAt *time.Time `json:"last_agent_seen_at"`- AlertRouteCount *int `json:"alert_route_count"`- ReportScheduleCount *int `json:"report_schedule_count"`- LastHealthCheck *time.Time `json:"last_health_check"`- CreatedAt time.Time `json:"created_at"`+ ID string `json:"id"`+ DisplayName string `json:"display_name"`+ State registry.TenantState `json:"state"`+ HealthCheckOK bool `json:"health_check_ok"`+ SetupStatus string `json:"setup_status"`+ AgentCount *int `json:"agent_count"`+ AgentTokenCount *int `json:"agent_token_count"`+ UnusedAgentTokenCount *int `json:"unused_agent_token_count"`+ LastAgentSeenAt *time.Time `json:"last_agent_seen_at"`+ AlertRouteCount *int `json:"alert_route_count"`+ DisabledAlertRouteCount *int `json:"disabled_alert_route_count"`+ ReportScheduleCount *int `json:"report_schedule_count"`+ DisabledReportScheduleCount *int `json:"disabled_report_schedule_count"`+ LastHealthCheck *time.Time `json:"last_health_check"`+ CreatedAt time.Time `json:"created_at"`} `json:"workspaces"`Summary struct {Total int `json:"total"`@@ -247,17 +251,21 @@ func TestPortalDashboard(t *testing.T) {// local helper type for easier indexingfor _, ws := range resp.Workspaces {wsByID[ws.ID] = dashboardRespWorkspace{- ID: ws.ID,- DisplayName: ws.DisplayName,- State: ws.State,- HealthCheckOK: ws.HealthCheckOK,- SetupStatus: ws.SetupStatus,- AgentCount: ws.AgentCount,- LastAgentSeenAt: ws.LastAgentSeenAt,- AlertRouteCount: ws.AlertRouteCount,- ReportScheduleCount: ws.ReportScheduleCount,- LastHealthCheck: ws.LastHealthCheck,- CreatedAt: ws.CreatedAt,+ ID: ws.ID,+ DisplayName: ws.DisplayName,+ State: ws.State,+ HealthCheckOK: ws.HealthCheckOK,+ SetupStatus: ws.SetupStatus,+ AgentCount: ws.AgentCount,+ AgentTokenCount: ws.AgentTokenCount,+ UnusedAgentTokenCount: ws.UnusedAgentTokenCount,+ LastAgentSeenAt: ws.LastAgentSeenAt,+ AlertRouteCount: ws.AlertRouteCount,+ DisabledAlertRouteCount: ws.DisabledAlertRouteCount,+ ReportScheduleCount: ws.ReportScheduleCount,+ DisabledReportScheduleCount: ws.DisabledReportScheduleCount,+ LastHealthCheck: ws.LastHealthCheck,+ CreatedAt: ws.CreatedAt,}}@@ -371,21 +379,33 @@ func TestPortalDashboardUsesWorkspaceSetupFacts(t *testing.T) {mux.Handle(PortalDashboardPath, admin.AdminKeyMiddleware("secret-key", HandlePortalDashboardWithSetupFacts(reg, staticSetupFactReader{tenantInstallID: {- AgentCount: intPtr(0),- AlertRouteCount: intPtr(0),- ReportScheduleCount: intPtr(0),+ AgentCount: intPtr(0),+ AgentTokenCount: intPtr(1),+ UnusedAgentTokenCount: intPtr(1),+ AlertRouteCount: intPtr(0),+ DisabledAlertRouteCount: intPtr(0),+ ReportScheduleCount: intPtr(0),+ DisabledReportScheduleCount: intPtr(0),},tenantOutputsID: {- AgentCount: intPtr(1),- LastAgentSeenAt: &lastSeen,- AlertRouteCount: intPtr(1),- ReportScheduleCount: intPtr(0),+ AgentCount: intPtr(1),+ AgentTokenCount: intPtr(1),+ UnusedAgentTokenCount: intPtr(0),+ LastAgentSeenAt: &lastSeen,+ AlertRouteCount: intPtr(1),+ DisabledAlertRouteCount: intPtr(1),+ ReportScheduleCount: intPtr(0),+ DisabledReportScheduleCount: intPtr(1),},tenantReadyID: {- AgentCount: intPtr(2),- LastAgentSeenAt: &lastSeen,- AlertRouteCount: intPtr(1),- ReportScheduleCount: intPtr(1),+ AgentCount: intPtr(2),+ AgentTokenCount: intPtr(2),+ UnusedAgentTokenCount: intPtr(0),+ LastAgentSeenAt: &lastSeen,+ AlertRouteCount: intPtr(1),+ DisabledAlertRouteCount: intPtr(0),+ ReportScheduleCount: intPtr(1),+ DisabledReportScheduleCount: intPtr(0),},})))@@ -403,17 +423,21 @@ func TestPortalDashboardUsesWorkspaceSetupFacts(t *testing.T) {got := map[string]dashboardRespWorkspace{}for _, ws := range resp.Workspaces {got[ws.ID] = dashboardRespWorkspace{- ID: ws.ID,- DisplayName: ws.DisplayName,- State: ws.State,- HealthCheckOK: ws.HealthCheckOK,- SetupStatus: ws.SetupStatus,- AgentCount: ws.AgentCount,- LastAgentSeenAt: ws.LastAgentSeenAt,- AlertRouteCount: ws.AlertRouteCount,- ReportScheduleCount: ws.ReportScheduleCount,- LastHealthCheck: ws.LastHealthCheck,- CreatedAt: ws.CreatedAt,+ ID: ws.ID,+ DisplayName: ws.DisplayName,+ State: ws.State,+ HealthCheckOK: ws.HealthCheckOK,+ SetupStatus: ws.SetupStatus,+ AgentCount: ws.AgentCount,+ AgentTokenCount: ws.AgentTokenCount,+ UnusedAgentTokenCount: ws.UnusedAgentTokenCount,+ LastAgentSeenAt: ws.LastAgentSeenAt,+ AlertRouteCount: ws.AlertRouteCount,+ DisabledAlertRouteCount: ws.DisabledAlertRouteCount,+ ReportScheduleCount: ws.ReportScheduleCount,+ DisabledReportScheduleCount: ws.DisabledReportScheduleCount,+ LastHealthCheck: ws.LastHealthCheck,+ CreatedAt: ws.CreatedAt,}}if got[tenantInstallID].SetupStatus != "install_agents" {@@ -431,20 +455,36 @@ func TestPortalDashboardUsesWorkspaceSetupFacts(t *testing.T) {if got[tenantReadyID].LastAgentSeenAt == nil || !got[tenantReadyID].LastAgentSeenAt.Equal(lastSeen) {t.Fatalf("ready last_agent_seen_at = %v, want %v", got[tenantReadyID].LastAgentSeenAt, lastSeen)}+ if got[tenantInstallID].AgentTokenCount == nil || *got[tenantInstallID].AgentTokenCount != 1 {+ t.Fatalf("install agent_token_count = %v, want 1", got[tenantInstallID].AgentTokenCount)+ }+ if got[tenantInstallID].UnusedAgentTokenCount == nil || *got[tenantInstallID].UnusedAgentTokenCount != 1 {+ t.Fatalf("install unused_agent_token_count = %v, want 1", got[tenantInstallID].UnusedAgentTokenCount)+ }+ if got[tenantOutputsID].DisabledAlertRouteCount == nil || *got[tenantOutputsID].DisabledAlertRouteCount != 1 {+ t.Fatalf("outputs disabled_alert_route_count = %v, want 1", got[tenantOutputsID].DisabledAlertRouteCount)+ }+ if got[tenantOutputsID].DisabledReportScheduleCount == nil || *got[tenantOutputsID].DisabledReportScheduleCount != 1 {+ t.Fatalf("outputs disabled_report_schedule_count = %v, want 1", got[tenantOutputsID].DisabledReportScheduleCount)+ }}type dashboardRespWorkspace struct {- ID string- DisplayName string- State registry.TenantState- HealthCheckOK bool- SetupStatus string- AgentCount *int- LastAgentSeenAt *time.Time- AlertRouteCount *int- ReportScheduleCount *int- LastHealthCheck *time.Time- CreatedAt time.Time+ ID string+ DisplayName string+ State registry.TenantState+ HealthCheckOK bool+ SetupStatus string+ AgentCount *int+ AgentTokenCount *int+ UnusedAgentTokenCount *int+ LastAgentSeenAt *time.Time+ AlertRouteCount *int+ DisabledAlertRouteCount *int+ ReportScheduleCount *int+ DisabledReportScheduleCount *int+ LastHealthCheck *time.Time+ CreatedAt time.Time}func TestPortalDashboardEmpty(t *testing.T) {@@ -1172,6 +1212,50 @@ func TestBuildPortalBootstrapJSON_Contract(t *testing.T) {}}+func TestBuildPortalBootstrapJSON_IncludesMSPSetupTemplate(t *testing.T) {+ bootstrapJSON, err := MarshalBootstrapJSON(BuildBootstrapData(true, "[email protected]", []portalPageAccount{+ {+ ID: "a_msp",+ Kind: string(registry.AccountKindMSP),+ KindLabel: "MSP",+ Name: "Example MSP",+ Role: "owner",+ CanManage: true,+ },+ }, false))+ if err != nil {+ t.Fatalf("MarshalBootstrapJSON: %v", err)+ }++ var payload map[string]any+ if err := json.Unmarshal([]byte(bootstrapJSON), &payload); err != nil {+ t.Fatalf("unmarshal bootstrap JSON: %v", err)+ }+ accounts, ok := payload["accounts"].([]any)+ if !ok || len(accounts) != 1 {+ t.Fatalf("accounts = %#v, want one account", payload["accounts"])+ }+ account, ok := accounts[0].(map[string]any)+ if !ok {+ t.Fatalf("account payload = %#v", accounts[0])+ }+ templates, ok := account["setup_templates"].([]any)+ if !ok || len(templates) != 1 {+ t.Fatalf("setup_templates = %#v, want one template", account["setup_templates"])+ }+ template, ok := templates[0].(map[string]any)+ if !ok {+ t.Fatalf("setup template payload = %#v", templates[0])+ }+ if got := template["title"]; got != "Standard client onboarding" {+ t.Fatalf("setup template title = %#v", got)+ }+ agentNaming, ok := template["agent_naming"].(string)+ if !ok || !strings.Contains(agentNaming, "repeated hostnames") {+ t.Fatalf("setup template agent_naming = %#v, want repeated-hostname guidance", template["agent_naming"])+ }+}+func TestHandlePortalBootstrap_Success(t *testing.T) {reg, sessionSvc, token, accountID, _ := newPortalSessionFixture(t)@@ -1269,10 +1353,14 @@ func TestHandlePortalBootstrapIncludesWorkspaceSetupFacts(t *testing.T) {rec := httptest.NewRecorder()HandlePortalBootstrapWithSignupPathAndSetupFacts(sessionSvc, reg, nil, PortalSignupPath, staticSetupFactReader{"t_bootstrap_facts": {- AgentCount: intPtr(1),- LastAgentSeenAt: &lastSeen,- AlertRouteCount: intPtr(1),- ReportScheduleCount: intPtr(0),+ AgentCount: intPtr(1),+ AgentTokenCount: intPtr(2),+ UnusedAgentTokenCount: intPtr(1),+ LastAgentSeenAt: &lastSeen,+ AlertRouteCount: intPtr(1),+ DisabledAlertRouteCount: intPtr(1),+ ReportScheduleCount: intPtr(0),+ DisabledReportScheduleCount: intPtr(1),},}).ServeHTTP(rec, req)@@ -1294,12 +1382,24 @@ func TestHandlePortalBootstrapIncludesWorkspaceSetupFacts(t *testing.T) {if got := workspace["agent_count"]; got != float64(1) {t.Fatalf("workspace agent_count = %#v, want 1", got)}+ if got := workspace["agent_token_count"]; got != float64(2) {+ t.Fatalf("workspace agent_token_count = %#v, want 2", got)+ }+ if got := workspace["unused_agent_token_count"]; got != float64(1) {+ t.Fatalf("workspace unused_agent_token_count = %#v, want 1", got)+ }if got := workspace["alert_route_count"]; got != float64(1) {t.Fatalf("workspace alert_route_count = %#v, want 1", got)}+ if got := workspace["disabled_alert_route_count"]; got != float64(1) {+ t.Fatalf("workspace disabled_alert_route_count = %#v, want 1", got)+ }if got := workspace["report_schedule_count"]; got != float64(0) {t.Fatalf("workspace report_schedule_count = %#v, want 0", got)}+ if got := workspace["disabled_report_schedule_count"]; got != float64(1) {+ t.Fatalf("workspace disabled_report_schedule_count = %#v, want 1", got)+ }if got := workspace["last_agent_seen_at"]; got != "2026-04-01T10:00:00Z" {t.Fatalf("workspace last_agent_seen_at = %#v, want 2026-04-01T10:00:00Z", got)}diff --git a/internal/cloudcp/portal/page.go b/internal/cloudcp/portal/page.goindex 094ea34075..f26c525d20 100644--- a/internal/cloudcp/portal/page.go+++ b/internal/cloudcp/portal/page.go@@ -14,18 +14,22 @@ import (// portalPageWorkspace holds per-workspace display data for the portal template.type portalPageWorkspace struct {- ID string- DisplayName string- State string- Healthy bool- HealthStatus string- SetupStatus string- AgentCount *int- LastAgentSeenAt *time.Time- AlertRouteCount *int- ReportScheduleCount *int- LastHealthCheck *time.Time- CreatedAt time.Time+ ID string+ DisplayName string+ State string+ Healthy bool+ HealthStatus string+ SetupStatus string+ AgentCount *int+ AgentTokenCount *int+ UnusedAgentTokenCount *int+ LastAgentSeenAt *time.Time+ AlertRouteCount *int+ DisabledAlertRouteCount *int+ ReportScheduleCount *int+ DisabledReportScheduleCount *int+ LastHealthCheck *time.Time+ CreatedAt time.Time}type portalPageMember struct {@@ -225,18 +229,22 @@ func portalPageWorkspaceFromTenant(t *registry.Tenant, facts WorkspaceSetupFactsreturn portalPageWorkspace{}}return portalPageWorkspace{- ID: t.ID,- DisplayName: t.DisplayName,- State: string(t.State),- Healthy: t.HealthCheckOK,- HealthStatus: workspaceHealthStatus(t.HealthCheckOK, t.LastHealthCheck),- SetupStatus: workspaceSetupStatus(t.State, t.HealthCheckOK, t.LastHealthCheck, facts),- AgentCount: facts.AgentCount,- LastAgentSeenAt: facts.LastAgentSeenAt,- AlertRouteCount: facts.AlertRouteCount,- ReportScheduleCount: facts.ReportScheduleCount,- LastHealthCheck: t.LastHealthCheck,- CreatedAt: t.CreatedAt,+ ID: t.ID,+ DisplayName: t.DisplayName,+ State: string(t.State),+ Healthy: t.HealthCheckOK,+ HealthStatus: workspaceHealthStatus(t.HealthCheckOK, t.LastHealthCheck),+ SetupStatus: workspaceSetupStatus(t.State, t.HealthCheckOK, t.LastHealthCheck, facts),+ AgentCount: facts.AgentCount,+ AgentTokenCount: facts.AgentTokenCount,+ UnusedAgentTokenCount: facts.UnusedAgentTokenCount,+ LastAgentSeenAt: facts.LastAgentSeenAt,+ AlertRouteCount: facts.AlertRouteCount,+ DisabledAlertRouteCount: facts.DisabledAlertRouteCount,+ ReportScheduleCount: facts.ReportScheduleCount,+ DisabledReportScheduleCount: facts.DisabledReportScheduleCount,+ LastHealthCheck: t.LastHealthCheck,+ CreatedAt: t.CreatedAt,}}diff --git a/internal/cloudcp/portal/setup_facts.go b/internal/cloudcp/portal/setup_facts.goindex 79b1528743..04297eda1b 100644--- a/internal/cloudcp/portal/setup_facts.go+++ b/internal/cloudcp/portal/setup_facts.go@@ -15,10 +15,14 @@ import ()type WorkspaceSetupFacts struct {- AgentCount *int- LastAgentSeenAt *time.Time- AlertRouteCount *int- ReportScheduleCount *int+ AgentCount *int+ AgentTokenCount *int+ UnusedAgentTokenCount *int+ LastAgentSeenAt *time.Time+ AlertRouteCount *int+ DisabledAlertRouteCount *int+ ReportScheduleCount *int+ DisabledReportScheduleCount *int}type WorkspaceSetupFactReader interface {@@ -55,9 +59,9 @@ func readWorkspaceSetupFacts(orgDir string) WorkspaceSetupFacts {return facts}- facts.AgentCount, facts.LastAgentSeenAt = readAgentSetupFacts(orgDir)- facts.AlertRouteCount = intPtr(readAlertRouteCount(orgDir))- facts.ReportScheduleCount = intPtr(readReportScheduleCount(orgDir))+ facts.AgentCount, facts.AgentTokenCount, facts.UnusedAgentTokenCount, facts.LastAgentSeenAt = readAgentSetupFacts(orgDir)+ facts.AlertRouteCount, facts.DisabledAlertRouteCount = readAlertRouteFacts(orgDir)+ facts.ReportScheduleCount, facts.DisabledReportScheduleCount = readReportScheduleFacts(orgDir)return facts}@@ -65,21 +69,28 @@ func intPtr(value int) *int {return &value}-func readAgentSetupFacts(orgDir string) (*int, *time.Time) {+func readAgentSetupFacts(orgDir string) (*int, *int, *int, *time.Time) {var tokens []config.APITokenRecordok, err := readMaybeEncryptedJSON(orgDir, "api_tokens.json", &tokens)if err != nil {log.Warn().Err(err).Str("org_dir", orgDir).Msg("cloudcp.portal.setup_facts: read api tokens")- return nil, nil+ return nil, nil, nil, nil}if !ok {- return intPtr(0), nil+ return intPtr(0), intPtr(0), intPtr(0), nil}count := 0+ tokenCount := 0+ unusedCount := 0var lastSeen *time.Timefor i := range tokens {- if tokens[i].IsExpired() || !tokens[i].HasScope(config.ScopeAgentReport) || tokens[i].LastUsedAt == nil {+ if tokens[i].IsExpired() || !tokens[i].HasScope(config.ScopeAgentReport) {+ continue+ }+ tokenCount+++ if tokens[i].LastUsedAt == nil {+ unusedCount++continue}count++@@ -88,31 +99,34 @@ func readAgentSetupFacts(orgDir string) (*int, *time.Time) {lastSeen = &seenAt}}- return intPtr(count), lastSeen+ return intPtr(count), intPtr(tokenCount), intPtr(unusedCount), lastSeen}-func readAlertRouteCount(orgDir string) int {- count := 0+func readAlertRouteFacts(orgDir string) (*int, *int) {+ enabledCount := 0+ disabledCount := 0var email notifications.EmailConfigif ok, err := readMaybeEncryptedJSON(orgDir, "email.enc", &email); err != nil {log.Warn().Err(err).Str("org_dir", orgDir).Msg("cloudcp.portal.setup_facts: read email config")- } else if ok && email.Enabled {- for _, recipient := range email.To {- if strings.TrimSpace(recipient) != "" {- count++- }+ } else if ok {+ emailRecipients := nonBlankCount(email.To)+ if email.Enabled {+ enabledCount += emailRecipients+ } else {+ disabledCount += emailRecipients}}var apprise notifications.AppriseConfigif ok, err := readMaybeEncryptedJSON(orgDir, "apprise.enc", &apprise); err != nil {log.Warn().Err(err).Str("org_dir", orgDir).Msg("cloudcp.portal.setup_facts: read apprise config")- } else if ok && apprise.Enabled {- for _, target := range apprise.Targets {- if strings.TrimSpace(target) != "" {- count++- }+ } else if ok {+ appriseTargets := nonBlankCount(apprise.Targets)+ if apprise.Enabled {+ enabledCount += appriseTargets+ } else {+ disabledCount += appriseTargets}}@@ -123,15 +137,30 @@ func readAlertRouteCount(orgDir string) int {_, _ = readMaybeEncryptedJSON(orgDir, "webhooks.json", &webhooks)}for _, webhook := range webhooks {- if webhook.Enabled && strings.TrimSpace(webhook.URL) != "" {- count+++ if strings.TrimSpace(webhook.URL) == "" {+ continue+ }+ if webhook.Enabled {+ enabledCount+++ } else {+ disabledCount++}}+ return intPtr(enabledCount), intPtr(disabledCount)+}++func nonBlankCount(values []string) int {+ count := 0+ for _, value := range values {+ if strings.TrimSpace(value) != "" {+ count+++ }+ }return count}-func readReportScheduleCount(orgDir string) int {+func readReportScheduleFacts(orgDir string) (*int, *int) {for _, leaf := range []string{"report_schedules.json", filepath.Join("reports", "schedules.json")} {var raw json.RawMessageok, err := readMaybeEncryptedJSON(orgDir, leaf, &raw)@@ -140,16 +169,17 @@ func readReportScheduleCount(orgDir string) int {continue}if ok {- return countReportSchedules(raw)+ enabled, disabled := countReportSchedules(raw)+ return intPtr(enabled), intPtr(disabled)}}- return 0+ return intPtr(0), intPtr(0)}-func countReportSchedules(raw json.RawMessage) int {+func countReportSchedules(raw json.RawMessage) (int, int) {trimmed := strings.TrimSpace(string(raw))if trimmed == "" || trimmed == "null" {- return 0+ return 0, 0}var items []json.RawMessage@@ -159,7 +189,7 @@ func countReportSchedules(raw json.RawMessage) int {var object map[string]json.RawMessageif err := json.Unmarshal(raw, &object); err != nil || len(object) == 0 {- return 0+ return 0, 0}for _, key := range []string{"schedules", "reports", "items"} {@@ -172,19 +202,25 @@ func countReportSchedules(raw json.RawMessage) int {}if isScheduleItemEnabled(raw) {- return 1+ return 1, 0}- return 0+ if isScheduleItemDisabled(raw) {+ return 0, 1+ }+ return 0, 0}-func countEnabledScheduleItems(items []json.RawMessage) int {- count := 0+func countEnabledScheduleItems(items []json.RawMessage) (int, int) {+ enabledCount := 0+ disabledCount := 0for _, item := range items {if isScheduleItemEnabled(item) {- count+++ enabledCount+++ } else if isScheduleItemDisabled(item) {+ disabledCount++}}- return count+ return enabledCount, disabledCount}func isScheduleItemEnabled(raw json.RawMessage) bool {@@ -201,6 +237,20 @@ func isScheduleItemEnabled(raw json.RawMessage) bool {return len(item) > 0}+func isScheduleItemDisabled(raw json.RawMessage) bool {+ var item map[string]any+ if err := json.Unmarshal(raw, &item); err != nil || len(item) == 0 {+ return false+ }+ if enabled, ok := item["enabled"].(bool); ok && !enabled {+ return true+ }+ if disabled, ok := item["disabled"].(bool); ok && disabled {+ return true+ }+ return false+}+func readMaybeEncryptedJSON(configDir string, leaf string, out any) (bool, error) {path, ok := safeConfigLeafPath(configDir, leaf)if !ok {diff --git a/internal/cloudcp/portal/setup_facts_test.go b/internal/cloudcp/portal/setup_facts_test.goindex 33cc7c1054..be6395d2b8 100644--- a/internal/cloudcp/portal/setup_facts_test.go+++ b/internal/cloudcp/portal/setup_facts_test.go@@ -91,15 +91,27 @@ func TestTenantDirWorkspaceSetupFactReaderCountsTenantFacts(t *testing.T) {if facts.AgentCount == nil || *facts.AgentCount != 1 {t.Fatalf("AgentCount = %v, want 1", facts.AgentCount)}+ if facts.AgentTokenCount == nil || *facts.AgentTokenCount != 2 {+ t.Fatalf("AgentTokenCount = %v, want 2", facts.AgentTokenCount)+ }+ if facts.UnusedAgentTokenCount == nil || *facts.UnusedAgentTokenCount != 1 {+ t.Fatalf("UnusedAgentTokenCount = %v, want 1", facts.UnusedAgentTokenCount)+ }if facts.LastAgentSeenAt == nil || !facts.LastAgentSeenAt.Equal(lastUsed) {t.Fatalf("LastAgentSeenAt = %v, want %v", facts.LastAgentSeenAt, lastUsed)}if facts.AlertRouteCount == nil || *facts.AlertRouteCount != 4 {t.Fatalf("AlertRouteCount = %v, want 4", facts.AlertRouteCount)}+ if facts.DisabledAlertRouteCount == nil || *facts.DisabledAlertRouteCount != 1 {+ t.Fatalf("DisabledAlertRouteCount = %v, want 1", facts.DisabledAlertRouteCount)+ }if facts.ReportScheduleCount == nil || *facts.ReportScheduleCount != 1 {t.Fatalf("ReportScheduleCount = %v, want 1", facts.ReportScheduleCount)}+ if facts.DisabledReportScheduleCount == nil || *facts.DisabledReportScheduleCount != 1 {+ t.Fatalf("DisabledReportScheduleCount = %v, want 1", facts.DisabledReportScheduleCount)+ }}func TestTenantDirWorkspaceSetupFactReaderMissingFactsAreZero(t *testing.T) {@@ -113,18 +125,36 @@ func TestTenantDirWorkspaceSetupFactReaderMissingFactsAreZero(t *testing.T) {if facts.AgentCount == nil || *facts.AgentCount != 0 {t.Fatalf("AgentCount = %v, want 0", facts.AgentCount)}+ if facts.AgentTokenCount == nil || *facts.AgentTokenCount != 0 {+ t.Fatalf("AgentTokenCount = %v, want 0", facts.AgentTokenCount)+ }+ if facts.UnusedAgentTokenCount == nil || *facts.UnusedAgentTokenCount != 0 {+ t.Fatalf("UnusedAgentTokenCount = %v, want 0", facts.UnusedAgentTokenCount)+ }if facts.AlertRouteCount == nil || *facts.AlertRouteCount != 0 {t.Fatalf("AlertRouteCount = %v, want 0", facts.AlertRouteCount)}+ if facts.DisabledAlertRouteCount == nil || *facts.DisabledAlertRouteCount != 0 {+ t.Fatalf("DisabledAlertRouteCount = %v, want 0", facts.DisabledAlertRouteCount)+ }if facts.ReportScheduleCount == nil || *facts.ReportScheduleCount != 0 {t.Fatalf("ReportScheduleCount = %v, want 0", facts.ReportScheduleCount)}+ if facts.DisabledReportScheduleCount == nil || *facts.DisabledReportScheduleCount != 0 {+ t.Fatalf("DisabledReportScheduleCount = %v, want 0", facts.DisabledReportScheduleCount)+ }}func TestTenantDirWorkspaceSetupFactReaderRejectsUnsafeTenantID(t *testing.T) {tenantsDir := t.TempDir()facts := NewTenantDirWorkspaceSetupFactReader(tenantsDir).FactsForWorkspace("../ws")- if facts.AgentCount != nil || facts.AlertRouteCount != nil || facts.ReportScheduleCount != nil {+ if facts.AgentCount != nil ||+ facts.AgentTokenCount != nil ||+ facts.UnusedAgentTokenCount != nil ||+ facts.AlertRouteCount != nil ||+ facts.DisabledAlertRouteCount != nil ||+ facts.ReportScheduleCount != nil ||+ facts.DisabledReportScheduleCount != nil {t.Fatalf("unsafe tenant facts = %+v, want empty facts", facts)}}diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.pyindex c94b31f3c9..f12ee61339 100644--- a/scripts/release_control/subsystem_lookup_test.py+++ b/scripts/release_control/subsystem_lookup_test.py@@ -2860,7 +2860,7 @@ class SubsystemLookupTest(unittest.TestCase):{"heading": "## Shared Boundaries","path": "internal/api/access_control_handlers.go",- "line": 313,+ "line": 318,"heading_line": 112,}],