去掉agent连接时的预检步骤,正常情况下都会通过,做了无畏的工作,如果异常则连接时弹出通知和告警
This commit is contained in:
@@ -22,7 +22,6 @@ import {
|
||||
acpCancel,
|
||||
acpRespondPermission,
|
||||
acpDisconnect,
|
||||
acpPreflight,
|
||||
} from "@/lib/tauri"
|
||||
import type {
|
||||
AgentType,
|
||||
@@ -35,7 +34,6 @@ import type {
|
||||
SessionConfigOptionInfo,
|
||||
SessionModeStateInfo,
|
||||
SessionUsageUpdateInfo,
|
||||
FixAction,
|
||||
PromptCapabilitiesInfo,
|
||||
PromptInputBlock,
|
||||
} from "@/lib/types"
|
||||
@@ -1734,80 +1732,6 @@ export function AcpConnectionsProvider({ children }: { children: ReactNode }) {
|
||||
}
|
||||
}
|
||||
|
||||
// Run preflight checks
|
||||
try {
|
||||
const preflight = await acpPreflight(agentType)
|
||||
if (!preflight.passed) {
|
||||
const failedChecks = preflight.checks.filter(
|
||||
(c) => c.status === "fail"
|
||||
)
|
||||
const detail = failedChecks.map((c) => c.message).join("\n")
|
||||
|
||||
if (isAutoLink) {
|
||||
const message =
|
||||
detail.trim().length > 0
|
||||
? detail
|
||||
: t("preflightCheckFailedDefault")
|
||||
pushAlertRef.current(
|
||||
"error",
|
||||
t("autoLinkFailedTitle", { agent: preflight.agent_name }),
|
||||
`${message}\n${t("agentsSetupHint")}`,
|
||||
[buildOpenAgentsSettingsAction(agentType)]
|
||||
)
|
||||
throw createAlertedError(message)
|
||||
}
|
||||
|
||||
// Collect fix actions from all failed checks
|
||||
const fixes: AlertAction[] = failedChecks.flatMap((c) =>
|
||||
c.fixes.map(
|
||||
(f: FixAction): AlertAction => ({
|
||||
label: f.label,
|
||||
kind: f.kind,
|
||||
payload: f.payload,
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
// Add retry action
|
||||
fixes.push({
|
||||
label: t("actions.retry"),
|
||||
kind: "retry_connection",
|
||||
payload: JSON.stringify({
|
||||
agentType,
|
||||
contextKey,
|
||||
workingDir,
|
||||
sessionId,
|
||||
}),
|
||||
})
|
||||
|
||||
pushAlertRef.current(
|
||||
"error",
|
||||
t("preflightFailedTitle", { agent: preflight.agent_name }),
|
||||
detail,
|
||||
fixes
|
||||
)
|
||||
return
|
||||
}
|
||||
} catch (e) {
|
||||
if (isAutoLink) {
|
||||
if (isAlertedError(e)) {
|
||||
throw e
|
||||
}
|
||||
const reason = t("autoLinkPreflightFailed", {
|
||||
message: normalizeErrorMessage(e),
|
||||
})
|
||||
pushAlertRef.current(
|
||||
"error",
|
||||
t("autoLinkFailedTitle", { agent: AGENT_LABELS[agentType] }),
|
||||
`${reason}\n${t("agentsSetupHint")}`,
|
||||
[buildOpenAgentsSettingsAction(agentType)]
|
||||
)
|
||||
throw createAlertedError(reason)
|
||||
}
|
||||
// Preflight itself failed — log and continue
|
||||
console.warn("[AcpConnections] preflight error, continuing:", e)
|
||||
}
|
||||
|
||||
const existing = storeRef.current.connections.get(contextKey)
|
||||
if (existing) {
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user