@@ -2,34 +2,39 @@ import { describe, expect, test } from "bun:test"
22import { SessionV1 } from "@opencode-ai/core/v1/session"
33import path from "path"
44import { Effect , FileSystem , Layer } from "effect"
5- import { FetchHttpClient } from "effect/unstable/http"
6- import { NodeFileSystem } from "@effect/platform-node"
75import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner"
8- import { FSUtil } from "@opencode-ai/core/fs-util"
96
107import { Instruction } from "../../src/session/instruction"
118import type { MessageV2 } from "../../src/session/message-v2"
129import { MessageID , PartID , SessionID } from "../../src/session/schema"
1310import { Global } from "@opencode-ai/core/global"
1411import { RuntimeFlags } from "../../src/effect/runtime-flags"
15- import { provideInstance , provideTmpdirInstance , testInstanceStoreLayer , tmpdirScoped } from "../fixture/fixture"
12+ import { provideInstance , provideTmpdirInstance , tmpdirScoped } from "../fixture/fixture"
1613import { testEffect } from "../lib/effect"
1714import { TestConfig } from "../fixture/config"
1815import { ProviderV2 } from "@opencode-ai/core/provider"
1916import { ModelV2 } from "@opencode-ai/core/model"
17+ import { AppNodeBuilder } from "@opencode-ai/core/effect/app-node-builder"
18+ import { LayerNode } from "@opencode-ai/core/effect/layer-node"
19+ import { LayerNodePlatform } from "@opencode-ai/core/effect/app-node-platform"
20+ import { InstanceStore } from "@/project/instance-store"
21+ import { InstanceBootstrap } from "@/project/bootstrap"
22+ import { Config } from "@/config/config"
2023
21- const it = testEffect ( Layer . mergeAll ( CrossSpawnSpawner . defaultLayer , NodeFileSystem . layer , testInstanceStoreLayer ) )
24+ const it = testEffect (
25+ AppNodeBuilder . build ( LayerNode . group ( [ CrossSpawnSpawner . node , LayerNodePlatform . filesystem , InstanceStore . node ] ) , [
26+ [ InstanceBootstrap . node , Layer . succeed ( InstanceBootstrap . Service , InstanceBootstrap . Service . of ( { run : Effect . void } ) ) ] ,
27+ ] ) ,
28+ )
2229
23- const configLayer = TestConfig . layer ( )
30+ const configLayer = Layer . succeed ( Config . Service , TestConfig . make ( ) )
2431
2532const instructionLayer = ( global : Partial < Global . Interface > , flags : Partial < RuntimeFlags . Info > = { } ) =>
26- Instruction . layer . pipe (
27- Layer . provide ( configLayer ) ,
28- Layer . provide ( FSUtil . defaultLayer ) ,
29- Layer . provide ( FetchHttpClient . layer ) ,
30- Layer . provide ( Global . layerWith ( global ) ) ,
31- Layer . provide ( RuntimeFlags . layer ( flags ) ) ,
32- )
33+ AppNodeBuilder . build ( Instruction . node , [
34+ [ Config . node , configLayer ] ,
35+ [ Global . node , Global . layerWith ( global ) ] ,
36+ [ RuntimeFlags . node , RuntimeFlags . layer ( flags ) ] ,
37+ ] )
3338
3439const provideInstruction =
3540 ( global : Partial < Global . Interface > , flags ?: Partial < RuntimeFlags . Info > ) =>
0 commit comments