2026-07-27 17:38:08 +00:00
|
|
|
import { Effect, Layer, Stream } from "effect"
|
2026-07-02 16:22:04 +00:00
|
|
|
import { Config } from "@opencode-ai/core/config"
|
|
|
|
|
import { Location } from "@opencode-ai/core/location"
|
|
|
|
|
import { MCP } from "@opencode-ai/core/mcp/index"
|
|
|
|
|
import { AbsolutePath } from "@opencode-ai/core/schema"
|
|
|
|
|
import { location } from "./location"
|
|
|
|
|
|
|
|
|
|
export const emptyMcpLayer = Layer.succeed(
|
|
|
|
|
MCP.Service,
|
|
|
|
|
MCP.Service.of({
|
|
|
|
|
servers: () => Effect.succeed([]),
|
2026-07-18 03:56:52 +00:00
|
|
|
add: () => Effect.die("unused mcp.add"),
|
|
|
|
|
connect: () => Effect.die("unused mcp.connect"),
|
|
|
|
|
disconnect: () => Effect.die("unused mcp.disconnect"),
|
|
|
|
|
remove: () => Effect.die("unused mcp.remove"),
|
2026-07-02 16:22:04 +00:00
|
|
|
tools: () => Effect.succeed([]),
|
|
|
|
|
callTool: () => Effect.die("unused mcp.callTool"),
|
|
|
|
|
instructions: () => Effect.succeed([]),
|
|
|
|
|
prompts: () => Effect.succeed([]),
|
|
|
|
|
prompt: () => Effect.succeed(undefined),
|
2026-07-07 16:55:06 +00:00
|
|
|
resourceCatalog: () => Effect.succeed(MCP.ResourceCatalog.make({ resources: [], templates: [] })),
|
2026-07-02 16:22:04 +00:00
|
|
|
readResource: () => Effect.succeed(undefined),
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
|
2026-07-27 18:32:38 +00:00
|
|
|
export const emptyConfigLayer = Config.testLayer()
|
2026-07-02 16:22:04 +00:00
|
|
|
|
|
|
|
|
export const testLocationLayer = Layer.succeed(
|
|
|
|
|
Location.Service,
|
|
|
|
|
Location.Service.of(location({ directory: AbsolutePath.make(process.cwd()) })),
|
|
|
|
|
)
|