|
@@ -73,14 +73,14 @@ function directoryState() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
describe("bootstrapDirectory", () => {
|
|
describe("bootstrapDirectory", () => {
|
|
|
- test("marks a loading directory partial during bootstrap and complete after success", async () => {
|
|
|
|
|
|
|
+ test("uses legacy MCP endpoints while refreshing a v1 directory", async () => {
|
|
|
const mcpReads: string[] = []
|
|
const mcpReads: string[] = []
|
|
|
const [store, setStore] = directoryState()
|
|
const [store, setStore] = directoryState()
|
|
|
|
|
|
|
|
await bootstrapDirectory({
|
|
await bootstrapDirectory({
|
|
|
directory: "/project",
|
|
directory: "/project",
|
|
|
scope: ServerScope.local,
|
|
scope: ServerScope.local,
|
|
|
- mcp: false,
|
|
|
|
|
|
|
+ mcp: true,
|
|
|
global: {
|
|
global: {
|
|
|
config: {} satisfies Config,
|
|
config: {} satisfies Config,
|
|
|
path: { state: "", config: "", worktree: "/project", directory: "/project", home: "/home" },
|
|
path: { state: "", config: "", worktree: "/project", directory: "/project", home: "/home" },
|
|
@@ -90,6 +90,7 @@ describe("bootstrapDirectory", () => {
|
|
|
sdk: {
|
|
sdk: {
|
|
|
app: { agents: async () => ({ data: [{ name: "build", mode: "primary" }] }) },
|
|
app: { agents: async () => ({ data: [{ name: "build", mode: "primary" }] }) },
|
|
|
config: { get: async () => ({ data: {} }) },
|
|
config: { get: async () => ({ data: {} }) },
|
|
|
|
|
+ session: { status: async () => ({ data: {} }) },
|
|
|
vcs: { get: async () => ({ data: undefined }) },
|
|
vcs: { get: async () => ({ data: undefined }) },
|
|
|
command: {
|
|
command: {
|
|
|
list: async () => {
|
|
list: async () => {
|
|
@@ -106,6 +107,14 @@ describe("bootstrapDirectory", () => {
|
|
|
return { data: {} }
|
|
return { data: {} }
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
|
|
+ experimental: {
|
|
|
|
|
+ resource: {
|
|
|
|
|
+ list: async () => {
|
|
|
|
|
+ mcpReads.push("resource")
|
|
|
|
|
+ return { data: {} }
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
provider: { list: async () => ({ data: { all: [], connected: [], default: {} } }) },
|
|
provider: { list: async () => ({ data: { all: [], connected: [], default: {} } }) },
|
|
|
} as unknown as OpencodeClient,
|
|
} as unknown as OpencodeClient,
|
|
|
api,
|
|
api,
|
|
@@ -115,6 +124,7 @@ describe("bootstrapDirectory", () => {
|
|
|
loadSessions() {},
|
|
loadSessions() {},
|
|
|
translate: (key) => key,
|
|
translate: (key) => key,
|
|
|
queryClient: new QueryClient(),
|
|
queryClient: new QueryClient(),
|
|
|
|
|
+ protocol: Promise.resolve("v1"),
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
expect(store.status).toBe("partial")
|
|
expect(store.status).toBe("partial")
|
|
@@ -122,7 +132,7 @@ describe("bootstrapDirectory", () => {
|
|
|
await new Promise((resolve) => setTimeout(resolve, 80))
|
|
await new Promise((resolve) => setTimeout(resolve, 80))
|
|
|
|
|
|
|
|
expect(store.status).toBe("complete")
|
|
expect(store.status).toBe("complete")
|
|
|
- expect(mcpReads).toEqual([])
|
|
|
|
|
|
|
+ expect(mcpReads.sort()).toEqual(["command", "resource", "status"])
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|