feat: Add ACP (Agent Client Protocol) support (#2947)

Co-authored-by: opencode-bot <devnull@opencode.local>
Co-authored-by: Dax Raad <d@ironbay.co>
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Joe Schmitt
2025-10-20 17:55:22 -04:00
committed by GitHub
parent 835fa9fb81
commit f3f21194ae
13 changed files with 991 additions and 160 deletions

View File

@@ -10,8 +10,6 @@ import { FileTime } from "../file/time"
import { Filesystem } from "../util/filesystem"
import { Instance } from "../project/instance"
import { Agent } from "../agent/agent"
import { createTwoFilesPatch } from "diff"
import { trimDiff } from "./edit"
export const WriteTool = Tool.define("write", {
description: DESCRIPTION,
@@ -29,13 +27,6 @@ export const WriteTool = Tool.define("write", {
const exists = await file.exists()
if (exists) await FileTime.assert(ctx.sessionID, filepath)
let oldContent = ""
let diff = ""
if (exists) {
oldContent = await file.text()
}
const agent = await Agent.get(ctx.agent)
if (agent.permission.edit === "ask")
await Permission.ask({
@@ -57,9 +48,6 @@ export const WriteTool = Tool.define("write", {
})
FileTime.read(ctx.sessionID, filepath)
// Generate diff for the write operation
diff = trimDiff(createTwoFilesPatch(filepath, filepath, oldContent, params.content))
let output = ""
await LSP.touchFile(filepath, true)
const diagnostics = await LSP.diagnostics()