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
Make MSP workspace onboarding actionable
rcourtman00f6ee9daa48
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 8bb6c37776..3ca0900b0a 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -424,6 +424,13 @@ profile and assignment columns, but embedded table framing must route throughlifecycle surfaces may display contact email when supplied by the sharedauth boundary, but they must not reinterpret SSO or Stripe email as thecanonical user identifier for setup, install, or fleet-management actions.+ Hosted Pulse Account may deep-link an MSP operator into a tenant workspace's+ agent-install surface through a signed local handoff target such as+ `/settings/infrastructure?add=linux-host`, but install-token generation,+ installer command construction, and first-agent onboarding remain+ agent-lifecycle/API-owned inside the tenant runtime. Control-plane handoff+ code must not mint lifecycle tokens or synthesize install commands for the+ tenant; it may only establish the tenant session and local destination.Availability-target API changes are adjacent but not lifecycle-owned:agentless MQTT, HTTP/S, ping, and TCP targets may appear in shared`internal/api/` handlers and resource projections, but their settings ownerdiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 74a810663f..a39f2174dc 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -161,6 +161,17 @@ files, owner, and comment. Recovery history may index those artifacts, but itmust not be the only API path for PBS protection or verification state when aplatform page needs source-native backup columns.+Hosted workspace handoff exchange is a canonical API/session payload boundary.+`/api/cloud/handoff/exchange` may redirect to a tenant-local target path only+when that path is carried in the signed control-plane JWT as `target_path`.+The exchange must ignore unsigned request-form or query redirect targets,+sanitize the signed target as a same-origin local path, fall back to `/` when+the claim is absent or unsafe, and include `target_path` in JSON responses only+after the same sanitization. This lets Pulse Account deep-link an MSP operator+to tenant-owned destinations such as agent installation or reporting without+turning the tenant exchange into an open redirect or moving API ownership for+agent tokens, alerts, or reports into the control plane.+1. `frontend-modern/src/api/agentProfiles.ts` shared with `agent-lifecycle`: the agent profiles frontend client is both an agent lifecycle control surface and a canonical API payload contract boundary.2. `frontend-modern/src/api/ai.ts` shared with `ai-runtime`: the AI frontend client is both an AI runtime control surface and a canonical API payload contract boundary.3. `frontend-modern/src/api/nodes.ts` shared with `agent-lifecycle`: the shared Proxmox node client is both an agent lifecycle setup/install control surface and a canonical API payload contract boundary.diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex 4db4ecf2a4..c1e07bf77d 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -314,6 +314,17 @@ or other self-hosted uncapped continuity plans.`Summary` destination. The top of `Workspaces` may surface one quiet inlinefacts line plus one next-action row before the list, but it must not turnthat summary into a second overview deck, metric grid, or competing shell.+ Pulse Account workspace handoff is the provider control-plane path into a+ client workspace, not a parallel monitoring surface. Workspace rows and+ selected-workspace panels may offer task handoffs such as `Open workspace`,+ `Install agents`, and reporting, but those actions must stay POST handoffs+ through the account tenant route. Any task target must be sanitized and+ signed into the control-plane handoff token as a tenant-local path, then+ sanitized again by the tenant exchange before redirect. Agent install+ commands, alerts, and performance reports remain owned by the target tenant+ runtime; Pulse Account may deep-link to those tenant surfaces but must not+ mint workspace agent credentials or render cross-client monitoring state in+ the account portal.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/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 6b6dc89765..1aaca2eb33 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -238,6 +238,13 @@ recovery scope, or a storage/recovery-owned secret source.those notes. Recovery-adjacent diagnostics consumers must preserve thesource-specific Docker / Podman wording and recovery destinations governedby the shared diagnostics API contract.+ Hosted Pulse Account may deep-link a client workspace handoff to reporting+ surfaces such as `/settings/support/reporting`, but that target is a signed+ tenant-local navigation hint only. Storage/recovery must not treat control-+ plane handoff target paths as recovery-point selectors, restore scope,+ backup freshness evidence, report-generation authority, or a storage-owned+ redirect channel; report and backup API payloads remain owned by their+ tenant runtime routes.When shared `internal/api/` handlers expose structured Patrol readiness orprovider/model/tool causes, storage and recovery surfaces may treat them onlyas adjacent operator context and must not convert them into storage health,diff --git a/internal/api/cloud_handoff_handlers.go b/internal/api/cloud_handoff_handlers.goindex 649f614b60..9026b20f02 100644--- a/internal/api/cloud_handoff_handlers.go+++ b/internal/api/cloud_handoff_handlers.go@@ -30,9 +30,10 @@ const (var errHandoffAuthorizationDenied = errors.New("handoff authorization denied")type cloudHandoffClaims struct {- AccountID string `json:"account_id"`- Email string `json:"email"`- Role string `json:"role"`+ AccountID string `json:"account_id"`+ Email string `json:"email"`+ Role string `json:"role"`+ TargetPath string `json:"target_path,omitempty"`jwt.RegisteredClaims}@@ -436,14 +437,36 @@ func HandleHandoffExchange(configDir string) http.HandlerFunc {"jti": claims.ID,"exp": claims.ExpiresAt.Time.UTC().Format(time.RFC3339),}+ if targetPath := sanitizeCloudHandoffTargetPath(claims.TargetPath); targetPath != "" {+ resp["target_path"] = targetPath+ }w.Header().Set("Content-Type", "application/json")w.WriteHeader(http.StatusOK)_ = json.NewEncoder(w).Encode(resp)return}- http.Redirect(w, r, "/", http.StatusTemporaryRedirect)+ targetPath := sanitizeCloudHandoffTargetPath(claims.TargetPath)+ if targetPath == "" {+ targetPath = "/"+ }+ http.Redirect(w, r, targetPath, http.StatusTemporaryRedirect)+ }+}++func sanitizeCloudHandoffTargetPath(raw string) string {+ raw = strings.TrimSpace(raw)+ if raw == "" || !strings.HasPrefix(raw, "/") || strings.HasPrefix(raw, "//") {+ return ""+ }+ if strings.IndexFunc(raw, func(r rune) bool { return r < 0x20 || r == 0x7f }) >= 0 {+ return ""+ }+ parsed, err := url.Parse(raw)+ if err != nil || parsed.IsAbs() || parsed.Host != "" || parsed.Path == "" || !strings.HasPrefix(parsed.Path, "/") {+ return ""}+ return parsed.String()}func authorizeHandoffOrganizationMembership(configDir, tenantID, userID, email, role string) (*handoffAuthorization, error) {diff --git a/internal/api/cloud_handoff_handlers_test.go b/internal/api/cloud_handoff_handlers_test.goindex 7a6b646338..c0a42dc6f1 100644--- a/internal/api/cloud_handoff_handlers_test.go+++ b/internal/api/cloud_handoff_handlers_test.go@@ -544,6 +544,122 @@ func TestHandleHandoffExchangeBrowserFlowSetsSessionCookies(t *testing.T) {}}+func TestHandleHandoffExchangeRedirectsToSignedLocalTargetPath(t *testing.T) {+ key := []byte("test-handoff-key")+ configDir := t.TempDir()+ resetSessionStoreForTests()+ t.Cleanup(resetSessionStoreForTests)+ resetCSRFStoreForTests()+ t.Cleanup(resetCSRFStoreForTests)+ InitSessionStore(configDir)+ InitCSRFStore(configDir)+ secretsDir := filepath.Join(configDir, "secrets")+ if err := os.MkdirAll(secretsDir, 0o755); err != nil {+ t.Fatalf("MkdirAll() error = %v", err)+ }+ if err := os.WriteFile(filepath.Join(secretsDir, "handoff.key"), key, 0o600); err != nil {+ t.Fatalf("WriteFile() error = %v", err)+ }++ handler := HandleHandoffExchange(configDir)+ tenantID := "tenant-target"+ saveHandoffTestOrganization(t, configDir, &models.Organization{+ ID: tenantID,+ DisplayName: "Tenant Target",+ Status: models.OrgStatusActive,+ CreatedAt: time.Now().UTC(),+ OwnerUserID: "[email protected]",+ })+ token := signHandoffToken(t, key, cloudHandoffClaims{+ AccountID: "acct-target",+ Email: "[email protected]",+ Role: "owner",+ TargetPath: "/settings/infrastructure?add=linux-host",+ RegisteredClaims: jwt.RegisteredClaims{+ ID: "jti-target",+ Subject: "user-target",+ Issuer: cloudHandoffIssuer,+ Audience: jwt.ClaimStrings{tenantID},+ ExpiresAt: jwt.NewNumericDate(time.Now().Add(time.Hour)),+ },+ })++ form := url.Values{}+ form.Set("token", token)+ req := httptest.NewRequest(http.MethodPost, "/api/cloud/handoff/exchange", strings.NewReader(form.Encode()))+ req.Header.Set("Content-Type", "application/x-www-form-urlencoded")+ req.Host = tenantID + ".example.com"+ req.RemoteAddr = "127.0.0.1:12345"++ rec := httptest.NewRecorder()+ handler.ServeHTTP(rec, req)++ if rec.Code != http.StatusTemporaryRedirect {+ t.Fatalf("status = %d, want %d", rec.Code, http.StatusTemporaryRedirect)+ }+ if loc := rec.Header().Get("Location"); loc != "/settings/infrastructure?add=linux-host" {+ t.Fatalf("redirect location = %q, want %q", loc, "/settings/infrastructure?add=linux-host")+ }+}++func TestHandleHandoffExchangeDropsUnsafeSignedTargetPath(t *testing.T) {+ key := []byte("test-handoff-key")+ configDir := t.TempDir()+ resetSessionStoreForTests()+ t.Cleanup(resetSessionStoreForTests)+ resetCSRFStoreForTests()+ t.Cleanup(resetCSRFStoreForTests)+ InitSessionStore(configDir)+ InitCSRFStore(configDir)+ secretsDir := filepath.Join(configDir, "secrets")+ if err := os.MkdirAll(secretsDir, 0o755); err != nil {+ t.Fatalf("MkdirAll() error = %v", err)+ }+ if err := os.WriteFile(filepath.Join(secretsDir, "handoff.key"), key, 0o600); err != nil {+ t.Fatalf("WriteFile() error = %v", err)+ }++ handler := HandleHandoffExchange(configDir)+ tenantID := "tenant-unsafe-target"+ saveHandoffTestOrganization(t, configDir, &models.Organization{+ ID: tenantID,+ DisplayName: "Tenant Unsafe Target",+ Status: models.OrgStatusActive,+ CreatedAt: time.Now().UTC(),+ OwnerUserID: "[email protected]",+ })+ token := signHandoffToken(t, key, cloudHandoffClaims{+ AccountID: "acct-unsafe-target",+ Email: "[email protected]",+ Role: "owner",+ TargetPath: "https://evil.example.com/pwn",+ RegisteredClaims: jwt.RegisteredClaims{+ ID: "jti-unsafe-target",+ Subject: "user-unsafe-target",+ Issuer: cloudHandoffIssuer,+ Audience: jwt.ClaimStrings{tenantID},+ ExpiresAt: jwt.NewNumericDate(time.Now().Add(time.Hour)),+ },+ })++ form := url.Values{}+ form.Set("token", token)+ req := httptest.NewRequest(http.MethodPost, "/api/cloud/handoff/exchange", strings.NewReader(form.Encode()))+ req.Header.Set("Content-Type", "application/x-www-form-urlencoded")+ req.Host = tenantID + ".example.com"+ req.RemoteAddr = "127.0.0.1:12345"++ rec := httptest.NewRecorder()+ handler.ServeHTTP(rec, req)++ if rec.Code != http.StatusTemporaryRedirect {+ t.Fatalf("status = %d, want %d", rec.Code, http.StatusTemporaryRedirect)+ }+ if loc := rec.Header().Get("Location"); loc != "/" {+ t.Fatalf("redirect location = %q, want %q", loc, "/")+ }+}+func TestHandleHandoffExchangeRejectsMissingTenantOrganizationMembership(t *testing.T) {key := []byte("test-handoff-key")configDir := t.TempDir()diff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 5fa54ad8b5..ce1383b9c0 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -7827,6 +7827,37 @@ func TestContract_TenantAIServiceAvoidsSnapshotProviderBridge(t *testing.T) {}}+func TestContract_HandoffExchangeTargetPathIsSignedAndLocalOnly(t *testing.T) {+ source, err := os.ReadFile(filepath.Clean("cloud_handoff_handlers.go"))+ if err != nil {+ t.Fatalf("read cloud_handoff_handlers.go: %v", err)+ }+ text := string(source)++ for _, required := range []string{+ "TargetPath string `json:\"target_path,omitempty\"`",+ "sanitizeCloudHandoffTargetPath(claims.TargetPath)",+ "http.Redirect(w, r, targetPath, http.StatusTemporaryRedirect)",+ "strings.HasPrefix(raw, \"//\")",+ "parsed.IsAbs() || parsed.Host != \"\"",+ } {+ if !strings.Contains(text, required) {+ t.Fatalf("cloud handoff exchange must preserve signed local target-path contract: missing %q", required)+ }+ }++ for _, forbidden := range []string{+ "r.FormValue(\"target_path\")",+ "r.URL.Query().Get(\"target_path\")",+ "r.FormValue(\"return_to\")",+ "r.URL.Query().Get(\"return_to\")",+ } {+ if strings.Contains(text, forbidden) {+ t.Fatalf("cloud handoff exchange must not accept unsigned redirect targets: found %q", forbidden)+ }+ }+}+func TestContract_HostedCloudHandoffUsesExistingTenantOrganizationMembership(t *testing.T) {key := []byte("test-handoff-key")configDir := t.TempDir()diff --git a/internal/cloudcp/handoff/handler.go b/internal/cloudcp/handoff/handler.goindex 863094aea4..1161ce9412 100644--- a/internal/cloudcp/handoff/handler.go+++ b/internal/cloudcp/handoff/handler.go@@ -156,14 +156,19 @@ func HandleHandoff(reg *registry.TenantRegistry, tenantsDir string) http.Handler}now := time.Now().UTC()+ targetPath := sanitizeTargetPath(r.URL.Query().Get("target_path"))+ if targetPath == "" {+ targetPath = sanitizeTargetPath(r.URL.Query().Get("return_to"))+ }token, err := MintHandoffToken(secret, HandoffClaims{- TenantID: tenantID,- UserID: userID,- AccountID: accountID,- Email: u.Email,- Role: m.Role,- IssuedAt: now,- ExpiresAt: now.Add(defaultTTL),+ TenantID: tenantID,+ UserID: userID,+ AccountID: accountID,+ Email: u.Email,+ Role: m.Role,+ TargetPath: targetPath,+ IssuedAt: now,+ ExpiresAt: now.Add(defaultTTL),})if err != nil {http.Error(w, "internal error", http.StatusInternalServerError)diff --git a/internal/cloudcp/handoff/handler_test.go b/internal/cloudcp/handoff/handler_test.goindex 4ca6e75fca..12cc2e74b2 100644--- a/internal/cloudcp/handoff/handler_test.go+++ b/internal/cloudcp/handoff/handler_test.go@@ -59,7 +59,7 @@ func TestHandoffHandler(t *testing.T) {h := HandleHandoff(reg, tenantsDir)mux.Handle("/api/accounts/{account_id}/tenants/{tenant_id}/handoff", admin.AdminKeyMiddleware("secret-key", h))- req := httptest.NewRequest(http.MethodPost, "/api/accounts/"+accountID+"/tenants/"+tenantID+"/handoff", nil)+ req := httptest.NewRequest(http.MethodPost, "/api/accounts/"+accountID+"/tenants/"+tenantID+"/handoff?target_path=%2Fsettings%2Finfrastructure%3Fadd%3Dlinux-host", nil)req.Host = "cloud.example.com"req.Header.Set("X-Admin-Key", "secret-key")req.Header.Set("X-User-ID", userID)@@ -110,6 +110,9 @@ func TestHandoffHandler(t *testing.T) {if got.Role != registry.MemberRoleTech {t.Fatalf("role = %q, want %q", got.Role, registry.MemberRoleTech)}+ if got.TargetPath != "/settings/infrastructure?add=linux-host" {+ t.Fatalf("target_path = %q, want %q", got.TargetPath, "/settings/infrastructure?add=linux-host")+ }if got.ExpiresAt == nil || time.Until(got.ExpiresAt.Time) > 60*time.Second+2*time.Second {t.Fatalf("exp looks wrong: %v", got.ExpiresAt)}diff --git a/internal/cloudcp/handoff/handoff.go b/internal/cloudcp/handoff/handoff.goindex ad33cc3101..da9185e6c9 100644--- a/internal/cloudcp/handoff/handoff.go+++ b/internal/cloudcp/handoff/handoff.go@@ -5,6 +5,7 @@ import ("encoding/hex""fmt""io"+ "net/url""strings""time"@@ -20,11 +21,12 @@ const (// HandoffClaims are the logical claims that the control plane wants to assert// when handing off an authenticated account user into a tenant container.type HandoffClaims struct {- TenantID string- UserID string- AccountID string- Email string- Role registry.MemberRole+ TenantID string+ UserID string+ AccountID string+ Email string+ Role registry.MemberRole+ TargetPath stringIssuedAt time.TimeExpiresAt time.Time@@ -32,9 +34,10 @@ type HandoffClaims struct {}type jwtHandoffClaims struct {- AccountID string `json:"account_id"`- Email string `json:"email"`- Role registry.MemberRole `json:"role"`+ AccountID string `json:"account_id"`+ Email string `json:"email"`+ Role registry.MemberRole `json:"role"`+ TargetPath string `json:"target_path,omitempty"`jwt.RegisteredClaims}@@ -55,6 +58,7 @@ func MintHandoffToken(secret []byte, claims HandoffClaims) (string, error) {claims.TenantID = sanitizeID(claims.TenantID)claims.UserID = sanitizeID(claims.UserID)claims.AccountID = sanitizeID(claims.AccountID)+ claims.TargetPath = sanitizeTargetPath(claims.TargetPath)if claims.TenantID == "" || claims.UserID == "" || claims.AccountID == "" {return "", fmt.Errorf("tenantID, userID, and accountID are required")}@@ -85,9 +89,10 @@ func MintHandoffToken(secret []byte, claims HandoffClaims) (string, error) {}jc := jwtHandoffClaims{- AccountID: claims.AccountID,- Email: claims.Email,- Role: claims.Role,+ AccountID: claims.AccountID,+ Email: claims.Email,+ Role: claims.Role,+ TargetPath: claims.TargetPath,RegisteredClaims: jwt.RegisteredClaims{Issuer: issuer,Subject: claims.UserID,@@ -118,3 +123,18 @@ func sanitizeID(s string) string {// IDs are generated by the registry; trimming prevents surprising mismatches.return strings.TrimSpace(s)}++func sanitizeTargetPath(raw string) string {+ raw = strings.TrimSpace(raw)+ if raw == "" || !strings.HasPrefix(raw, "/") || strings.HasPrefix(raw, "//") {+ return ""+ }+ if strings.IndexFunc(raw, func(r rune) bool { return r < 0x20 || r == 0x7f }) >= 0 {+ return ""+ }+ parsed, err := url.Parse(raw)+ if err != nil || parsed.IsAbs() || parsed.Host != "" || parsed.Path == "" || !strings.HasPrefix(parsed.Path, "/") {+ return ""+ }+ return parsed.String()+}diff --git a/internal/cloudcp/handoff/handoff_test.go b/internal/cloudcp/handoff/handoff_test.goindex 42e692487d..911e3e703e 100644--- a/internal/cloudcp/handoff/handoff_test.go+++ b/internal/cloudcp/handoff/handoff_test.go@@ -14,13 +14,14 @@ func TestMintAndVerify(t *testing.T) {now := time.Now().UTC()tokenStr, err := MintHandoffToken(secret, HandoffClaims{- TenantID: "t-TESTTENANT",- UserID: "u_TESTUSER",- AccountID: "a_TESTACCOUNT",- Email: "[email protected]",- Role: registry.MemberRoleTech,- IssuedAt: now,- ExpiresAt: now.Add(60 * time.Second),+ TenantID: "t-TESTTENANT",+ UserID: "u_TESTUSER",+ AccountID: "a_TESTACCOUNT",+ Email: "[email protected]",+ Role: registry.MemberRoleTech,+ TargetPath: "/settings/infrastructure?add=linux-host",+ IssuedAt: now,+ ExpiresAt: now.Add(60 * time.Second),})if err != nil {t.Fatalf("MintHandoffToken: %v", err)@@ -54,6 +55,9 @@ func TestMintAndVerify(t *testing.T) {if got.Role != registry.MemberRoleTech {t.Fatalf("role = %q, want %q", got.Role, registry.MemberRoleTech)}+ if got.TargetPath != "/settings/infrastructure?add=linux-host" {+ t.Fatalf("target_path = %q, want %q", got.TargetPath, "/settings/infrastructure?add=linux-host")+ }if got.ID == "" {t.Fatalf("jti empty")}@@ -65,6 +69,45 @@ func TestMintAndVerify(t *testing.T) {}}+func TestMintHandoffTokenDropsUnsafeTargetPath(t *testing.T) {+ secret := []byte("0123456789abcdef0123456789abcdef")+ now := time.Now().UTC()++ tokenStr, err := MintHandoffToken(secret, HandoffClaims{+ TenantID: "t-TENANT",+ UserID: "u_USER",+ AccountID: "a_ACCOUNT",+ Email: "[email protected]",+ Role: registry.MemberRoleAdmin,+ TargetPath: "https://evil.example.com/pwn",+ IssuedAt: now,+ ExpiresAt: now.Add(60 * time.Second),+ JTI: "0123456789abcdef0123456789abcdef",+ })+ if err != nil {+ t.Fatalf("MintHandoffToken: %v", err)+ }++ var got jwtHandoffClaims+ parsed, err := jwt.ParseWithClaims(+ tokenStr,+ &got,+ func(t *jwt.Token) (any, error) { return secret, nil },+ jwt.WithValidMethods([]string{jwt.SigningMethodHS256.Alg()}),+ jwt.WithIssuer(issuer),+ jwt.WithAudience("t-TENANT"),+ )+ if err != nil {+ t.Fatalf("ParseWithClaims: %v", err)+ }+ if !parsed.Valid {+ t.Fatalf("token valid = false, want true")+ }+ if got.TargetPath != "" {+ t.Fatalf("target_path = %q, want empty", got.TargetPath)+ }+}+func TestExpiredToken(t *testing.T) {secret := []byte("0123456789abcdef0123456789abcdef")past := time.Now().UTC().Add(-2 * time.Minute)diff --git a/internal/cloudcp/portal/dist/build_manifest.json b/internal/cloudcp/portal/dist/build_manifest.jsonindex fc6cde5524..ec7e6e58e1 100644--- a/internal/cloudcp/portal/dist/build_manifest.json+++ b/internal/cloudcp/portal/dist/build_manifest.json@@ -1,5 +1,5 @@{- "source_hash": "ff1828403441d25373e005de762dcfe0486e438e6b360d59fe217cbb22302906",+ "source_hash": "43681a0db38909097b68e0cac9790c9ed1bba5137af508c7a765ec21ec38cbbc","build_inputs": ["package.json","tsconfig.json",diff --git a/internal/cloudcp/portal/dist/portal_app.css b/internal/cloudcp/portal/dist/portal_app.cssindex b0c933be74..f70da9e76e 100644--- a/internal/cloudcp/portal/dist/portal_app.css+++ b/internal/cloudcp/portal/dist/portal_app.css@@ -551,6 +551,38 @@ header .logout-btn:hover,font-size: 13px;color: var(--ink-secondary);}+.workspace-management-next-steps {+ display: flex;+ flex-direction: column;+ gap: 8px;+}+.workspace-next-step {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: center;+ gap: 12px;+ padding: 10px 12px;+ border: 1px solid var(--border-muted);+ border-radius: var(--radius);+ background: var(--bg);+}+.workspace-next-step div {+ display: flex;+ flex-direction: column;+ gap: 2px;+ min-width: 0;+}+.workspace-next-step strong {+ font-size: 13px;+ color: var(--ink);+}+.workspace-next-step span {+ font-size: 12px;+ color: var(--ink-secondary);+}+.workspace-next-step form {+ margin: 0;+}.workspace-management-actions {display: flex;gap: 8px;@@ -1671,6 +1703,12 @@ header .logout-btn:hover,.workspace-management-facts {grid-template-columns: 1fr;}+ .workspace-next-step {+ grid-template-columns: 1fr;+ }+ .workspace-next-step form {+ justify-self: flex-start;+ }}@media (max-width: 480px) {header {diff --git a/internal/cloudcp/portal/dist/portal_app.js b/internal/cloudcp/portal/dist/portal_app.jsindex c5c0ce8c6c..7d76efd2a7 100644--- a/internal/cloudcp/portal/dist/portal_app.js+++ b/internal/cloudcp/portal/dist/portal_app.js@@ -74,10 +74,10 @@var status = workspaceHealthState(workspace);var state = String(workspace.state || "");if (state === "active" && status === "healthy") {- return "This workspace is active. Open it from the workspace list, or suspend it here if you intend to take it out of service.";+ return "This workspace is active. Open it to work inside this client boundary, or install agents to reach the workspace-bound install commands.";}if (state === "active" && status === "checking") {- return "This workspace is active. The latest health check is still pending.";+ return "This workspace is active. The latest health check is still pending, but the workspace can still own agent install commands.";}if (status === "unhealthy") {return "The latest health check is unhealthy. Review the current state before suspending or deleting this workspace.";@@ -125,7 +125,24 @@}return null;}- function renderWorkspaceManagement(account, entry) {+ var WORKSPACE_INSTALL_TARGET_PATH = "/settings/infrastructure?add=linux-host";+ var WORKSPACE_REPORTING_TARGET_PATH = "/settings/support/reporting";+ function workspaceHandoffActionPath(accountAPIBasePath, accountID, workspaceID, targetPath = "") {+ var path = accountAPIBasePath + "/" + encodeURIComponent(accountID) + "/tenants/" + encodeURIComponent(workspaceID) + "/handoff";+ if (!targetPath) return path;+ return path + "?target_path=" + encodeURIComponent(targetPath);+ }+ function setWorkspaceHandoffForm(form, button, accountAPIBasePath, accountID, workspace, targetPath = "", pending = false) {+ if (!form || !button) return;+ var canOpen = workspace.state === "active" && !!accountAPIBasePath;+ if (canOpen) {+ form.action = workspaceHandoffActionPath(accountAPIBasePath, accountID, workspace.id, targetPath);+ } else {+ form.removeAttribute("action");+ }+ button.disabled = pending || !canOpen;+ }+ function renderWorkspaceManagement(account, entry, accountAPIBasePath = "") {var panel = getElement("workspace-management-" + account.id);var shell = getElement("workspace-operations-shell-" + account.id);var detail = getElement("workspace-operations-detail-" + account.id);@@ -141,6 +158,12 @@var guidance = getElement("workspace-management-guidance-" + account.id);var actionButton = getElement("workspace-management-action-" + account.id);var closeButton = getElement("workspace-management-close-" + account.id);+ var openForm = getElement("workspace-management-open-form-" + account.id);+ var openButton = getElement("workspace-management-open-" + account.id);+ var installForm = getElement("workspace-management-install-form-" + account.id);+ var installButton = getElement("workspace-management-install-" + account.id);+ var reportingForm = getElement("workspace-management-reporting-form-" + account.id);+ var reportingButton = getElement("workspace-management-reporting-" + account.id);if (!empty || !content || !title || !meta || !summary || !health || !lifecycle || !created || !guidance || !actionButton || !closeButton) return;var workspace = entry.selectedWorkspaceID ? findWorkspace(account, entry.selectedWorkspaceID) : null;var hasSelection = !!workspace;@@ -170,6 +193,12 @@actionButton.removeAttribute("data-workspace-id");actionButton.removeAttribute("data-workspace-name");actionButton.removeAttribute("data-workspace-action");+ openForm?.removeAttribute("action");+ installForm?.removeAttribute("action");+ reportingForm?.removeAttribute("action");+ if (openButton) openButton.disabled = true;+ if (installButton) installButton.disabled = true;+ if (reportingButton) reportingButton.disabled = true;return;}title.textContent = workspace.display_name;@@ -185,6 +214,9 @@actionButton.setAttribute("data-workspace-name", workspace.display_name);actionButton.setAttribute("data-workspace-action", workspace.state === "active" ? "suspend" : "delete");closeButton.disabled = entry.manageWorkspace.pending;+ setWorkspaceHandoffForm(openForm, openButton, accountAPIBasePath, account.id, workspace, "", entry.manageWorkspace.pending);+ setWorkspaceHandoffForm(installForm, installButton, accountAPIBasePath, account.id, workspace, WORKSPACE_INSTALL_TARGET_PATH, entry.manageWorkspace.pending);+ setWorkspaceHandoffForm(reportingForm, reportingButton, accountAPIBasePath, account.id, workspace, WORKSPACE_REPORTING_TARGET_PATH, entry.manageWorkspace.pending);}function setContainerMessage(container, title, msg, isError) {container.textContent = "";@@ -450,7 +482,7 @@roster.appendChild(renderAccessMemberRow(accountID, member, isOwner, canManage, activeJob));}}- function renderAccountUI(accountState, accounts) {+ function renderAccountUI(accountState, accounts, accountAPIBasePath = "") {var accountIDs = Object.keys(accountState.byAccountID);for (var i = 0; i < accountIDs.length; i += 1) {var accountID = accountIDs[i];@@ -463,7 +495,7 @@}}renderAddWorkspaceSection(accountID, entry);- if (account) renderWorkspaceManagement(account, entry);+ if (account) renderWorkspaceManagement(account, entry, accountAPIBasePath);renderAccessSection(accountID, entry);}}@@ -977,7 +1009,8 @@return true;};var renderAccountRuntime = function() {- renderAccountUI(deps.store.getAccountState(), deps.store.getBootstrap().accounts || []);+ var bootstrap = deps.store.getBootstrap();+ renderAccountUI(deps.store.getAccountState(), bootstrap.accounts || [], bootstrap.account_api_base_path || "");};var loadAccessRoster = async function(accountID) {var section = getElement("access-section-" + accountID);@@ -2418,6 +2451,12 @@function workspaceRowAnchorID(accountID, workspaceID) {return "workspace-row-" + accountID + "-" + workspaceID;}+ var WORKSPACE_INSTALL_TARGET_PATH2 = "/settings/infrastructure?add=linux-host";+ function workspaceHandoffActionPath2(accountAPIBasePath, accountID, workspaceID, targetPath = "") {+ var path = accountAPIBasePath + "/" + encodeURIComponent(accountID) + "/tenants/" + encodeURIComponent(workspaceID) + "/handoff";+ if (!targetPath) return path;+ return path + "?target_path=" + encodeURIComponent(targetPath);+ }function renderWorkspaceCard(account, workspace, accountAPIBasePath) {var status = workspaceHealthState(workspace);var state = String(workspace.state || "");@@ -2431,19 +2470,29 @@}var openAction = "";if (state === "active") {- openAction = '<form method="POST" action="' + escapeAttr(accountAPIBasePath + "/" + account.id + "/tenants/" + workspace.id + "/handoff") + '"><button type="submit" class="btn-primary">Open workspace</button></form>';+ openAction = '<form method="POST" action="' + escapeAttr(workspaceHandoffActionPath2(accountAPIBasePath, account.id, workspace.id)) + '"><button type="submit" class="btn-primary">Open workspace</button></form>';+ }+ var installAction = "";+ if (state === "active") {+ installAction = '<form method="POST" action="' + escapeAttr(workspaceHandoffActionPath2(accountAPIBasePath, account.id, workspace.id, WORKSPACE_INSTALL_TARGET_PATH2)) + '"><button type="submit" class="btn-secondary">Install agents</button></form>';}var manageAction = "";if (account.can_manage && (state === "active" || state === "suspended" || state === "failed")) {manageAction = '<button type="button" class="btn-secondary btn-workspace-manage" data-action="select-workspace" data-account-id="' + escapeAttr(account.id) + '" data-workspace-id="' + escapeAttr(workspace.id) + '">Lifecycle</button>';}- return '<article class="workspace-row workspace-row-health-' + escapeAttr(status) + " workspace-row-state-" + escapeAttr(state || "unknown") + '" id="' + escapeAttr(workspaceRowAnchorID(account.id, workspace.id)) + '" data-workspace-row="' + escapeAttr(workspace.id) + '"><div class="workspace-row-primary"><div class="workspace-row-heading"><h4 class="workspace-name">' + escapeHTML(workspace.display_name) + '</h4><div class="workspace-meta">' + metaParts.join("") + '</div></div><div class="workspace-row-note">' + escapeHTML(workspaceRowNote(workspace)) + '</div></div><div class="workspace-row-status-cell workspace-row-status-cell-badge">' + healthBadgeHTML(workspace) + '</div><div class="workspace-row-status-cell workspace-row-status-cell-badge"><span class="badge badge-' + escapeHTML(state || "unknown") + '">' + escapeHTML(titleCase(state || "Unknown")) + '</span></div><div class="workspace-actions">' + openAction + manageAction + "</div></article>";+ return '<article class="workspace-row workspace-row-health-' + escapeAttr(status) + " workspace-row-state-" + escapeAttr(state || "unknown") + '" id="' + escapeAttr(workspaceRowAnchorID(account.id, workspace.id)) + '" data-workspace-row="' + escapeAttr(workspace.id) + '"><div class="workspace-row-primary"><div class="workspace-row-heading"><h4 class="workspace-name">' + escapeHTML(workspace.display_name) + '</h4><div class="workspace-meta">' + metaParts.join("") + '</div></div><div class="workspace-row-note">' + escapeHTML(workspaceRowNote(workspace)) + '</div></div><div class="workspace-row-status-cell workspace-row-status-cell-badge">' + healthBadgeHTML(workspace) + '</div><div class="workspace-row-status-cell workspace-row-status-cell-badge"><span class="badge badge-' + escapeHTML(state || "unknown") + '">' + escapeHTML(titleCase(state || "Unknown")) + '</span></div><div class="workspace-actions">' + openAction + installAction + manageAction + "</div></article>";}function renderWorkspaceHandoffForm(accountID, workspaceID, accountAPIBasePath, label, buttonClassName = "btn-secondary btn-compact") {if (!accountAPIBasePath) {return '<button class="' + escapeAttr(buttonClassName) + '" type="button" data-shell-action="activate-section" data-shell-section="workspaces">' + escapeHTML(label) + "</button>";}- return '<form method="POST" action="' + escapeAttr(accountAPIBasePath + "/" + accountID + "/tenants/" + workspaceID + "/handoff") + '"><button type="submit" class="' + escapeAttr(buttonClassName) + '">' + escapeHTML(label) + "</button></form>";+ return '<form method="POST" action="' + escapeAttr(workspaceHandoffActionPath2(accountAPIBasePath, accountID, workspaceID)) + '"><button type="submit" class="' + escapeAttr(buttonClassName) + '">' + escapeHTML(label) + "</button></form>";+ }+ function renderWorkspaceInstallHandoffForm(accountID, workspaceID, accountAPIBasePath, label = "Install agents", buttonClassName = "btn-secondary btn-compact") {+ if (!accountAPIBasePath) {+ return '<button class="' + escapeAttr(buttonClassName) + '" type="button" data-shell-action="activate-section" data-shell-section="workspaces">' + escapeHTML(label) + "</button>";+ }+ return '<form method="POST" action="' + escapeAttr(workspaceHandoffActionPath2(accountAPIBasePath, accountID, workspaceID, WORKSPACE_INSTALL_TARGET_PATH2)) + '"><button type="submit" class="' + escapeAttr(buttonClassName) + '">' + escapeHTML(label) + "</button></form>";}function attentionWorkspaceEntries(entries) {var results = [];@@ -2527,7 +2576,7 @@"Open workspace","btn-primary btn-compact");- secondaryAction = ready.length > 1 ? renderWorkspaceAnchorAction(workspaceListAnchorID(readyEntry.account.id), "See all workspaces") : "";+ secondaryAction = ready.length > 1 ? renderWorkspaceAnchorAction(workspaceListAnchorID(readyEntry.account.id), "See all workspaces") : renderWorkspaceInstallHandoffForm(readyEntry.account.id, readyEntry.workspace.id, accountAPIBasePath);} else if (creatableAccount) {title = "Create the first workspace";description = "No hosted workspace is attached yet. Create the first workspace in " + creatableAccount.name + ".";@@ -2616,7 +2665,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 lifecycle</h3><p>Manage this workspace or create a new one.</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>Lifecycle</span><strong id="workspace-management-lifecycle-' + 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-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 lifecycle</h3><p>Manage this workspace or create a new one.</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>Lifecycle</span><strong id="workspace-management-lifecycle-' + 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-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><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>Health</span><span>Lifecycle</span><span>Actions</span></div><div class="workspace-list">' + workspaces.map(function(workspace) {return renderWorkspaceCard(account, workspace, accountAPIBasePath);diff --git a/internal/cloudcp/portal/frontend/dev.mjs b/internal/cloudcp/portal/frontend/dev.mjsindex 936bd9ca8c..a8bb7827c5 100644--- a/internal/cloudcp/portal/frontend/dev.mjs+++ b/internal/cloudcp/portal/frontend/dev.mjs@@ -246,6 +246,82 @@ function previewReturnURL(request, scenario, toastMessage) {return url.toString();}+function previewWorkspaceURL(scenario, workspaceID, targetPath) {+ const origin = 'http://' + previewHost + ':' + String(previewPort);+ const url = new URL('/__portal_preview/workspaces/' + encodeURIComponent(workspaceID), origin);+ url.searchParams.set('scenario', scenario);+ if (targetPath) {+ url.searchParams.set('target_path', targetPath);+ }+ return url.toString();+}++function findWorkspaceByID(bootstrap, workspaceID) {+ for (const account of bootstrap.accounts || []) {+ for (const workspace of account.workspaces || []) {+ if (workspace.id === workspaceID) {+ return { account, workspace };+ }+ }+ }+ return null;+}++function previewTargetLabel(targetPath) {+ if (targetPath === '/settings/infrastructure?add=linux-host') {+ return 'Settings -> Infrastructure, with the agent install drawer open';+ }+ if (targetPath === '/settings/support/reporting') {+ return 'Settings -> Reporting for this client workspace';+ }+ return 'the workspace dashboard';+}++function buildPreviewWorkspaceHTML(bootstrap, workspaceID, targetPath, scenario) {+ const entry = findWorkspaceByID(bootstrap, workspaceID);+ const title = entry ? entry.workspace.display_name : workspaceID;+ const accountName = entry ? entry.account.name : 'Pulse Account';+ const targetLabel = previewTargetLabel(targetPath);+ const portalURL = '/?scenario=' + encodeURIComponent(scenario);+ return '<!DOCTYPE html>' ++ '<html lang="en">' ++ '<head>' ++ '<meta charset="utf-8">' ++ '<meta name="viewport" content="width=device-width, initial-scale=1">' ++ '<title>' + escapeHTML(title) + ' - Preview workspace</title>' ++ '<style>' ++ 'body{margin:0;font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:#f6f7f9;color:#101828}' ++ 'main{max-width:760px;margin:0 auto;padding:48px 20px}' ++ '.panel{background:#fff;border:1px solid #d0d5dd;border-radius:8px;padding:24px;box-shadow:0 1px 2px rgba(16,24,40,.06)}' ++ 'h1{margin:0 0 8px;font-size:24px;letter-spacing:0}' ++ '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}' ++ '.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}' ++ 'a{display:inline-flex;align-items:center;min-height:34px;padding:0 12px;border-radius:6px;background:#155eef;color:#fff;text-decoration:none;font-size:14px;font-weight:600}' ++ '@media(max-width:640px){.facts{grid-template-columns:1fr}}' ++ '</style>' ++ '</head>' ++ '<body>' ++ '<main>' ++ '<section class="panel">' ++ '<p>Preview workspace handoff</p>' ++ '<h1>' + escapeHTML(title) + '</h1>' ++ '<p>This preview page stands in for the hosted client workspace. In production the signed handoff creates a session inside the client workspace and opens ' + escapeHTML(targetLabel) + '.</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>Target</span><strong>' + escapeHTML(targetPath || '/') + '</strong></div>' ++ '</div>' ++ '<p>Agents, alerts, and reports are scoped to this workspace after the handoff.</p>' ++ '<a href="' + escapeHTML(portalURL) + '">Back to Pulse Account</a>' ++ '</section>' ++ '</main>' ++ '</body>' ++ '</html>';+}+function buildPreviewHTML(assets, bootstrap, previewToast) {const bootstrapJSON = JSON.stringify(bootstrap).replace(/</g, '\\u003c');const safeToast = previewToast ? JSON.stringify(String(previewToast)) : 'null';@@ -348,7 +424,7 @@ function findAccount(bootstrap, accountID) {}function routeAccountAPI(request, response, url, bootstrap, scenario) {- const match = url.pathname.match(/^\/api\/accounts\/([^/]+)\/(tenants|members)(?:\/([^/]+))?$/);+ const match = url.pathname.match(/^\/api\/accounts\/([^/]+)\/(tenants|members)(?:\/([^/]+))?(?:\/([^/]+))?$/);if (!match) {sendText(response, 404, 'Not found');return;@@ -357,12 +433,18 @@ function routeAccountAPI(request, response, url, bootstrap, scenario) {const accountID = decodeURIComponent(match[1]);const resource = match[2];const resourceID = match[3] ? decodeURIComponent(match[3]) : '';+ const action = match[4] ? decodeURIComponent(match[4]) : '';const account = findAccount(bootstrap, accountID);if (!account) {sendJSON(response, 404, { error: 'Account not found.' });return;}+ if (action && !(resource === 'tenants' && action === 'handoff')) {+ sendText(response, 404, 'Not found');+ return;+ }+if (resource === 'members') {if (request.method === 'GET' && !resourceID) {sendJSON(response, 200, account.members || []);@@ -421,6 +503,29 @@ function routeAccountAPI(request, response, url, bootstrap, scenario) {}if (resource === 'tenants') {+ if (request.method === 'POST' && resourceID && action === 'handoff') {+ const workspace = (account.workspaces || []).find(function(item) {+ return item.id === resourceID;+ });+ if (!workspace) {+ sendJSON(response, 404, { error: 'Workspace not found.' });+ return;+ }+ if (workspace.state !== 'active') {+ sendJSON(response, 409, { error: 'Workspace is not active.' });+ return;+ }+ response.writeHead(303, {+ Location: previewWorkspaceURL(scenario, resourceID, String(url.searchParams.get('target_path') || '')),+ 'Cache-Control': 'no-store',+ });+ response.end();+ return;+ }+ if (action) {+ sendText(response, 405, 'Method not allowed');+ return;+ }if (request.method === 'POST' && !resourceID) {readJSONBody(request).then(function(body) {const displayName = String(body.display_name || '').trim();@@ -713,6 +818,21 @@ const server = http.createServer(function(request, response) {return;}+ const previewWorkspaceMatch = url.pathname.match(/^\/__portal_preview\/workspaces\/([^/]+)$/);+ if (previewWorkspaceMatch) {+ response.writeHead(200, {+ 'Content-Type': 'text/html; charset=utf-8',+ 'Cache-Control': 'no-store',+ });+ response.end(buildPreviewWorkspaceHTML(+ getScenarioState(scenario),+ decodeURIComponent(previewWorkspaceMatch[1]),+ String(url.searchParams.get('target_path') || ''),+ scenario,+ ));+ return;+ }+if (url.pathname.startsWith('/__portal_preview/commercial/')) {routeCommercialAPI(request, response, url, scenario);return;diff --git a/internal/cloudcp/portal/frontend/src/account_runtime.ts b/internal/cloudcp/portal/frontend/src/account_runtime.tsindex 353f272f42..7e1c5a3b42 100644--- a/internal/cloudcp/portal/frontend/src/account_runtime.ts+++ b/internal/cloudcp/portal/frontend/src/account_runtime.ts@@ -67,7 +67,8 @@ export function installAccountRuntime(deps: AccountRuntimeDeps): AccountRuntime};var renderAccountRuntime = function(): void {- renderAccountUIState(deps.store.getAccountState(), deps.store.getBootstrap().accounts || []);+ var bootstrap = deps.store.getBootstrap();+ renderAccountUIState(deps.store.getAccountState(), bootstrap.accounts || [], bootstrap.account_api_base_path || '');};var loadAccessRoster = async function(accountID: string): Promise<void> {diff --git a/internal/cloudcp/portal/frontend/src/account_view.test.ts b/internal/cloudcp/portal/frontend/src/account_view.test.tsindex 323a93ebfc..340ab83980 100644--- a/internal/cloudcp/portal/frontend/src/account_view.test.ts+++ b/internal/cloudcp/portal/frontend/src/account_view.test.ts@@ -77,6 +77,9 @@ describe('account view', function() {'<div id="workspace-management-lifecycle-' + accountID + '"></div>' +'<div id="workspace-management-created-' + accountID + '"></div>' +'<div id="workspace-management-guidance-' + accountID + '"></div>' ++ '<form id="workspace-management-open-form-' + accountID + '"><button id="workspace-management-open-' + accountID + '"></button></form>' ++ '<form id="workspace-management-install-form-' + accountID + '"><button id="workspace-management-install-' + accountID + '"></button></form>' ++ '<form id="workspace-management-reporting-form-' + accountID + '"><button id="workspace-management-reporting-' + accountID + '"></button></form>' +'<button id="workspace-management-action-' + accountID + '"></button>' +'</div>' +'</div>' +@@ -285,7 +288,7 @@ describe('account view', function() {it('renders workspace management selection from account UI state', function() {document.body.innerHTML = createWorkspaceManagementDOM('acct_1');- renderWorkspaceManagement(createAccount(), createEntry({ selectedWorkspaceID: 'ws_1' }));+ renderWorkspaceManagement(createAccount(), createEntry({ selectedWorkspaceID: 'ws_1' }), '/api/accounts');expect(document.getElementById('workspace-management-acct_1')?.classList.contains('visible')).toBe(true);expect(document.getElementById('workspace-management-acct_1')?.hidden).toBe(false);expect(document.getElementById('workspace-operations-detail-acct_1')?.hidden).toBe(false);@@ -296,6 +299,9 @@ describe('account view', function() {expect(document.getElementById('workspace-management-title-acct_1')?.textContent).toContain('Alpha Workspace');expect(document.getElementById('workspace-management-health-acct_1')?.textContent).toContain('Healthy');expect(document.getElementById('workspace-management-action-acct_1')?.textContent).toContain('Suspend workspace');+ 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');});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 25295e4fe8..17ae0de199 100644--- a/internal/cloudcp/portal/frontend/src/account_view.ts+++ b/internal/cloudcp/portal/frontend/src/account_view.ts@@ -54,7 +54,35 @@ function findWorkspace(account: PortalAccountSummary, workspaceID: string): Portreturn null;}-export function renderWorkspaceManagement(account: PortalAccountSummary, entry: PortalAccountUIEntry): void {+const WORKSPACE_INSTALL_TARGET_PATH = '/settings/infrastructure?add=linux-host';+const WORKSPACE_REPORTING_TARGET_PATH = '/settings/support/reporting';++function workspaceHandoffActionPath(accountAPIBasePath: string, accountID: string, workspaceID: string, targetPath = ''): string {+ var path = accountAPIBasePath + '/' + encodeURIComponent(accountID) + '/tenants/' + encodeURIComponent(workspaceID) + '/handoff';+ if (!targetPath) return path;+ return path + '?target_path=' + encodeURIComponent(targetPath);+}++function setWorkspaceHandoffForm(+ form: HTMLFormElement | null,+ button: HTMLButtonElement | null,+ accountAPIBasePath: string,+ accountID: string,+ workspace: PortalWorkspaceSummary,+ targetPath = '',+ pending = false+): void {+ if (!form || !button) return;+ var canOpen = workspace.state === 'active' && !!accountAPIBasePath;+ if (canOpen) {+ form.action = workspaceHandoffActionPath(accountAPIBasePath, accountID, workspace.id, targetPath);+ } else {+ form.removeAttribute('action');+ }+ button.disabled = pending || !canOpen;+}++export function renderWorkspaceManagement(account: PortalAccountSummary, entry: PortalAccountUIEntry, accountAPIBasePath = ''): void {var panel = getElement<HTMLElement>('workspace-management-' + account.id);var shell = getElement<HTMLElement>('workspace-operations-shell-' + account.id);var detail = getElement<HTMLElement>('workspace-operations-detail-' + account.id);@@ -70,6 +98,12 @@ export function renderWorkspaceManagement(account: PortalAccountSummary, entry:var guidance = getElement<HTMLElement>('workspace-management-guidance-' + account.id);var actionButton = getElement<HTMLButtonElement>('workspace-management-action-' + account.id);var closeButton = getElement<HTMLButtonElement>('workspace-management-close-' + account.id);+ var openForm = getElement<HTMLFormElement>('workspace-management-open-form-' + account.id);+ var openButton = getElement<HTMLButtonElement>('workspace-management-open-' + account.id);+ var installForm = getElement<HTMLFormElement>('workspace-management-install-form-' + account.id);+ var installButton = getElement<HTMLButtonElement>('workspace-management-install-' + account.id);+ var reportingForm = getElement<HTMLFormElement>('workspace-management-reporting-form-' + account.id);+ var reportingButton = getElement<HTMLButtonElement>('workspace-management-reporting-' + account.id);if (!empty || !content || !title || !meta || !summary || !health || !lifecycle || !created || !guidance || !actionButton || !closeButton) return;var workspace = entry.selectedWorkspaceID ? findWorkspace(account, entry.selectedWorkspaceID) : null;@@ -101,6 +135,12 @@ export function renderWorkspaceManagement(account: PortalAccountSummary, entry:actionButton.removeAttribute('data-workspace-id');actionButton.removeAttribute('data-workspace-name');actionButton.removeAttribute('data-workspace-action');+ openForm?.removeAttribute('action');+ installForm?.removeAttribute('action');+ reportingForm?.removeAttribute('action');+ if (openButton) openButton.disabled = true;+ if (installButton) installButton.disabled = true;+ if (reportingButton) reportingButton.disabled = true;return;}@@ -117,6 +157,9 @@ export function renderWorkspaceManagement(account: PortalAccountSummary, entry:actionButton.setAttribute('data-workspace-name', workspace.display_name);actionButton.setAttribute('data-workspace-action', workspace.state === 'active' ? 'suspend' : 'delete');closeButton.disabled = entry.manageWorkspace.pending;+ setWorkspaceHandoffForm(openForm, openButton, accountAPIBasePath, account.id, workspace, '', entry.manageWorkspace.pending);+ setWorkspaceHandoffForm(installForm, installButton, accountAPIBasePath, account.id, workspace, WORKSPACE_INSTALL_TARGET_PATH, entry.manageWorkspace.pending);+ setWorkspaceHandoffForm(reportingForm, reportingButton, accountAPIBasePath, account.id, workspace, WORKSPACE_REPORTING_TARGET_PATH, entry.manageWorkspace.pending);}function setContainerMessage(container: HTMLElement, title: string, msg: string, isError: boolean): void {@@ -428,7 +471,7 @@ export function renderAccessSection(accountID: string, entry: PortalAccountUIEnt}}-export function renderAccountUI(accountState: PortalAccountState, accounts: PortalAccountSummary[]): void {+export function renderAccountUI(accountState: PortalAccountState, accounts: PortalAccountSummary[], accountAPIBasePath = ''): void {var accountIDs = Object.keys(accountState.byAccountID);for (var i = 0; i < accountIDs.length; i += 1) {var accountID = accountIDs[i];@@ -441,7 +484,7 @@ export function renderAccountUI(accountState: PortalAccountState, accounts: Port}}renderAddWorkspaceSection(accountID, entry);- if (account) renderWorkspaceManagement(account, entry);+ if (account) renderWorkspaceManagement(account, entry, accountAPIBasePath);renderAccessSection(accountID, entry);}}diff --git a/internal/cloudcp/portal/frontend/src/shell_view.test.ts b/internal/cloudcp/portal/frontend/src/shell_view.test.tsindex c4f3aa1a55..c335322194 100644--- a/internal/cloudcp/portal/frontend/src/shell_view.test.ts+++ b/internal/cloudcp/portal/frontend/src/shell_view.test.ts@@ -201,7 +201,11 @@ describe('shell view', function() {expect(html).toContain('This workspace is in a failed state.');expect(html).toContain('Health check pending');expect(html).toContain('/api/accounts/acct_1/tenants/ws_active/handoff');+ expect(html).toContain('/api/accounts/acct_1/tenants/ws_active/handoff?target_path=%2Fsettings%2Finfrastructure%3Fadd%3Dlinux-host');expect(html).toContain('Open workspace');+ expect(html).toContain('Install agents');+ expect(html).toContain('Open the workspace-bound install commands.');+ expect(html).toContain('Alerts and performance reports stay inside the client workspace.');expect(html).toContain('data-action="select-workspace"');expect(html).toContain('Create a workspace');expect(html).toContain('Access changes stay in Access. Billing changes stay in Billing.');diff --git a/internal/cloudcp/portal/frontend/src/shell_view.ts b/internal/cloudcp/portal/frontend/src/shell_view.tsindex e9c1f59dc4..1639e081ca 100644--- a/internal/cloudcp/portal/frontend/src/shell_view.ts+++ b/internal/cloudcp/portal/frontend/src/shell_view.ts@@ -404,6 +404,15 @@ function workspaceRowAnchorID(accountID: string, workspaceID: string): string {return 'workspace-row-' + accountID + '-' + workspaceID;}+const WORKSPACE_INSTALL_TARGET_PATH = '/settings/infrastructure?add=linux-host';+const WORKSPACE_REPORTING_TARGET_PATH = '/settings/support/reporting';++function workspaceHandoffActionPath(accountAPIBasePath: string, accountID: string, workspaceID: string, targetPath = ''): string {+ var path = accountAPIBasePath + '/' + encodeURIComponent(accountID) + '/tenants/' + encodeURIComponent(workspaceID) + '/handoff';+ if (!targetPath) return path;+ return path + '?target_path=' + encodeURIComponent(targetPath);+}+function renderWorkspaceCard(account: PortalAccountSummary, workspace: PortalWorkspaceSummary, accountAPIBasePath: string): string {var status = workspaceHealthState(workspace);var state = String(workspace.state || '');@@ -420,12 +429,22 @@ function renderWorkspaceCard(account: PortalAccountSummary, workspace: PortalWorif (state === 'active') {openAction ='<form method="POST" action="' +- escapeAttr(accountAPIBasePath + '/' + account.id + '/tenants/' + workspace.id + '/handoff') ++ escapeAttr(workspaceHandoffActionPath(accountAPIBasePath, account.id, workspace.id)) +'">' +'<button type="submit" class="btn-primary">Open workspace</button>' +'</form>';}+ var installAction = '';+ if (state === 'active') {+ installAction =+ '<form method="POST" action="' ++ escapeAttr(workspaceHandoffActionPath(accountAPIBasePath, account.id, workspace.id, WORKSPACE_INSTALL_TARGET_PATH)) ++ '">' ++ '<button type="submit" class="btn-secondary">Install agents</button>' ++ '</form>';+ }+var manageAction = '';if (account.can_manage && (state === 'active' || state === 'suspended' || state === 'failed')) {manageAction =@@ -453,6 +472,7 @@ function renderWorkspaceCard(account: PortalAccountSummary, workspace: PortalWor'</div>' +'<div class="workspace-actions">' +openAction ++ installAction +manageAction +'</div>' +'</article>'@@ -475,7 +495,20 @@ function renderWorkspaceHandoffForm(accountID: string, workspaceID: string, acco}return ('<form method="POST" action="' +- escapeAttr(accountAPIBasePath + '/' + accountID + '/tenants/' + workspaceID + '/handoff') ++ escapeAttr(workspaceHandoffActionPath(accountAPIBasePath, accountID, workspaceID)) ++ '">' ++ '<button type="submit" class="' + escapeAttr(buttonClassName) + '">' + escapeHTML(label) + '</button>' ++ '</form>'+ );+}++function renderWorkspaceInstallHandoffForm(accountID: string, workspaceID: string, accountAPIBasePath: string, label = 'Install agents', buttonClassName = 'btn-secondary btn-compact'): string {+ if (!accountAPIBasePath) {+ return '<button class="' + escapeAttr(buttonClassName) + '" type="button" data-shell-action="activate-section" data-shell-section="workspaces">' + escapeHTML(label) + '</button>';+ }+ return (+ '<form method="POST" action="' ++ escapeAttr(workspaceHandoffActionPath(accountAPIBasePath, accountID, workspaceID, WORKSPACE_INSTALL_TARGET_PATH)) +'">' +'<button type="submit" class="' + escapeAttr(buttonClassName) + '">' + escapeHTML(label) + '</button>' +'</form>'@@ -600,7 +633,7 @@ function renderWorkspaceSummaryDecision();secondaryAction = ready.length > 1? renderWorkspaceAnchorAction(workspaceListAnchorID(readyEntry.account.id), 'See all workspaces')- : '';+ : renderWorkspaceInstallHandoffForm(readyEntry.account.id, readyEntry.workspace.id, accountAPIBasePath);} else if (creatableAccount) {title = 'Create the first workspace';description = 'No hosted workspace is attached yet. Create the first workspace in ' + creatableAccount.name + '.';@@ -841,6 +874,40 @@ function renderAccountWorkspaceSection(account: PortalAccountSummary, accountAPI'<div class="workspace-management-guidance" id="workspace-management-guidance-' +escapeAttr(account.id) +'"></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>' +'<div class="workspace-management-actions">' +'<button type="button" class="btn-danger" id="workspace-management-action-' +escapeAttr(account.id) +diff --git a/internal/cloudcp/portal/frontend/src/styles.css b/internal/cloudcp/portal/frontend/src/styles.cssindex 238cfbccbd..e46bd401ce 100644--- a/internal/cloudcp/portal/frontend/src/styles.css+++ b/internal/cloudcp/portal/frontend/src/styles.css@@ -519,6 +519,44 @@ header .logout-btn:hover,color: var(--ink-secondary);}+.workspace-management-next-steps {+ display: flex;+ flex-direction: column;+ gap: 8px;+}++.workspace-next-step {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: center;+ gap: 12px;+ padding: 10px 12px;+ border: 1px solid var(--border-muted);+ border-radius: var(--radius);+ background: var(--bg);+}++.workspace-next-step div {+ display: flex;+ flex-direction: column;+ gap: 2px;+ min-width: 0;+}++.workspace-next-step strong {+ font-size: 13px;+ color: var(--ink);+}++.workspace-next-step span {+ font-size: 12px;+ color: var(--ink-secondary);+}++.workspace-next-step form {+ margin: 0;+}+.workspace-management-actions {display: flex;gap: 8px;@@ -1426,6 +1464,8 @@ header .logout-btn:hover,.portal-support-simple-row { grid-template-columns: 1fr; gap: 4px; }.workspace-management-facts { grid-template-columns: 1fr; }+ .workspace-next-step { grid-template-columns: 1fr; }+ .workspace-next-step form { justify-self: flex-start; }}@media (max-width: 480px) {diff --git a/internal/cloudcp/portal/frontend/src/workspace_presentation.test.ts b/internal/cloudcp/portal/frontend/src/workspace_presentation.test.tsindex ee9ebb4bb5..5030c63fe7 100644--- a/internal/cloudcp/portal/frontend/src/workspace_presentation.test.ts+++ b/internal/cloudcp/portal/frontend/src/workspace_presentation.test.ts@@ -41,8 +41,8 @@ describe('workspace presentation', function() {});it('uses literal lifecycle guidance instead of commentary', function() {- expect(workspaceGuidanceCopy(createWorkspace())).toBe('This workspace is active. Open it from the workspace list, or suspend it here if you intend to take it out of service.');- expect(workspaceGuidanceCopy(createWorkspace({ healthy: false, health_status: 'checking' }))).toBe('This workspace is active. The latest health check is still pending.');+ expect(workspaceGuidanceCopy(createWorkspace())).toBe('This workspace is active. Open it to work inside this client boundary, or install agents to reach the workspace-bound install commands.');+ expect(workspaceGuidanceCopy(createWorkspace({ healthy: false, health_status: 'checking' }))).toBe('This workspace is active. The latest health check is still pending, but the workspace can still own agent install commands.');expect(workspaceGuidanceCopy(createWorkspace({ healthy: false, health_status: 'unhealthy' }))).toBe('The latest health check is unhealthy. Review the current state before suspending or deleting this workspace.');expect(workspaceGuidanceCopy(createWorkspace({ state: 'suspended', health_status: 'healthy' }))).toBe('This workspace is suspended. The remaining lifecycle action here is deletion.');});diff --git a/internal/cloudcp/portal/frontend/src/workspace_presentation.ts b/internal/cloudcp/portal/frontend/src/workspace_presentation.tsindex 67b81b0c59..e0bc189df8 100644--- a/internal/cloudcp/portal/frontend/src/workspace_presentation.ts+++ b/internal/cloudcp/portal/frontend/src/workspace_presentation.ts@@ -40,10 +40,10 @@ export function workspaceGuidanceCopy(workspace: PortalWorkspaceSummary): stringvar status = workspaceHealthState(workspace);var state = String(workspace.state || '');if (state === 'active' && status === 'healthy') {- return 'This workspace is active. Open it from the workspace list, or suspend it here if you intend to take it out of service.';+ return 'This workspace is active. Open it to work inside this client boundary, or install agents to reach the workspace-bound install commands.';}if (state === 'active' && status === 'checking') {- return 'This workspace is active. The latest health check is still pending.';+ return 'This workspace is active. The latest health check is still pending, but the workspace can still own agent install commands.';}if (status === 'unhealthy') {return 'The latest health check is unhealthy. Review the current state before suspending or deleting this workspace.';diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.pyindex 4299b0bb79..4ade7e9519 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": 283,+ "line": 294,"heading_line": 112,}],