|
|
@@ -1,6 +1,9 @@
|
|
|
import { describe, expect } from "bun:test"
|
|
|
import { Effect, Layer } from "effect"
|
|
|
import * as TestClock from "effect/testing/TestClock"
|
|
|
+import { makeLocationNode } from "@opencode-ai/core/effect/app-node"
|
|
|
+import { AppNodeBuilder } from "@opencode-ai/core/effect/app-node-builder"
|
|
|
+import { LayerNode } from "@opencode-ai/core/effect/layer-node"
|
|
|
import { Location } from "@opencode-ai/core/location"
|
|
|
import { FSUtil } from "@opencode-ai/core/fs-util"
|
|
|
import { Global } from "@opencode-ai/core/global"
|
|
|
@@ -25,12 +28,14 @@ const locationLayer = Layer.succeed(
|
|
|
),
|
|
|
),
|
|
|
)
|
|
|
+const locationNode = makeLocationNode({ service: Location.Service, layer: locationLayer, deps: [] })
|
|
|
+const builtInsNode = LayerNode.bind(
|
|
|
+ LayerNode.group([SystemContextBuiltIns.node, SystemContextRegistry.node]),
|
|
|
+ Location.node,
|
|
|
+ locationNode,
|
|
|
+)
|
|
|
const it = testEffect(
|
|
|
- SystemContextBuiltIns.locationLayer.pipe(
|
|
|
- Layer.provide(FSUtil.defaultLayer),
|
|
|
- Layer.provide(Global.layerWith({ config: "/global" })),
|
|
|
- Layer.provide(locationLayer),
|
|
|
- ),
|
|
|
+ AppNodeBuilder.build(builtInsNode, [LayerNode.replace(Global.layer, Global.layerWith({ config: "/global" }))]),
|
|
|
)
|
|
|
const instructionFS = Layer.effect(
|
|
|
FSUtil.Service,
|
|
|
@@ -43,13 +48,12 @@ const instructionFS = Layer.effect(
|
|
|
}),
|
|
|
),
|
|
|
),
|
|
|
-).pipe(Layer.provide(FSUtil.defaultLayer))
|
|
|
+).pipe(Layer.provide(LayerNode.compile(FSUtil.node)))
|
|
|
const itWithInstructions = testEffect(
|
|
|
- SystemContextBuiltIns.locationLayer.pipe(
|
|
|
- Layer.provide(instructionFS),
|
|
|
- Layer.provide(Global.layerWith({ config: "/global" })),
|
|
|
- Layer.provide(locationLayer),
|
|
|
- ),
|
|
|
+ AppNodeBuilder.build(builtInsNode, [
|
|
|
+ LayerNode.replace(FSUtil.layer, instructionFS),
|
|
|
+ LayerNode.replace(Global.layer, Global.layerWith({ config: "/global" })),
|
|
|
+ ]),
|
|
|
)
|
|
|
|
|
|
describe("SystemContextBuiltIns", () => {
|