refactor(core): support tiered layer nodes (#33937)

This commit is contained in:
James Long
2026-06-25 14:34:17 -04:00
committed by GitHub
parent 21b78c49fc
commit 0e731c2a1a
80 changed files with 1132 additions and 601 deletions
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect } from "bun:test"
import { Effect, Exit, Layer, Option } from "effect"
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http"
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http"
import { LayerNode } from "@opencode-ai/core/effect/layer-node"
import { httpClient } from "@opencode-ai/core/effect/layer-node-platform"
import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner"
@@ -35,7 +35,7 @@ const none = HttpClient.make(() => Effect.die("unexpected http call"))
function requestLayer(client: HttpClient.HttpClient) {
return LayerNode.buildLayer(LayerNode.group([ShareNext.node, AccountRepo.node]), {
replacements: [LayerNode.replace(httpClient, Layer.succeed(HttpClient.HttpClient, client))],
replacements: [LayerNode.replace(FetchHttpClient.layer, Layer.succeed(HttpClient.HttpClient, client))],
})
}
@@ -49,9 +49,7 @@ function integrationLayer(client: HttpClient.HttpClient) {
AccountRepo.node,
Database.node,
]),
{
replacements: [LayerNode.replace(httpClient, Layer.succeed(HttpClient.HttpClient, client))],
},
{ replacements: [LayerNode.replace(FetchHttpClient.layer, Layer.succeed(HttpClient.HttpClient, client))] },
)
}