refactor(core): simplify location filesystem (#31545)

This commit is contained in:
Dax 2026-06-09 14:28:45 -04:00 committed by GitHub
commit 132ef57272
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
73 changed files with 1048 additions and 1416 deletions

View file

@ -670,6 +670,11 @@ const scenarios: Scenario[] = [
.at((ctx) => ({ path: "/api/fs/read?path=hello.txt", headers: ctx.headers() }))
.json(200, locationData(object)),
http.protected.get("/api/fs/list", "v2.fs.list").json(200, locationData(array)),
http.protected
.get("/api/fs/find", "v2.fs.find")
.seeded((ctx) => ctx.file("hello.txt", "hello\n"))
.at((ctx) => ({ path: "/api/fs/find?query=hello&type=file", headers: ctx.headers() }))
.json(200, locationData(array)),
http.protected.get("/api/reference", "v2.reference.list").json(200, object),
http.protected
.get("/api/provider/{providerID}", "v2.provider.get")

View file

@ -390,10 +390,13 @@ describe("HttpApi SDK", () => {
onRequest: (value) => (request = value),
})
const file = yield* call(() => sdk.v2.fs.read({ path: "hello.txt" }))
const found = yield* call(() => sdk.v2.fs.find({ query: "hello", type: "file" }))
const url = new URL(request!.url)
expect(file.response.status).toBe(200)
expect(file.data).toMatchObject({ data: { content: "hello" } })
expect(found.response.status).toBe(200)
expect(found.data).toMatchObject({ data: [{ path: "hello.txt", type: "file" }] })
expect(url.searchParams.get("directory")).toBe(directory)
expect(url.searchParams.get("workspace")).toBe(workspaceID)
expect(url.searchParams.get("location[directory]")).toBe(directory)

View file

@ -8,7 +8,6 @@ import { ProviderV2 } from "@opencode-ai/core/provider"
import { SessionEvent } from "@opencode-ai/core/session/event"
import { SessionMessageUpdater } from "@opencode-ai/core/session/message-updater"
import { SessionMessage } from "@opencode-ai/core/session/message"
import { ToolOutput } from "@opencode-ai/core/tool-output"
test.skip("step snapshots carry over to assistant messages", () => {
const state: SessionMessageUpdater.MemoryState = { messages: [] }
@ -182,7 +181,7 @@ test.skip("tool completion stores completed timestamp", () => {
timestamp: DateTime.makeUnsafe(4),
callID,
structured: {},
content: [ToolOutput.text({ type: "text", text: "/tmp" })],
content: [{ type: "text", text: "/tmp" }],
provider: { executed: true, metadata: { fake: { status: "done" } } },
},
} satisfies SessionEvent.Event),