放开部分文件读/写限制
This commit is contained in:
@@ -777,10 +777,9 @@ export function FileWorkspacePanel() {
|
||||
const renderedContent = activeFileTab?.content ?? ""
|
||||
const isFileTab = activeFileTab?.kind === "file"
|
||||
const fileReadonly = isFileTab ? Boolean(activeFileTab.readonly) : true
|
||||
const fileTruncated = isFileTab ? Boolean(activeFileTab.truncated) : false
|
||||
const fileSaveState = isFileTab ? (activeFileTab.saveState ?? "idle") : "idle"
|
||||
const fileIsDirty = isFileTab ? Boolean(activeFileTab.isDirty) : false
|
||||
const canEdit = isFileTab && !fileReadonly && !fileTruncated
|
||||
const canEdit = isFileTab && !fileReadonly
|
||||
const autoSaveTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
|
||||
const autoSaveGuardRef = useRef({
|
||||
canEdit: false,
|
||||
|
||||
@@ -2302,7 +2302,9 @@ export function FileTreeTab() {
|
||||
<DialogContent
|
||||
onOpenAutoFocus={(e) => {
|
||||
e.preventDefault()
|
||||
const input = (e.currentTarget as HTMLElement | null)?.querySelector("input")
|
||||
const input = (
|
||||
e.currentTarget as HTMLElement | null
|
||||
)?.querySelector("input")
|
||||
if (input) requestAnimationFrame(() => input.focus())
|
||||
}}
|
||||
>
|
||||
@@ -2369,7 +2371,9 @@ export function FileTreeTab() {
|
||||
<DialogContent
|
||||
onOpenAutoFocus={(e) => {
|
||||
e.preventDefault()
|
||||
const input = (e.currentTarget as HTMLElement | null)?.querySelector("input")
|
||||
const input = (
|
||||
e.currentTarget as HTMLElement | null
|
||||
)?.querySelector("input")
|
||||
if (input) requestAnimationFrame(() => input.focus())
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -2040,10 +2040,7 @@ function hasComparableVersion(
|
||||
}
|
||||
|
||||
function buildVersionCheck(agent: AcpAgentInfo): UiCheckItem | null {
|
||||
if (
|
||||
agent.distribution_type !== "binary" &&
|
||||
agent.distribution_type !== "npx"
|
||||
)
|
||||
if (agent.distribution_type !== "binary" && agent.distribution_type !== "npx")
|
||||
return null
|
||||
|
||||
const remoteVersion = agent.registry_version ?? "unknown"
|
||||
@@ -2390,46 +2387,51 @@ export function AcpAgentSettings() {
|
||||
|
||||
const runPreflight = useCallback(
|
||||
async (agentType: AgentType, forceRefresh?: boolean) => {
|
||||
setChecking((prev) => ({ ...prev, [agentType]: true }))
|
||||
try {
|
||||
const [resultState, versionState] = await Promise.allSettled([
|
||||
acpPreflight(agentType, forceRefresh),
|
||||
acpDetectAgentLocalVersion(agentType),
|
||||
])
|
||||
setChecking((prev) => ({ ...prev, [agentType]: true }))
|
||||
try {
|
||||
const [resultState, versionState] = await Promise.allSettled([
|
||||
acpPreflight(agentType, forceRefresh),
|
||||
acpDetectAgentLocalVersion(agentType),
|
||||
])
|
||||
|
||||
if (versionState.status === "fulfilled") {
|
||||
setAgents((prev) => {
|
||||
if (versionState.value === null) return prev
|
||||
let changed = false
|
||||
const next = prev.map((agent) => {
|
||||
if (agent.agent_type !== agentType) return agent
|
||||
if (agent.installed_version === versionState.value) return agent
|
||||
changed = true
|
||||
return { ...agent, installed_version: versionState.value }
|
||||
if (versionState.status === "fulfilled") {
|
||||
setAgents((prev) => {
|
||||
if (versionState.value === null) return prev
|
||||
let changed = false
|
||||
const next = prev.map((agent) => {
|
||||
if (agent.agent_type !== agentType) return agent
|
||||
if (agent.installed_version === versionState.value) return agent
|
||||
changed = true
|
||||
return { ...agent, installed_version: versionState.value }
|
||||
})
|
||||
return changed ? next : prev
|
||||
})
|
||||
return changed ? next : prev
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (resultState.status === "fulfilled") {
|
||||
setCheckState((prev) => ({
|
||||
...prev,
|
||||
[agentType]: { result: resultState.value },
|
||||
}))
|
||||
} else {
|
||||
const message =
|
||||
resultState.reason instanceof Error
|
||||
? resultState.reason.message
|
||||
: String(resultState.reason)
|
||||
if (resultState.status === "fulfilled") {
|
||||
setCheckState((prev) => ({
|
||||
...prev,
|
||||
[agentType]: { result: resultState.value },
|
||||
}))
|
||||
} else {
|
||||
const message =
|
||||
resultState.reason instanceof Error
|
||||
? resultState.reason.message
|
||||
: String(resultState.reason)
|
||||
setCheckState((prev) => ({
|
||||
...prev,
|
||||
[agentType]: { error: message },
|
||||
}))
|
||||
}
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err)
|
||||
setCheckState((prev) => ({ ...prev, [agentType]: { error: message } }))
|
||||
} finally {
|
||||
setChecking((prev) => ({ ...prev, [agentType]: false }))
|
||||
}
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err)
|
||||
setCheckState((prev) => ({ ...prev, [agentType]: { error: message } }))
|
||||
} finally {
|
||||
setChecking((prev) => ({ ...prev, [agentType]: false }))
|
||||
}
|
||||
}, [])
|
||||
},
|
||||
[]
|
||||
)
|
||||
|
||||
const runAllPreflight = useCallback(
|
||||
async (agentTypes: AgentType[]) => {
|
||||
@@ -2790,10 +2792,7 @@ export function AcpAgentSettings() {
|
||||
await runNpxAction(agent, "upgrade")
|
||||
return
|
||||
}
|
||||
if (
|
||||
action.kind === "uninstall_binary" ||
|
||||
action.kind === "uninstall_npx"
|
||||
) {
|
||||
if (action.kind === "uninstall_binary" || action.kind === "uninstall_npx") {
|
||||
setUninstallConfirmAgent(agent)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user