chore: generate

This commit is contained in:
opencode-agent[bot]
2026-06-29 03:49:43 +00:00
parent 84336e4f91
commit 846d548154
16 changed files with 43 additions and 83 deletions
+6 -1
View File
@@ -135,7 +135,12 @@ type ValidReplacements<Items extends Replacements> = Items & CheckReplacements<I
function replacementNode(source: AnyNode, replacement: AnyNode | Layer.Any) { function replacementNode(source: AnyNode, replacement: AnyNode | Layer.Any) {
const replacementNode = isNode(replacement) const replacementNode = isNode(replacement)
? replacement ? replacement
: make({ ...nodeMakeIdentity(source), layer: replacement as Layer.Layer<unknown, unknown>, deps: [], tag: source.tag }) : make({
...nodeMakeIdentity(source),
layer: replacement as Layer.Layer<unknown, unknown>,
deps: [],
tag: source.tag,
})
if (source.name !== replacementNode.name) { if (source.name !== replacementNode.name) {
throw new Error(`Cannot replace ${source.name} with ${replacementNode.name}`) throw new Error(`Cannot replace ${source.name} with ${replacementNode.name}`)
} }
+5 -11
View File
@@ -27,9 +27,7 @@ const catalogLayer = AppNodeBuilder.build(
LayerNode.group([Catalog.node, EventV2.node, Credential.node, Integration.node, Policy.node]), LayerNode.group([Catalog.node, EventV2.node, Credential.node, Integration.node, Policy.node]),
[[Location.node, locationLayer]], [[Location.node, locationLayer]],
) )
const it = testEffect( const it = testEffect(catalogLayer)
catalogLayer,
)
describe("CatalogV2", () => { describe("CatalogV2", () => {
it.effect("publishes an updated event after catalog changes", () => it.effect("publishes an updated event after catalog changes", () =>
@@ -50,10 +48,7 @@ describe("CatalogV2", () => {
it.effect("derives availability from active credentials without changing provider state", () => { it.effect("derives availability from active credentials without changing provider state", () => {
const integrationID = Integration.ID.make("test") const integrationID = Integration.ID.make("test")
const localCatalogLayer = Layer.fresh( const localCatalogLayer = Layer.fresh(
AppNodeBuilder.build( AppNodeBuilder.build(LayerNode.group([Catalog.node, Credential.node]), [[Location.node, locationLayer]]),
LayerNode.group([Catalog.node, Credential.node]),
[[Location.node, locationLayer]],
),
) )
return Effect.gen(function* () { return Effect.gen(function* () {
@@ -82,10 +77,9 @@ describe("CatalogV2", () => {
const integrationID = Integration.ID.make("gateway") const integrationID = Integration.ID.make("gateway")
const providerID = ProviderV2.ID.make("remote") const providerID = ProviderV2.ID.make("remote")
const localCatalogLayer = Layer.fresh( const localCatalogLayer = Layer.fresh(
AppNodeBuilder.build( AppNodeBuilder.build(LayerNode.group([Catalog.node, Credential.node, Integration.node]), [
LayerNode.group([Catalog.node, Credential.node, Integration.node]), [Location.node, locationLayer],
[[Location.node, locationLayer]], ]),
),
) )
return Effect.gen(function* () { return Effect.gen(function* () {
+1 -4
View File
@@ -42,10 +42,7 @@ function testLayer(
), ),
), ),
) )
return AppNodeBuilder.build( return AppNodeBuilder.build(LayerNode.group([configNode, Policy.node]), [[Location.node, locationLayer]])
LayerNode.group([configNode, Policy.node]),
[[Location.node, locationLayer]],
)
} }
const provider = { const provider = {
@@ -70,7 +70,8 @@ void invalidNodeReplacement
LayerNode.compile(a, [[a, Layer.effect(A, Effect.fail(new OtherError()))]]) LayerNode.compile(a, [[a, Layer.effect(A, Effect.fail(new OtherError()))]])
// @ts-expect-error Node replacement cannot introduce a new error // @ts-expect-error Node replacement cannot introduce a new error
const invalidNodeErrorReplacement = () => LayerNode.compile(a, [[a, make({ service: A, layer: Layer.effect(A, Effect.fail(new OtherError())), deps: [] })]]) const invalidNodeErrorReplacement = () =>
LayerNode.compile(a, [[a, make({ service: A, layer: Layer.effect(A, Effect.fail(new OtherError())), deps: [] })]])
void invalidNodeErrorReplacement void invalidNodeErrorReplacement
class TagA extends Context.Service<TagA, {}>()("test/TagA") {} class TagA extends Context.Service<TagA, {}>()("test/TagA") {}
@@ -12,15 +12,12 @@ import { it } from "./lib/effect"
const provide = (directory: string) => const provide = (directory: string) =>
Effect.provide( Effect.provide(
LayerNode.compile( LayerNode.compile(FileSystem.node, [
FileSystem.node,
[ [
[ Location.node,
Location.node, Layer.succeed(Location.Service, Location.Service.of(location({ directory: AbsolutePath.make(directory) }))),
Layer.succeed(Location.Service, Location.Service.of(location({ directory: AbsolutePath.make(directory) }))),
],
], ],
), ]),
) )
const withTmp = <A, E, R>(f: (directory: string) => Effect.Effect<A, E, R>) => const withTmp = <A, E, R>(f: (directory: string) => Effect.Effect<A, E, R>) =>
+4 -7
View File
@@ -12,15 +12,12 @@ import { it } from "./lib/effect"
function provide(directory: string) { function provide(directory: string) {
return Effect.provide( return Effect.provide(
LayerNode.compile( LayerNode.compile(LocationMutation.node, [
LocationMutation.node,
[ [
[ Location.node,
Location.node, Layer.succeed(Location.Service, Location.Service.of(location({ directory: AbsolutePath.make(directory) }))),
Layer.succeed(Location.Service, Location.Service.of(location({ directory: AbsolutePath.make(directory) }))),
],
], ],
), ]),
) )
} }
+3 -4
View File
@@ -19,10 +19,9 @@ const locationLayer = Layer.succeed(
Location.Service, Location.Service,
Location.Service.of(location({ directory: AbsolutePath.make(import.meta.dir) })), Location.Service.of(location({ directory: AbsolutePath.make(import.meta.dir) })),
) )
const layer = AppNodeBuilder.build( const layer = AppNodeBuilder.build(LayerNode.group([Catalog.node, Integration.node, EventV2.node]), [
LayerNode.group([Catalog.node, Integration.node, EventV2.node]), [Location.node, locationLayer],
[[Location.node, locationLayer]], ])
)
const it = testEffect(layer) const it = testEffect(layer)
describe("ModelsDevPlugin", () => { describe("ModelsDevPlugin", () => {
+1 -6
View File
@@ -16,12 +16,7 @@ const locationLayer = Layer.succeed(
Location.Service, Location.Service,
Location.Service.of(location({ directory: AbsolutePath.make(import.meta.dir) })), Location.Service.of(location({ directory: AbsolutePath.make(import.meta.dir) })),
) )
const it = testEffect( const it = testEffect(AppNodeBuilder.build(Catalog.node, [[Location.node, locationLayer]]))
AppNodeBuilder.build(
Catalog.node,
[[Location.node, locationLayer]],
),
)
describe("VariantPlugin", () => { describe("VariantPlugin", () => {
it.effect("adds GLM 5.2 variants after catalog sources", () => it.effect("adds GLM 5.2 variants after catalog sources", () =>
+1 -4
View File
@@ -24,10 +24,7 @@ import { testEffect } from "./lib/effect"
import { Snapshot } from "@opencode-ai/core/snapshot" import { Snapshot } from "@opencode-ai/core/snapshot"
const it = testEffect(AppNodeBuilder.build(LayerNode.group([Database.node, EventV2.node, SessionProjector.node]))) const it = testEffect(AppNodeBuilder.build(LayerNode.group([Database.node, EventV2.node, SessionProjector.node])))
const sessionsLayer = AppNodeBuilder.build( const sessionsLayer = AppNodeBuilder.build(SessionV2.node, [[SessionExecution.node, SessionExecution.noopLayer]])
SessionV2.node,
[[SessionExecution.node, SessionExecution.noopLayer]],
)
const sessionID = SessionV2.ID.make("ses_projector_test") const sessionID = SessionV2.ID.make("ses_projector_test")
const created = DateTime.makeUnsafe(0) const created = DateTime.makeUnsafe(0)
const model = { id: ModelV2.ID.make("model"), providerID: ProviderV2.ID.make("provider") } const model = { id: ModelV2.ID.make("model"), providerID: ProviderV2.ID.make("provider") }
+3 -4
View File
@@ -31,10 +31,9 @@ const permission = Layer.succeed(
list: () => Effect.die("unused"), list: () => Effect.die("unused"),
}), }),
) )
const registry = AppNodeBuilder.build( const registry = AppNodeBuilder.build(LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode]), [
LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode]), [ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig],
[[ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig]], ])
)
const question = Layer.succeed( const question = Layer.succeed(
QuestionV2.Service, QuestionV2.Service,
QuestionV2.Service.of({ QuestionV2.Service.of({
+3 -4
View File
@@ -66,10 +66,9 @@ describe("SkillTool", () => {
list: () => Effect.succeed(current), list: () => Effect.succeed(current),
}), }),
) )
const registry = AppNodeBuilder.build( const registry = AppNodeBuilder.build(LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode]), [
LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode]), [ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig],
[[ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig]], ])
)
const tool = SkillTool.layer.pipe( const tool = SkillTool.layer.pipe(
Layer.provide(registry), Layer.provide(registry),
Layer.provide(permission), Layer.provide(permission),
@@ -206,10 +206,7 @@ const providerErrorLLM = Layer.succeed(
), ),
}), }),
) )
const providerErrorEnv = LayerNode.compile( const providerErrorEnv = LayerNode.compile(root, [...replacements, [LLM.node, providerErrorLLM]])
root,
[...replacements, [LLM.node, providerErrorLLM]],
)
const itProviderError = testEffect(providerErrorEnv) const itProviderError = testEffect(providerErrorEnv)
const fragmentFailureLLM = Layer.succeed( const fragmentFailureLLM = Layer.succeed(
@@ -226,10 +223,7 @@ const fragmentFailureLLM = Layer.succeed(
), ),
}), }),
) )
const fragmentFailureEnv = LayerNode.compile( const fragmentFailureEnv = LayerNode.compile(root, [...replacements, [LLM.node, fragmentFailureLLM]])
root,
[...replacements, [LLM.node, fragmentFailureLLM]],
)
const itFragmentFailure = testEffect(fragmentFailureEnv) const itFragmentFailure = testEffect(fragmentFailureEnv)
const boot = Effect.fn("test.boot")(function* () { const boot = Effect.fn("test.boot")(function* () {
@@ -87,14 +87,11 @@ const root = LayerNode.group([
LayerNode.make({ service: TestLLMServer, layer: TestLLMServer.layer, deps: [] }), LayerNode.make({ service: TestLLMServer, layer: TestLLMServer.layer, deps: [] }),
]) ])
const it = testEffect( const it = testEffect(
LayerNode.compile( LayerNode.compile(root, [
root, [MCP.node, mcp],
[ [LSP.node, lsp],
[MCP.node, mcp], [RuntimeFlags.node, RuntimeFlags.layer({ experimentalEventSystem: true })],
[LSP.node, lsp], ]),
[RuntimeFlags.node, RuntimeFlags.layer({ experimentalEventSystem: true })],
],
),
) )
const providerCfg = (url: string) => ({ const providerCfg = (url: string) => ({
@@ -35,10 +35,7 @@ const none = HttpClient.make(() => Effect.die("unexpected http call"))
function requestLayer(client: HttpClient.HttpClient) { function requestLayer(client: HttpClient.HttpClient) {
const replacement = [httpClient, Layer.succeed(HttpClient.HttpClient, client)] as const const replacement = [httpClient, Layer.succeed(HttpClient.HttpClient, client)] as const
return LayerNode.compile( return LayerNode.compile(LayerNode.group([ShareNext.node, AccountRepo.node]), [replacement])
LayerNode.group([ShareNext.node, AccountRepo.node]),
[replacement],
)
} }
function integrationLayer(client: HttpClient.HttpClient) { function integrationLayer(client: HttpClient.HttpClient) {
+1 -6
View File
@@ -55,12 +55,7 @@ const replacements = [
] as const ] as const
const it = testEffect(LayerNode.compile(root, replacements)) const it = testEffect(LayerNode.compile(root, replacements))
const withBrokenPlugin = testEffect( const withBrokenPlugin = testEffect(LayerNode.compile(root, [...replacements, [Plugin.node, brokenPluginLayer]]))
LayerNode.compile(
root,
[...replacements, [Plugin.node, brokenPluginLayer]],
),
)
afterEach(async () => { afterEach(async () => {
await disposeAllInstances() await disposeAllInstances()
+1 -4
View File
@@ -49,10 +49,7 @@ export function createEmbeddedRoutes() {
} }
function makeRoutes<AuthError, AuthServices>(auth: Layer.Layer<ServerAuth.Config, AuthError, AuthServices>) { function makeRoutes<AuthError, AuthServices>(auth: Layer.Layer<ServerAuth.Config, AuthError, AuthServices>) {
const serviceLayer = AppNodeBuilder.build( const serviceLayer = AppNodeBuilder.build(applicationServices, [[SessionExecution.node, SessionExecutionLocal.node]])
applicationServices,
[[SessionExecution.node, SessionExecutionLocal.node]],
)
return HttpApiBuilder.layer(Api, { openapiPath: "/openapi.json" }).pipe( return HttpApiBuilder.layer(Api, { openapiPath: "/openapi.json" }).pipe(
Layer.provide(handlers), Layer.provide(handlers),