集成系统通知,并在Agent响应完成后发出通知

This commit is contained in:
xintaofei
2026-03-21 18:39:28 +08:00
parent e41a37cd4f
commit a9e0a742ac
17 changed files with 144 additions and 12 deletions

View File

@@ -42,6 +42,7 @@ import {
CONNECTION_IDLE_TIMEOUT_MS,
IDLE_SWEEP_INTERVAL_MS,
} from "@/lib/constants"
import { notifyTurnComplete } from "@/lib/notification"
import { useAlertContext, type AlertAction } from "@/contexts/alert-context"
// ── Shared types (re-exported for consumers) ──
@@ -1545,6 +1546,17 @@ export function AcpConnectionsProvider({ children }: { children: ReactNode }) {
}
}
}
// Send OS notification when window is not focused
{
const nc = storeRef.current.connections.get(contextKey)
if (nc) {
const agentLabel = AGENT_LABELS[nc.agentType]
notifyTurnComplete(
"Codeg",
t("notificationTurnComplete", { agent: agentLabel }),
).catch(() => {})
}
}
break
}
case "error":

View File

@@ -1311,7 +1311,8 @@
"autoLinkPreflightFailed": "فشل فحص ما قبل التشغيل للربط التلقائي: {message}",
"connectFailedTitle": "فشل اتصال {agent}",
"toolFallbackTitle": "أداة",
"eventErrorTitle": "خطأ الوكيل"
"eventErrorTitle": "خطأ الوكيل",
"notificationTurnComplete": "{agent} أنهى الاستجابة"
},
"connectionLifecycle": {
"tasks": {

View File

@@ -1311,7 +1311,8 @@
"autoLinkPreflightFailed": "Auto-Link-Preflight fehlgeschlagen: {message}",
"connectFailedTitle": "{agent} Verbindung fehlgeschlagen",
"toolFallbackTitle": "Werkzeug",
"eventErrorTitle": "Agentenfehler"
"eventErrorTitle": "Agentenfehler",
"notificationTurnComplete": "{agent} hat die Antwort abgeschlossen"
},
"connectionLifecycle": {
"tasks": {

View File

@@ -1311,7 +1311,8 @@
"autoLinkPreflightFailed": "Auto-link preflight failed: {message}",
"connectFailedTitle": "{agent} connection failed",
"toolFallbackTitle": "Tool",
"eventErrorTitle": "Agent Error"
"eventErrorTitle": "Agent Error",
"notificationTurnComplete": "{agent} has finished responding"
},
"connectionLifecycle": {
"tasks": {

View File

@@ -1311,7 +1311,8 @@
"autoLinkPreflightFailed": "Falló la verificación previa del autovínculo: {message}",
"connectFailedTitle": "Falló la conexión de {agent}",
"toolFallbackTitle": "Herramienta",
"eventErrorTitle": "Error del agente"
"eventErrorTitle": "Error del agente",
"notificationTurnComplete": "{agent} ha terminado de responder"
},
"connectionLifecycle": {
"tasks": {

View File

@@ -1311,7 +1311,8 @@
"autoLinkPreflightFailed": "Échec de la vérification préalable de l'auto-liaison : {message}",
"connectFailedTitle": "Échec de la connexion de {agent}",
"toolFallbackTitle": "Outil",
"eventErrorTitle": "Erreur de l'agent"
"eventErrorTitle": "Erreur de l'agent",
"notificationTurnComplete": "{agent} a terminé de répondre"
},
"connectionLifecycle": {
"tasks": {

View File

@@ -1311,7 +1311,8 @@
"autoLinkPreflightFailed": "自動リンクの事前チェックに失敗しました: {message}",
"connectFailedTitle": "{agent} の接続に失敗しました",
"toolFallbackTitle": "ツール",
"eventErrorTitle": "エージェントエラー"
"eventErrorTitle": "エージェントエラー",
"notificationTurnComplete": "{agent} の応答が完了しました"
},
"connectionLifecycle": {
"tasks": {

View File

@@ -1311,7 +1311,8 @@
"autoLinkPreflightFailed": "자동 연결 사전 점검 실패: {message}",
"connectFailedTitle": "{agent} 연결 실패",
"toolFallbackTitle": "도구",
"eventErrorTitle": "에이전트 오류"
"eventErrorTitle": "에이전트 오류",
"notificationTurnComplete": "{agent} 응답이 완료되었습니다"
},
"connectionLifecycle": {
"tasks": {

View File

@@ -1311,7 +1311,8 @@
"autoLinkPreflightFailed": "Pré-voo do vínculo automático falhou: {message}",
"connectFailedTitle": "Falha na conexão de {agent}",
"toolFallbackTitle": "Ferramenta",
"eventErrorTitle": "Erro do agente"
"eventErrorTitle": "Erro do agente",
"notificationTurnComplete": "{agent} terminou de responder"
},
"connectionLifecycle": {
"tasks": {

View File

@@ -1311,7 +1311,8 @@
"autoLinkPreflightFailed": "自动链接预检查失败:{message}",
"connectFailedTitle": "{agent} 连接失败",
"toolFallbackTitle": "工具",
"eventErrorTitle": "Agent 错误"
"eventErrorTitle": "Agent 错误",
"notificationTurnComplete": "{agent} 已完成响应"
},
"connectionLifecycle": {
"tasks": {

View File

@@ -1311,7 +1311,8 @@
"autoLinkPreflightFailed": "自動連結預檢查失敗:{message}",
"connectFailedTitle": "{agent} 連線失敗",
"toolFallbackTitle": "工具",
"eventErrorTitle": "Agent 錯誤"
"eventErrorTitle": "Agent 錯誤",
"notificationTurnComplete": "{agent} 已完成回應"
},
"connectionLifecycle": {
"tasks": {