JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
feat(a2a): enhance A2A outbound management with enterprise features
NickFuryXXX8e45ca33502e
diff --git a/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/A2AOutboundPanel.tsx b/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/A2AOutboundPanel.tsxindex 8a8eac88dc..cc800f71f1 100644--- a/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/A2AOutboundPanel.tsx+++ b/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/A2AOutboundPanel.tsx@@ -2,6 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';import { createPortal } from 'react-dom';import { useTranslation } from 'react-i18next';import { ChevronDown, Plus, Power, RefreshCw, Search, Server, Trash2, X } from 'lucide-react';+import { isEnterprise } from '../../edition';import type { WebError } from '../../types/websocket';import { Switch } from '../Switch';import { A2AOutboundCredentialInput } from './A2AOutboundCredentialInput';@@ -33,6 +34,7 @@ const errorMessage = (error: unknown): string => (error as WebError)?.message ||export function A2AOutboundPanel({ isConnected, request, headerActionsContainer }: Props) {const { t, i18n } = useTranslation();+ const enterpriseMode = isEnterprise();const [url, setUrl] = useState('');const [discovery, setDiscovery] = useState<A2AOutboundDiscovery | null>(null);const [discoveryDrawerOpen, setDiscoveryDrawerOpen] = useState(false);@@ -68,19 +70,23 @@ export function A2AOutboundPanel({ isConnected, request, headerActionsContainerif (!isConnected) return;const generation = generationRef.current.next();try {- const [payload, rawSettings] = await Promise.all([request('a2a.outbound.list'), request('a2a.outbound.settings.get')]);+ const [payload, rawSettings] = enterpriseMode+ ? [await request('a2a.outbound.list'), null]+ : await Promise.all([request('a2a.outbound.list'), request('a2a.outbound.settings.get')]);if (!generationRef.current.accepts(generation)) return;const next = normalizeA2AOutboundList(payload);- const settings = normalizeA2AOutboundSettings(rawSettings);- if (!next || !settings) throw new Error(t('a2aIngress.outbound.errors.invalidResponse'));+ const settings = enterpriseMode ? null : normalizeA2AOutboundSettings(rawSettings);+ if (!next || (!enterpriseMode && !settings)) throw new Error(t('a2aIngress.outbound.errors.invalidResponse'));setAgents(next);- setAllowLoopbackHttp(settings.allow_loopback_http);- setSavedAllowLoopbackHttp(settings.allow_loopback_http);+ if (settings) {+ setAllowLoopbackHttp(settings.allow_loopback_http);+ setSavedAllowLoopbackHttp(settings.allow_loopback_http);+ }setError(null);} catch (nextError) {if (generationRef.current.accepts(generation)) setError(errorMessage(nextError));}- }, [isConnected, request, t]);+ }, [enterpriseMode, isConnected, request, t]);useEffect(() => {void refresh();@@ -192,7 +198,11 @@ export function A2AOutboundPanel({ isConnected, request, headerActionsContainergenerationRef.current.next();try {let payload: unknown;- if (operation === 'toggle') payload = await request('a2a.outbound.update', { agent_id: agent.agent_id, enabled: !agent.enabled });+ if (operation === 'toggle') {+ payload = enterpriseMode+ ? await request('a2a.outbound.enabled.update', { agent_id: agent.agent_id, user_enabled: !agent.user_enabled })+ : await request('a2a.outbound.update', { agent_id: agent.agent_id, enabled: !agent.enabled });+ }else if (operation === 'refresh') payload = await request('a2a.outbound.refresh', { agent_id: agent.agent_id });else if (operation === 'confirm' || operation === 'reject')payload = await request('a2a.outbound.confirm_revision', { agent_id: agent.agent_id, accept: operation === 'confirm' });@@ -276,7 +286,7 @@ export function A2AOutboundPanel({ isConnected, request, headerActionsContainerreturn (<div className="flex min-h-0 flex-1 flex-col gap-4 pr-1">- {headerActionsContainer &&+ {!enterpriseMode && headerActionsContainer &&createPortal(<buttontype="button"@@ -305,7 +315,7 @@ export function A2AOutboundPanel({ isConnected, request, headerActionsContainer</Notice>)}- {discoveryDrawerOpen && (+ {!enterpriseMode && discoveryDrawerOpen && (<div className="fixed inset-0 z-[1400] flex justify-end bg-overlay-cron-drawer" onClick={closeDiscoveryDrawer}><sectionrole="dialog"@@ -462,7 +472,9 @@ export function A2AOutboundPanel({ isConnected, request, headerActionsContainer<h3 className="text-sm font-semibold text-text">{t('a2aIngress.outbound.list.title')}</h3><span className="rounded-full bg-secondary px-2 py-0.5 text-xs text-text-muted">{agents.length}</span></div>- <p className="mt-1 text-xs text-text-muted">{t('a2aIngress.outbound.list.description')}</p>+ <p className="mt-1 text-xs text-text-muted">+ {t(enterpriseMode ? 'a2aIngress.outbound.list.enterpriseDescription' : 'a2aIngress.outbound.list.description')}+ </p></div><div className="flex flex-wrap gap-2"><button type="button" className="btn secondary" onClick={() => void refresh()} disabled={!isConnected || !!busy}>@@ -472,7 +484,9 @@ export function A2AOutboundPanel({ isConnected, request, headerActionsContainer</div></div>{agents.length === 0 ? (- <div className="grid min-h-0 flex-1 place-items-center px-4 py-12 text-center text-sm text-text-muted">{t('a2aIngress.outbound.list.empty')}</div>+ <div className="grid min-h-0 flex-1 place-items-center px-4 py-12 text-center text-sm text-text-muted">+ {t(enterpriseMode ? 'a2aIngress.outbound.list.enterpriseEmpty' : 'a2aIngress.outbound.list.empty')}+ </div>) : (<div className="grid min-h-0 flex-1 content-start gap-3 overflow-auto p-4">{agents.map(agent => {@@ -492,29 +506,35 @@ export function A2AOutboundPanel({ isConnected, request, headerActionsContainer{t(`a2aIngress.outbound.availability.${agent.availability}`)}</span><span className="rounded-full bg-secondary px-2 py-0.5 text-xs text-text-muted">- {agent.enabled ? t('a2aIngress.outbound.enabled') : t('a2aIngress.outbound.disabled')}+ {enterpriseMode && !agent.manager_enabled+ ? t('a2aIngress.outbound.managerDisabled')+ : agent.effective_enabled+ ? t('a2aIngress.outbound.enabled')+ : t('a2aIngress.outbound.disabled')}</span></div><div className="mt-1 break-all font-mono text-xs text-text-muted">{agent.selected_interface.url}</div></div></div>- <div className="mt-4 grid gap-3 rounded-lg border border-border bg-secondary/20 p-3 sm:grid-cols-2 xl:grid-cols-4">+ <div className={`mt-4 grid gap-3 rounded-lg border border-border bg-secondary/20 p-3 sm:grid-cols-2 ${enterpriseMode ? 'xl:grid-cols-3' : 'xl:grid-cols-4'}`}><Valuelabel={t('a2aIngress.outbound.fields.protocol')}value={`${agent.selected_interface.protocol_binding} ${agent.selected_interface.protocol_version}`}/><Value label={t('a2aIngress.outbound.fields.revision')} value={String(agent.card_revision)} />- <Value- label={t('a2aIngress.outbound.fields.credentialState')}- value={agent.has_credential ? t('a2aIngress.outbound.configured') : t('a2aIngress.outbound.notConfigured')}- />+ {!enterpriseMode && (+ <Value+ label={t('a2aIngress.outbound.fields.credentialState')}+ value={agent.has_credential ? t('a2aIngress.outbound.configured') : t('a2aIngress.outbound.notConfigured')}+ />+ )}<Valuelabel={t('a2aIngress.outbound.fields.lastChecked')}value={agent.last_checked_at ? formatTime(agent.last_checked_at, i18n.language) : '-'}/></div>{agent.last_error_summary && <p className="mt-3 rounded-md bg-danger/10 px-3 py-2 text-xs text-danger">{agent.last_error_summary}</p>}- <div className="mt-4 border-t border-border pt-3">+ {!enterpriseMode && <div className="mt-4 border-t border-border pt-3"><buttontype="button"className="flex w-full items-center justify-between gap-3 text-left text-sm font-medium text-text-muted hover:text-text"@@ -575,8 +595,8 @@ export function A2AOutboundPanel({ isConnected, request, headerActionsContainer</div></div>)}- </div>- {agent.availability === 'review_required' && (+ </div>}+ {!enterpriseMode && agent.availability === 'review_required' && (<div className="mt-4 rounded-lg border border-warn/30 bg-warn/10 p-3 text-sm"><p>{t('a2aIngress.outbound.reviewRequired')}</p><PendingDiff agent={agent} label={t('a2aIngress.outbound.endpointChange')} />@@ -591,25 +611,41 @@ export function A2AOutboundPanel({ isConnected, request, headerActionsContainer</div>)}</div>- <div className="flex flex-wrap justify-end gap-2 border-t border-border bg-secondary/10 px-4 py-3">- <button- type="button"- className="btn secondary"- onClick={() => void operate(agent, 'toggle')}- disabled={!!busy || agent.availability === 'review_required'}- >- <Power size={16} />- {agent.enabled ? t('a2aIngress.outbound.disable') : t('a2aIngress.outbound.enable')}- </button>- <button type="button" className="btn secondary" onClick={() => void operate(agent, 'refresh')} disabled={!!busy}>- <RefreshCw size={16} />- {t('a2aIngress.outbound.refresh')}- </button>- <button type="button" className="btn secondary text-danger" onClick={() => void operate(agent, 'delete')} disabled={!!busy}>- <Trash2 size={16} />- {t('common.delete')}- </button>- </div>+ {enterpriseMode ? (+ <div className="flex items-center justify-end gap-3 border-t border-border bg-secondary/10 px-4 py-3">+ <span className="text-sm text-text-muted">+ {agent.manager_enabled+ ? t(agent.user_enabled ? 'a2aIngress.outbound.disable' : 'a2aIngress.outbound.enable')+ : t('a2aIngress.outbound.managerDisabled')}+ </span>+ <Switch+ checked={agent.user_enabled}+ onChange={() => void operate(agent, 'toggle')}+ disabled={!isConnected || !!busy || !agent.manager_enabled}+ title={agent.manager_enabled ? t('a2aIngress.outbound.userToggle') : t('a2aIngress.outbound.managerDisabled')}+ />+ </div>+ ) : (+ <div className="flex flex-wrap justify-end gap-2 border-t border-border bg-secondary/10 px-4 py-3">+ <button+ type="button"+ className="btn secondary"+ onClick={() => void operate(agent, 'toggle')}+ disabled={!!busy || agent.availability === 'review_required'}+ >+ <Power size={16} />+ {agent.enabled ? t('a2aIngress.outbound.disable') : t('a2aIngress.outbound.enable')}+ </button>+ <button type="button" className="btn secondary" onClick={() => void operate(agent, 'refresh')} disabled={!!busy}>+ <RefreshCw size={16} />+ {t('a2aIngress.outbound.refresh')}+ </button>+ <button type="button" className="btn secondary text-danger" onClick={() => void operate(agent, 'delete')} disabled={!!busy}>+ <Trash2 size={16} />+ {t('common.delete')}+ </button>+ </div>+ )}</article>);})}diff --git a/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/a2aIngressPanelState.ts b/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/a2aIngressPanelState.tsindex 4b36d0b99f..c355a86dad 100644--- a/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/a2aIngressPanelState.ts+++ b/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/a2aIngressPanelState.ts@@ -93,6 +93,7 @@ export type A2AOutboundDispatchStatus =export interface A2AOutboundDispatchRecord {dispatch_id: string;agent_id: string;+ agent_name: string;mode: 'sync' | 'async';status: A2AOutboundDispatchStatus;remote_task_id: string | null;@@ -260,6 +261,7 @@ export function normalizeA2AOutboundDispatchHistory(value: unknown): A2AOutbounditems.push({dispatch_id: dispatchId,agent_id: agentId,+ agent_name: asString(item.agent_name).trim() || agentId,mode: mode as 'sync' | 'async',status,remote_task_id: typeof item.remote_task_id === 'string' ? item.remote_task_id : null,diff --git a/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/a2aOutboundPanelState.ts b/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/a2aOutboundPanelState.tsindex 4b8ea53cda..f0d7846a3b 100644--- a/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/a2aOutboundPanelState.ts+++ b/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/a2aOutboundPanelState.ts@@ -31,6 +31,9 @@ export interface A2AOutboundAgent {agent_card: Record<string, unknown>;selected_interface: A2AOutboundInterface;enabled: boolean;+ manager_enabled: boolean;+ user_enabled: boolean;+ effective_enabled: boolean;availability: A2AOutboundAvailability;has_credential: boolean;connect_timeout_seconds: number;@@ -92,13 +95,17 @@ export function normalizeA2AOutboundAgent(value: unknown): A2AOutboundAgent | nuconst availability = asString(item.availability) as A2AOutboundAvailability;const selectedInterface = normalizeInterface(item.selected_interface);if (!asString(item.agent_id) || !selectedInterface || !['available', 'unreachable', 'incompatible', 'review_required'].includes(availability)) return null;+ const enabled = item.enabled === true;return {agent_id: asString(item.agent_id),display_name: asString(item.display_name),card_revision: asNumber(item.card_revision),agent_card: item.agent_card && typeof item.agent_card === 'object' ? (item.agent_card as Record<string, unknown>) : {},selected_interface: selectedInterface,- enabled: item.enabled === true,+ enabled,+ manager_enabled: typeof item.manager_enabled === 'boolean' ? item.manager_enabled : enabled,+ user_enabled: typeof item.user_enabled === 'boolean' ? item.user_enabled : enabled,+ effective_enabled: typeof item.effective_enabled === 'boolean' ? item.effective_enabled : enabled,availability,has_credential: item.has_credential === true,connect_timeout_seconds: asNumber(item.connect_timeout_seconds),diff --git a/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/index.tsx b/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/index.tsxindex f94a0c28ad..8c65fc6cfe 100644--- a/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/index.tsx+++ b/jiuwenswarm/channels/web/frontend/src/components/A2AIngressPanel/index.tsx@@ -1,6 +1,7 @@import { useCallback, useEffect, useRef, useState, type ReactNode } from 'react';import { useTranslation } from 'react-i18next';import { Check, Copy, Power, RefreshCw, RotateCw, X } from 'lucide-react';+import { isEnterprise } from '../../edition';import type { WebError } from '../../types/websocket';import { A2AOutboundPanel } from './A2AOutboundPanel';import { A2AIngressSecurityFields } from './A2AIngressSecurityFields';@@ -46,7 +47,8 @@ function errorMessage(error: unknown): string {export function A2AIngressPanel({ isConnected, request }: A2AIngressPanelProps) {const { t, i18n } = useTranslation();- const [activeTab, setActiveTab] = useState<'config' | 'outbound' | 'history'>('config');+ const enterpriseMode = isEnterprise();+ const [activeTab, setActiveTab] = useState<'config' | 'outbound' | 'history'>(enterpriseMode ? 'outbound' : 'config');const [snapshot, setSnapshot] = useState<A2AIngressSnapshot | null>(null);const [draft, setDraft] = useState<A2AIngressDraft | null>(null);const [loading, setLoading] = useState(false);@@ -57,7 +59,7 @@ export function A2AIngressPanel({ isConnected, request }: A2AIngressPanelProps)const [history, setHistory] = useState<A2AIngressRequestRecord[]>([]);const [historyLoading, setHistoryLoading] = useState(false);const [historyError, setHistoryError] = useState<string | null>(null);- const [historyDirection, setHistoryDirection] = useState<'ingress' | 'outbound'>('ingress');+ const [historyDirection, setHistoryDirection] = useState<'ingress' | 'outbound'>(enterpriseMode ? 'outbound' : 'ingress');const [outboundHistory, setOutboundHistory] = useState<A2AOutboundDispatchRecord[]>([]);const [outboundHistoryLoading, setOutboundHistoryLoading] = useState(false);const [outboundHistoryError, setOutboundHistoryError] = useState<string | null>(null);@@ -86,7 +88,7 @@ export function A2AIngressPanel({ isConnected, request }: A2AIngressPanelProps)const refresh = useCallback(async (showLoading = true) => {- if (!isConnected) return;+ if (enterpriseMode || !isConnected) return;const responseGeneration = ++responseGenerationRef.current;if (showLoading) setLoading(true);try {@@ -102,21 +104,21 @@ export function A2AIngressPanel({ isConnected, request }: A2AIngressPanelProps)if (showLoading && shouldAcceptA2AIngressResponse(responseGeneration, responseGenerationRef.current)) setLoading(false);}},- [acceptSnapshot, isConnected, request],+ [acceptSnapshot, enterpriseMode, isConnected, request],);useEffect(() => {void refresh();}, [refresh]);useEffect(() => {- if (loading || operation || isDirty || !isA2AIngressTransitioning(snapshot?.state)) return;+ if (enterpriseMode || loading || operation || isDirty || !isA2AIngressTransitioning(snapshot?.state)) return;const timer = window.setInterval(() => void refresh(false), 1200);return () => window.clearInterval(timer);- }, [refresh, snapshot?.state, loading, operation, isDirty]);+ }, [enterpriseMode, refresh, snapshot?.state, loading, operation, isDirty]);const refreshHistory = useCallback(async (showLoading = true) => {- if (!isConnected) return;+ if (enterpriseMode || !isConnected) return;const responseGeneration = ++historyResponseGenerationRef.current;if (showLoading) setHistoryLoading(true);try {@@ -133,7 +135,7 @@ export function A2AIngressPanel({ isConnected, request }: A2AIngressPanelProps)if (showLoading && shouldAcceptA2AIngressResponse(responseGeneration, historyResponseGenerationRef.current)) setHistoryLoading(false);}},- [isConnected, request, t],+ [enterpriseMode, isConnected, request, t],);const refreshOutboundHistory = useCallback(@@ -160,11 +162,11 @@ export function A2AIngressPanel({ isConnected, request }: A2AIngressPanelProps)useEffect(() => {if (activeTab !== 'history' || !isConnected) return;- const refreshActiveHistory = historyDirection === 'ingress' ? refreshHistory : refreshOutboundHistory;+ const refreshActiveHistory = enterpriseMode || historyDirection === 'outbound' ? refreshOutboundHistory : refreshHistory;void refreshActiveHistory();const timer = window.setInterval(() => void refreshActiveHistory(false), 2000);return () => window.clearInterval(timer);- }, [activeTab, historyDirection, isConnected, refreshHistory, refreshOutboundHistory]);+ }, [activeTab, enterpriseMode, historyDirection, isConnected, refreshHistory, refreshOutboundHistory]);useEffect(() => () => {@@ -253,8 +255,8 @@ export function A2AIngressPanel({ isConnected, request }: A2AIngressPanelProps)const serviceEnabled = snapshot?.enabled === true;const lifecycleOperation = serviceEnabled ? 'disable' : 'enable';const canToggleService = serviceEnabled ? canDisable : canEnable;- const activeHistoryLoading = historyDirection === 'ingress' ? historyLoading : outboundHistoryLoading;- const refreshActiveHistory = historyDirection === 'ingress' ? refreshHistory : refreshOutboundHistory;+ const activeHistoryLoading = enterpriseMode || historyDirection === 'outbound' ? outboundHistoryLoading : historyLoading;+ const refreshActiveHistory = enterpriseMode || historyDirection === 'outbound' ? refreshOutboundHistory : refreshHistory;return (<div className="flex-1 min-h-0">@@ -262,7 +264,7 @@ export function A2AIngressPanel({ isConnected, request }: A2AIngressPanelProps)<div className="mb-1 flex shrink-0 flex-wrap items-start justify-between gap-4"><div><h2 className="text-lg font-semibold">{t('a2aIngress.title')}</h2>- <p className="text-sm text-text-muted mt-1">{t('a2aIngress.subtitle')}</p>+ <p className="text-sm text-text-muted mt-1">{t(enterpriseMode ? 'a2aIngress.enterpriseSubtitle' : 'a2aIngress.subtitle')}</p></div>{activeTab === 'config' ? (<div className="flex flex-wrap items-center gap-2">@@ -311,7 +313,7 @@ export function A2AIngressPanel({ isConnected, request }: A2AIngressPanelProps)) : null}</div><div className="app-subtabs shrink-0" role="tablist" aria-label={t('a2aIngress.tabs.ariaLabel')}>- {(['config', 'outbound', 'history'] as const).map(tab => (+ {(enterpriseMode ? (['outbound', 'history'] as const) : (['config', 'outbound', 'history'] as const)).map(tab => (<buttonkey={tab}type="button"@@ -484,24 +486,26 @@ export function A2AIngressPanel({ isConnected, request }: A2AIngressPanelProps)<h3 className="text-sm font-semibold text-text">{t(`a2aIngress.history.${historyDirection}.title`)}</h3><p className="mt-1 text-xs text-text-muted">{t(`a2aIngress.history.${historyDirection}.description`)}</p></div>- <div- className="ml-auto inline-flex shrink-0 rounded-lg border border-border bg-secondary/50 p-1"- role="tablist"- aria-label={t('a2aIngress.history.tabs.ariaLabel')}- >- {(['ingress', 'outbound'] as const).map(direction => (- <button- key={direction}- type="button"- role="tab"- aria-selected={historyDirection === direction}- className={`rounded-md px-4 py-1.5 text-sm font-medium transition-colors ${historyDirection === direction ? 'bg-bg text-accent shadow-sm' : 'text-text-muted hover:bg-bg/60 hover:text-text'}`}- onClick={() => setHistoryDirection(direction)}- >- {t(`a2aIngress.history.tabs.${direction}`)}- </button>- ))}- </div>+ {!enterpriseMode && (+ <div+ className="ml-auto inline-flex shrink-0 rounded-lg border border-border bg-secondary/50 p-1"+ role="tablist"+ aria-label={t('a2aIngress.history.tabs.ariaLabel')}+ >+ {(['ingress', 'outbound'] as const).map(direction => (+ <button+ key={direction}+ type="button"+ role="tab"+ aria-selected={historyDirection === direction}+ className={`rounded-md px-4 py-1.5 text-sm font-medium transition-colors ${historyDirection === direction ? 'bg-bg text-accent shadow-sm' : 'text-text-muted hover:bg-bg/60 hover:text-text'}`}+ onClick={() => setHistoryDirection(direction)}+ >+ {t(`a2aIngress.history.tabs.${direction}`)}+ </button>+ ))}+ </div>+ )}</div></div>{historyDirection === 'ingress' ? (@@ -589,7 +593,7 @@ export function A2AIngressPanel({ isConnected, request }: A2AIngressPanelProps)<tr><th className="px-4 py-3 font-medium">{t('a2aIngress.history.columns.status')}</th><th className="px-4 py-3 font-medium">{t('a2aIngress.history.columns.mode')}</th>- <th className="px-4 py-3 font-medium">{t('a2aIngress.history.columns.agentId')}</th>+ <th className="px-4 py-3 font-medium">{t('a2aIngress.history.columns.agent')}</th><th className="px-4 py-3 font-medium">{t('a2aIngress.history.columns.dispatchId')}</th><th className="px-4 py-3 font-medium">{t('a2aIngress.history.columns.remoteTaskId')}</th><th className="px-4 py-3 font-medium">{t('a2aIngress.history.columns.startedAt')}</th>@@ -608,7 +612,7 @@ export function A2AIngressPanel({ isConnected, request }: A2AIngressPanelProps)<td className="px-4 py-3">{t(`a2aIngress.history.outbound.modes.${item.mode}`)}</td><td className="max-w-48 px-4 py-3 font-mono text-xs"><CopyableHistoryValue- value={item.agent_id}+ value={item.agent_name}copied={copiedHistoryCell === `outbound:${item.dispatch_id}:agent`}onCopy={() => void copyHistoryValue(`outbound:${item.dispatch_id}:agent`, item.agent_id)}copyLabel={t('a2aIngress.history.copy')}diff --git a/jiuwenswarm/channels/web/frontend/src/edition.ts b/jiuwenswarm/channels/web/frontend/src/edition.tsindex 7071e1e936..1d06955472 100644--- a/jiuwenswarm/channels/web/frontend/src/edition.ts+++ b/jiuwenswarm/channels/web/frontend/src/edition.ts@@ -17,5 +17,4 @@ export const ENTERPRISE_HIDDEN_NAV_ITEMS = ["configpanel","browserpanel","updatepanel",- "a2aingress",] as const;diff --git a/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json b/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.jsonindex 4b8ec4d681..5b09e6c748 100644--- a/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json+++ b/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json@@ -569,6 +569,7 @@},"title": "A2A Control Center","subtitle": "Manage the A2A service exposed by JiuwenSwarm.",+ "enterpriseSubtitle": "View administrator-assigned A2A Agents and manage your enabled state and processing history.","tabs": {"ariaLabel": "A2A Control Center pages","config": "Ingress Configuration",@@ -636,6 +637,8 @@"list": {"title": "Registered Agents","description": "Manage availability, connection settings, and Agent Card updates.",+ "enterpriseDescription": "Agent configuration is managed by administrators. You can choose which available Agents to enable.",+ "enterpriseEmpty": "No A2A Agents have been assigned to this instance by an administrator","empty": "No third-party Agents are registered"},"fields": {@@ -658,6 +661,8 @@"registered": "The third-party Agent is registered and can now participate in outbound calls when enabled and available.","enabled": "Enabled","disabled": "Disabled",+ "managerDisabled": "Disabled by administrator",+ "userToggle": "Toggle personal enabled state","enable": "Enable","disable": "Disable","refresh": "Refresh Card",@@ -719,6 +724,7 @@"contextId": "Context ID","mode": "Mode","agentId": "Agent ID",+ "agent": "Agent","dispatchId": "Dispatch ID","remoteTaskId": "Remote task ID","startedAt": "Started",diff --git a/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json b/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.jsonindex f9acad7b73..b8772b085e 100644--- a/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json+++ b/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json@@ -570,6 +570,7 @@},"title": "A2A 调度中心","subtitle": "管理 JiuwenSwarm 对外提供的 A2A 服务。",+ "enterpriseSubtitle": "查看管理员分配的 A2A Agent,并管理个人启用状态和处理历史。","tabs": { "ariaLabel": "A2A 调度中心页面", "config": "入站配置", "outbound": "出站配置", "history": "处理历史" },"enable": "启用服务","enabling": "启用中...",@@ -629,6 +630,8 @@"list": {"title": "已注册 Agent","description": "管理第三方 Agent 的可用状态、连接配置和 Card 更新。",+ "enterpriseDescription": "管理员统一维护 Agent 配置;你可以决定启用哪些可用 Agent。",+ "enterpriseEmpty": "管理员尚未向当前实例下发 A2A Agent","empty": "暂无已注册的第三方 Agent"},"fields": {@@ -651,6 +654,8 @@"registered": "第三方 Agent 已注册,现在可按启用和可用状态参与出站调用。","enabled": "已启用","disabled": "已停用",+ "managerDisabled": "管理员已停用",+ "userToggle": "切换个人启用状态","enable": "启用","disable": "停用","refresh": "刷新 Card",@@ -709,6 +714,7 @@"contextId": "上下文 ID","mode": "模式","agentId": "Agent ID",+ "agent": "Agent","dispatchId": "派发 ID","remoteTaskId": "远端任务 ID","startedAt": "开始时间",diff --git a/jiuwenswarm/channels/web/frontend/src/services/webHttpClient.ts b/jiuwenswarm/channels/web/frontend/src/services/webHttpClient.tsindex f4af9eb1b6..3a95539814 100644--- a/jiuwenswarm/channels/web/frontend/src/services/webHttpClient.ts+++ b/jiuwenswarm/channels/web/frontend/src/services/webHttpClient.ts@@ -80,6 +80,9 @@ const ROUTES: Record<string, RouteRow> = {'chat.user_answer': { verb: 'POST', path: '/chat/{session_id}/actions/answer', kind: 'unary' },'config.get': { verb: 'GET', path: '/config', kind: 'unary' },'models.list': { verb: 'GET', path: '/models', kind: 'unary' },+ 'a2a.outbound.list': { verb: 'GET', path: '/a2a/outbound/agents', kind: 'unary' },+ 'a2a.outbound.enabled.update': { verb: 'PATCH', path: '/a2a/outbound/agents/{agent_id}/enabled', kind: 'unary' },+ 'a2a.outbound.dispatch.list': { verb: 'GET', path: '/a2a/outbound/dispatches', kind: 'unary' },'locale.get_conf': { verb: 'GET', path: '/locale', kind: 'unary' },'locale.set_conf': { verb: 'PUT', path: '/locale', kind: 'unary' },'cron.job.list': { verb: 'GET', path: '/cron/jobs', kind: 'unary' },diff --git a/jiuwenswarm/channels/web/frontend/tests/a2aIngressPanelState.test.mjs b/jiuwenswarm/channels/web/frontend/tests/a2aIngressPanelState.test.mjsindex cdf7901652..be73c2753b 100644--- a/jiuwenswarm/channels/web/frontend/tests/a2aIngressPanelState.test.mjs+++ b/jiuwenswarm/channels/web/frontend/tests/a2aIngressPanelState.test.mjs@@ -171,6 +171,7 @@ test('A2A outbound history accepts dispatch metadata without result bodies', (){dispatch_id: 'disp-1',agent_id: 'agent-1',+ agent_name: 'Research Agent',mode: 'sync',status: 'completed',remote_task_id: 'task-1',@@ -189,6 +190,7 @@ test('A2A outbound history accepts dispatch metadata without result bodies', (){dispatch_id: 'disp-1',agent_id: 'agent-1',+ agent_name: 'Research Agent',mode: 'sync',status: 'completed',remote_task_id: 'task-1',@@ -223,6 +225,7 @@ test('A2A outbound history skips malformed rows without discarding valid recordsassert.equal(history?.items.length, 1);assert.equal(history?.items[0].dispatch_id, 'disp-1');+ assert.equal(history?.items[0].agent_name, 'agent-1');assert.equal(history?.items[0].updated_at, '2026-08-27T01:00:10Z');assert.equal(history?.total, 2);});diff --git a/jiuwenswarm/channels/web/frontend/tests/a2aOutboundPanelState.test.mjs b/jiuwenswarm/channels/web/frontend/tests/a2aOutboundPanelState.test.mjsindex d568276baa..2045e59198 100644--- a/jiuwenswarm/channels/web/frontend/tests/a2aOutboundPanelState.test.mjs+++ b/jiuwenswarm/channels/web/frontend/tests/a2aOutboundPanelState.test.mjs@@ -23,6 +23,9 @@ const agent = {agent_card: { name: 'Research Agent' },selected_interface: selectedInterface,enabled: true,+ manager_enabled: true,+ user_enabled: true,+ effective_enabled: true,availability: 'available',has_credential: false,connect_timeout_seconds: 10,@@ -63,6 +66,20 @@ test('A2A outbound agent rejects unknown availability and malformed interfaces',assert.equal(normalizeA2AOutboundAgent({ ...agent, selected_interface: { url: selectedInterface.url } }), null);});+test('personal records derive enterprise enable states from enabled', () => {+ const { manager_enabled, user_enabled, effective_enabled } = normalizeA2AOutboundAgent({+ ...agent,+ manager_enabled: undefined,+ user_enabled: undefined,+ effective_enabled: undefined,+ });+ assert.deepEqual({ manager_enabled, user_enabled, effective_enabled }, {+ manager_enabled: true,+ user_enabled: true,+ effective_enabled: true,+ });+});+test('A2A outbound list rejects any malformed item', () => {assert.deepEqual(normalizeA2AOutboundList({ items: [agent] }), [agent]);assert.equal(normalizeA2AOutboundList({ items: [agent, { agent_id: '' }] }), null);diff --git a/jiuwenswarm/channels/web/frontend/tests/webHttpClient.test.mjs b/jiuwenswarm/channels/web/frontend/tests/webHttpClient.test.mjsindex 6eeaef8632..d5fd89a4a9 100644--- a/jiuwenswarm/channels/web/frontend/tests/webHttpClient.test.mjs+++ b/jiuwenswarm/channels/web/frontend/tests/webHttpClient.test.mjs@@ -178,6 +178,9 @@ const ENTERPRISE_ASSEMBLE = [['chat.user_answer', 'POST', '/api/v1/chat/sid/actions/answer', { session_id: 'sid', request_id: 'q', answers: {} }, 'unary'],['config.get', 'GET', '/api/v1/config', {}, 'unary'],['models.list', 'GET', '/api/v1/models', {}, 'unary'],+ ['a2a.outbound.list', 'GET', '/api/v1/a2a/outbound/agents', {}, 'unary'],+ ['a2a.outbound.enabled.update', 'PATCH', '/api/v1/a2a/outbound/agents/agent-1/enabled', { agent_id: 'agent-1', user_enabled: false }, 'unary'],+ ['a2a.outbound.dispatch.list', 'GET', '/api/v1/a2a/outbound/dispatches', { limit: 200 }, 'unary'],['locale.get_conf', 'GET', '/api/v1/locale', {}, 'unary'],['locale.set_conf', 'PUT', '/api/v1/locale', { preferred_language: 'zh' }, 'unary'],['cron.job.list', 'GET', '/api/v1/cron/jobs', {}, 'unary'],@@ -207,7 +210,7 @@ const ENTERPRISE_ASSEMBLE = [];test('every enterprise mapped method assembles verb+url+kind', () => {- assert.equal(ENTERPRISE_ASSEMBLE.length, 35);+ assert.equal(ENTERPRISE_ASSEMBLE.length, 38);const seen = new Set();for (const [method, verb, url, params, kind] of ENTERPRISE_ASSEMBLE) {seen.add(method);diff --git a/jiuwenswarm/gateway/channel_manager/web/app_web_handlers.py b/jiuwenswarm/gateway/channel_manager/web/app_web_handlers.pyindex b6567ae056..aa48799d6e 100644--- a/jiuwenswarm/gateway/channel_manager/web/app_web_handlers.py+++ b/jiuwenswarm/gateway/channel_manager/web/app_web_handlers.py@@ -1992,6 +1992,25 @@ def _register_web_handlers(bind: WebHandlersBindParams) -> None:ws, req_id, lambda: a2a_manager.outbound_update(agent_id, payload))+ async def _a2a_outbound_enabled_update(ws, req_id, params, session_id):+ user_enabled = params.get("user_enabled")+ if not isinstance(user_enabled, bool):+ await channel.send_response(+ ws,+ req_id,+ ok=False,+ error="user_enabled must be a boolean",+ code="A2A_OUTBOUND_STORE_INVALID",+ )+ return+ await _send_a2a_outbound(+ ws,+ req_id,+ lambda: a2a_manager.outbound_set_user_enabled(+ str(params.get("agent_id") or ""), enabled=user_enabled+ ),+ )+async def _a2a_outbound_refresh(ws, req_id, params, session_id):await _send_a2a_outbound(ws, req_id, lambda: a2a_manager.outbound_refresh(str(params.get("agent_id") or ""))@@ -2062,6 +2081,7 @@ def _register_web_handlers(bind: WebHandlersBindParams) -> None:channel.register_method("a2a.outbound.get", _a2a_outbound_get)channel.register_method("a2a.outbound.edit", _a2a_outbound_edit)channel.register_method("a2a.outbound.update", _a2a_outbound_update)+ channel.register_method("a2a.outbound.enabled.update", _a2a_outbound_enabled_update)channel.register_method("a2a.outbound.refresh", _a2a_outbound_refresh)channel.register_method("a2a.outbound.confirm_revision", _a2a_outbound_confirm_revisiondiff --git a/jiuwenswarm/gateway/channel_manager/web/invoke.py b/jiuwenswarm/gateway/channel_manager/web/invoke.pyindex 20644b6d20..456e03ce4a 100644--- a/jiuwenswarm/gateway/channel_manager/web/invoke.py+++ b/jiuwenswarm/gateway/channel_manager/web/invoke.py@@ -29,6 +29,12 @@ _ENTERPRISE_BLOCKED_EXACT = frozenset({"updater.upgrade", "updater.reset_source", "updater.set_conf",})_ENTERPRISE_BLOCKED_PREFIXES = ("agents.", "teams.", "extensions.", "plugins.")+_ENTERPRISE_A2A_ALLOWED = frozenset({+ "a2a.outbound.list",+ "a2a.outbound.enabled.update",+ "a2a.outbound.dispatch.list",+ "a2a.outbound.dispatch.get",+})_ENTERPRISE_SKILL_ALLOWED = frozenset({"skills.list","skills.get",@@ -52,6 +58,8 @@ def is_enterprise_write_forbidden(method: str) -> bool:return Falseif method in _ENTERPRISE_BLOCKED_EXACT or method.startswith(_ENTERPRISE_BLOCKED_PREFIXES):return True+ if method.startswith("a2a.") and method not in _ENTERPRISE_A2A_ALLOWED:+ return Trueif method.startswith("channel.") and (method.endswith(".set_conf") or method.endswith(".unbind")):return Trueif method.startswith("skills.") and method not in _ENTERPRISE_SKILL_ALLOWED:diff --git a/jiuwenswarm/gateway/channel_manager/web/web_http_routes.py b/jiuwenswarm/gateway/channel_manager/web/web_http_routes.pyindex b9d615c455..f5ea4414d1 100644--- a/jiuwenswarm/gateway/channel_manager/web/web_http_routes.py+++ b/jiuwenswarm/gateway/channel_manager/web/web_http_routes.py@@ -131,6 +131,15 @@ _A2A_OUTBOUND_ROUTES: tuple[WebHttpMappedRoute, ...] = ("读取第三方 A2A Agent 注册项",path_to_param={"agent_id": "agent_id"},),+ WebHttpMappedRoute(+ "PATCH",+ "/a2a/outbound/agents/{agent_id}/enabled",+ "a2a.outbound.enabled.update",+ "a2a",+ "更新 A2A Agent 的用户启用状态",+ path_to_param={"agent_id": "agent_id"},+ accept_body=True,+ ),WebHttpMappedRoute("PATCH","/a2a/outbound/agents/{agent_id}",diff --git a/tests/unit_tests/gateway/test_a2a_manager_web_handlers.py b/tests/unit_tests/gateway/test_a2a_manager_web_handlers.pyindex 6fb3cffa26..a15752da86 100644--- a/tests/unit_tests/gateway/test_a2a_manager_web_handlers.py+++ b/tests/unit_tests/gateway/test_a2a_manager_web_handlers.py@@ -66,6 +66,14 @@ class _OutboundRegistryProbe:async def update_agent(self, agent_id, params):return {"agent_id": agent_id, **params}+ async def set_user_enabled(self, agent_id, user_enabled):+ return {+ "agent_id": agent_id,+ "user_enabled": user_enabled,+ "manager_enabled": True,+ "effective_enabled": user_enabled,+ }+async def refresh_agent(self, agent_id):return {"agent_id": agent_id, "refreshed": True}@@ -305,6 +313,12 @@ async def test_a2a_outbound_web_handlers_expose_management_facade():await channel.methods["a2a.outbound.dispatch.list"](object(), "dispatch-list", {"limit": 20}, "session")+ await channel.methods["a2a.outbound.enabled.update"](+ object(),+ "enabled-update",+ {"agent_id": "agent-1", "user_enabled": False},+ "session",+ )assert channel.responses[0]["payload"]["discovery_id"] == "disc-1"assert channel.responses[1]["payload"]["agent_id"] == "agent-1"@@ -318,6 +332,7 @@ async def test_a2a_outbound_web_handlers_expose_management_facade():assert channel.responses[9]["payload"] == {"allow_loopback_http": False}assert channel.responses[10]["payload"] == {"allow_loopback_http": True}assert channel.responses[11]["payload"] == {"items": [], "total": 0, "limit": 20}+ assert channel.responses[12]["payload"]["user_enabled"] is Falseassert settings.enabled is Trueassert all(item["ok"] for item in channel.responses)@@ -365,6 +380,30 @@ async def test_a2a_outbound_dispatch_list_clamps_limit_to_200():assert channel.responses[-1]["payload"]["limit"] == 200+async def test_a2a_outbound_user_enabled_requires_boolean():+ channel = _WebChannelProbe()+ manager = A2AManager(+ _ChannelManagerProbe(),+ object(),+ A2AIngressConfig(),+ repository=_RepositoryProbe(),+ channel_factory=lambda config, router: _ChannelProbe(),+ outbound_registry=_OutboundRegistryProbe(),+ )+ _register_web_handlers(WebHandlersBindParams(channel=channel, a2a_manager=manager))++ await channel.methods["a2a.outbound.enabled.update"](+ object(),+ "enabled-update",+ {"agent_id": "agent-1", "user_enabled": "false"},+ "session",+ )++ assert channel.responses[-1]["ok"] is False+ assert channel.responses[-1]["code"] == "A2A_OUTBOUND_STORE_INVALID"++@pytest.mark.asyncio@pytest.mark.parametrize("params", [{"agent_id": "agent-1"}, {"agent_id": "agent-1", "accept": "false"}]@@ -404,6 +443,9 @@ async def test_a2a_outbound_handlers_tolerate_missing_manager():await channel.methods["a2a.outbound.update"](object(), "update", {"agent_id": "agent-1"}, "session")+ await channel.methods["a2a.outbound.enabled.update"](+ object(), "enabled-update", {"agent_id": "agent-1", "user_enabled": True}, "session"+ )await channel.methods["a2a.outbound.refresh"](object(), "refresh", {"agent_id": "agent-1"}, "session")@@ -417,7 +459,7 @@ async def test_a2a_outbound_handlers_tolerate_missing_manager():object(), "dispatch_get", {"dispatch_id": "dispatch-1"}, "session")- assert [item["ok"] for item in channel.responses] == [False] * 8+ assert [item["ok"] for item in channel.responses] == [False] * 9assert {item["code"] for item in channel.responses} == {"A2A_OUTBOUND_STORE_INVALID"}@@ -434,6 +476,10 @@ def test_a2a_outbound_http_routes_map_to_rpc_methods():assert routes[("POST", "/a2a/outbound/agents")] == "a2a.outbound.register"assert routes[("GET", "/a2a/outbound/agents")] == "a2a.outbound.list"assert routes[("GET", "/a2a/outbound/dispatches")] == "a2a.outbound.dispatch.list"+ assert (+ routes[("PATCH", "/a2a/outbound/agents/{agent_id}/enabled")]+ == "a2a.outbound.enabled.update"+ )assert routes[("PATCH", "/a2a/outbound/agents/{agent_id}")] == "a2a.outbound.update"assert (routes[("POST", "/a2a/outbound/agents/{agent_id}:refresh")]diff --git a/tests/unit_tests/gateway/test_enterprise_a2a_web_gate.py b/tests/unit_tests/gateway/test_enterprise_a2a_web_gate.pynew file mode 100644index 0000000000..ee8deaf685--- /dev/null+++ b/tests/unit_tests/gateway/test_enterprise_a2a_web_gate.py@@ -0,0 +1,39 @@+# Copyright (c) Huawei Technologies Co., Ltd. 2026. All rights reserved.++from jiuwenswarm.gateway.channel_manager.web import invoke as web_invoke+++def test_enterprise_a2a_web_gate_only_allows_directory_toggle_and_history(+ monkeypatch,+):+ monkeypatch.setattr(web_invoke, "is_enterprise", lambda: True)+ allowed = {+ "a2a.outbound.list",+ "a2a.outbound.enabled.update",+ "a2a.outbound.dispatch.list",+ "a2a.outbound.dispatch.get",+ }+ blocked = {+ "a2a.outbound.settings.get",+ "a2a.outbound.settings.update",+ "a2a.outbound.discover",+ "a2a.outbound.register",+ "a2a.outbound.get",+ "a2a.outbound.edit",+ "a2a.outbound.update",+ "a2a.outbound.refresh",+ "a2a.outbound.confirm_revision",+ "a2a.outbound.delete",+ "a2a.ingress.get",+ "a2a.ingress.edit",+ "a2a.ingress.history",+ "a2a.ingress.update",+ "a2a.ingress.enable",+ "a2a.ingress.disable",+ "a2a.ingress.reload",+ }++ assert all(not web_invoke.is_enterprise_write_forbidden(item) for item in allowed)+ assert all(web_invoke.is_enterprise_write_forbidden(item) for item in blocked)+ monkeypatch.setattr(web_invoke, "is_enterprise", lambda: False)+ assert all(not web_invoke.is_enterprise_write_forbidden(item) for item in blocked)