11import { expect } from "bun:test"
2+ import { AppFileSystem } from "@opencode-ai/core/filesystem"
23import { Effect , Layer } from "effect"
34import path from "path"
45import { pathToFileURL } from "url"
56import { Agent } from "../../src/agent/agent"
7+ import { Bus } from "../../src/bus"
8+ import { Config } from "../../src/config/config"
9+ import { Env } from "../../src/env"
610import { Plugin } from "../../src/plugin"
11+ import { AccountTest } from "../fake/account"
12+ import { AuthTest } from "../fake/auth"
13+ import { NpmTest } from "../fake/npm"
14+ import { ProviderTest } from "../fake/provider"
15+ import { SkillTest } from "../fake/skill"
716import { testEffect } from "../lib/effect"
817import { PLUGIN_AGENT } from "../fixture/agent-plugin.constants"
918
@@ -12,7 +21,24 @@ import { PLUGIN_AGENT } from "../fixture/agent-plugin.constants"
1221// to verify plugin → config hook → Agent.list.
1322const pluginUrl = pathToFileURL ( path . join ( import . meta. dir , ".." , "fixture" , "agent-plugin.ts" ) ) . href
1423
15- const it = testEffect ( Layer . mergeAll ( Agent . defaultLayer , Plugin . defaultLayer ) )
24+ const provider = ProviderTest . fake ( )
25+ const configLayer = Config . layer . pipe (
26+ Layer . provide ( AppFileSystem . defaultLayer ) ,
27+ Layer . provide ( Env . defaultLayer ) ,
28+ Layer . provide ( AuthTest . empty ) ,
29+ Layer . provide ( AccountTest . empty ) ,
30+ Layer . provide ( NpmTest . noop ) ,
31+ )
32+ const pluginLayer = Plugin . layer . pipe ( Layer . provide ( Bus . layer ) , Layer . provide ( configLayer ) )
33+ const agentLayer = Agent . layer . pipe (
34+ Layer . provide ( configLayer ) ,
35+ Layer . provide ( AuthTest . empty ) ,
36+ Layer . provide ( SkillTest . empty ) ,
37+ Layer . provide ( provider . layer ) ,
38+ Layer . provide ( pluginLayer ) ,
39+ )
40+
41+ const it = testEffect ( Layer . mergeAll ( agentLayer , pluginLayer ) )
1642
1743it . instance (
1844 "plugin-registered agents appear in Agent.list" ,
0 commit comments