mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-10 00:28:29 +00:00
chore: generate
This commit is contained in:
parent
84336e4f91
commit
846d548154
16 changed files with 43 additions and 83 deletions
|
|
@ -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}`)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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* () {
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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") {}
|
||||
|
|
|
|||
|
|
@ -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>) =>
|
||||
|
|
|
|||
|
|
@ -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) }))),
|
||||
],
|
||||
),
|
||||
]),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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", () => {
|
||||
|
|
|
|||
|
|
@ -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", () =>
|
||||
|
|
|
|||
|
|
@ -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") }
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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* () {
|
||||
|
|
|
|||
|
|
@ -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) => ({
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue