opencode-agent[bot] před 2 měsíci
rodič
revize
846d548154

+ 6 - 1
packages/core/src/effect/layer-node.ts

@@ -135,7 +135,12 @@ type ValidReplacements<Items extends Replacements> = Items & CheckReplacements<I
 function replacementNode(source: AnyNode, replacement: AnyNode | Layer.Any) {
   const replacementNode = isNode(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) {
     throw new Error(`Cannot replace ${source.name} with ${replacementNode.name}`)
   }

+ 5 - 11
packages/core/test/catalog.test.ts

@@ -27,9 +27,7 @@ const catalogLayer = AppNodeBuilder.build(
   LayerNode.group([Catalog.node, EventV2.node, Credential.node, Integration.node, Policy.node]),
   [[Location.node, locationLayer]],
 )
-const it = testEffect(
-  catalogLayer,
-)
+const it = testEffect(catalogLayer)
 
 describe("CatalogV2", () => {
   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", () => {
     const integrationID = Integration.ID.make("test")
     const localCatalogLayer = Layer.fresh(
-      AppNodeBuilder.build(
-        LayerNode.group([Catalog.node, Credential.node]),
-        [[Location.node, locationLayer]],
-      ),
+      AppNodeBuilder.build(LayerNode.group([Catalog.node, Credential.node]), [[Location.node, locationLayer]]),
     )
 
     return Effect.gen(function* () {
@@ -82,10 +77,9 @@ describe("CatalogV2", () => {
     const integrationID = Integration.ID.make("gateway")
     const providerID = ProviderV2.ID.make("remote")
     const localCatalogLayer = Layer.fresh(
-      AppNodeBuilder.build(
-        LayerNode.group([Catalog.node, Credential.node, Integration.node]),
-        [[Location.node, locationLayer]],
-      ),
+      AppNodeBuilder.build(LayerNode.group([Catalog.node, Credential.node, Integration.node]), [
+        [Location.node, locationLayer],
+      ]),
     )
 
     return Effect.gen(function* () {

+ 1 - 4
packages/core/test/config/config.test.ts

@@ -42,10 +42,7 @@ function testLayer(
       ),
     ),
   )
-  return AppNodeBuilder.build(
-    LayerNode.group([configNode, Policy.node]),
-    [[Location.node, locationLayer]],
-  )
+  return AppNodeBuilder.build(LayerNode.group([configNode, Policy.node]), [[Location.node, locationLayer]])
 }
 
 const provider = {

+ 2 - 1
packages/core/test/effect/layer-node/layer-node-types.test.ts

@@ -70,7 +70,8 @@ void invalidNodeReplacement
 LayerNode.compile(a, [[a, Layer.effect(A, Effect.fail(new OtherError()))]])
 
 // @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
 
 class TagA extends Context.Service<TagA, {}>()("test/TagA") {}

+ 4 - 7
packages/core/test/location-filesystem.test.ts

@@ -12,15 +12,12 @@ import { it } from "./lib/effect"
 
 const provide = (directory: string) =>
   Effect.provide(
-    LayerNode.compile(
-      FileSystem.node,
+    LayerNode.compile(FileSystem.node, [
       [
-        [
-          Location.node,
-          Layer.succeed(Location.Service, Location.Service.of(location({ directory: AbsolutePath.make(directory) }))),
-        ],
+        Location.node,
+        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>) =>

+ 4 - 7
packages/core/test/location-mutation.test.ts

@@ -12,15 +12,12 @@ import { it } from "./lib/effect"
 
 function provide(directory: string) {
   return Effect.provide(
-    LayerNode.compile(
-      LocationMutation.node,
+    LayerNode.compile(LocationMutation.node, [
       [
-        [
-          Location.node,
-          Layer.succeed(Location.Service, Location.Service.of(location({ directory: AbsolutePath.make(directory) }))),
-        ],
+        Location.node,
+        Layer.succeed(Location.Service, Location.Service.of(location({ directory: AbsolutePath.make(directory) }))),
       ],
-    ),
+    ]),
   )
 }
 

+ 3 - 4
packages/core/test/plugin/models-dev.test.ts

@@ -19,10 +19,9 @@ const locationLayer = Layer.succeed(
   Location.Service,
   Location.Service.of(location({ directory: AbsolutePath.make(import.meta.dir) })),
 )
-const layer = AppNodeBuilder.build(
-  LayerNode.group([Catalog.node, Integration.node, EventV2.node]),
-  [[Location.node, locationLayer]],
-)
+const layer = AppNodeBuilder.build(LayerNode.group([Catalog.node, Integration.node, EventV2.node]), [
+  [Location.node, locationLayer],
+])
 const it = testEffect(layer)
 
 describe("ModelsDevPlugin", () => {

+ 1 - 6
packages/core/test/plugin/variant.test.ts

@@ -16,12 +16,7 @@ const locationLayer = Layer.succeed(
   Location.Service,
   Location.Service.of(location({ directory: AbsolutePath.make(import.meta.dir) })),
 )
-const it = testEffect(
-  AppNodeBuilder.build(
-    Catalog.node,
-    [[Location.node, locationLayer]],
-  ),
-)
+const it = testEffect(AppNodeBuilder.build(Catalog.node, [[Location.node, locationLayer]]))
 
 describe("VariantPlugin", () => {
   it.effect("adds GLM 5.2 variants after catalog sources", () =>

+ 1 - 4
packages/core/test/session-projector.test.ts

@@ -24,10 +24,7 @@ import { testEffect } from "./lib/effect"
 import { Snapshot } from "@opencode-ai/core/snapshot"
 
 const it = testEffect(AppNodeBuilder.build(LayerNode.group([Database.node, EventV2.node, SessionProjector.node])))
-const sessionsLayer = AppNodeBuilder.build(
-  SessionV2.node,
-  [[SessionExecution.node, SessionExecution.noopLayer]],
-)
+const sessionsLayer = AppNodeBuilder.build(SessionV2.node, [[SessionExecution.node, SessionExecution.noopLayer]])
 const sessionID = SessionV2.ID.make("ses_projector_test")
 const created = DateTime.makeUnsafe(0)
 const model = { id: ModelV2.ID.make("model"), providerID: ProviderV2.ID.make("provider") }

+ 3 - 4
packages/core/test/tool-question.test.ts

@@ -31,10 +31,9 @@ const permission = Layer.succeed(
     list: () => Effect.die("unused"),
   }),
 )
-const registry = AppNodeBuilder.build(
-  LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode]),
-  [[ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig]],
-)
+const registry = AppNodeBuilder.build(LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode]), [
+  [ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig],
+])
 const question = Layer.succeed(
   QuestionV2.Service,
   QuestionV2.Service.of({

+ 3 - 4
packages/core/test/tool-skill.test.ts

@@ -66,10 +66,9 @@ describe("SkillTool", () => {
               list: () => Effect.succeed(current),
             }),
           )
-          const registry = AppNodeBuilder.build(
-            LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode]),
-            [[ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig]],
-          )
+          const registry = AppNodeBuilder.build(LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode]), [
+            [ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig],
+          ])
           const tool = SkillTool.layer.pipe(
             Layer.provide(registry),
             Layer.provide(permission),

+ 2 - 8
packages/opencode/test/session/processor-effect.test.ts

@@ -206,10 +206,7 @@ const providerErrorLLM = Layer.succeed(
       ),
   }),
 )
-const providerErrorEnv = LayerNode.compile(
-  root,
-  [...replacements, [LLM.node, providerErrorLLM]],
-)
+const providerErrorEnv = LayerNode.compile(root, [...replacements, [LLM.node, providerErrorLLM]])
 const itProviderError = testEffect(providerErrorEnv)
 
 const fragmentFailureLLM = Layer.succeed(
@@ -226,10 +223,7 @@ const fragmentFailureLLM = Layer.succeed(
       ),
   }),
 )
-const fragmentFailureEnv = LayerNode.compile(
-  root,
-  [...replacements, [LLM.node, fragmentFailureLLM]],
-)
+const fragmentFailureEnv = LayerNode.compile(root, [...replacements, [LLM.node, fragmentFailureLLM]])
 const itFragmentFailure = testEffect(fragmentFailureEnv)
 
 const boot = Effect.fn("test.boot")(function* () {

+ 5 - 8
packages/opencode/test/session/snapshot-tool-race.test.ts

@@ -87,14 +87,11 @@ const root = LayerNode.group([
   LayerNode.make({ service: TestLLMServer, layer: TestLLMServer.layer, deps: [] }),
 ])
 const it = testEffect(
-  LayerNode.compile(
-    root,
-    [
-      [MCP.node, mcp],
-      [LSP.node, lsp],
-      [RuntimeFlags.node, RuntimeFlags.layer({ experimentalEventSystem: true })],
-    ],
-  ),
+  LayerNode.compile(root, [
+    [MCP.node, mcp],
+    [LSP.node, lsp],
+    [RuntimeFlags.node, RuntimeFlags.layer({ experimentalEventSystem: true })],
+  ]),
 )
 
 const providerCfg = (url: string) => ({

+ 1 - 4
packages/opencode/test/share/share-next.test.ts

@@ -35,10 +35,7 @@ const none = HttpClient.make(() => Effect.die("unexpected http call"))
 
 function requestLayer(client: HttpClient.HttpClient) {
   const replacement = [httpClient, Layer.succeed(HttpClient.HttpClient, client)] as const
-  return LayerNode.compile(
-    LayerNode.group([ShareNext.node, AccountRepo.node]),
-    [replacement],
-  )
+  return LayerNode.compile(LayerNode.group([ShareNext.node, AccountRepo.node]), [replacement])
 }
 
 function integrationLayer(client: HttpClient.HttpClient) {

+ 1 - 6
packages/opencode/test/tool/registry.test.ts

@@ -55,12 +55,7 @@ const replacements = [
 ] as const
 
 const it = testEffect(LayerNode.compile(root, replacements))
-const withBrokenPlugin = testEffect(
-  LayerNode.compile(
-    root,
-    [...replacements, [Plugin.node, brokenPluginLayer]],
-  ),
-)
+const withBrokenPlugin = testEffect(LayerNode.compile(root, [...replacements, [Plugin.node, brokenPluginLayer]]))
 
 afterEach(async () => {
   await disposeAllInstances()

+ 1 - 4
packages/server/src/routes.ts

@@ -49,10 +49,7 @@ export function createEmbeddedRoutes() {
 }
 
 function makeRoutes<AuthError, AuthServices>(auth: Layer.Layer<ServerAuth.Config, AuthError, AuthServices>) {
-  const serviceLayer = AppNodeBuilder.build(
-    applicationServices,
-    [[SessionExecution.node, SessionExecutionLocal.node]],
-  )
+  const serviceLayer = AppNodeBuilder.build(applicationServices, [[SessionExecution.node, SessionExecutionLocal.node]])
 
   return HttpApiBuilder.layer(Api, { openapiPath: "/openapi.json" }).pipe(
     Layer.provide(handlers),