Merge branch 'channel' into cv-channel-urci3p

This commit is contained in:
xintaofei
2026-03-31 16:00:12 +08:00
12 changed files with 41 additions and 14 deletions

View File

@@ -42,7 +42,7 @@ import {
CONNECTION_IDLE_TIMEOUT_MS, CONNECTION_IDLE_TIMEOUT_MS,
IDLE_SWEEP_INTERVAL_MS, IDLE_SWEEP_INTERVAL_MS,
} from "@/lib/constants" } from "@/lib/constants"
import { notifyTurnComplete } from "@/lib/notification" import { sendSystemNotification } from "@/lib/notification"
import { import {
applySavedModePreference, applySavedModePreference,
applySavedConfigPreferences, applySavedConfigPreferences,
@@ -1704,7 +1704,7 @@ export function AcpConnectionsProvider({ children }: { children: ReactNode }) {
const agentLabel = AGENT_LABELS[nc.agentType] const agentLabel = AGENT_LABELS[nc.agentType]
const fn = folderNameRef.current const fn = folderNameRef.current
const title = fn ? `${fn} - Codeg` : "Codeg" const title = fn ? `${fn} - Codeg` : "Codeg"
notifyTurnComplete( sendSystemNotification(
title, title,
t("notificationTurnComplete", { agent: agentLabel }) t("notificationTurnComplete", { agent: agentLabel })
).catch(() => {}) ).catch(() => {})
@@ -1712,11 +1712,28 @@ export function AcpConnectionsProvider({ children }: { children: ReactNode }) {
} }
break break
} }
case "error": case "error": {
flushStreamingQueue() flushStreamingQueue()
dispatch({ type: "ERROR", contextKey, message: e.message }) dispatch({ type: "ERROR", contextKey, message: e.message })
pushAlertRef.current("error", t("eventErrorTitle"), e.message) pushAlertRef.current("error", t("eventErrorTitle"), e.message)
// Send OS notification for agent errors
{
const nc = storeRef.current.connections.get(contextKey)
if (nc) {
const agentLabel = AGENT_LABELS[nc.agentType]
const fn = folderNameRef.current
const title = fn ? `${fn} - Codeg` : "Codeg"
sendSystemNotification(
title,
t("notificationError", {
agent: agentLabel,
message: e.message,
})
).catch(() => {})
}
}
break break
}
case "available_commands": case "available_commands":
flushStreamingQueue() flushStreamingQueue()
dispatch({ dispatch({

View File

@@ -1350,7 +1350,8 @@
"connectFailedTitle": "فشل اتصال {agent}", "connectFailedTitle": "فشل اتصال {agent}",
"toolFallbackTitle": "أداة", "toolFallbackTitle": "أداة",
"eventErrorTitle": "خطأ الوكيل", "eventErrorTitle": "خطأ الوكيل",
"notificationTurnComplete": "{agent} أنهى الاستجابة" "notificationTurnComplete": "{agent} أنهى الاستجابة",
"notificationError": "{agent} خطأ: {message}"
}, },
"connectionLifecycle": { "connectionLifecycle": {
"tasks": { "tasks": {

View File

@@ -1350,7 +1350,8 @@
"connectFailedTitle": "{agent} Verbindung fehlgeschlagen", "connectFailedTitle": "{agent} Verbindung fehlgeschlagen",
"toolFallbackTitle": "Werkzeug", "toolFallbackTitle": "Werkzeug",
"eventErrorTitle": "Agentenfehler", "eventErrorTitle": "Agentenfehler",
"notificationTurnComplete": "{agent} hat die Antwort abgeschlossen" "notificationTurnComplete": "{agent} hat die Antwort abgeschlossen",
"notificationError": "{agent} Fehler: {message}"
}, },
"connectionLifecycle": { "connectionLifecycle": {
"tasks": { "tasks": {

View File

@@ -1351,7 +1351,8 @@
"connectFailedTitle": "{agent} connection failed", "connectFailedTitle": "{agent} connection failed",
"toolFallbackTitle": "Tool", "toolFallbackTitle": "Tool",
"eventErrorTitle": "Agent Error", "eventErrorTitle": "Agent Error",
"notificationTurnComplete": "{agent} has finished responding" "notificationTurnComplete": "{agent} has finished responding",
"notificationError": "{agent} error: {message}"
}, },
"connectionLifecycle": { "connectionLifecycle": {
"tasks": { "tasks": {

View File

@@ -1350,7 +1350,8 @@
"connectFailedTitle": "Falló la conexión de {agent}", "connectFailedTitle": "Falló la conexión de {agent}",
"toolFallbackTitle": "Herramienta", "toolFallbackTitle": "Herramienta",
"eventErrorTitle": "Error del agente", "eventErrorTitle": "Error del agente",
"notificationTurnComplete": "{agent} ha terminado de responder" "notificationTurnComplete": "{agent} ha terminado de responder",
"notificationError": "{agent} error: {message}"
}, },
"connectionLifecycle": { "connectionLifecycle": {
"tasks": { "tasks": {

View File

@@ -1350,7 +1350,8 @@
"connectFailedTitle": "Échec de la connexion de {agent}", "connectFailedTitle": "Échec de la connexion de {agent}",
"toolFallbackTitle": "Outil", "toolFallbackTitle": "Outil",
"eventErrorTitle": "Erreur de l'agent", "eventErrorTitle": "Erreur de l'agent",
"notificationTurnComplete": "{agent} a terminé de répondre" "notificationTurnComplete": "{agent} a terminé de répondre",
"notificationError": "{agent} erreur : {message}"
}, },
"connectionLifecycle": { "connectionLifecycle": {
"tasks": { "tasks": {

View File

@@ -1350,7 +1350,8 @@
"connectFailedTitle": "{agent} の接続に失敗しました", "connectFailedTitle": "{agent} の接続に失敗しました",
"toolFallbackTitle": "ツール", "toolFallbackTitle": "ツール",
"eventErrorTitle": "エージェントエラー", "eventErrorTitle": "エージェントエラー",
"notificationTurnComplete": "{agent} の応答が完了しました" "notificationTurnComplete": "{agent} の応答が完了しました",
"notificationError": "{agent} エラー:{message}"
}, },
"connectionLifecycle": { "connectionLifecycle": {
"tasks": { "tasks": {

View File

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

View File

@@ -1350,7 +1350,8 @@
"connectFailedTitle": "Falha na conexão de {agent}", "connectFailedTitle": "Falha na conexão de {agent}",
"toolFallbackTitle": "Ferramenta", "toolFallbackTitle": "Ferramenta",
"eventErrorTitle": "Erro do agente", "eventErrorTitle": "Erro do agente",
"notificationTurnComplete": "{agent} terminou de responder" "notificationTurnComplete": "{agent} terminou de responder",
"notificationError": "{agent} erro: {message}"
}, },
"connectionLifecycle": { "connectionLifecycle": {
"tasks": { "tasks": {

View File

@@ -1351,7 +1351,8 @@
"connectFailedTitle": "{agent} 连接失败", "connectFailedTitle": "{agent} 连接失败",
"toolFallbackTitle": "工具", "toolFallbackTitle": "工具",
"eventErrorTitle": "Agent 错误", "eventErrorTitle": "Agent 错误",
"notificationTurnComplete": "{agent} 已完成响应" "notificationTurnComplete": "{agent} 已完成响应",
"notificationError": "{agent} 错误:{message}"
}, },
"connectionLifecycle": { "connectionLifecycle": {
"tasks": { "tasks": {

View File

@@ -1350,7 +1350,8 @@
"connectFailedTitle": "{agent} 連線失敗", "connectFailedTitle": "{agent} 連線失敗",
"toolFallbackTitle": "工具", "toolFallbackTitle": "工具",
"eventErrorTitle": "Agent 錯誤", "eventErrorTitle": "Agent 錯誤",
"notificationTurnComplete": "{agent} 已完成回應" "notificationTurnComplete": "{agent} 已完成回應",
"notificationError": "{agent} 錯誤:{message}"
}, },
"connectionLifecycle": { "connectionLifecycle": {
"tasks": { "tasks": {

View File

@@ -1,7 +1,7 @@
import { getTransport } from "./transport" import { getTransport } from "./transport"
import { isDesktop } from "./transport" import { isDesktop } from "./transport"
export async function notifyTurnComplete( export async function sendSystemNotification(
title: string, title: string,
body: string body: string
): Promise<void> { ): Promise<void> {