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
Implement Discovery observed context UX
rcourtman9c55c341e275
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex a1663696b1..bf4edcf5b5 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -1160,6 +1160,14 @@ single-resource discovery, and `pulse_discovery` refreshes before any`discovery_interval_hours: 0` is the only manual-command-scan mode: recurringscans stay stopped, but explicit admin-triggered refreshes may use thehardcoded trusted catalog.+The value boundary for keeping Discovery is observed workload context:+Assistant and Patrol may consume normalized service name, version, endpoint,+port, config path, data path, log path, bind-mount, confidence, and user-note+fields through `pulse_discovery` or scoped prefetch. Raw command output remains+debug/admin material and must not become the primary Assistant context. When a+Discovery record includes a suggested web URL, the tool response and prefetch+summary may include that URL as observed context, but it must be treated as a+candidate rather than an operator-approved management URL.The same action-audit boundary now also requires persisted action records tocarry a normalized plan and preflight: action id, request id, capability,approval policy, dry-run availability, safety checks, verification steps, anddiff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex f5d28dcba9..db7a509518 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -1394,6 +1394,12 @@ AI runtime.`hasValidDiscovery` — so the same record either renders in allsurfaces or hides in all surfaces, preventing "Unknown" rows orzero-confidence noise from drifting into peripheral UI.+ Discovery is an opt-in observed-context layer, not an automatic row-link+ owner. The reducer must carry provenance, observed time, service version,+ endpoint candidates, and URL-source copy so drawer surfaces can show+ "Observed by Discovery" context and pass suggested URLs into the shared+ web-interface field. Persisted/manual web-interface metadata remains the+ only row-link source until the operator explicitly adopts a suggested URL.## Current State@@ -3142,11 +3148,16 @@ That same presentation owner also packages the identified-service summaryconsumed by surfaces outside the Discovery sub-tab.`getDiscoveryIdentifiedSummary` is the canonical reducer that turns a stored`ResourceDiscovery` into the compact card payload (service name, category,-confidence percent, port and path counts, cli access hint). New surfaces that-want to label a workload with its identified service must read through that+confidence percent, port and path counts, cli access hint, service version,+observed timestamp, provenance label, and suggested web-interface URL+metadata). New surfaces that want to label a workload with its identified+service or offer a Discovery-sourced endpoint candidate must read through thathelper rather than re-implementing the empty/low-signal gate, so theDiscovery tab and out-of-tab surfaces collapse the same records and avoid-surfacing "Unknown" rows or zero-confidence noise.+surfacing "Unknown" rows or zero-confidence noise. Manual/persisted+web-interface URLs still win: Discovery suggestions may be copied, opened, or+adopted through the shared `WebInterfaceUrlField`, but they must not silently+replace metadata or make row-name links active until the operator saves them.That same settings-shell boundary now also owns the shared settingspresentation helpers that those panels consume. `frontend-modern/src/utils/systemSettingsPresentation.ts`is the canonical owner for shared system-settings presets, summaries, anddiff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 324cf332d5..cc7a95a62c 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -1574,3 +1574,10 @@ type, agent id, resource id) rather than re-implementing targetresolution, so workloads without canonical discovery ownership (e.g.TrueNAS app-containers without explicit `discoveryTarget`) skip thefetch cleanly.+Observed service version, source labels, observed age, and suggested web+URL candidates may be rendered from that same cached discovery summary,+but they must not add a second discovery request, route-level Suspense+dependency, row-time endpoint probe, or auto-save mutation. Suggested+URLs remain copy/open/adopt affordances only; persisting them as a+workload link stays a user action through the existing Web Interface URL+field.diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 16f93e7b63..acbf956133 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -1688,6 +1688,14 @@ That access-side analysis surface still follows the same shell/runtime split asthe rest of the drawer: `DiscoveryTab.tsx` owns presentation and disclosures,while `useDiscoveryTabState.ts` owns API fetches, websocket progress, andnote/discovery mutations.+Discovery endpoint candidates are support context, not authoritative resource+links. Resource and workload drawers may pass observed Discovery URLs into the+shared web-interface field with visible provenance, copy/open affordances, and+an explicit adopt/save path, but row-name links and persisted metadata must+continue to use the operator-saved web-interface URL. Version, config-path,+port, and endpoint facts surfaced outside the Discovery sub-tab must be+labelled as Discovery-observed so API-owned resource facts and command-derived+facts remain distinguishable.Command-availability guidance inside that analysis surface must consume theshared `frontend-modern/src/utils/discoveryPresentation.ts` settings targetsand scan-error copy instead of hard-coding legacy settings labels such asdiff --git a/frontend-modern/src/components/Discovery/DiscoveryTab.tsx b/frontend-modern/src/components/Discovery/DiscoveryTab.tsxindex 9efaae90bf..f48c67405f 100644--- a/frontend-modern/src/components/Discovery/DiscoveryTab.tsx+++ b/frontend-modern/src/components/Discovery/DiscoveryTab.tsx@@ -1,4 +1,7 @@import { Component, For, Show, createMemo } from 'solid-js';+import CheckIcon from 'lucide-solid/icons/check';+import CopyIcon from 'lucide-solid/icons/copy';+import ExternalLinkIcon from 'lucide-solid/icons/external-link';import type { ResourceType } from '../../types/discovery';import {formatDiscoveryAge,@@ -13,8 +16,14 @@ import {getDiscoveryAnalysisProviderBadgeClass,getDiscoveryCategoryBadgeClass,getDiscoveryCommandSettingsTarget,+ getDiscoveryObservedSourceLabel,+ getDiscoverySuggestedURLReason,getDiscoverySuggestedURLFallback,- getDiscoveryURLSuggestionSourceLabel,+ getDiscoverySuggestedURLActionClass,+ getDiscoverySuggestedURLCardClass,+ getDiscoverySuggestedURLCodeClass,+ getDiscoverySuggestedURLHeadingClass,+ getDiscoverySuggestedURLTextClass,} from '@/utils/discoveryPresentation';import {DISCOVERY_ANALYSIS_EXPLANATION,@@ -33,20 +42,63 @@ interface DiscoveryTabProps {showManualRunAction?: boolean;}-const toSentence = (text?: string): string => {- const trimmed = (text || '').trim();- if (!trimmed) return '';- const first = trimmed.charAt(0);- return first.toUpperCase() + trimmed.slice(1);+interface CopyValueButtonProps {+ value?: string | null;+ copiedValue: () => string;+ onCopy: (value?: string | null) => void | Promise<void>;+ label: string;+ class?: string;+}++const CopyValueButton: Component<CopyValueButtonProps> = (props) => {+ const trimmedValue = () => (props.value || '').trim();+ const copied = () => Boolean(trimmedValue()) && props.copiedValue() === trimmedValue();++ return (+ <button+ type="button"+ class={+ props.class ||+ 'inline-flex min-h-7 min-w-7 shrink-0 items-center justify-center rounded border border-border bg-surface px-2 text-muted transition-colors hover:bg-surface-hover hover:text-base-content'+ }+ onClick={() => void props.onCopy(trimmedValue())}+ disabled={!trimmedValue()}+ title={props.label}+ aria-label={props.label}+ >+ <Show when={copied()} fallback={<CopyIcon class="h-3.5 w-3.5" />}>+ <CheckIcon class="h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400" />+ </Show>+ </button>+ );};+interface CopyableCodeRowProps extends CopyValueButtonProps {+ value: string;+}++const CopyableCodeRow: Component<CopyableCodeRowProps> = (props) => (+ <div class="flex items-start gap-2 rounded bg-surface-alt px-2 py-1.5">+ <code class="min-w-0 flex-1 break-all font-mono text-xs text-base-content">{props.value}</code>+ <CopyValueButton+ value={props.value}+ copiedValue={props.copiedValue}+ onCopy={props.onCopy}+ label={props.label}+ class="inline-flex min-h-6 min-w-6 shrink-0 items-center justify-center rounded text-muted transition-colors hover:bg-surface-hover hover:text-base-content"+ />+ </div>+);+export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {const {canTriggerDiscovery,connectedAgents,+ copiedDiscoveryValue,discovery,discoveryInfo,editingNotes,+ handleCopyDiscoveryValue,handleSaveNotes,handleTriggerDiscovery,hasConnectedAgent,@@ -73,22 +125,13 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {const suggestedURLReasonText = createMemo(() => {const current = discovery();if (!current) return '';- const detail = toSentence(current.suggested_url_source_detail);- if (detail) return detail;- if (current.suggested_url_source_code) {- return getDiscoveryURLSuggestionSourceLabel(current.suggested_url_source_code);- }- return '';+ return getDiscoverySuggestedURLReason(current).text;});const suggestedURLReasonTitle = createMemo(() => {const current = discovery();if (!current) return '';- const label = getDiscoveryURLSuggestionSourceLabel(current.suggested_url_source_code);- if (current.suggested_url_source_detail) {- return `${label}: ${current.suggested_url_source_detail}`;- }- return label;+ return getDiscoverySuggestedURLReason(current).title;});const confidenceInfo = createMemo(() => {@@ -622,7 +665,16 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {{d().service_name || 'Unknown Service'}</h3><Show when={d().service_version}>- <p class="text-xs text-muted mt-0.5">Version {d().service_version}</p>+ <div class="mt-1 flex items-center gap-2">+ <span class="text-xs text-muted">Version {d().service_version}</span>+ <CopyValueButton+ value={d().service_version}+ copiedValue={copiedDiscoveryValue}+ onCopy={handleCopyDiscoveryValue}+ label="Copy service version"+ class="inline-flex min-h-5 min-w-5 shrink-0 items-center justify-center rounded text-muted transition-colors hover:bg-surface-hover hover:text-base-content"+ />+ </div></Show></div><Show when={d().category && d().category !== 'unknown'}>@@ -637,13 +689,24 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {{confidenceInfo()!.label} ({Math.round((d().confidence || 0) * 100)}%)</p></Show>+ <div class="mt-3 flex flex-wrap gap-2 text-[10px] text-muted">+ <span class="rounded border border-border bg-surface-alt px-2 py-0.5">+ {getDiscoveryObservedSourceLabel()}+ </span>+ <Show when={d().updated_at}>+ <span class="rounded border border-border bg-surface-alt px-2 py-0.5">+ Last observed {formatDiscoveryAge(d().updated_at)}+ </span>+ </Show>+ <span class="rounded border border-border bg-surface-alt px-2 py-0.5">+ Available to Pulse Assistant+ </span>+ </div></div><Show when={d().suggested_url || d().suggested_url_diagnostic}>- <div class="rounded border border-blue-200 bg-blue-50 p-3 shadow-sm dark:border-blue-800 dark:bg-blue-900">- <div class="text-[11px] font-medium uppercase tracking-wide text-blue-800 dark:text-blue-200 mb-1">- Web Interface Suggestion- </div>+ <div class={getDiscoverySuggestedURLCardClass()}>+ <div class={getDiscoverySuggestedURLHeadingClass()}>Web Interface Suggestion</div><Showwhen={d().suggested_url}fallback={@@ -657,17 +720,34 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {><Show when={suggestedURLReasonText()}><p- class="mb-1 text-[10px] text-blue-700 dark:text-blue-300"+ class={`mb-1 text-[10px] ${getDiscoverySuggestedURLTextClass()}`}title={suggestedURLReasonTitle()}>Why this URL: {suggestedURLReasonText()}</p></Show>- <code class="block rounded px-2 py-1 text-xs text-blue-800 dark:text-blue-100 font-mono break-all">- {d().suggested_url}- </code>- <p class="mt-1.5 text-[11px] text-blue-700 dark:text-blue-300">- Save this URL from the Overview tab in the Web Interface URL field.+ <div class="flex items-start gap-2">+ <code class={getDiscoverySuggestedURLCodeClass()}>{d().suggested_url}</code>+ <a+ href={d().suggested_url}+ target="_blank"+ rel="noopener noreferrer"+ class={getDiscoverySuggestedURLActionClass()}+ title="Open suggested URL"+ aria-label="Open suggested URL"+ >+ <ExternalLinkIcon class="h-3.5 w-3.5" />+ </a>+ <CopyValueButton+ value={d().suggested_url}+ copiedValue={copiedDiscoveryValue}+ onCopy={handleCopyDiscoveryValue}+ label="Copy suggested URL"+ class={getDiscoverySuggestedURLActionClass()}+ />+ </div>+ <p class={`mt-1.5 text-[11px] ${getDiscoverySuggestedURLTextClass()}`}>+ Save it in the Web Interface URL field before Pulse uses it as a link.</p></Show></div>@@ -679,9 +759,12 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {<div class="text-[11px] font-medium uppercase tracking-wide text-base-content mb-2">CLI Access</div>- <code class="block bg-surface-alt rounded px-2 py-1.5 text-xs text-base-content font-mono overflow-x-auto">- {d().cli_access}- </code>+ <CopyableCodeRow+ value={d().cli_access}+ copiedValue={copiedDiscoveryValue}+ onCopy={handleCopyDiscoveryValue}+ label="Copy CLI access"+ /></div></Show>@@ -701,7 +784,14 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {</div><div class="space-y-1"><For each={d().config_paths}>- {(path) => <code class="block text-xs text-muted font-mono">{path}</code>}+ {(path) => (+ <CopyableCodeRow+ value={path}+ copiedValue={copiedDiscoveryValue}+ onCopy={handleCopyDiscoveryValue}+ label="Copy config path"+ />+ )}</For></div></div>@@ -713,7 +803,14 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {</div><div class="space-y-1"><For each={d().data_paths}>- {(path) => <code class="block text-xs text-muted font-mono">{path}</code>}+ {(path) => (+ <CopyableCodeRow+ value={path}+ copiedValue={copiedDiscoveryValue}+ onCopy={handleCopyDiscoveryValue}+ label="Copy data path"+ />+ )}</For></div></div>@@ -725,7 +822,14 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {</div><div class="space-y-1"><For each={d().log_paths}>- {(path) => <code class="block text-xs text-muted font-mono">{path}</code>}+ {(path) => (+ <CopyableCodeRow+ value={path}+ copiedValue={copiedDiscoveryValue}+ onCopy={handleCopyDiscoveryValue}+ label="Copy log path"+ />+ )}</For></div></div>@@ -742,12 +846,28 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {<div class="flex flex-wrap gap-1"><For each={d().ports}>{(port) => (- <span class="inline-block rounded px-1.5 py-0.5 text-[10px]">- {port.port}/{port.protocol}+ <button+ type="button"+ class="inline-flex items-center gap-1 rounded bg-surface-alt px-1.5 py-0.5 text-[10px] text-base-content transition-colors hover:bg-surface-hover"+ onClick={() =>+ void handleCopyDiscoveryValue(`${port.port}/${port.protocol}`)+ }+ title="Copy port"+ aria-label={`Copy ${port.port}/${port.protocol}`}+ >+ <span>+ {port.port}/{port.protocol}+ </span><Show when={port.process}>- <span class="text-muted ml-1">({port.process})</span>+ <span class="text-muted">({port.process})</span>+ </Show>+ <Show+ when={copiedDiscoveryValue() === `${port.port}/${port.protocol}`}+ fallback={<CopyIcon class="h-3 w-3 text-muted" />}+ >+ <CheckIcon class="h-3 w-3 text-emerald-600 dark:text-emerald-400" /></Show>- </span>+ </button>)}</For></div>@@ -763,14 +883,20 @@ export const DiscoveryTab: Component<DiscoveryTabProps> = (props) => {<div class="space-y-1.5"><For each={d().facts.slice(0, 8)}>{(fact) => (- <div class="flex items-center justify-between text-xs">- <span class="text-muted">{fact.key}</span>- <span- class="font-medium text-base-content truncate ml-2 max-w-[60%]"- title={fact.value}- >- {fact.value}- </span>+ <div class="flex items-center justify-between gap-2 text-xs">+ <span class="min-w-0 text-muted truncate">{fact.key}</span>+ <div class="flex min-w-0 items-center gap-1.5">+ <span class="truncate font-medium text-base-content" title={fact.value}>+ {fact.value}+ </span>+ <CopyValueButton+ value={fact.value}+ copiedValue={copiedDiscoveryValue}+ onCopy={handleCopyDiscoveryValue}+ label={`Copy ${fact.key}`}+ class="inline-flex min-h-5 min-w-5 shrink-0 items-center justify-center rounded text-muted transition-colors hover:bg-surface-hover hover:text-base-content"+ />+ </div></div>)}</For>diff --git a/frontend-modern/src/components/Discovery/__tests__/DiscoveryTab.test.tsx b/frontend-modern/src/components/Discovery/__tests__/DiscoveryTab.test.tsxindex 84a830dd2a..0b1f48475e 100644--- a/frontend-modern/src/components/Discovery/__tests__/DiscoveryTab.test.tsx+++ b/frontend-modern/src/components/Discovery/__tests__/DiscoveryTab.test.tsx@@ -16,8 +16,13 @@ vi.mock('@/api/discovery', () => {};});+vi.mock('@/utils/clipboard', () => ({+ copyToClipboard: vi.fn(async () => true),+}));+import * as discoveryApi from '@/api/discovery';import { DiscoveryTab } from '@/components/Discovery/DiscoveryTab';+import { copyToClipboard } from '@/utils/clipboard';describe('DiscoveryTab', () => {afterEach(() => {@@ -159,6 +164,9 @@ describe('DiscoveryTab', () => {discovered_at: '2026-04-15T00:00:00Z',updated_at: '2026-04-15T00:00:00Z',scan_duration: 12,+ suggested_url: 'http://192.0.2.10:5432',+ suggested_url_source_code: 'web_port_inference',+ suggested_url_source_detail: 'detected 5432/tcp',});render(() => (@@ -166,7 +174,17 @@ describe('DiscoveryTab', () => {));expect(await screen.findByText('Analysis: Cloud (Anthropic)')).toBeInTheDocument();+ expect(await screen.findByText('Observed by Discovery')).toBeInTheDocument();+ expect(await screen.findByText('Available to Pulse Assistant')).toBeInTheDocument();expect(await screen.findByText('Analysis Reasoning')).toBeInTheDocument();+ expect(screen.getByRole('link', { name: 'Open suggested URL' })).toHaveAttribute(+ 'href',+ 'http://192.0.2.10:5432',+ );+ fireEvent.click(screen.getByRole('button', { name: 'Copy suggested URL' }));+ await waitFor(() => {+ expect(copyToClipboard).toHaveBeenCalledWith('http://192.0.2.10:5432');+ });expect(await screen.findByText('Mapped open ports and running processes to a PostgreSQL service.'),).toBeInTheDocument();diff --git a/frontend-modern/src/components/Discovery/useDiscoveryTabState.ts b/frontend-modern/src/components/Discovery/useDiscoveryTabState.tsindex d21b042337..17c8bb7ffc 100644--- a/frontend-modern/src/components/Discovery/useDiscoveryTabState.ts+++ b/frontend-modern/src/components/Discovery/useDiscoveryTabState.ts@@ -10,6 +10,7 @@ import {import { eventBus } from '@/stores/events';import type { DiscoveryProgress, ResourceType } from '@/types/discovery';import { getDiscoveryNoConnectedAgentMessage } from '@/utils/discoveryPresentation';+import { copyToClipboard } from '@/utils/clipboard';import { toDiscoveryAPIResourceType } from '@/utils/discoveryTarget';export interface DiscoveryTabStateProps {@@ -37,6 +38,8 @@ export function useDiscoveryTabState(props: DiscoveryTabStateProps) {const [showCommandsPreview, setShowCommandsPreview] = createSignal(false);const [showExplanation, setShowExplanation] = createSignal(true);const [httpScanInProgress, setHttpScanInProgress] = createSignal(false);+ const [copiedDiscoveryValue, setCopiedDiscoveryValue] = createSignal('');+ let copyFeedbackTimer: ReturnType<typeof setTimeout> | undefined;const targetAgentId = createMemo(() => props.agentId || '');const discoverySourceKey = createMemo(@@ -200,6 +203,30 @@ export function useDiscoveryTabState(props: DiscoveryTabStateProps) {setEditingNotes(true);};+ const clearCopyFeedbackTimer = () => {+ if (copyFeedbackTimer === undefined) return;+ clearTimeout(copyFeedbackTimer);+ copyFeedbackTimer = undefined;+ };++ onCleanup(() => {+ clearCopyFeedbackTimer();+ });++ const handleCopyDiscoveryValue = async (value?: string | null) => {+ const text = (value || '').trim();+ if (!text) return;+ const copied = await copyToClipboard(text);+ if (!copied) return;++ clearCopyFeedbackTimer();+ setCopiedDiscoveryValue(text);+ copyFeedbackTimer = setTimeout(() => {+ setCopiedDiscoveryValue('');+ copyFeedbackTimer = undefined;+ }, 2000);+ };+createEffect(() => {const unsubscribe = eventBus.on('ai_discovery_progress', (progress) => {if (!progress || progress.resource_id !== resourceId()) return;@@ -247,9 +274,16 @@ export function useDiscoveryTabState(props: DiscoveryTabStateProps) {(current.data_paths && current.data_paths.length > 0) ||(current.log_paths && current.log_paths.length > 0);const hasCliAccess = Boolean(current.cli_access);+ const hasSuggestedUrl = Boolean(current.suggested_url || current.suggested_url_diagnostic);return Boolean(- hasServiceName || hasConfidence || hasPorts || hasFacts || hasPaths || hasCliAccess,+ hasServiceName ||+ hasConfidence ||+ hasPorts ||+ hasFacts ||+ hasPaths ||+ hasCliAccess ||+ hasSuggestedUrl,);});@@ -260,10 +294,12 @@ export function useDiscoveryTabState(props: DiscoveryTabStateProps) {return {connectedAgents,canTriggerDiscovery,+ copiedDiscoveryValue,discovery,discoveryInfo,editingNotes,handleSaveNotes,+ handleCopyDiscoveryValue,handleTriggerDiscovery,hasConnectedAgent,hasValidDiscovery,diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsxindex 76b1ef64b8..2781529c35 100644--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx@@ -672,6 +672,17 @@ export const ResourceDetailDrawerOverviewTab: Component<ResourceDetailDrawerOvermetadataId={config().metadataId}targetLabel={config().targetLabel}title="Web interface"+ discoveryLoading={drawer.discoveryLoading()}+ suggestedUrl={drawer.discoveryIdentifiedSummary()?.suggestedUrl}+ suggestedUrlReasonText={+ drawer.discoveryIdentifiedSummary()?.suggestedUrlReasonText+ }+ suggestedUrlReasonTitle={+ drawer.discoveryIdentifiedSummary()?.suggestedUrlReasonTitle+ }+ suggestedUrlDiagnostic={+ drawer.discoveryIdentifiedSummary()?.suggestedUrlDiagnostic+ }embedded/>diff --git a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.tsindex 5ce4ba2226..bfdcc5c723 100644--- a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts+++ b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts@@ -1,4 +1,7 @@import { createMemo, type Accessor } from 'solid-js';+import { getDiscovery } from '@/api/discovery';+import { createNonSuspendingQuery } from '@/hooks/createNonSuspendingQuery';+import type { ResourceDiscovery, ResourceType as DiscoveryResourceType } from '@/types/discovery';import type { Resource, ResourceRelationship } from '@/types/resource';import { requiresGovernedResourceDisplay } from '@/types/resource';import type { ResourceVMwareMeta } from '@/types/resource';@@ -36,6 +39,7 @@ import {type PlatformData,} from '@/components/Infrastructure/resourceDetailMappers';import { toDiscoveryConfig } from '@/components/Infrastructure/resourceDetailDiscoveryModel';+import { getDiscoveryIdentifiedSummary } from '@/utils/discoveryPresentation';import {buildPbsActiveTasks,buildPbsVisibleJobBreakdown,@@ -69,6 +73,12 @@ import { getResourceHealthIssuePresentation } from './resourceHealthPresentationtype DrawerTab = 'overview' | 'mail' | 'namespaces' | 'deployments' | 'swarm' | 'debug';+interface ResourceDrawerDiscoverySourceKey {+ type: DiscoveryResourceType;+ agent: string;+ resource: string;+}+interface UseResourceDetailDrawerDerivedStateOptions {resource: Resource;resolveResourceLabel?: (resourceId: string) => string | null | undefined;@@ -251,6 +261,33 @@ export const useResourceDetailDrawerDerivedState = (const hasMergedSources = createMemo(() => mergedSources().length > 1);const discoveryConfig = createMemo(() => toDiscoveryConfig(resource));const discoveryContextSummary = createMemo(() => buildDiscoveryContextSummary(discoveryConfig()));+ const discoverySourceKey = createMemo(() => {+ const config = discoveryConfig();+ if (!config?.resourceType || !config.agentId || !config.resourceId) return null;+ return {+ type: config.resourceType,+ agent: config.agentId,+ resource: config.resourceId,+ } as ResourceDrawerDiscoverySourceKey;+ });+ const discoveryRecord = createNonSuspendingQuery<+ ResourceDiscovery | null,+ ResourceDrawerDiscoverySourceKey+ >({+ source: discoverySourceKey,+ initialValue: null,+ cacheKey: (key) => `resource-detail-discovery:${key.type}:${key.agent}:${key.resource}`,+ fetcher: async (key) => {+ try {+ return await getDiscovery(key.type, key.agent, key.resource);+ } catch {+ return null;+ }+ },+ });+ const discoveryIdentifiedSummary = createMemo(() =>+ getDiscoveryIdentifiedSummary(discoveryRecord.value()),+ );const hostDetailCards = createMemo(() =>buildHostDetailCards({@@ -396,6 +433,8 @@ export const useResourceDetailDrawerDerivedState = (hasMergedSources,discoveryConfig,discoveryContextSummary,+ discoveryIdentifiedSummary,+ discoveryLoading: discoveryRecord.loading,accessSummary,hasAccessContext,hasHostDetails,diff --git a/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx b/frontend-modern/src/components/Workloads/GuestDrawer.test.tsxindex 6024527c1b..81b1455a3f 100644--- a/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx+++ b/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx@@ -71,11 +71,17 @@ vi.mock('@/components/shared/WebInterfaceUrlField', () => ({metadataKind: string;metadataId: string;targetLabel: string;+ suggestedUrl?: string;+ suggestedUrlReasonText?: string;+ suggestedUrlDiagnostic?: string;}) => (<div data-testid="web-interface-url-field"><span data-testid="url-kind">{props.metadataKind}</span><span data-testid="url-id">{props.metadataId}</span><span data-testid="url-label">{props.targetLabel}</span>+ <span data-testid="url-suggested">{props.suggestedUrl ?? ''}</span>+ <span data-testid="url-suggested-reason">{props.suggestedUrlReasonText ?? ''}</span>+ <span data-testid="url-suggested-diagnostic">{props.suggestedUrlDiagnostic ?? ''}</span></div>),}));@@ -196,6 +202,7 @@ describe('GuestDrawer', () => {target_id: 'node1',service_name: 'Homepage Dashboard',service_type: 'homepage',+ service_version: '0.9.0',category: 'web_server',confidence: 0.95,cli_access: 'docker exec -it homepage /bin/sh',@@ -204,6 +211,10 @@ describe('GuestDrawer', () => {config_paths: ['/opt/homepage/config'],data_paths: [],log_paths: [],+ updated_at: '2026-05-18T09:49:19.049058+01:00',+ suggested_url: 'http://192.0.2.10:3000',+ suggested_url_source_code: 'web_port_inference',+ suggested_url_source_detail: 'detected 3000/tcp',} as unknown as import('@/types/discovery').ResourceDiscovery);render(() => <GuestDrawer guest={makeGuest()} onClose={vi.fn()} />);@@ -213,8 +224,12 @@ describe('GuestDrawer', () => {});expect(screen.getByText('Homepage Dashboard')).toBeInTheDocument();expect(screen.getByText('web_server')).toBeInTheDocument();+ expect(screen.getByText('0.9.0')).toBeInTheDocument();expect(screen.getByText('95%')).toBeInTheDocument();+ expect(screen.getAllByText('http://192.0.2.10:3000').length).toBeGreaterThan(0);expect(screen.getByText('docker exec -it homepage /bin/sh')).toBeInTheDocument();+ expect(screen.getByTestId('url-suggested')).toHaveTextContent('http://192.0.2.10:3000');+ expect(screen.getByTestId('url-suggested-reason')).toHaveTextContent('Detected 3000/tcp');});it('hides the Identified Service card when the discovery record is null or empty', async () => {@@ -228,8 +243,7 @@ describe('GuestDrawer', () => {it('keeps the passive discovery lookup out of the parent Suspense fallback', () => {discoveryApiMocks.getDiscovery.mockImplementationOnce(- () =>- new Promise<import('@/types/discovery').ResourceDiscovery | null>(() => undefined),+ () => new Promise<import('@/types/discovery').ResourceDiscovery | null>(() => undefined),);render(() => (diff --git a/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx b/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsxindex e5782f9687..a399b9a896 100644--- a/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx+++ b/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx@@ -1,5 +1,6 @@import { For, Show } from 'solid-js';+import { formatDiscoveryAge } from '@/api/discovery';import { WebInterfaceUrlField } from '@/components/shared/WebInterfaceUrlField';import type { DiscoveryIdentifiedSummary } from '@/utils/discoveryPresentation';import { formatBytes, formatUptime } from '@/utils/format';@@ -69,6 +70,28 @@ export function GuestDrawerOverview(props: GuestDrawerOverviewProps) {</span></div></Show>+ <Show when={summary().serviceVersion}>+ <div class="flex items-center justify-between gap-2">+ <span class="text-muted">Version</span>+ <span+ class="font-medium text-base-content truncate ml-2"+ title={summary().serviceVersion}+ >+ {summary().serviceVersion}+ </span>+ </div>+ </Show>+ <Show when={summary().suggestedUrl}>+ <div class="flex items-center justify-between gap-2">+ <span class="text-muted">Endpoint</span>+ <span+ class="font-medium text-base-content truncate ml-2"+ title={summary().suggestedUrl}+ >+ {summary().suggestedUrl}+ </span>+ </div>+ </Show><Show when={summary().portCount > 0}><div class="flex items-center justify-between gap-2"><span class="text-muted">Ports</span>@@ -83,9 +106,12 @@ export function GuestDrawerOverview(props: GuestDrawerOverviewProps) {{summary().cliAccess}</div></Show>- <p class="text-[10px] text-muted pt-1">- Full details in the Discovery tab.- </p>+ <div class="flex flex-wrap gap-1 pt-1 text-[10px] text-muted">+ <span>{summary().sourceLabel}</span>+ <Show when={summary().observedAt}>+ <span>· {formatDiscoveryAge(summary().observedAt!)}</span>+ </Show>+ </div></div></div>)}@@ -297,6 +323,10 @@ export function GuestDrawerOverview(props: GuestDrawerOverviewProps) {targetLabel={props.webInterfaceTargetLabel}customUrl={props.customUrl}onCustomUrlChange={(url) => props.onCustomUrlChange?.(props.guestId, url)}+ suggestedUrl={props.discoveryIdentifiedSummary?.suggestedUrl}+ suggestedUrlReasonText={props.discoveryIdentifiedSummary?.suggestedUrlReasonText}+ suggestedUrlReasonTitle={props.discoveryIdentifiedSummary?.suggestedUrlReasonTitle}+ suggestedUrlDiagnostic={props.discoveryIdentifiedSummary?.suggestedUrlDiagnostic}/></div></div>diff --git a/frontend-modern/src/components/shared/WebInterfaceUrlField.tsx b/frontend-modern/src/components/shared/WebInterfaceUrlField.tsxindex 32d196dbec..fe5f335a27 100644--- a/frontend-modern/src/components/shared/WebInterfaceUrlField.tsx+++ b/frontend-modern/src/components/shared/WebInterfaceUrlField.tsx@@ -1,4 +1,7 @@import { Component, Show } from 'solid-js';+import CheckIcon from 'lucide-solid/icons/check';+import CopyIcon from 'lucide-solid/icons/copy';+import ExternalLinkIcon from 'lucide-solid/icons/external-link';import { useWebInterfaceUrlFieldState } from './useWebInterfaceUrlFieldState';import type { WebInterfaceUrlFieldProps } from './webInterfaceUrlFieldModel';@@ -9,7 +12,7 @@ export const WebInterfaceUrlField: Component<WebInterfaceUrlFieldProps> = (propsconst title = () => props.title?.trim() || 'Web Interface URL';const rootClass = () =>props.embedded- ? props.class ?? ''+ ? (props.class ?? ''): `rounded border border-border bg-surface p-3 shadow-sm ${props.class ?? ''}`.trim();return (@@ -18,10 +21,10 @@ export const WebInterfaceUrlField: Component<WebInterfaceUrlFieldProps> = (props<div class="text-[11px] font-medium uppercase tracking-wide text-base-content mb-2">{title()}</div>- <div class="flex items-center gap-2">+ <div class="flex flex-wrap items-center gap-2"><inputtype="url"- class="flex-1 text-xs px-2.5 py-1.5 border border-border rounded-md bg-surface text-base-content focus:ring-1 focus:ring-blue-500 focus:border-blue-500 transition-colors"+ class="min-w-[180px] flex-1 text-xs px-2.5 py-1.5 border border-border rounded-md bg-surface text-base-content focus:ring-1 focus:ring-blue-500 focus:border-blue-500 transition-colors"placeholder="https://198.51.100.100:8080"value={state.urlValue()}onInput={(e) => state.setUrlValue(e.currentTarget.value)}@@ -45,12 +48,29 @@ export const WebInterfaceUrlField: Component<WebInterfaceUrlFieldProps> = (propshref={state.normalizedCurrentUrl()}target="_blank"rel="noopener noreferrer"- class="px-2.5 py-1.5 text-xs font-medium rounded-md text-blue-600 hover:bg-blue-50 dark:text-blue-400 dark:hover:bg-blue-900 transition-colors"+ class="inline-flex min-h-8 min-w-8 items-center justify-center rounded-md text-blue-600 transition-colors hover:bg-blue-50 dark:text-blue-400 dark:hover:bg-blue-900"title="Open URL"+ aria-label="Open URL">- Open+ <ExternalLinkIcon class="h-3.5 w-3.5" /></a></Show>+ <Show when={state.normalizedCurrentUrl()}>+ <button+ type="button"+ class="inline-flex min-h-8 min-w-8 items-center justify-center rounded-md text-muted transition-colors hover:bg-surface-hover hover:text-base-content"+ onClick={() => void state.handleCopyUrl(state.normalizedCurrentUrl())}+ title="Copy URL"+ aria-label="Copy URL"+ >+ <Show+ when={state.copiedUrlValue() === state.normalizedCurrentUrl()}+ fallback={<CopyIcon class="h-3.5 w-3.5" />}+ >+ <CheckIcon class="h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400" />+ </Show>+ </button>+ </Show><Show when={state.normalizedCurrentUrl()}><buttontype="button"@@ -103,13 +123,37 @@ export const WebInterfaceUrlField: Component<WebInterfaceUrlFieldProps> = (propsWhy this URL: {props.suggestedUrlReasonText}</p></Show>- <div class="flex items-center gap-2">+ <div class="flex flex-wrap items-center gap-2"><code- class="flex-1 text-xs text-blue-800 dark:text-blue-200 font-mono truncate"+ class="min-w-[180px] flex-1 text-xs text-blue-800 dark:text-blue-200 font-mono truncate"title={state.normalizedSuggestedUrl()}>{state.normalizedSuggestedUrl()}</code>+ <a+ href={state.normalizedSuggestedUrl()}+ target="_blank"+ rel="noopener noreferrer"+ class="inline-flex min-h-7 min-w-7 shrink-0 items-center justify-center rounded text-blue-700 transition-colors hover:bg-blue-100 dark:text-blue-200 dark:hover:bg-blue-950"+ title="Open suggested URL"+ aria-label="Open suggested URL"+ >+ <ExternalLinkIcon class="h-3.5 w-3.5" />+ </a>+ <button+ type="button"+ class="inline-flex min-h-7 min-w-7 shrink-0 items-center justify-center rounded text-blue-700 transition-colors hover:bg-blue-100 dark:text-blue-200 dark:hover:bg-blue-950"+ onClick={() => void state.handleCopyUrl(state.normalizedSuggestedUrl())}+ title="Copy suggested URL"+ aria-label="Copy suggested URL"+ >+ <Show+ when={state.copiedUrlValue() === state.normalizedSuggestedUrl()}+ fallback={<CopyIcon class="h-3.5 w-3.5" />}+ >+ <CheckIcon class="h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400" />+ </Show>+ </button><buttontype="button"class="px-2 py-1 text-xs font-medium rounded bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 transition-colors flex-shrink-0"diff --git a/frontend-modern/src/components/shared/__tests__/WebInterfaceUrlField.test.tsx b/frontend-modern/src/components/shared/__tests__/WebInterfaceUrlField.test.tsxindex c428a62fd7..9c853ef506 100644--- a/frontend-modern/src/components/shared/__tests__/WebInterfaceUrlField.test.tsx+++ b/frontend-modern/src/components/shared/__tests__/WebInterfaceUrlField.test.tsx@@ -18,8 +18,13 @@ vi.mock('@/api/agentMetadata', () => ({},}));+vi.mock('@/utils/clipboard', () => ({+ copyToClipboard: vi.fn(async () => true),+}));+import { AgentMetadataAPI } from '@/api/agentMetadata';import { WebInterfaceUrlField } from '@/components/shared/WebInterfaceUrlField';+import { copyToClipboard } from '@/utils/clipboard';describe('WebInterfaceUrlField', () => {afterEach(() => {@@ -37,7 +42,10 @@ describe('WebInterfaceUrlField', () => {expect(webInterfaceUrlFieldStateSource).toContain('GuestMetadataAPI.getMetadata');expect(webInterfaceUrlFieldStateSource).toContain('AgentMetadataAPI.updateMetadata');expect(webInterfaceUrlFieldStateSource).toContain('createSignal');- expect(webInterfaceUrlFieldStateSource).toContain('export function useWebInterfaceUrlFieldState');+ expect(webInterfaceUrlFieldStateSource).toContain('copyToClipboard');+ expect(webInterfaceUrlFieldStateSource).toContain(+ 'export function useWebInterfaceUrlFieldState',+ );expect(webInterfaceUrlFieldModelSource).toContain('validateWebInterfaceCustomUrl');expect(webInterfaceUrlFieldModelSource).toContain('getWebInterfaceSuggestedUrlFallback');@@ -112,4 +120,34 @@ describe('WebInterfaceUrlField', () => {expect(await screen.findByText('No suggested URL available')).toBeInTheDocument();expect(screen.getByText('No management interface could be inferred.')).toBeInTheDocument();});++ it('offers discovered URL copy, open, and adopt actions without saving automatically', async () => {+ render(() => (+ <WebInterfaceUrlField+ metadataKind="guest"+ metadataId="guest-1"+ customUrl=""+ suggestedUrl="http://192.0.2.10:8123"+ suggestedUrlReasonText="Detected web port"+ />+ ));++ expect(await screen.findByText('Suggested URL')).toBeInTheDocument();+ expect(screen.getByText('http://192.0.2.10:8123')).toBeInTheDocument();+ expect(screen.getByRole('link', { name: 'Open suggested URL' })).toHaveAttribute(+ 'href',+ 'http://192.0.2.10:8123',+ );++ fireEvent.click(screen.getByRole('button', { name: 'Copy suggested URL' }));+ await waitFor(() => {+ expect(copyToClipboard).toHaveBeenCalledWith('http://192.0.2.10:8123');+ });++ fireEvent.click(screen.getByRole('button', { name: 'Use this' }));+ expect(AgentMetadataAPI.updateMetadata).not.toHaveBeenCalled();+ expect(screen.getByPlaceholderText('https://198.51.100.100:8080')).toHaveValue(+ 'http://192.0.2.10:8123',+ );+ });});diff --git a/frontend-modern/src/components/shared/useWebInterfaceUrlFieldState.ts b/frontend-modern/src/components/shared/useWebInterfaceUrlFieldState.tsindex 59005f0083..918961585f 100644--- a/frontend-modern/src/components/shared/useWebInterfaceUrlFieldState.ts+++ b/frontend-modern/src/components/shared/useWebInterfaceUrlFieldState.ts@@ -1,6 +1,7 @@import { createEffect, createMemo, createSignal, onCleanup } from 'solid-js';import { GuestMetadataAPI } from '@/api/guestMetadata';import { AgentMetadataAPI } from '@/api/agentMetadata';+import { copyToClipboard } from '@/utils/clipboard';import {getWebInterfaceSuggestedUrlFallback,getWebInterfaceTargetLabel,@@ -17,7 +18,9 @@ export function useWebInterfaceUrlFieldState(props: WebInterfaceUrlFieldProps) {const [urlSaving, setUrlSaving] = createSignal(false);const [urlError, setUrlError] = createSignal<string | null>(null);const [urlSuccess, setUrlSuccess] = createSignal<string | null>(null);+ const [copiedUrlValue, setCopiedUrlValue] = createSignal('');let urlSuccessTimer: ReturnType<typeof setTimeout> | undefined;+ let copyFeedbackTimer: ReturnType<typeof setTimeout> | undefined;const metadataId = createMemo(() => normalizeWebInterfaceUrl(props.metadataId));const targetLabel = createMemo(() =>@@ -49,8 +52,15 @@ export function useWebInterfaceUrlFieldState(props: WebInterfaceUrlFieldProps) {urlSuccessTimer = undefined;};+ const clearCopyFeedbackTimer = () => {+ if (!copyFeedbackTimer) return;+ clearTimeout(copyFeedbackTimer);+ copyFeedbackTimer = undefined;+ };+onCleanup(() => {clearUrlSuccessTimer();+ clearCopyFeedbackTimer();});const setUrlSuccessMessage = (message: string) => {@@ -155,8 +165,24 @@ export function useWebInterfaceUrlFieldState(props: WebInterfaceUrlFieldProps) {}};+ const handleCopyUrl = async (value?: string | null) => {+ const trimmed = normalizeWebInterfaceUrl(value);+ if (!trimmed) return;+ const copied = await copyToClipboard(trimmed);+ if (!copied) return;++ clearCopyFeedbackTimer();+ setCopiedUrlValue(trimmed);+ copyFeedbackTimer = setTimeout(() => {+ setCopiedUrlValue('');+ copyFeedbackTimer = undefined;+ }, 2000);+ };+return {+ copiedUrlValue,currentCustomUrl,+ handleCopyUrl,handleDeleteUrl,handleSaveUrl,metadataId,diff --git a/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts b/frontend-modern/src/utils/__tests__/discoveryPresentation.test.tsindex e3162e211f..3800db734d 100644--- a/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/discoveryPresentation.test.ts@@ -8,12 +8,16 @@ import {getDiscoveryNoConnectedAgentMessage,getNetworkDiscoveryModePresentation,getDiscoveryNotesEmptyState,+ getDiscoveryObservedSourceLabel,getNetworkDiscoveryPriorityNotice,getNetworkDiscoverySectionPresentation,getNetworkDiscoverySubnetPresentation,getDiscoveryAnalysisProviderBadgeClass,getDiscoveryCategoryBadgeClass,+ getDiscoverySuggestedURLActionClass,+ getDiscoverySuggestedURLCardClass,getDiscoverySuggestedURLFallback,+ getDiscoverySuggestedURLReason,getDiscoveryURLSuggestionSourceLabel,} from '@/utils/discoveryPresentation';import type { ResourceDiscovery } from '@/types/discovery';@@ -34,6 +38,16 @@ describe('discoveryPresentation', () => {it('falls back to the generic discovery heuristic label', () => {expect(getDiscoveryURLSuggestionSourceLabel('')).toBe('Discovery heuristic');expect(getDiscoveryURLSuggestionSourceLabel('unknown-code')).toBe('Discovery heuristic');+ expect(getDiscoverySuggestedURLReason(null)).toEqual({ text: '', title: '' });+ expect(+ getDiscoverySuggestedURLReason({+ suggested_url_source_code: 'web_port_inference',+ suggested_url_source_detail: 'detected port 8080/tcp',+ }),+ ).toEqual({+ text: 'Detected port 8080/tcp',+ title: 'Detected web port: detected port 8080/tcp',+ });});it('returns canonical analysis provider badge classes', () => {@@ -44,6 +58,8 @@ describe('discoveryPresentation', () => {it('returns a canonical discovery category badge class', () => {expect(getDiscoveryCategoryBadgeClass()).toContain('bg-blue-100');expect(getDiscoveryCategoryBadgeClass()).toContain('text-blue-700');+ expect(getDiscoverySuggestedURLCardClass()).toContain('bg-blue-50');+ expect(getDiscoverySuggestedURLActionClass()).toContain('text-blue-700');});it('returns canonical discovery empty-state copy', () => {@@ -152,19 +168,36 @@ describe('discoveryPresentation', () => {target_id: 'delly',service_name: 'Homepage Dashboard',service_type: 'homepage',+ service_version: '0.9.0',category: 'web_server',confidence: 0.95,cli_access: 'docker exec -it homepage /bin/sh',- ports: [{ port: 3000, protocol: 'tcp', process: 'next-server', address: '0.0.0.0' }] as unknown as ResourceDiscovery['ports'],- facts: [{ key: 'os', value: 'Debian 12', source: 'os_release', category: 'security', confidence: 1, discovered_at: '' }] as unknown as ResourceDiscovery['facts'],+ ports: [+ { port: 3000, protocol: 'tcp', process: 'next-server', address: '0.0.0.0' },+ ] as unknown as ResourceDiscovery['ports'],+ facts: [+ {+ key: 'os',+ value: 'Debian 12',+ source: 'os_release',+ category: 'security',+ confidence: 1,+ discovered_at: '',+ },+ ] as unknown as ResourceDiscovery['facts'],config_paths: ['/opt/homepage/config'],data_paths: ['/opt/homepage/config'],log_paths: ['/var/log/syslog', '/var/log/daemon.log'],discovered_at: '2026-05-17T09:49:19.049058+01:00',+ updated_at: '2026-05-18T09:49:19.049058+01:00',+ suggested_url: 'http://192.0.2.10:3000',+ suggested_url_source_code: 'web_port_inference',+ suggested_url_source_detail: 'detected 3000/tcp',} as ResourceDiscovery;expect(getDiscoveryIdentifiedSummary(record)).toEqual({serviceName: 'Homepage Dashboard',serviceType: 'homepage',+ serviceVersion: '0.9.0',category: 'web_server',confidence: 0.95,confidencePercent: '95%',@@ -174,6 +207,36 @@ describe('discoveryPresentation', () => {dataPathCount: 1,logPathCount: 2,discoveredAt: '2026-05-17T09:49:19.049058+01:00',+ observedAt: '2026-05-18T09:49:19.049058+01:00',+ sourceLabel: getDiscoveryObservedSourceLabel(),+ suggestedUrl: 'http://192.0.2.10:3000',+ suggestedUrlReasonText: 'Detected 3000/tcp',+ suggestedUrlReasonTitle: 'Detected web port: detected 3000/tcp',+ suggestedUrlDiagnostic: undefined,+ hasEndpointCandidate: true,+ });+ });++ it('treats an endpoint-only discovery record as useful out-of-tab context', () => {+ expect(+ getDiscoveryIdentifiedSummary({+ id: 'docker:agent:container',+ resource_type: 'docker',+ resource_id: 'container',+ target_id: 'agent',+ service_name: 'Unknown',+ confidence: 0,+ ports: [],+ facts: [],+ config_paths: [],+ data_paths: [],+ log_paths: [],+ suggested_url: 'http://192.0.2.10:8123',+ } as unknown as ResourceDiscovery),+ ).toMatchObject({+ serviceName: 'Unidentified service',+ suggestedUrl: 'http://192.0.2.10:8123',+ hasEndpointCandidate: true,});});diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.tsindex 27c3132d3e..55f02bc3f8 100644--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts@@ -3143,7 +3143,8 @@ describe('frontend resource type boundaries', () => {expect(unifiedResourceTableViewportSyncSource).toContain('getBoundingClientRect');expect(unifiedResourceTableViewportSyncSource).toContain('hostWindowing.onScroll');expect(unifiedResourceTableViewportSyncSource).not.toContain('scrollIntoView');- expect(discoveryTabSource).toContain('getDiscoveryURLSuggestionSourceLabel');+ expect(discoveryTabSource).toContain('getDiscoverySuggestedURLReason');+ expect(discoveryTabSource).toContain('getDiscoveryObservedSourceLabel');expect(discoveryTabSource).toContain('getDiscoveryAnalysisProviderBadgeClass');expect(discoveryTabSource).toContain('getDiscoveryCategoryBadgeClass');expect(discoveryTabSource).toContain('getDiscoveryInitialEmptyState');@@ -3165,6 +3166,16 @@ describe('frontend resource type boundaries', () => {expect(discoveryPresentationSource).toContain('export function getDiscoveryURLSuggestionSourceLabel',);+ expect(discoveryPresentationSource).toContain('export function getDiscoverySuggestedURLReason');+ expect(discoveryPresentationSource).toContain(+ 'export function getDiscoveryObservedSourceLabel',+ );+ expect(discoveryPresentationSource).toContain(+ 'export function getDiscoverySuggestedURLCardClass',+ );+ expect(discoveryPresentationSource).toContain(+ 'export function getDiscoverySuggestedURLActionClass',+ );expect(discoveryTabSource).not.toContain('bg-blue-100 text-blue-700');expect(discoveryTabSource).not.toContain('bg-green-100 text-green-700');expect(discoveryTabSource).not.toContain('No discovery data yet');diff --git a/frontend-modern/src/utils/discoveryPresentation.ts b/frontend-modern/src/utils/discoveryPresentation.tsindex 4400b9d7ce..a01cd26fcc 100644--- a/frontend-modern/src/utils/discoveryPresentation.ts+++ b/frontend-modern/src/utils/discoveryPresentation.ts@@ -7,6 +7,7 @@ import {export interface DiscoveryIdentifiedSummary {serviceName: string;serviceType?: string;+ serviceVersion?: string;category?: string;confidence: number;confidencePercent: string;@@ -16,12 +17,28 @@ export interface DiscoveryIdentifiedSummary {dataPathCount: number;logPathCount: number;discoveredAt?: string;+ observedAt?: string;+ sourceLabel: string;+ suggestedUrl?: string;+ suggestedUrlReasonText?: string;+ suggestedUrlReasonTitle?: string;+ suggestedUrlDiagnostic?: string;+ hasEndpointCandidate: boolean;}+const OBSERVED_SOURCE_LABEL = 'Observed by Discovery';++const toSentence = (text?: string | null): string => {+ const trimmed = (text || '').trim();+ if (!trimmed) return '';+ const first = trimmed.charAt(0);+ return first.toUpperCase() + trimmed.slice(1);+};+// getDiscoveryIdentifiedSummary returns a compact presentation object for// surfaces outside the Discovery sub-tab (e.g. the workload drawer overview)-// to label a resource with its identified service. Returns null when the-// stored record has no meaningful identification — the gate mirrors+// to label a resource with its identified service and endpoint candidates.+// Returns null when the stored record has no meaningful observed context — the gate mirrors// hasValidDiscovery in useDiscoveryTabState so the same record either// renders in both surfaces or neither.export function getDiscoveryIdentifiedSummary(@@ -39,12 +56,27 @@ export function getDiscoveryIdentifiedSummary(const hasFacts = Array.isArray(discovery.facts) && discovery.facts.length > 0;const hasCli = typeof discovery.cli_access === 'string' && discovery.cli_access.trim().length > 0;const hasPaths = configPathCount + dataPathCount + logPathCount > 0;- if (!hasName && !hasConfidence && portCount === 0 && !hasFacts && !hasPaths && !hasCli) {+ const suggestedUrl = normalizeDiscoverySuggestedUrl(discovery.suggested_url);+ const hasEndpointCandidate =+ Boolean(suggestedUrl) ||+ (typeof discovery.suggested_url_diagnostic === 'string' &&+ discovery.suggested_url_diagnostic.trim().length > 0);+ if (+ !hasName &&+ !hasConfidence &&+ portCount === 0 &&+ !hasFacts &&+ !hasPaths &&+ !hasCli &&+ !hasEndpointCandidate+ ) {return null;}+ const suggestedUrlReason = getDiscoverySuggestedURLReason(discovery);return {serviceName: hasName ? serviceName : 'Unidentified service',serviceType: discovery.service_type?.trim() || undefined,+ serviceVersion: discovery.service_version?.trim() || undefined,category: discovery.category?.trim() || undefined,confidence,confidencePercent: `${Math.round(confidence * 100)}%`,@@ -54,9 +86,25 @@ export function getDiscoveryIdentifiedSummary(dataPathCount,logPathCount,discoveredAt: discovery.discovered_at || undefined,+ observedAt: discovery.updated_at || discovery.discovered_at || undefined,+ sourceLabel: OBSERVED_SOURCE_LABEL,+ suggestedUrl,+ suggestedUrlReasonText: suggestedUrlReason.text || undefined,+ suggestedUrlReasonTitle: suggestedUrlReason.title || undefined,+ suggestedUrlDiagnostic: discovery.suggested_url_diagnostic?.trim() || undefined,+ hasEndpointCandidate,};}+export function getDiscoveryObservedSourceLabel(): string {+ return OBSERVED_SOURCE_LABEL;+}++export function normalizeDiscoverySuggestedUrl(value?: string | null): string | undefined {+ const trimmed = (value || '').trim();+ return trimmed || undefined;+}+export function getDiscoveryURLSuggestionSourceLabel(code?: string | null): string {switch ((code || '').trim()) {case 'service_default_match':@@ -80,6 +128,26 @@ export function getDiscoveryURLSuggestionSourceLabel(code?: string | null): stri}}+export function getDiscoverySuggestedURLReason(+ discovery?: {+ suggested_url_source_code?: string | null;+ suggested_url_source_detail?: string | null;+ } | null,+) {+ if (!discovery) {+ return { text: '', title: '' } as const;+ }+ const detail = toSentence(discovery.suggested_url_source_detail);+ const label = getDiscoveryURLSuggestionSourceLabel(discovery.suggested_url_source_code);+ const title = discovery.suggested_url_source_detail+ ? `${label}: ${discovery.suggested_url_source_detail}`+ : label;+ return {+ text: detail || (discovery.suggested_url_source_code ? label : ''),+ title,+ } as const;+}+export function getDiscoveryAnalysisProviderBadgeClass(isLocal?: boolean | null): string {return isLocal? 'inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300'@@ -90,6 +158,26 @@ export function getDiscoveryCategoryBadgeClass(): string {return 'inline-block rounded bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-700 dark:bg-blue-900 dark:text-blue-200';}+export function getDiscoverySuggestedURLCardClass(): string {+ return 'rounded border border-blue-200 bg-blue-50 p-3 shadow-sm dark:border-blue-800 dark:bg-blue-900';+}++export function getDiscoverySuggestedURLHeadingClass(): string {+ return 'text-[11px] font-medium uppercase tracking-wide text-blue-800 dark:text-blue-200 mb-1';+}++export function getDiscoverySuggestedURLTextClass(): string {+ return 'text-blue-700 dark:text-blue-300';+}++export function getDiscoverySuggestedURLCodeClass(): string {+ return 'min-w-0 flex-1 rounded bg-blue-100 px-2 py-1.5 text-xs text-blue-800 dark:bg-blue-950 dark:text-blue-100 font-mono break-all';+}++export function getDiscoverySuggestedURLActionClass(): string {+ return 'inline-flex min-h-8 min-w-8 shrink-0 items-center justify-center rounded border border-blue-200 bg-blue-100 text-blue-700 transition-colors hover:bg-blue-200 dark:border-blue-700 dark:bg-blue-950 dark:text-blue-200 dark:hover:bg-blue-900';+}+export function getDiscoveryInitialEmptyState(loading: boolean) {return loading? {diff --git a/internal/ai/chat/context_prefetch.go b/internal/ai/chat/context_prefetch.goindex 195b28764a..eaefd5a824 100644--- a/internal/ai/chat/context_prefetch.go+++ b/internal/ai/chat/context_prefetch.go@@ -696,6 +696,12 @@ func (p *ContextPrefetcher) formatContextSummary(mentions []ResourceMention, dis// Add discovery info if availableif hasDiscovery {+ if discovery.ServiceVersion != "" {+ sb.WriteString(fmt.Sprintf("Service version: %s\n", discovery.ServiceVersion))+ }+ if discovery.SuggestedURL != "" {+ sb.WriteString(fmt.Sprintf("Suggested web URL: %s\n", discovery.SuggestedURL))+ }if len(discovery.ConfigPaths) > 0 {sb.WriteString(fmt.Sprintf("Config paths: %v\n", discovery.ConfigPaths))}@@ -749,6 +755,12 @@ func (p *ContextPrefetcher) formatContextSummary(mentions []ResourceMention, dis}sb.WriteString("\n")}+ if discovery.ServiceVersion != "" {+ sb.WriteString(fmt.Sprintf("Service version: %s\n", discovery.ServiceVersion))+ }+ if discovery.SuggestedURL != "" {+ sb.WriteString(fmt.Sprintf("Suggested web URL: %s\n", discovery.SuggestedURL))+ }// File paths - these are the verified paths to useif len(discovery.LogPaths) > 0 {diff --git a/internal/ai/tools/adapters.go b/internal/ai/tools/adapters.goindex 302df96f0c..75a5ce6902 100644--- a/internal/ai/tools/adapters.go+++ b/internal/ai/tools/adapters.go@@ -898,6 +898,7 @@ type DiscoverySourceData struct {LogPaths []stringPorts []DiscoverySourcePortDockerMounts []DiscoverySourceDockerMount // Docker bind mounts (for LXCs/VMs running Docker)+ SuggestedURL stringUserNotes stringConfidence float64AIReasoning stringdiff --git a/internal/ai/tools/executor.go b/internal/ai/tools/executor.goindex bcff2e723f..1b76315e0d 100644--- a/internal/ai/tools/executor.go+++ b/internal/ai/tools/executor.go@@ -391,6 +391,7 @@ type ResourceDiscoveryInfo struct {LogPaths []string `json:"log_paths,omitempty"` // Log file paths or commands (e.g., journalctl)Ports []DiscoveryPortInfo `json:"ports"`BindMounts []DiscoveryMount `json:"bind_mounts,omitempty"` // For Docker: host->container path mappings+ SuggestedURL string `json:"suggested_url,omitempty"`UserNotes string `json:"user_notes,omitempty"`Confidence float64 `json:"confidence"`AIReasoning string `json:"ai_reasoning,omitempty"`diff --git a/internal/ai/tools/tools_discovery.go b/internal/ai/tools/tools_discovery.goindex c0c91e9826..17e54b4631 100644--- a/internal/ai/tools/tools_discovery.go+++ b/internal/ai/tools/tools_discovery.go@@ -464,6 +464,10 @@ func buildDiscoveryToolResponse(req discoveryResourceRequest, discovery *Resourc"updated_at": discovery.UpdatedAt,}+ if discovery.SuggestedURL != "" {+ response["suggested_url"] = discovery.SuggestedURL+ }+// Add log paths if we have them (from fallback or discovery)if len(responseLogPaths) > 0 {response["log_paths"] = responseLogPathsdiff --git a/internal/ai/tools/tools_discovery_test.go b/internal/ai/tools/tools_discovery_test.goindex 27698ac979..3dc9d84475 100644--- a/internal/ai/tools/tools_discovery_test.go+++ b/internal/ai/tools/tools_discovery_test.go@@ -336,6 +336,7 @@ func TestExecuteGetDiscovery_CanonicalAppContainerUsesDockerProviderType(t *testResourceID: "abc123",TargetID: "agent-1",Hostname: "docker-host-1",+ SuggestedURL: "http://192.0.2.10:8080",},}exec := NewPulseToolExecutor(ExecutorConfig{DiscoveryProvider: provider})@@ -354,6 +355,7 @@ func TestExecuteGetDiscovery_CanonicalAppContainerUsesDockerProviderType(t *testvar payload map[string]interface{}assert.NoError(t, json.Unmarshal([]byte(result.Content[0].Text), &payload))assert.Equal(t, "app-container", payload["resource_type"])+ assert.Equal(t, "http://192.0.2.10:8080", payload["suggested_url"])}func TestExecuteRunDiscovery_ForcesFreshDiscovery(t *testing.T) {diff --git a/internal/servicediscovery/formatters.go b/internal/servicediscovery/formatters.goindex 45c459902b..ea89fb4339 100644--- a/internal/servicediscovery/formatters.go+++ b/internal/servicediscovery/formatters.go@@ -53,6 +53,10 @@ func formatSingleDiscovery(d *ResourceDiscovery) string {sb.WriteString(fmt.Sprintf("- **Version:** %s\n", d.ServiceVersion))}+ if d.SuggestedURL != "" {+ sb.WriteString(fmt.Sprintf("- **Suggested Web URL:** %s\n", d.SuggestedURL))+ }+if d.Category != "" && d.Category != CategoryUnknown {sb.WriteString(fmt.Sprintf("- **Category:** %s\n", d.Category))}diff --git a/internal/servicediscovery/formatters_test.go b/internal/servicediscovery/formatters_test.goindex fcf0946fa2..8c59f764ba 100644--- a/internal/servicediscovery/formatters_test.go+++ b/internal/servicediscovery/formatters_test.go@@ -26,6 +26,7 @@ func TestFormattersAndTables(t *testing.T) {ConfigPaths: []string{"/etc/app/config.yml"},DataPaths: []string{"/var/lib/app"},Ports: []PortInfo{{Port: 80, Protocol: "tcp"}},+ SuggestedURL: "http://host1",UserNotes: "keepalive enabled",Facts: []DiscoveryFact{{Category: FactCategoryHardware, Key: "gpu", Value: "nvidia", Confidence: 0.9},@@ -40,6 +41,9 @@ func TestFormattersAndTables(t *testing.T) {if !strings.Contains(ctx, "docker exec") || !strings.Contains(ctx, "User Notes") {t.Fatalf("missing expected fields in context")}+ if !strings.Contains(ctx, "Suggested Web URL") || !strings.Contains(ctx, "http://host1") {+ t.Fatalf("missing suggested URL in context")+ }if FormatSingleForAIContext(nil) != "" {t.Fatalf("expected empty string for nil discovery")diff --git a/internal/servicediscovery/tools_adapter.go b/internal/servicediscovery/tools_adapter.goindex ea51d8dec4..650b47b080 100644--- a/internal/servicediscovery/tools_adapter.go+++ b/internal/servicediscovery/tools_adapter.go@@ -169,6 +169,7 @@ func (a *ToolsAdapter) convertToSourceData(d *ResourceDiscovery) tools.DiscoveryLogPaths: d.LogPaths,Ports: ports,DockerMounts: dockerMounts,+ SuggestedURL: d.SuggestedURL,UserNotes: d.UserNotes,Confidence: d.Confidence,AIReasoning: d.AIReasoning,@@ -231,6 +232,7 @@ func (a *ToolsAdapter) convertFromSourceData(sd tools.DiscoverySourceData) *ResoLogPaths: sd.LogPaths,Ports: ports,DockerMounts: dockerMounts,+ SuggestedURL: sd.SuggestedURL,UserNotes: sd.UserNotes,Confidence: sd.Confidence,AIReasoning: sd.AIReasoning,diff --git a/internal/servicediscovery/tools_adapter_test.go b/internal/servicediscovery/tools_adapter_test.goindex b8f70baf95..b84f54427c 100644--- a/internal/servicediscovery/tools_adapter_test.go+++ b/internal/servicediscovery/tools_adapter_test.go@@ -54,6 +54,7 @@ func TestToolsAdapter_GetDiscovery(t *testing.T) {Ports: []PortInfo{{Port: 80, Protocol: "tcp", Process: "nginx", Address: "0.0.0.0"},},+ SuggestedURL: "http://localhost",DockerMounts: []DockerBindMount{{ContainerName: "nginx", Source: "/host/data", Destination: "/container/data", Type: "bind", ReadOnly: true},},@@ -71,6 +72,7 @@ func TestToolsAdapter_GetDiscovery(t *testing.T) {assert.Equal(t, discovery.TargetID, result.TargetID)assert.Empty(t, result.AgentID)assert.Equal(t, discovery.ServiceName, result.ServiceName)+ assert.Equal(t, discovery.SuggestedURL, result.SuggestedURL)// Check facts conversionrequire.Len(t, result.Facts, 1)